index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <template>
  2. <div>
  3. <van-nav-bar
  4. :title="route.query.bh == '1' ? '驳回反馈' : '处置反馈'"
  5. left-text="返回"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. />
  9. <div class="listcontent" :style="`height:${bodyheight}px`">
  10. <div v-if="route.query.bh == '1'">
  11. <van-form @submit="onSubmitbh">
  12. <van-cell-group>
  13. <van-field
  14. v-model="bhobj.resonRemark"
  15. name="驳回原因"
  16. label="驳回原因"
  17. placeholder="请输入驳回原因"
  18. />
  19. <van-field name="现场图片" label="现场图片">
  20. <template #input>
  21. <ImageUpload v-model="bhobj.images"></ImageUpload>
  22. </template>
  23. </van-field>
  24. <van-field name="说明报告" label="说明报告">
  25. <template #input>
  26. <FileUpload v-model="bhobj.files" :fileSize="100"></FileUpload>
  27. </template>
  28. </van-field>
  29. </van-cell-group>
  30. <div style="margin: 16px">
  31. <van-button round block type="primary" native-type="submit">
  32. 提交
  33. </van-button>
  34. </div>
  35. </van-form>
  36. </div>
  37. <div v-if="route.query.bh != '1'">
  38. <van-form @submit="onSubmit">
  39. <van-cell-group>
  40. <van-field
  41. v-model="czobj.qsdes"
  42. name="权属确认"
  43. label="权属确认"
  44. placeholder="请输入权属确认(现场勘查)"
  45. />
  46. <van-field
  47. v-model="xyobj.zyrs"
  48. name="作业人数"
  49. label="作业人数"
  50. type="number"
  51. placeholder="请输入"
  52. />
  53. <van-field
  54. v-model="xyobj.carxh"
  55. name="车辆型号"
  56. label="车辆型号"
  57. placeholder="请输入车辆型号"
  58. />
  59. <van-field
  60. v-model="xyobj.carnumber"
  61. name="车辆号牌"
  62. label="车辆号牌"
  63. placeholder="请输入车辆号牌"
  64. />
  65. <van-field
  66. v-model="xyobj.gls"
  67. name="公里数"
  68. label="公里数"
  69. placeholder="请输入公里数"
  70. />
  71. <van-tabs v-model:active="activeName">
  72. <van-tab title="工作量" name="1">
  73. <van-row>
  74. <van-col :span="24" v-for="item in czobj.gzldata">
  75. <div style="margin-bottom:10px">
  76. <van-row>
  77. <!-- <van-col :span="8"><div style="text-align: right;padding-right:6px">{{ item.name }}:</div></van-col> -->
  78. <van-col :span="item.hasOwnProperty('value2') ? 16 : 24">
  79. <van-field
  80. v-model="item.value1"
  81. placeholder="请输入"
  82. :label="item.name"
  83. >
  84. <template #button v-if="item.unit1!==''">{{
  85. item.unit1
  86. }}</template></van-field
  87. >
  88. </van-col>
  89. <van-col :span="8" v-if="item.hasOwnProperty('value2')">
  90. <div style="padding-left:5px">
  91. <van-field
  92. v-if="item.hasOwnProperty('value2')"
  93. v-model="item.value2"
  94. placeholder="请输入"
  95. >
  96. <template #button v-if="item.unit2!==''">{{
  97. item.unit2
  98. }}</template></van-field>
  99. </div>
  100. </van-col>
  101. </van-row>
  102. </div>
  103. </van-col>
  104. </van-row>
  105. </van-tab>
  106. <van-tab title="车辆设备" name="2">
  107. <van-row>
  108. <van-col :span="24" v-for="item in czobj.clsbdata">
  109. <div style="margin-bottom:10px">
  110. <van-row>
  111. <!-- <van-col :span="8"><div style="text-align: right;padding-right:6px">{{ item.name }}:</div></van-col> -->
  112. <van-col :span="item.hasOwnProperty('value2') ? 16 : 24">
  113. <van-field
  114. v-model="item.value1"
  115. placeholder="请输入"
  116. :label="item.name"
  117. >
  118. <template #button v-if="item.unit1!==''">{{
  119. item.unit1
  120. }}</template></van-field
  121. >
  122. </van-col>
  123. <van-col :span="8" v-if="item.hasOwnProperty('value2')">
  124. <div style="padding-left:5px">
  125. <van-field
  126. v-if="item.hasOwnProperty('value2')"
  127. v-model="item.value2"
  128. placeholder="请输入"
  129. >
  130. <template #button v-if="item.unit2!==''">{{
  131. item.unit2
  132. }}</template></van-field>
  133. </div>
  134. </van-col>
  135. </van-row>
  136. </div>
  137. </van-col>
  138. </van-row>
  139. </van-tab>
  140. <van-tab title="耗材" name="3">
  141. <van-row>
  142. <van-col :span="24" v-for="item in czobj.hcdata">
  143. <div style="margin-bottom:10px">
  144. <van-row>
  145. <!-- <van-col :span="8"><div style="text-align: right;padding-right:6px">{{ item.name }}:</div></van-col> -->
  146. <van-col :span="item.hasOwnProperty('value2') ? 16 : 24">
  147. <van-field
  148. v-model="item.value1"
  149. placeholder="请输入"
  150. :label="item.name"
  151. >
  152. <template #button v-if="item.unit1!==''">{{
  153. item.unit1
  154. }}</template></van-field
  155. >
  156. </van-col>
  157. <van-col :span="8" v-if="item.hasOwnProperty('value2')">
  158. <div style="padding-left:5px">
  159. <van-field
  160. v-if="item.hasOwnProperty('value2')"
  161. v-model="item.value2"
  162. placeholder="请输入"
  163. >
  164. <template #button v-if="item.unit2!==''">{{
  165. item.unit2
  166. }}</template></van-field>
  167. </div>
  168. </van-col>
  169. </van-row>
  170. </div>
  171. </van-col>
  172. </van-row>
  173. </van-tab>
  174. </van-tabs>
  175. <van-field
  176. v-model="czobj.images[0]"
  177. name="处置前照片"
  178. label="处置前照片"
  179. >
  180. <template #input>
  181. <ImageUpload v-model="czobj.images[0]"></ImageUpload>
  182. </template>
  183. </van-field>
  184. <van-field
  185. v-model="czobj.images[1]"
  186. name="处置中照片"
  187. label="处置中照片"
  188. >
  189. <template #input>
  190. <ImageUpload v-model="czobj.images[1]"></ImageUpload>
  191. </template>
  192. </van-field>
  193. <van-field
  194. v-model="czobj.images[2]"
  195. name="处置后照片"
  196. label="处置后照片"
  197. >
  198. <template #input>
  199. <ImageUpload v-model="czobj.images[2]"></ImageUpload>
  200. </template>
  201. </van-field>
  202. <van-field
  203. v-model="taskinfo.taskAddr"
  204. name="详细地址"
  205. label="详细地址"
  206. placeholder="详细地址"
  207. >
  208. <template #button>
  209. <van-button
  210. size="small"
  211. type="primary"
  212. icon="search"
  213. @click="searchaddr"
  214. ></van-button>
  215. </template>
  216. </van-field>
  217. <div style="padding-top: 10px">
  218. <MapSelect
  219. ref="mapSelect"
  220. v-model:formv="formlocation"
  221. ></MapSelect>
  222. </div>
  223. </van-cell-group>
  224. <div style="margin: 16px">
  225. <van-button round block type="primary" native-type="submit">
  226. 提交
  227. </van-button>
  228. </div>
  229. </van-form>
  230. </div>
  231. </div>
  232. </div>
  233. </template>
  234. <script setup>
  235. import { defineComponent, ref, onMounted, watch } from "vue";
  236. import { cloneDeep } from "lodash";
  237. import { listDept, getDept } from "@/api/system/dept";
  238. import ImagePreview from "@/components/ImagePreview";
  239. import { useDict } from "@/utils/dict";
  240. import { useRoute } from "vue-router";
  241. import MapSelect from "@/components/MapSelect";
  242. import moment from "moment";
  243. import ImageUpload from "@/components/ImageUpload";
  244. import FileUpload from "@/components/FileUpload";
  245. import {
  246. listTask,
  247. getTask,
  248. delTask,
  249. addTask,
  250. updateTask,
  251. distributedTask,
  252. closeTask,
  253. czTask,
  254. gzTask,
  255. hcTask,
  256. ddTask,
  257. } from "@/api/system/task";
  258. import { Toast } from "vant";
  259. import router from "../../../../router";
  260. import {
  261. changeUserStatus,
  262. listUser,
  263. resetUserPwd,
  264. delUser,
  265. getUser,
  266. updateUser,
  267. addUser,
  268. } from "@/api/system/user";
  269. const {
  270. sys_area,
  271. task_work,
  272. task_car,
  273. task_consumables,
  274. } = useDict(
  275. "sys_area",
  276. "task_work",
  277. "task_car",
  278. "task_consumables"
  279. );
  280. const activeName = "1";
  281. const route = useRoute();
  282. const bhobj = ref({ resonRemark: [], files: "", images: [] });
  283. const czobj = ref({
  284. qsdes: "",
  285. images: ["","",""],
  286. gzldata: [],
  287. clsbdata: [],
  288. hcdata: [],
  289. });
  290. var task = localStorage.getItem("currenttask");
  291. try {
  292. if (task) {
  293. task = JSON.parse(task);
  294. if (task.taskId != Number(route.query.id)) {
  295. Toast.fail("未查到任务");
  296. router.back();
  297. }
  298. var logs = (task.tblTaskLogList ?? []).filter((i) => i.taskStatus == 2);
  299. if (Array.isArray(logs) && logs.length > 0) {
  300. var log = JSON.parse(logs[0].logDes);
  301. czobj.value = log;
  302. if (Array.isArray(log.images)) {
  303. if (log.images.length < 3) {
  304. czobj.value.images = log.images.concat(["", "", ""]);
  305. } else {
  306. czobj.value.images = log.images;
  307. }
  308. } else {
  309. czobj.value.images = ["", "", ""]
  310. }
  311. if (!czobj.value.hasOwnProperty('gzldata')) {
  312. czobj.value.gzldata = [];
  313. }
  314. if (!czobj.value.hasOwnProperty('clsbdata')) {
  315. czobj.value.clsbdata = [];
  316. }
  317. if (!czobj.value.hasOwnProperty('hcdata')) {
  318. czobj.value.hcdata = [];
  319. }
  320. }
  321. } else {
  322. Toast.fail("未查到任务");
  323. router.back();
  324. }
  325. } catch (E) {}
  326. const bodyheight = ref(0);
  327. const gettaskitemlogdes = (item, status) => {
  328. var templist = {};
  329. var list = item.tblTaskLogList;
  330. for (var i in list) {
  331. var log = list[i];
  332. if (templist.hasOwnProperty(log.taskStatus + "")) {
  333. if (
  334. moment(templist[log.taskStatus + ""].createTime).unix() -
  335. moment(log.createTime).unix() <
  336. 0
  337. ) {
  338. templist[log.taskStatus + ""] = log;
  339. }
  340. } else {
  341. templist[log.taskStatus + ""] = log;
  342. }
  343. }
  344. var lists = [];
  345. for (var i in templist) {
  346. lists.push(templist[i]);
  347. }
  348. if (templist[status + ""] == null || templist[status + ""] == undefined || templist[status + ""] == "") return null;
  349. return JSON.parse(templist[status + ""].logDes);
  350. }
  351. bodyheight.value = document.body.clientHeight - 48;
  352. const searchaddr = () => {
  353. if (taskinfo.value.taskAddr) {
  354. mapSelect.value.searchaddr(taskinfo.value.taskAddr);
  355. } else {
  356. Toast("请输入地址");
  357. }
  358. };
  359. const taskinfo = ref({
  360. taskId: Number(route.query.id),
  361. taskAddr: task.taskAddr,
  362. taskLocation: task.taskLocation,
  363. taskArea: task.taskArea,
  364. });
  365. const mapSelect = ref(null);
  366. const formlocation = ref({ addr: "", locations: "" });
  367. if (route.query.bh != "1") {
  368. watch(
  369. () => formlocation.value.addr,
  370. () => {
  371. taskinfo.value.taskAddr = formlocation.value.addr;
  372. }
  373. );
  374. watch(
  375. () => formlocation.value.locations,
  376. () => {
  377. taskinfo.value.taskLocation = formlocation.value.locations;
  378. if (formlocation.value.locations != "") {
  379. mapSelect.value.getlocationaddr(
  380. formlocation.value.locations,
  381. (data) => {
  382. var qu = data.regeocode.addressComponent.district;
  383. if (qu) {
  384. for (var i in sys_area.value) {
  385. if (sys_area.value[i].label == qu) {
  386. taskinfo.value.taskArea = sys_area.value[i].value;
  387. }
  388. }
  389. }
  390. }
  391. );
  392. }
  393. }
  394. );
  395. }
  396. const xyobj = ref({
  397. bzxytime: "",
  398. ddxctime: "",
  399. czwctime: "",
  400. zysc: "",
  401. clsc: "",
  402. zyfzr: "",
  403. zyrs: 0,
  404. carxh: "",
  405. carnumber: "",
  406. gls: "",
  407. });
  408. const onSubmitbh = async () => {
  409. const TaskClose = () => {
  410. closeTask({
  411. taskId: route.params.id,
  412. logDes: JSON.stringify(bhobj.value),
  413. }).then(async (res) => {
  414. var logc = gettaskitemlogdes(taskinfo.value, -1);
  415. if (logc !=null) {
  416. xyobj.value = logc;
  417. }
  418. xyobj.value.czwctime = moment().format("YYYY-MM-DD HH:mm:ss");
  419. await ddTask({
  420. taskId: item.taskId,
  421. taskStatus: -1,
  422. logDes: JSON.stringify(xyobj.value)
  423. })
  424. Toast.success("成功");
  425. router.back();
  426. });
  427. };
  428. };
  429. watch(
  430. [() => xyobj.value.bzxytime, xyobj.value.ddxctime, xyobj.value.czwctime],
  431. () => {
  432. if (xyobj.value.bzxytime != "" && xyobj.value.czwctime != "") {
  433. xyobj.value.clsc =
  434. (
  435. (moment(xyobj.value.czwctime).unix() -
  436. moment(xyobj.value.bzxytime).unix()) /
  437. 3600.0
  438. ).toFixed(2) + "";
  439. }
  440. if (xyobj.value.ddxctime != "" && xyobj.value.czwctime != "") {
  441. xyobj.value.zysc =
  442. (
  443. (moment(xyobj.value.czwctime).unix() -
  444. moment(xyobj.value.ddxctime).unix()) /
  445. 3600.0
  446. ).toFixed(2) + "";
  447. }
  448. }
  449. );
  450. const onSubmit = async () => {
  451. ddTask({
  452. taskId: Number(route.query.id),
  453. taskStatus: 2,
  454. logDes: JSON.stringify(czobj.value),
  455. }).then(async (res) => {
  456. await updateTask(taskinfo.value);
  457. await ddTask({
  458. taskId: item.taskId,
  459. taskStatus: -1,
  460. logDes: JSON.stringify(xyobj.value)
  461. })
  462. Toast.success("成功");
  463. router.back();
  464. });
  465. };
  466. const onClickLeft = () => {
  467. router.back();
  468. };
  469. watch(() => task_work.value, () => {
  470. task_work.value.map((i) => {
  471. i.remark = i.remark == undefined || i.remark == null ? '' : i.remark;
  472. var data = { name: i.label, unit1: i.remark };
  473. if ((i.remark ?? "").split(",").length > 1) {
  474. data["value1"] = '';
  475. data["value2"] = '';
  476. data["unit1"] = (i.remark ?? "").split(",")[0];
  477. data["unit2"] = (i.remark ?? "").split(",")[1];
  478. } else {
  479. data["value1"] = '';
  480. }
  481. var temp = czobj.value.gzldata.find((p) => {
  482. return p.name == data.name;
  483. });
  484. if (temp == undefined) {
  485. czobj.value.gzldata.push(data);
  486. }
  487. });
  488. })
  489. watch(() => task_car.value, () => {
  490. task_car.value.map((i) => {
  491. i.remark = i.remark == undefined || i.remark == null ? '' : i.remark;
  492. var data = { name: i.label, unit1: i.remark };
  493. if ((i.remark ?? "").split(",").length > 1) {
  494. data["value1"] = '';
  495. data["value2"] = '';
  496. data["unit1"] = (i.remark ?? "").split(",")[0];
  497. data["unit2"] = (i.remark ?? "").split(",")[1];
  498. } else {
  499. data["value1"] = '';
  500. }
  501. var temp = czobj.value.clsbdata.find((p) => {
  502. return p.name == data.name;
  503. });
  504. if (temp == undefined) {
  505. czobj.value.clsbdata.push(data);
  506. }
  507. });
  508. })
  509. watch(() => task_consumables.value, () => {
  510. task_consumables.value.map((i) => {
  511. i.remark = i.remark == undefined || i.remark == null ? '' : i.remark;
  512. var data = { name: i.label, unit1: i.remark };
  513. if ((i.remark ?? "").split(",").length > 1) {
  514. data["value1"] = '';
  515. data["value2"] = '';
  516. data["unit1"] = (i.remark ?? "").split(",")[0];
  517. data["unit2"] = (i.remark ?? "").split(",")[1];
  518. } else {
  519. data["value1"] = '';
  520. }
  521. var temp = czobj.value.hcdata.find((p) => {
  522. return p.name == data.name;
  523. });
  524. if (temp == undefined) {
  525. czobj.value.hcdata.push(data);
  526. }
  527. });
  528. })
  529. onMounted(() => {
  530. formlocation.value.addr = taskinfo.value.taskAddr;
  531. formlocation.value.locations = taskinfo.value.taskLocation;
  532. });
  533. </script>
  534. <style lang="scss">
  535. body {
  536. position: fixed;
  537. width: 100%;
  538. top: -1px;
  539. }
  540. .listcontent {
  541. overflow-y: auto;
  542. padding: 10px;
  543. }
  544. </style>