index.vue 29 KB

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