wenhongquan преди 3 години
родител
ревизия
d63769d757

+ 7 - 2
src/components/Task/Add/index.vue

@@ -236,8 +236,13 @@ export default defineComponent({
       alldept.value = cloneDeep(response.data);
       alldept.value = cloneDeep(response.data);
     });
     });
 
 
-    const doinit = () => {
-      taskinfo.value = props.taskinfo;
+    const doinit = (data) => {
+        // taskinfo.value = props.taskinfo;
+      taskinfo.value = data;
+
+
+
+
       fileList.value = "";
       fileList.value = "";
       formlocation.value = { addr: "", locations: "" };
       formlocation.value = { addr: "", locations: "" };
     };
     };

+ 1 - 1
src/views/detection/list/index.vue

@@ -271,7 +271,7 @@ import { listDetection,addDetection } from "@/api/system/detection";
 import { listDept, getDept } from "@/api/system/dept";
 import { listDept, getDept } from "@/api/system/dept";
 import { treeselect as deptTreeselect } from "@/api/system/dept";
 import { treeselect as deptTreeselect } from "@/api/system/dept";
 import { cloneDeep } from "lodash";
 import { cloneDeep } from "lodash";
-
+import { ElMessage } from "element-plus";
 import { useRoute } from "vue-router";
 import { useRoute } from "vue-router";
 
 
 const { detection_status, detection_type } = useDict(
 const { detection_status, detection_type } = useDict(

+ 1 - 0
src/views/maintain/list/index.vue

@@ -248,6 +248,7 @@ import { listFacilities } from "@/api/system/facilities";
 import { listMaintain ,addMaintain} from "@/api/system/maintain";
 import { listMaintain ,addMaintain} from "@/api/system/maintain";
 
 
 import { cloneDeep } from "lodash";
 import { cloneDeep } from "lodash";
+import { ElMessage } from "element-plus";
 
 
 import { useRoute } from "vue-router";
 import { useRoute } from "vue-router";
 
 

+ 11 - 1
src/views/mb/detection/index.vue

@@ -5,7 +5,12 @@
       left-text="返回"
       left-text="返回"
       left-arrow
       left-arrow
       @click-left="onClickLeft"
       @click-left="onClickLeft"
-    />
+       @click-right="onClickRight"
+    >
+     <template #right>
+    <van-icon name="plus" />
+  </template>
+    </van-nav-bar>
     <div class="body">
     <div class="body">
       <van-dropdown-menu>
       <van-dropdown-menu>
         <van-dropdown-item v-model="value1" :options="option1" />
         <van-dropdown-item v-model="value1" :options="option1" />
@@ -170,6 +175,11 @@ const onRefresh = () => {
 const onClickLeft = () => {
 const onClickLeft = () => {
   router.back();
   router.back();
 };
 };
+
+const onClickRight = () => {
+  alert("add")
+}
+
 const gotodetail = (item) => {
 const gotodetail = (item) => {
   router.push(`/mb/detection/detail/${item.id}`);
   router.push(`/mb/detection/detail/${item.id}`);
 }
 }

+ 52 - 23
src/views/mb/maintain/index.vue

@@ -5,7 +5,12 @@
       left-text="返回"
       left-text="返回"
       left-arrow
       left-arrow
       @click-left="onClickLeft"
       @click-left="onClickLeft"
-    />
+      @click-right="onClickRight"
+    >
+      <template #right>
+        <van-icon name="plus" />
+      </template>
+    </van-nav-bar>
     <div class="body">
     <div class="body">
       <van-dropdown-menu>
       <van-dropdown-menu>
         <van-dropdown-item v-model="value1" :options="option1" />
         <van-dropdown-item v-model="value1" :options="option1" />
@@ -22,19 +27,30 @@
           >
           >
             <div
             <div
               style="padding: 10px 10px; padding-bottom: 0"
               style="padding: 10px 10px; padding-bottom: 0"
-              v-for="item in maintainlist" @click="gotodetail(item)"
+              v-for="item in maintainlist"
+              @click="gotodetail(item)"
             >
             >
               <div class="item">
               <div class="item">
                 <div>
                 <div>
                   <div class="header">
                   <div class="header">
-                    <div>计划名称:{{  alldevices.filter((i) => i.id === item.facilitiesId)[0]
-                  ?.roadName ?? "-" }}养护计划</div>
+                    <div>
+                      计划名称:{{
+                        alldevices.filter((i) => i.id === item.facilitiesId)[0]
+                          ?.roadName ?? "-"
+                      }}养护计划
+                    </div>
                     <div class="time">{{ item.maintainTime }}</div>
                     <div class="time">{{ item.maintainTime }}</div>
                   </div>
                   </div>
                   <div class="body">
                   <div class="body">
-                    <div class="status">{{maintain_status.filter(
-                  (i) => i.value.toString() === (item.status??"").toString()
-                )[0]?.label ?? "-"}}</div>
+                    <div class="status">
+                      {{
+                        maintain_status.filter(
+                          (i) =>
+                            i.value.toString() ===
+                            (item.status ?? "").toString()
+                        )[0]?.label ?? "-"
+                      }}
+                    </div>
 
 
                     <van-row>
                     <van-row>
                       <van-col span="24"
                       <van-col span="24"
@@ -48,8 +64,12 @@
                           }}
                           }}
                         </div></van-col
                         </div></van-col
                       >
                       >
-                      <van-col span="12"> <div>计划年:{{item.maintainYear}}</div></van-col>
-                      <van-col span="12"><div>计划月:{{item.maintainMonth}}</div></van-col>
+                      <van-col span="12">
+                        <div>计划年:{{ item.maintainYear }}</div></van-col
+                      >
+                      <van-col span="12"
+                        ><div>计划月:{{ item.maintainMonth }}</div></van-col
+                      >
                       <van-col span="24"
                       <van-col span="24"
                         ><div>养护单位: {{ item.maintainUnit }}</div></van-col
                         ><div>养护单位: {{ item.maintainUnit }}</div></van-col
                       >
                       >
@@ -83,8 +103,9 @@ const loading = ref(false);
 const finished = ref(false);
 const finished = ref(false);
 const refreshing = ref(false);
 const refreshing = ref(false);
 
 
-const { maintain_status,maintain_type } = useDict(
-  "maintain_status","maintain_type"
+const { maintain_status, maintain_type } = useDict(
+  "maintain_status",
+  "maintain_type"
 );
 );
 
 
 const bodyheight = ref(0);
 const bodyheight = ref(0);
@@ -96,9 +117,11 @@ const option1 = [
   { text: "全部", value: 1 },
   { text: "全部", value: 1 },
 ];
 ];
 const option2 = computed(() => {
 const option2 = computed(() => {
-  return [{ text: "全部", value: "0" }].concat(maintain_status.value.map((i) => {
-    return { text: i.label, value: i.value };
-  }));
+  return [{ text: "全部", value: "0" }].concat(
+    maintain_status.value.map((i) => {
+      return { text: i.label, value: i.value };
+    })
+  );
 });
 });
 const alldevices = ref([]);
 const alldevices = ref([]);
 listFacilities().then((res) => {
 listFacilities().then((res) => {
@@ -113,8 +136,8 @@ const onLoad = () => {
     pagec.value = 1;
     pagec.value = 1;
   }
   }
   var p = { pageSize: 10, pageNum: pagec.value++ };
   var p = { pageSize: 10, pageNum: pagec.value++ };
-  if (value2.value !== '0') {
-    p['status'] =parseInt(value2.value)
+  if (value2.value !== "0") {
+    p["status"] = parseInt(value2.value);
   }
   }
   listMaintain(p).then((res) => {
   listMaintain(p).then((res) => {
     // finished.value = true;
     // finished.value = true;
@@ -127,10 +150,13 @@ const onLoad = () => {
   console.log("----");
   console.log("----");
 };
 };
 
 
-watch(() => value2.value, () => {
-  refreshing.value = true;
-  onLoad();
-})
+watch(
+  () => value2.value,
+  () => {
+    refreshing.value = true;
+    onLoad();
+  }
+);
 
 
 const onRefresh = () => {
 const onRefresh = () => {
   // 清空列表数据
   // 清空列表数据
@@ -143,9 +169,12 @@ const onRefresh = () => {
 const onClickLeft = () => {
 const onClickLeft = () => {
   router.back();
   router.back();
 };
 };
+const onClickRight = () => {
+  alert("add");
+};
 const gotodetail = (item) => {
 const gotodetail = (item) => {
   router.push(`/mb/maintain/detail/${item.id}`);
   router.push(`/mb/maintain/detail/${item.id}`);
-}
+};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
@@ -160,7 +189,7 @@ body {
 
 
   .item {
   .item {
     background: #fff;
     background: #fff;
-    border: 1px solid rgba(209, 217, 221,0.4);
+    border: 1px solid rgba(209, 217, 221, 0.4);
     padding: 10px 15px;
     padding: 10px 15px;
     font-size: 10px;
     font-size: 10px;
     border-radius: 5px;
     border-radius: 5px;
@@ -169,7 +198,7 @@ body {
       font-weight: bold;
       font-weight: bold;
       position: relative;
       position: relative;
       padding-bottom: 8px;
       padding-bottom: 8px;
-      border-bottom: 1px solid rgba(209, 217, 221,0.4);
+      border-bottom: 1px solid rgba(209, 217, 221, 0.4);
       .time {
       .time {
         position: absolute;
         position: absolute;
         right: 0;
         right: 0;

+ 44 - 22
src/views/mb/task/index.vue

@@ -5,7 +5,12 @@
       left-text="返回"
       left-text="返回"
       left-arrow
       left-arrow
       @click-left="onClickLeft"
       @click-left="onClickLeft"
-    />
+      @click-right="onClickRight"
+    >
+      <template #right>
+        <van-icon name="plus" />
+      </template>
+    </van-nav-bar>
     <div class="body">
     <div class="body">
       <van-dropdown-menu>
       <van-dropdown-menu>
         <van-dropdown-item v-model="value1" :options="option1" />
         <van-dropdown-item v-model="value1" :options="option1" />
@@ -31,9 +36,15 @@
                     <div class="time">{{ item.taskTime }}</div>
                     <div class="time">{{ item.taskTime }}</div>
                   </div>
                   </div>
                   <div class="body">
                   <div class="body">
-                    <div class="status">{{task_status.filter(
-                  (i) => i.value.toString() === (item.status??"").toString()
-                )[0]?.label ?? "-"}}</div>
+                    <div class="status">
+                      {{
+                        task_status.filter(
+                          (i) =>
+                            i.value.toString() ===
+                            (item.status ?? "").toString()
+                        )[0]?.label ?? "-"
+                      }}
+                    </div>
 
 
                     <van-row>
                     <van-row>
                       <van-col span="24"
                       <van-col span="24"
@@ -42,13 +53,19 @@
                             task_event_type.filter(
                             task_event_type.filter(
                               (i) =>
                               (i) =>
                                 i.value.toString() ===
                                 i.value.toString() ===
-                                (item.taskEventType??"").toString()
+                                (item.taskEventType ?? "").toString()
                             )[0]?.label ?? "-"
                             )[0]?.label ?? "-"
                           }}
                           }}
                         </div></van-col
                         </div></van-col
                       >
                       >
-                      <van-col span="12"> <div>联系人:{{item.taskReporter}}</div></van-col>
-                      <van-col span="12"><div>联系方式:{{item.taskComplainConnect}}</div></van-col>
+                      <van-col span="12">
+                        <div>联系人:{{ item.taskReporter }}</div></van-col
+                      >
+                      <van-col span="12"
+                        ><div>
+                          联系方式:{{ item.taskComplainConnect }}
+                        </div></van-col
+                      >
                       <van-col span="24"
                       <van-col span="24"
                         ><div>任务内容: {{ item.taskContent }}</div></van-col
                         ><div>任务内容: {{ item.taskContent }}</div></van-col
                       >
                       >
@@ -96,18 +113,19 @@ const option1 = [
   { text: "全部", value: 1 },
   { text: "全部", value: 1 },
 ];
 ];
 const option2 = computed(() => {
 const option2 = computed(() => {
-  return [{ text: "全部", value: "0" }].concat(task_status.value.map((i) => {
-    return { text: i.label, value: i.value };
-  }));
+  return [{ text: "全部", value: "0" }].concat(
+    task_status.value.map((i) => {
+      return { text: i.label, value: i.value };
+    })
+  );
 });
 });
 
 
 const gotodetail = (item) => {
 const gotodetail = (item) => {
   router.push(`/mb/task/detail/${item.taskId}`);
   router.push(`/mb/task/detail/${item.taskId}`);
-}
+};
 
 
 const pagec = ref(1);
 const pagec = ref(1);
 
 
-
 const onLoad = () => {
 const onLoad = () => {
   if (refreshing.value) {
   if (refreshing.value) {
     tasklist.value = [];
     tasklist.value = [];
@@ -115,8 +133,8 @@ const onLoad = () => {
     pagec.value = 1;
     pagec.value = 1;
   }
   }
   var p = { pageSize: 10, pageNum: pagec.value++ };
   var p = { pageSize: 10, pageNum: pagec.value++ };
-  if (value2.value !== '0') {
-    p['status'] =parseInt(value2.value)
+  if (value2.value !== "0") {
+    p["status"] = parseInt(value2.value);
   }
   }
   listTask(p).then((res) => {
   listTask(p).then((res) => {
     // finished.value = true;
     // finished.value = true;
@@ -126,14 +144,15 @@ const onLoad = () => {
       finished.value = true;
       finished.value = true;
     }
     }
   });
   });
-
 };
 };
 
 
-watch(() => value2.value, () => {
-  refreshing.value = true;
-  onLoad();
-})
-
+watch(
+  () => value2.value,
+  () => {
+    refreshing.value = true;
+    onLoad();
+  }
+);
 
 
 const onRefresh = () => {
 const onRefresh = () => {
   // 清空列表数据
   // 清空列表数据
@@ -146,6 +165,9 @@ const onRefresh = () => {
 const onClickLeft = () => {
 const onClickLeft = () => {
   router.back();
   router.back();
 };
 };
+const onClickRight = () => {
+  alert("add");
+};
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
@@ -160,7 +182,7 @@ body {
 
 
   .item {
   .item {
     background: #fff;
     background: #fff;
-    border: 1px solid rgba(209, 217, 221,0.4);
+    border: 1px solid rgba(209, 217, 221, 0.4);
     padding: 10px 15px;
     padding: 10px 15px;
     font-size: 10px;
     font-size: 10px;
     border-radius: 5px;
     border-radius: 5px;
@@ -169,7 +191,7 @@ body {
       font-weight: bold;
       font-weight: bold;
       position: relative;
       position: relative;
       padding-bottom: 8px;
       padding-bottom: 8px;
-      border-bottom: 1px solid rgba(209, 217, 221,0.4);
+      border-bottom: 1px solid rgba(209, 217, 221, 0.4);
       .time {
       .time {
         position: absolute;
         position: absolute;
         right: 0;
         right: 0;

+ 49 - 26
src/views/task/list/index.vue

@@ -16,7 +16,7 @@
             end-placeholder="结束时间"
             end-placeholder="结束时间"
           />
           />
         </el-form-item>
         </el-form-item>
-        <el-form-item label="任务状态" v-if="currentstatus==1">
+        <el-form-item label="任务状态" v-if="currentstatus == 1">
           <el-select
           <el-select
             v-model="queryparameters.status"
             v-model="queryparameters.status"
             class="m-1"
             class="m-1"
@@ -88,13 +88,14 @@
           <el-table-column prop="taskAddrRoad" label="道路名" />
           <el-table-column prop="taskAddrRoad" label="道路名" />
           <el-table-column prop="taskContent" label="任务内容" />
           <el-table-column prop="taskContent" label="任务内容" />
           <el-table-column prop="taskTime" label="来件时间" />
           <el-table-column prop="taskTime" label="来件时间" />
-          <!-- <el-table-column prop="address" label="操作" >
-<template #default="scope">
-    <el-button text size="small" @click="handleClick">
-    </el-button>
-    <el-button text size="small">Edit</el-button>
-</template>
-        </el-table-column> -->
+          <el-table-column prop="address" label="操作">
+            <template #default="scope">
+              <el-button text size="small" @click.stop="edittask(scope.row)"
+                >修改
+              </el-button>
+              <el-button text size="small" @click.stop="deltask(scope.row)">删除</el-button>
+            </template>
+          </el-table-column>
         </el-table>
         </el-table>
         <div style="position: relative; padding-right: 20px; margin-top: -20px">
         <div style="position: relative; padding-right: 20px; margin-top: -20px">
           <Pagination
           <Pagination
@@ -119,7 +120,13 @@
       </div>
       </div>
     </div>
     </div>
 
 
-    <el-dialog v-model="showadd" v-loading="loading" title="新增任务" width="70%" draggable>
+    <el-dialog
+      v-model="showadd"
+      v-loading="loading"
+      title="新增任务"
+      width="70%"
+      draggable
+    >
       <div>
       <div>
         <TaskAdd v-model:taskinfo="taskinfo" ref="taskaddref"></TaskAdd>
         <TaskAdd v-model:taskinfo="taskinfo" ref="taskaddref"></TaskAdd>
       </div>
       </div>
@@ -138,6 +145,7 @@ import { defineComponent, ref, reactive, onMounted, computed } from "vue";
 import { useDict } from "@/utils/dict";
 import { useDict } from "@/utils/dict";
 import TaskAdd from "@/components/Task/Add";
 import TaskAdd from "@/components/Task/Add";
 import router from "../../../router";
 import router from "../../../router";
+import { ElMessage } from "element-plus";
 // 分页组件
 // 分页组件
 import Pagination from "@/components/Pagination";
 import Pagination from "@/components/Pagination";
 import {
 import {
@@ -147,10 +155,11 @@ import {
   addTask,
   addTask,
   updateTask,
   updateTask,
 } from "@/api/system/task";
 } from "@/api/system/task";
-import { cloneDeep } from 'lodash';
+import { cloneDeep } from "lodash";
 import { isArray } from "@vue/shared";
 import { isArray } from "@vue/shared";
 import { useRoute } from "vue-router";
 import { useRoute } from "vue-router";
 
 
+
 const {
 const {
   task_status,
   task_status,
   task_type,
   task_type,
@@ -178,11 +187,8 @@ const tableData = ref([]);
 const pagedata = ref({});
 const pagedata = ref({});
 const taskinfo = ref();
 const taskinfo = ref();
 const taskaddref = ref();
 const taskaddref = ref();
-const route = useRoute()
- const currentstatus = computed(() => route.params.status);
-
-
-
+const route = useRoute();
+const currentstatus = computed(() => route.params.status);
 
 
 const addtask = () => {
 const addtask = () => {
   showadd.value = true;
   showadd.value = true;
@@ -199,7 +205,7 @@ const addtask = () => {
     taskAddrRoad: null,
     taskAddrRoad: null,
     taskOtherId: null,
     taskOtherId: null,
     taskTime: null,
     taskTime: null,
-    taskArea:"1",
+    taskArea: "1",
     taskReqCompleteTime: null,
     taskReqCompleteTime: null,
     status: 1,
     status: 1,
     remark: "",
     remark: "",
@@ -213,32 +219,40 @@ const addtask = () => {
     remark: "",
     remark: "",
   };
   };
   // console.log(taskaddref.value)
   // console.log(taskaddref.value)
-  taskaddref.value?.doinit();
+  taskaddref.value?.doinit(taskinfo.value);
 };
 };
 
 
 const tblrowclick = (row) => {
 const tblrowclick = (row) => {
   // console.log(row)
   // console.log(row)
   router.push(`/task/detail/${row.taskId}`);
   router.push(`/task/detail/${row.taskId}`);
 };
 };
-const ontaskadd = async ()=>{
+const ontaskadd = async () => {
   showadd.value = false;
   showadd.value = false;
   var taskobj = cloneDeep(taskinfo.value);
   var taskobj = cloneDeep(taskinfo.value);
   taskobj.status = 1;
   taskobj.status = 1;
-  taskobj.taskDeptRange = (taskobj.taskDeptRange instanceof Array) ? taskobj.taskDeptRange.join(","):'';
+  taskobj.taskDeptRange =
+    taskobj.taskDeptRange instanceof Array
+      ? taskobj.taskDeptRange.join(",")
+      : "";
   console.log(taskobj);
   console.log(taskobj);
   loading.value = true;
   loading.value = true;
 
 
-  await addTask(taskobj);
+  if (taskobj.taskId) {
+     await updateTask(taskobj);
+  } else {
+     await addTask(taskobj);
+  }
+
   loading.value = false;
   loading.value = false;
   getList();
   getList();
-}
+};
 
 
 const getList = () => {
 const getList = () => {
   if (currentstatus.value != 1) {
   if (currentstatus.value != 1) {
-    if (currentstatus.value == 2){
+    if (currentstatus.value == 2) {
       queryparameters.value.status = 1;
       queryparameters.value.status = 1;
     } else {
     } else {
-     queryparameters.value.status = currentstatus.value;
+      queryparameters.value.status = currentstatus.value;
     }
     }
   } else {
   } else {
     queryparameters.value.status = "";
     queryparameters.value.status = "";
@@ -251,13 +265,22 @@ const getList = () => {
   );
   );
 };
 };
 getList();
 getList();
+const edittask = (row) => {
+  showadd.value = true;
+  taskinfo.value = cloneDeep(row);
 
 
+  taskaddref.value?.doinit(taskinfo.value);
 
 
+}
+const deltask = (row) => {
+  delTask(row.taskId).then(res => {
+    ElMessage.success("删除成功");
+    getList();
+  })
 
 
-onMounted(() => {
-
+}
 
 
-});
+onMounted(() => {});
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>