index.vue 27 KB

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