index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. <template>
  2. <div style="padding: 10px">
  3. <div class="formbody">
  4. <el-form :inline="true" v-model="queryparameters" class="demo-form-inline">
  5. <el-col :span="6">
  6. <el-form-item label="设施台账">
  7. <el-select filterable
  8. v-model="queryparameters.facilitiesId"
  9. class="m-1"
  10. placeholder="请选择"
  11. >
  12. <el-option
  13. v-for="item in alldevices"
  14. :label="item.ext1.tz_id" :value="item.id"
  15. ></el-option>
  16. </el-select>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="6">
  20. <el-form-item label="计划状态" v-if="currentstatus == 1">
  21. <el-select v-model="queryparameters.status" class="m-1" placeholder="请选择">
  22. <el-option
  23. v-for="item in detection_status"
  24. :label="item.label"
  25. :value="item.value"
  26. ></el-option>
  27. </el-select>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="6">
  31. <el-form-item label="道路名">
  32. <el-select v-model="queryparameters.taskArea" class="m-2" placeholder="请选择">
  33. <el-option
  34. v-for="item in alldevices"
  35. :label="item.roadName"
  36. :value="item.roadName"
  37. ></el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="6">
  42. <el-form-item label="班组区域">
  43. <el-tree-select v-model="queryparameters.taskDeptRange" multiple :data="treedept" check-strictly="true" />
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="6">
  47. <el-form-item label="任务时间">
  48. <el-date-picker v-model="qdate" type="daterange" value-format="YYYY-MM-DD" range-separator="到"
  49. start-placeholder="开始时间" end-placeholder="结束时间" />
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="6">
  53. <el-form-item label="关键字">
  54. <el-input v-model="queryparameters.searchkey" placeholder="设施名称/道路"></el-input>
  55. </el-form-item>
  56. </el-col>
  57. <el-col :span="12">
  58. <div style="float: right">
  59. <el-form-item>
  60. <el-button type="primary" @click="resetall">重置</el-button>
  61. </el-form-item>
  62. <el-form-item>
  63. <el-button type="primary" @click="getList">查询</el-button>
  64. </el-form-item>
  65. <el-form-item>
  66. <el-button type="success" @click="adddetection">新增</el-button>
  67. </el-form-item>
  68. </div>
  69. </el-col>
  70. </el-form>
  71. <div>
  72. <el-table
  73. :data="tableData"
  74. class="eltable"
  75. style="width: 100%"
  76. @row-click="tblrowclick"
  77. >
  78. <el-table-column prop="taskCode" label="台账编号">
  79. <template #default="scope">
  80. {{
  81. alldevices.filter((i) => i.id === scope.row.facilitiesId)[0]?.ext1
  82. .tz_id ?? "-"
  83. }}
  84. </template>
  85. </el-table-column>
  86. <el-table-column prop="taskCode" label="设施名称">
  87. <template #default="scope">
  88. {{
  89. alldevices.filter((i) => i.id === scope.row.facilitiesId)[0]?.ext1
  90. .tz_ss_name ?? "-"
  91. }}
  92. </template>
  93. </el-table-column>
  94. <el-table-column prop="taskCode" label="城区">
  95. <template #default="scope">
  96. {{
  97. (sys_area ?? []).filter(
  98. (i) =>
  99. i.value ===
  100. alldevices.filter((i) => i.id === scope.row.facilitiesId)[0]?.ext1
  101. .tz_area_new +
  102. ""
  103. )[0]?.label ?? "-"
  104. }}
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="检测类型">
  108. <template #default="scope">
  109. {{
  110. detection_type.filter(
  111. (i) => i.value + "" === scope.row.detectionType + ""
  112. )[0]?.label ?? "-"
  113. }}
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="路段范围">
  117. <template #default="scope">
  118. {{
  119. alldevices.filter((i) => i.id === scope.row.facilitiesId)[0]?.ext1
  120. .tz_ss_road_se ?? "-"
  121. }}
  122. </template>
  123. </el-table-column>
  124. <el-table-column prop="ext1.task.datestart" label="计划时间" />
  125. <el-table-column prop="ext1.task.dateend" label="完成时间" />
  126. <el-table-column label="管径(mm)">
  127. <template #default="scope">
  128. {{ scope.row.ext1.task.gd.map((i) => i.yh_gj).join("、") }}
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="管道清淤(米)">
  132. <template #default="scope">
  133. {{
  134. evilFn(
  135. scope.row.ext1.task.gd
  136. .map((i) => (i.yh_length && i.yh_length != "" ? i.yh_length : 0))
  137. .join("+")
  138. )
  139. }}
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="雨水口清掏(座)">
  143. <template #default="scope">
  144. {{ scope.row.ext1.task.ysk }}
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="检查井清掏(座)">
  148. <template #default="scope">
  149. {{ scope.row.ext1.task.jcj }}
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="计划状态">
  153. <template #default="scope">
  154. {{
  155. detection_status.filter((i) => i.value === scope.row.status + "")[0]
  156. ?.label ?? "-"
  157. }}
  158. </template>
  159. </el-table-column>
  160. <el-table-column prop="maintainUnit" label="辖区班组">
  161. <template #default="scope">
  162. {{
  163. (scope.row.ext1.facilities_unit == ""
  164. ? []
  165. : scope.row.ext1.facilities_unit ?? []
  166. )
  167. .map((i) => {
  168. return (
  169. alldept.find((p) => {
  170. return p.deptId + "" === i + "";
  171. })?.deptName ?? "-"
  172. );
  173. })
  174. .join("、")
  175. }}
  176. </template>
  177. </el-table-column>
  178. <el-table-column label="检测单位">
  179. <template #default="scope">
  180. {{ scope.row.detectionDes }}
  181. </template>
  182. </el-table-column>
  183. <el-table-column label="备注">
  184. <template #default="scope">
  185. {{ scope.row.detectionRemark }}
  186. </template>
  187. </el-table-column>
  188. <el-table-column prop="address" label="操作">
  189. <template #default="scope">
  190. <el-button text size="small" @click.stop="edittask(scope.row)"
  191. >修改
  192. </el-button>
  193. <el-popconfirm title="确定删除?" @confirm="deltask(scope.row)">
  194. <template #reference>
  195. <el-button text size="small" @click.stop="">删除</el-button>
  196. </template>
  197. </el-popconfirm>
  198. </template>
  199. </el-table-column>
  200. <!-- <el-table-column prop="ext1" label="责任人" width="180">
  201. <template #default="scope">
  202. {{ scope.row.ext1 === "" ? "未派发" : scope.row.ext1 }}
  203. </template>
  204. </el-table-column> -->
  205. </el-table>
  206. <div style="position: relative; padding-right: 20px; margin-top: -20px">
  207. <Pagination
  208. :total="pagedata.total ?? 0"
  209. v-show="pagedata.total > 0"
  210. v-model:page="queryparameters.pageNum"
  211. v-model:limit="queryparameters.pageSize"
  212. @pagination="getList"
  213. ></Pagination>
  214. <!-- <el-pagination
  215. style="float: right"
  216. small
  217. background
  218. :page-sizes="[10, 20, 30, 50]"
  219. :page-size="10"
  220. layout=" sizes,prev, pager, next"
  221. :total="pagedata.total??0"
  222. class="mt-4"
  223. /> -->
  224. </div>
  225. </div>
  226. </div>
  227. <el-dialog
  228. v-model="showadd"
  229. v-loading="loading"
  230. title="新增设施检测计划"
  231. width="70%"
  232. draggable
  233. >
  234. <div>
  235. <el-form :model="detectioninfo" ref="form">
  236. <div style="font-weight: bold; font-size: 15px; margin-bottom: 10px">
  237. 任务基础信息
  238. </div>
  239. <el-row>
  240. <el-col :span="12"
  241. ><el-form-item label="关联设施" label-width="150px">
  242. <el-select
  243. v-model="detectioninfo.facilitiesId"
  244. filterable
  245. placeholder="请选择设备"
  246. >
  247. <el-option
  248. v-for="item in alldevices"
  249. :label="item.ext1.tz_id"
  250. :value="item.id"
  251. ></el-option>
  252. </el-select> </el-form-item
  253. ></el-col>
  254. <el-col :span="12">
  255. <el-form-item
  256. label="任务类型"
  257. required
  258. label-width="150px"
  259. prop="maintainType"
  260. >
  261. <el-select
  262. v-model="detectioninfo.maintainType"
  263. filterable
  264. placeholder="请选择类型"
  265. >
  266. <el-option
  267. v-for="item in detection_type"
  268. :label="item.label"
  269. :value="parseInt(item.value)"
  270. ></el-option>
  271. </el-select> </el-form-item
  272. ></el-col>
  273. </el-row>
  274. <el-row>
  275. <el-col :span="12"
  276. ><el-form-item label="设施名称" label-width="150px">
  277. <el-input
  278. v-model="detectioninfo.ext1.facilities_name"
  279. placeholder="请输入"
  280. ></el-input></el-form-item
  281. ></el-col>
  282. <el-col :span="12"
  283. ><el-form-item label="所在道路" label-width="150px">
  284. <el-input
  285. v-model="detectioninfo.ext1.facilities_road"
  286. placeholder="请输入"
  287. ></el-input></el-form-item
  288. ></el-col>
  289. <el-col :span="6"
  290. ><el-form-item label="运维长度" label-width="100px">
  291. <el-input
  292. type="number"
  293. v-model="detectioninfo.ext1.facilities_length"
  294. placeholder="请输入"
  295. ><template #append>(米)</template></el-input
  296. ></el-form-item
  297. ></el-col
  298. >
  299. <el-col :span="6"
  300. ><el-form-item label="管径范围" label-width="100px">
  301. <el-input
  302. type="number"
  303. v-model="detectioninfo.ext1.facilities_gjfw"
  304. placeholder="请输入"
  305. ><template #append>(mm)</template></el-input
  306. ></el-form-item
  307. ></el-col
  308. >
  309. <el-col :span="12"
  310. ><el-form-item
  311. label="检测起点"
  312. required
  313. label-width="100px"
  314. prop="ext1.facilities_start"
  315. >
  316. <el-input
  317. v-model="detectioninfo.ext1.facilities_start"
  318. placeholder="请输入"
  319. ></el-input></el-form-item
  320. ></el-col>
  321. <el-col :span="12"
  322. ><el-form-item label="辖区班组" label-width="100px">
  323. <el-tree-select
  324. v-model="detectioninfo.ext1.facilities_unit"
  325. multiple
  326. :data="treedept"
  327. check-strictly="true"
  328. /></el-form-item>
  329. </el-col>
  330. <el-col :span="12"
  331. ><el-form-item
  332. label="检测终点"
  333. required
  334. label-width="100px"
  335. prop="ext1.facilities_end"
  336. >
  337. <el-input
  338. v-model="detectioninfo.ext1.facilities_end"
  339. placeholder="请输入"
  340. ></el-input></el-form-item
  341. ></el-col>
  342. <el-col :span="24">
  343. <el-form-item label="检测备注" label-width="150px">
  344. <el-input
  345. v-model="detectioninfo.detectionRemark"
  346. type="textarea"
  347. placeholder="请输入"
  348. ></el-input></el-form-item
  349. ></el-col>
  350. <el-col :span="24">
  351. <el-form-item label="检测单位" label-width="150px">
  352. <el-input
  353. v-model="detectioninfo.detectionDes"
  354. type="textarea"
  355. placeholder="请输入"
  356. ></el-input></el-form-item
  357. ></el-col>
  358. </el-row>
  359. <div style="font-weight: bold; font-size: 15px; margin-bottom: 10px">
  360. 养护计划量及任务派发
  361. </div>
  362. <el-row>
  363. <el-col :span="8">
  364. <el-form-item label="检查井" label-width="100px">
  365. <el-input
  366. v-model="detectioninfo.ext1.task.jcj"
  367. type="number"
  368. placeholder="请输入"
  369. ><template #append>(座)</template></el-input
  370. ></el-form-item
  371. >
  372. </el-col>
  373. <el-col :span="8">
  374. <el-form-item label="雨水口" label-width="100px">
  375. <el-input
  376. v-model="detectioninfo.ext1.task.ysk"
  377. type="number"
  378. placeholder="请输入"
  379. ><template #append>(座)</template></el-input
  380. ></el-form-item
  381. >
  382. </el-col>
  383. <el-col :span="8">
  384. <el-form-item label="排河口" label-width="100px">
  385. <el-input
  386. v-model="detectioninfo.ext1.task.phk"
  387. type="number"
  388. placeholder="请输入"
  389. ><template #append>(座)</template></el-input
  390. ></el-form-item
  391. >
  392. </el-col>
  393. </el-row>
  394. <el-row>
  395. <el-col :span="4">
  396. <div
  397. style="
  398. font-weight: bold;
  399. font-size: 15px;
  400. text-align: right;
  401. padding-right: 30px;
  402. padding-top: 3px;
  403. "
  404. >
  405. 雨水口检测详情
  406. </div>
  407. </el-col>
  408. <el-col :span="4" style="padding-right: 10px">
  409. <el-form-item label="单箅" label-width="40px">
  410. <el-input
  411. v-model="detectioninfo.ext1.task.bz_dan"
  412. type="number"
  413. placeholder="请输入"
  414. ><template #append>(个)</template></el-input
  415. ></el-form-item
  416. >
  417. </el-col>
  418. <el-col :span="4" style="padding-right: 10px">
  419. <el-form-item label="双箅" label-width="40px">
  420. <el-input
  421. v-model="detectioninfo.ext1.task.bz_shuang"
  422. type="number"
  423. placeholder="请输入"
  424. ><template #append>(个)</template></el-input
  425. ></el-form-item
  426. >
  427. </el-col>
  428. <el-col :span="4" style="padding-right: 10px">
  429. <el-form-item label="三箅" label-width="40px">
  430. <el-input
  431. v-model="detectioninfo.ext1.task.bz_san"
  432. type="number"
  433. placeholder="请输入"
  434. ><template #append>(个)</template></el-input
  435. ></el-form-item
  436. >
  437. </el-col>
  438. <el-col :span="4" style="padding-right: 10px">
  439. <el-form-item label="四箅" label-width="40px">
  440. <el-input
  441. v-model="detectioninfo.ext1.task.bz_si"
  442. type="number"
  443. placeholder="请输入"
  444. ><template #append>(个)</template></el-input
  445. ></el-form-item
  446. >
  447. </el-col>
  448. <el-col :span="4" style="padding-right: 10px">
  449. <el-form-item label="多箅" label-width="40px">
  450. <el-input
  451. v-model="detectioninfo.ext1.task.bz_duo"
  452. type="number"
  453. placeholder="请输入"
  454. ><template #append>(个)</template></el-input
  455. ></el-form-item
  456. >
  457. </el-col>
  458. </el-row>
  459. <el-row>
  460. <el-col :span="4">
  461. <div
  462. style="
  463. font-weight: bold;
  464. font-size: 15px;
  465. text-align: right;
  466. padding-right: 30px;
  467. padding-top: 3px;
  468. "
  469. >
  470. 管道检测详情
  471. </div>
  472. </el-col>
  473. <el-col :span="20">
  474. <el-row>
  475. <el-col :span="24">
  476. <el-row v-for="(item, index) in detectioninfo.ext1.task.gd">
  477. <el-col :span="8" style="padding-right: 10px">
  478. <el-form-item label="管道检测" label-width="80px">
  479. <el-input
  480. v-model="item.yh_length"
  481. type="number"
  482. placeholder="请输入"
  483. ><template #append>(米)</template></el-input
  484. ></el-form-item
  485. >
  486. </el-col>
  487. <el-col :span="8" style="padding-right: 10px">
  488. <el-form-item label="管径" label-width="80px">
  489. <el-input v-model="item.yh_gj" type="number" placeholder="请输入"
  490. ><template #append>(mm)</template></el-input
  491. ></el-form-item
  492. >
  493. </el-col>
  494. <el-col :span="8" style="padding-right: 40px; position: relative">
  495. <el-form-item label="备注" label-width="40px">
  496. <el-input
  497. v-model="item.yh_remark"
  498. type="text"
  499. placeholder="请输入"
  500. ></el-input
  501. ></el-form-item>
  502. <el-button
  503. style="position: absolute; right: 0; top: 3px"
  504. size="small"
  505. @click="gzloperat(index)"
  506. type="primary"
  507. :icon="
  508. index == detectioninfo.ext1.task.gd.length - 1 ? Plus : Minus
  509. "
  510. ></el-button>
  511. </el-col>
  512. </el-row>
  513. </el-col>
  514. <el-col :span="24">
  515. <div style="font-weight: bold; font-size: 15px">
  516. 合计:{{
  517. evilFn(
  518. detectioninfo.ext1.task.gd
  519. .map((i) => {
  520. var p = 0;
  521. try {
  522. p = parseFloat(i.yh_length);
  523. } catch (e) {
  524. p = 0;
  525. }
  526. return p == "" || isNaN(p) ? 0 : p;
  527. })
  528. .join("+")
  529. )
  530. }}
  531. </div>
  532. </el-col>
  533. </el-row>
  534. </el-col>
  535. </el-row>
  536. <el-row style="margin-top: 10px">
  537. <el-col :span="12" style="text-align: right">
  538. <el-form-item :label="`计划开始时间`">
  539. <el-date-picker
  540. v-model="detectioninfo.ext1.task.datestart"
  541. value-format="YYYY-MM"
  542. type="month"
  543. placeholder="请选择"
  544. />
  545. </el-form-item>
  546. </el-col>
  547. <el-col :span="12" style="text-align: right">
  548. <el-form-item :label="`计划结束时间`">
  549. <el-date-picker
  550. v-model="detectioninfo.ext1.task.dateend"
  551. value-format="YYYY-MM"
  552. type="month"
  553. placeholder="请选择"
  554. />
  555. </el-form-item>
  556. </el-col>
  557. </el-row>
  558. </el-form>
  559. </div>
  560. <template #footer>
  561. <span class="dialog-footer">
  562. <el-button @click="showadd = false">取消</el-button>
  563. <el-button type="primary" @click="onadd">保存</el-button>
  564. </span>
  565. </template>
  566. </el-dialog>
  567. </div>
  568. </template>
  569. <script setup>
  570. import { defineComponent, ref, reactive, onMounted, computed } from "vue";
  571. import { useDict } from "@/utils/dict";
  572. import router from "../../../router";
  573. // 分页组件
  574. import Pagination from "@/components/Pagination";
  575. import { listFacilities } from "@/api/system/facilities";
  576. import { listDetection, addDetection } from "@/api/system/detection";
  577. import { listDept, getDept } from "@/api/system/dept";
  578. import { treeselect as deptTreeselect } from "@/api/system/dept";
  579. import { cloneDeep } from "lodash";
  580. import { ElMessage } from "element-plus";
  581. import { onBeforeRouteLeave, useRoute } from "vue-router";
  582. import { delDetection, updateDetection } from "../../../api/system/detection";
  583. import {
  584. Delete,
  585. Edit,
  586. Search,
  587. Share,
  588. Upload,
  589. Plus,
  590. Minus,
  591. } from "@element-plus/icons-vue";
  592. const {
  593. task_status,
  594. task_type,
  595. task_event_type,
  596. task_event_category,
  597. sys_area,
  598. facilities_pstz,
  599. } = useDict(
  600. "task_status",
  601. "task_type",
  602. "task_event_type",
  603. "task_event_category",
  604. "sys_area",
  605. "facilities_pstz"
  606. );
  607. const { detection_status, detection_type } = useDict(
  608. "detection_status",
  609. "detection_type"
  610. );
  611. const queryparameters = ref({
  612. status: "",
  613. facilitiesId: "",
  614. taskDeptRange: [],
  615. searchkey: "",
  616. pageNum: 1,
  617. pageSize: 10,
  618. });
  619. const { proxy } = getCurrentInstance();
  620. const showadd = ref(false);
  621. const loading = ref(false);
  622. const tableData = ref([]);
  623. const pagedata = ref({});
  624. const route = useRoute();
  625. const qdate = ref([]);
  626. const currentstatus = computed(() => route.params.status);
  627. const alldevices = ref([]);
  628. const treedept = ref([]);
  629. const detectioninfo = ref({});
  630. const maintaininfo = ref();
  631. const alldept = ref([]);
  632. const adddetection = () => {
  633. initadd();
  634. showadd.value = true;
  635. };
  636. const tblrowclick = (row) => {
  637. // console.log(row)
  638. router.push(`/detection/detail/${row.id}`);
  639. };
  640. const resetall = () => {
  641. queryparameters.value = {
  642. status: "",
  643. facilitiesId: "",
  644. taskDeptRange: [],
  645. searchkey: "",
  646. pageNum: 1,
  647. pageSize: 10,
  648. }
  649. }
  650. const initadd = () => {
  651. detectioninfo.value = {
  652. ext1: {
  653. facilities_name: "",
  654. facilities_road: "",
  655. facilities_length: "",
  656. facilities_gjfw: "",
  657. facilities_start: "",
  658. facilities_end: "",
  659. facilities_unit: "",
  660. task: {
  661. jcj: "",
  662. ysk: "",
  663. phk: "",
  664. bz_dan: "",
  665. bz_shuang: "",
  666. bz_san: "",
  667. bz_si: "",
  668. bz_duo: "",
  669. gd: [
  670. {
  671. yh_length: "",
  672. yh_gj: "",
  673. yh_remark: "",
  674. }
  675. ],
  676. datestart: "",
  677. dateend: "",
  678. },
  679. },
  680. facilitiesId: null,
  681. detectionRemark: "",
  682. detectionDes: '',
  683. detectionWeek:'',
  684. detectionType: "",
  685. id: null,
  686. status: 1,
  687. };
  688. };
  689. const onadd = () => {
  690. loading.value = true;
  691. if (detectioninfo.value.id == null) {
  692. var detectioninfoobj = cloneDeep(detectioninfo.value);
  693. detectioninfoobj.ext1 = JSON.stringify(detectioninfoobj.ext1);
  694. // delete detectioninfoobj.detectionDept;
  695. detectioninfoobj.detectionDept =
  696. detectioninfo.value.detectionDept instanceof Array
  697. ? detectioninfo.value.detectionDept.join(",")
  698. : "";
  699. addDetection(detectioninfoobj).then((res) => {
  700. loading.value = false;
  701. showadd.value = false;
  702. getList();
  703. });
  704. } else {
  705. var detectioninfoobj = cloneDeep(detectioninfo.value);
  706. detectioninfoobj.ext1 = JSON.stringify(detectioninfoobj.ext1);
  707. // delete detectioninfoobj.detectionDept;
  708. detectioninfoobj.detectionDept =
  709. detectioninfo.value.detectionDept instanceof Array
  710. ? detectioninfo.value.detectionDept.join(",")
  711. : "";
  712. updateDetection(detectioninfoobj).then((res) => {
  713. loading.value = false;
  714. showadd.value = false;
  715. getList();
  716. });
  717. }
  718. };
  719. const getList = () => {
  720. if (currentstatus.value != 1) {
  721. if (currentstatus.value == 2) {
  722. queryparameters.value.status = 1;
  723. } else {
  724. queryparameters.value.status = currentstatus.value;
  725. }
  726. } else {
  727. queryparameters.value.status = "";
  728. }
  729. var cq = cloneDeep(queryparameters.value);
  730. var query = proxy.addDateRange(cq, qdate.value);
  731. if (query.status == "0") {
  732. delete query.status;
  733. }
  734. if (query.searchkey != undefined && query.searchkey !== "") {
  735. query.params["searchkey"] = query.searchkey;
  736. }
  737. if (query.taskDeptRange != undefined) {
  738. query.taskDeptRange = query.taskDeptRange.join(",");
  739. }
  740. listDetection(query).then((response) => {
  741. tableData.value = response.rows.map((i) => {
  742. i.ext1 = JSON.parse(i.ext1);
  743. return i;
  744. });
  745. pagedata.value = response;
  746. });
  747. };
  748. const getyears = () => {
  749. var years = [];
  750. for (var i = 0; i <= 100; i++) {
  751. years.push((2019 + i).toString());
  752. }
  753. return years;
  754. };
  755. const getmonth = () => {
  756. var months = [];
  757. for (var i = 0; i < 12; i++) {
  758. if (i < 9) {
  759. months.push("0" + (1 + i).toString());
  760. } else {
  761. months.push((1 + i).toString());
  762. }
  763. }
  764. return months;
  765. };
  766. const gzloperat = (index) => {
  767. if (detectioninfo.value.ext1.task.gd.length - 1 == index) {
  768. //add
  769. detectioninfo.value.ext1.task.gd.push({
  770. yh_length: "",
  771. yh_gj: "",
  772. yh_remark: "",
  773. });
  774. } else {
  775. //sub
  776. detectioninfo.value.ext1.task.gd.splice(index, 1);
  777. }
  778. };
  779. const evilFn = (fn) => {
  780. let Fn = Function; // 一个变量指向Function,防止有些前端编译工具报错
  781. return new Fn(`return ${fn}`)();
  782. };
  783. const edittask = (row) => {
  784. detectioninfo.value = cloneDeep(row);
  785. if (
  786. detectioninfo.value.detectionDept != null &&
  787. detectioninfo.value.detectionDept != "" &&
  788. detectioninfo.value.detectionDept != undefined &&
  789. !Array.isArray(detectioninfo.value.detectionDept)
  790. ) {
  791. detectioninfo.value.detectionDept = detectioninfo.value.detectionDept
  792. .split(",")
  793. .map((i) => parseInt(i));
  794. }
  795. showadd.value = true;
  796. };
  797. const deltask = (row) => {
  798. delDetection(row.id).then((res) => {
  799. ElMessage.success("删除成功");
  800. getList();
  801. });
  802. };
  803. {
  804. listFacilities().then((res) => {
  805. alldevices.value = res.rows.map((i) => {
  806. i.ext1 = JSON.parse(i.ext1);
  807. return i;
  808. });
  809. });
  810. initadd();
  811. getList();
  812. listDept().then((response) => {
  813. alldept.value = cloneDeep(response.data);
  814. });
  815. function setdatakey(dept) {
  816. if (dept.children) {
  817. dept.children = dept.children.map((i) => {
  818. return setdatakey(i);
  819. });
  820. }
  821. dept["value"] = dept.id;
  822. return dept;
  823. }
  824. deptTreeselect().then((res) => {
  825. treedept.value = [setdatakey(res.data[0].children.filter(i => i.id == 202))[0]];
  826. });
  827. watch(
  828. () => detectioninfo.value.facilitiesId,
  829. () => {
  830. if (detectioninfo.value.facilitiesId != null) {
  831. var fd = alldevices.value.filter(
  832. (i) => i.id + "" == detectioninfo.value.facilitiesId + ""
  833. )[0];
  834. detectioninfo.value.ext1["facilities_name"] = fd.ext1.tz_ss_name;
  835. detectioninfo.value.ext1["facilities_road"] = fd.ext1.tz_ss_road;
  836. detectioninfo.value.ext1["facilities_length"] = fd.ext1.tz_ss_data_length;
  837. detectioninfo.value.ext1["facilities_gjfw"] = fd.ext1.tz_ss_dn;
  838. detectioninfo.value.ext1["facilities_start"] = fd.ext1.tz_ss_road_start;
  839. detectioninfo.value.ext1["facilities_end"] = fd.ext1.tz_ss_road_end;
  840. detectioninfo.value.ext1["facilities_unit"] = fd.ext1.tz_ss_unit;
  841. detectioninfo.value.ext1["task"]["jcj"] = fd.ext1.tz_ss_data_jing;
  842. detectioninfo.value.ext1["task"]["ysk"] = fd.ext1.tz_ss_data_ysk;
  843. detectioninfo.value.ext1["task"]["phk"] = fd.ext1.tz_pfk;
  844. detectioninfo.value.ext1["task"]["bz_dan"] = fd.ext1.tz_bz_dan;
  845. detectioninfo.value.ext1["task"]["bz_shuang"] = fd.ext1.tz_bz_shuang;
  846. detectioninfo.value.ext1["task"]["bz_san"] = fd.ext1.tz_bz_san;
  847. detectioninfo.value.ext1["task"]["bz_si"] = fd.ext1.tz_bz_si;
  848. detectioninfo.value.ext1["task"]["bz_duo"] = fd.ext1.tz_bz_duo;
  849. }
  850. }
  851. );
  852. }
  853. onMounted(() => {
  854. });
  855. onBeforeRouteLeave((to, from, next) => {
  856. to.meta.activeMenu = from.path;
  857. console.log(to);
  858. next()
  859. })
  860. </script>
  861. <style lang="scss" scoped>
  862. .formbody {
  863. background: #fff;
  864. width: 100%;
  865. border-radius: 5px;
  866. min-height: 80vh;
  867. padding: 15px 10px;
  868. .eltable {
  869. border: 1px solid #e5e9f2;
  870. border-radius: 5px;
  871. }
  872. }
  873. </style>
  874. <style>
  875. .el-table__row:hover {
  876. cursor: pointer;
  877. }
  878. .el-select {
  879. width: 100%;
  880. }
  881. </style>