index.vue 30 KB

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