index.vue 28 KB

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