wenhongquan 3 years ago
parent
commit
1707bb0b25

+ 1 - 0
index.html

@@ -7,6 +7,7 @@
     <meta name="renderer" content="webkit">
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
     <link rel="icon" href="/favicon.ico">
+
     <title>南宁北排管理系统</title>
     <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
     <style>

+ 17 - 11
src/components/MapSelect/index.jsx

@@ -41,10 +41,10 @@ export default defineComponent({
     });
     const mapselect = ref(false);
 
-    watch(
-      () => props.formv.locations,
-      () => {
-        form.value = props.formv;
+
+    const setlocation = () => {
+      if (window.map) {
+           form.value = props.formv;
         if (form.value.locations !== '') {
           setpoint(
             Number(form.value.locations.split(',')[0]),
@@ -65,7 +65,19 @@ export default defineComponent({
           clearallmark();
 
         }
+        }
+    }
 
+
+    watch(
+      () => props.formv.locations,
+      () => {
+        if (window.map == undefined) {
+          setTimeout(() => {
+            setlocation();
+          }, 1500);
+        }
+        setlocation();
       },
     );
 
@@ -73,13 +85,7 @@ export default defineComponent({
 
       if (props.formv.locations) {
         mapselect.value = false;
-        // form.value = cloneDeep(props.formv);
-        //  console.log(form.value);
-        // setpoint(
-        //   Number(form.value.locations.split(',')[0]),
-        //   Number(form.value.locations.split(',')[1]),
-        //   form.value.addr,
-        // );
+        setlocation();
       } else {
         mapselect.value = true;
       }

+ 3 - 2
src/components/MapView/index.vue

@@ -5,7 +5,6 @@
 import {defineComponent,onMounted} from 'vue'
 import AMapLoader from '@amap/amap-jsapi-loader';
 import { shallowRef } from '@vue/reactivity'
-
 export default defineComponent({
    name: 'MapSelect',
   props: {
@@ -21,7 +20,8 @@ export default defineComponent({
             key:"33424b3226727e5038f0756003f50060",             // 申请好的Web端开发者Key,首次调用 load 时必填
             version:"2.0",      // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
             plugins:[''],       // 需要使用的的插件列表,如比例尺'AMap.Scale'等
-        }).then((AMap)=>{
+        }).then((AMap) => {
+             window.AMap = AMap;
             map.value = new AMap.Map("container",{  //设置地图容器id
                 viewMode:"3D",    //是否为3D地图模式
                 zoom:10,           //初始化地图级别
@@ -37,6 +37,7 @@ export default defineComponent({
       initMap();
 
     })
+   return {map,}
 
  }
 

+ 29 - 19
src/components/Task/Add/index.vue

@@ -12,7 +12,7 @@
               <el-option
                 v-for="item in task_type"
                 :label="item.label"
-                :value="item.value"
+                :value=" parseInt(item.value)"
               ></el-option>
             </el-select>
           </el-form-item>
@@ -62,7 +62,7 @@
               <el-option
                 v-for="item in task_event_category"
                 :label="item.label"
-                :value="item.value"
+                :value="parseInt(item.value)"
               ></el-option>
             </el-select>
           </el-form-item>
@@ -78,7 +78,7 @@
               <el-option
                 v-for="item in task_event_type"
                 :label="item.label"
-                :value="item.value"
+                :value="parseInt(item.value)"
               ></el-option>
             </el-select>
           </el-form-item>
@@ -186,7 +186,6 @@ import { Plus } from "@element-plus/icons-vue";
 // 文件上传组件
 import ImageUpload from "@/components/ImageUpload";
 import { treeselect as deptTreeselect } from "@/api/system/dept";
-import { isArray } from "@vue/shared";
 
 export default defineComponent({
   name: "taskadd",
@@ -209,7 +208,8 @@ export default defineComponent({
       "task_event_type",
       "task_event_category",
       "sys_area"
-    );
+      );
+    const taskinfo = ref({});
 
     watch(
       () => formlocation.value.addr,
@@ -237,17 +237,30 @@ export default defineComponent({
     });
 
     const doinit = (data) => {
-        // taskinfo.value = props.taskinfo;
-      taskinfo.value = data;
 
 
+      taskinfo.value = data;
+
+      if (data.taskId == null) {
+        fileList.value = "";
+        formlocation.value = { addr: "", locations: "" };
+      } else {
+        if (taskinfo.value.taskDeptRange!=null && taskinfo.value.taskDeptRange!="" && taskinfo.value.taskDeptRange!=undefined && !Array.isArray(taskinfo.value.taskDeptRange)) {
+          taskinfo.value.taskDeptRange = taskinfo.value.taskDeptRange.split(",").map(i => parseInt(i));
+        }
+        if (taskinfo.value.taskPics!=null && taskinfo.value.taskPics!="" && taskinfo.value.taskPics!=undefined) {
+          fileList.value = taskinfo.value.taskPics;
+        }
+        if (taskinfo.value.taskAddr != null && taskinfo.value.taskAddr != "" && taskinfo.value.taskAddr != undefined) {
+          formlocation.value.addr = taskinfo.value.taskAddr;
+          formlocation.value.locations = taskinfo.value.taskLocation;
+        }
+      }
 
 
-      fileList.value = "";
-      formlocation.value = { addr: "", locations: "" };
     };
     onMounted(() => {
-      //  doinit();
+       doinit(props.taskinfo);
     });
 
     const fileList = ref([]);
@@ -255,9 +268,11 @@ export default defineComponent({
       () => fileList.value,
       () => {
         taskinfo.value.taskPics = fileList.value;
-        context.emit("update:taskinfo", taskinfo.value);
       }
     );
+    const updateallvalue = () => {
+       context.emit("update:taskinfo", taskinfo.value);
+    }
 
     function setdatakey(dept) {
       if (dept.children) {
@@ -283,14 +298,8 @@ export default defineComponent({
       treedept.value = [setdatakey(res.data[0])];
     });
 
-    const taskinfo = ref({});
-    watch(
-      () => taskinfo,
-      () => {
-        context.emit("update:taskinfo", taskinfo.value);
-      },
-      { deep: true }
-    );
+
+
     return {
       mapSelect,
       MapSelect,
@@ -306,6 +315,7 @@ export default defineComponent({
       sys_area,
       fileList,
       doinit,
+      updateallvalue,
     };
   },
 });

+ 7 - 0
src/router/index.js

@@ -189,6 +189,13 @@ export const constantRoutes = [{
                 name: "mbtaskdetail",
                 meta: { title: "热线工单详情", icon: "user" },
             },
+            {
+                path: "task/add",
+                component: () =>
+                    import ("@/views/mb/task/add/index"),
+                name: "mbtaskadd",
+                meta: { title: "热线工单新增", icon: "user" },
+            },
         ],
     },
     {

+ 242 - 0
src/views/mb/task/add/index.vue

@@ -0,0 +1,242 @@
+<template>
+  <div>
+    <van-nav-bar
+      title="工单新增"
+      left-text="返回"
+      left-arrow
+      @click-left="onClickLeft"
+    />
+    <div class="listcontent" :style="`height:${bodyheight}px`">
+      <van-form @submit="onSubmit">
+        <van-cell-group inset>
+          <van-field
+            v-model="taskinfo.taskName"
+            name="工单名称"
+            label="工单名称"
+            placeholder="工单名称"
+          />
+          <van-field
+            v-model="taskinfo.taskTime"
+            is-link
+            readonly
+            name="picker"
+            label="工单时间"
+            placeholder="点击选择时间"
+            @click="showPicker = true"
+          />
+
+          <van-popup v-model:show="showPicker" position="bottom">
+            <van-datetime-picker
+              v-model="taskdate"
+              type="datetime"
+              title="选择完整时间"
+              @confirm="onConfirm"
+              @cancel="showPicker = false"
+            />
+          </van-popup>
+
+          <van-field
+            name="工单内容"
+            label="工单内容"
+            v-model="taskinfo.taskContent"
+            rows="2"
+            autosize
+            type="textarea"
+            placeholder="请输入工单内容"
+          />
+
+          <van-field
+            v-model="taskdtype"
+            name="事件类型"
+            label="事件类型"
+            is-link
+            readonly
+            placeholder="点击选择事件类型"
+            @click="showPicker1 = true"
+          />
+
+          <van-popup v-model:show="showPicker1" position="bottom">
+            <van-picker
+              v-model="taskdtype"
+              title="选择事件类型"
+              :columns="alltype"
+              @confirm="onConfirm1"
+              @cancel="showPicker1 = false"
+            />
+          </van-popup>
+
+          <van-field
+            v-model="taskinfo.taskFacilitieCode"
+            name="设施编号"
+            label="设施编号"
+            placeholder="设施编号"
+          />
+          <van-field
+            v-model="taskinfo.taskAddr"
+            name="详细地址"
+            label="详细地址"
+            placeholder="详细地址"
+          >
+            <template #button>
+              <van-button
+                size="small"
+                type="primary"
+                icon="search"
+                @click="searchaddr"
+              ></van-button>
+            </template>
+          </van-field>
+          <div style="padding-top: 10px">
+            <MapSelect ref="mapSelect" v-model:formv="formlocation"></MapSelect>
+          </div>
+        </van-cell-group>
+
+        <div style="margin: 16px">
+          <van-button round block type="primary" native-type="submit">
+            提交
+          </van-button>
+        </div>
+      </van-form>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { defineComponent, ref, onMounted, watch } from "vue";
+import { cloneDeep } from "lodash";
+import { listDept, getDept } from "@/api/system/dept";
+import ImagePreview from "@/components/ImagePreview";
+import { useDict } from "@/utils/dict";
+import { useRoute } from "vue-router";
+import MapSelect from "@/components/MapSelect";
+import moment from "moment";
+import {
+  listTask,
+  getTask,
+  delTask,
+  addTask,
+  updateTask,
+  distributedTask,
+  closeTask,
+  czTask,
+  gzTask,
+  hcTask,
+} from "@/api/system/task";
+import {
+  changeUserStatus,
+  listUser,
+  resetUserPwd,
+  delUser,
+  getUser,
+  updateUser,
+  addUser,
+} from "@/api/system/user";
+import { Toast } from "vant";
+import { treeselect as deptTreeselect } from "@/api/system/dept";
+import router from "../../../../router";
+
+const { task_status, task_event_category, task_event_type } = useDict(
+  "task_status",
+  "task_event_category",
+  "task_event_type"
+);
+const bodyheight = ref(0);
+const showPicker = ref(false);
+const showPicker1 = ref(false);
+const taskdate = ref(new Date());
+
+const taskdtype = ref("");
+const alltype = ref([]);
+bodyheight.value = document.body.clientHeight - 48;
+
+const onConfirm = () => {
+  showPicker.value = false;
+  taskinfo.value.taskTime = moment(taskdate.value).format(
+    "YYYY-MM-DD HH:mm:ss"
+  );
+};
+const onConfirm1 = (value) => {
+  showPicker1.value = false;
+  taskdtype.value = value;
+
+  taskinfo.value.taskEventType =
+    task_event_type.value.filter(
+      (i) => i.label.toString() === (taskdtype.value ?? "").toString()
+    )[0]?.value ?? null;
+};
+
+const searchaddr = () => {
+  if (taskinfo.value.taskAddr) {
+    mapSelect.value.searchaddr(taskinfo.value.taskAddr);
+  } else {
+    Toast("请输入地址");
+  }
+};
+
+const alldept = ref([]);
+listDept().then((response) => {
+  alldept.value = cloneDeep(response.data);
+});
+const allusers = ref([]);
+listUser({ pageSize: 1000 }).then((res) => {
+  allusers.value = res.rows;
+});
+
+const taskinfo = ref({
+  taskName: null,
+  taskContent: null,
+  taskTime: null,
+  taskEventType: null,
+  taskFacilitieCode: "",
+  taskAddr: null,
+  taskLocation: null,
+  status:1
+});
+
+const mapSelect = ref(null);
+const formlocation = ref({ addr: "", locations: "" });
+watch(
+  () => formlocation.value.addr,
+  () => {
+    taskinfo.value.taskAddr = formlocation.value.addr;
+  }
+);
+watch(
+  () => formlocation.value.locations,
+  () => {
+    taskinfo.value.taskLocation = formlocation.value.locations;
+  }
+);
+
+watch(() => task_event_type.value, () => {
+  alltype.value = task_event_type.value.map(i => i.label);
+})
+
+const onSubmit = async () => {
+  if (taskinfo.taskName === null || taskinfo.taskName === '') {
+    Toast.fail("请填写完整");
+    return;
+  }
+
+  await addTask(taskinfo.value);
+  Toast.success("添加成功");
+  router.back();
+
+};
+
+const onClickLeft = () => {
+  router.back();
+};
+</script>
+
+<style lang="scss">
+body {
+  position: fixed;
+  width: 100%;
+  top: -1px;
+}
+.listcontent {
+  overflow-y: auto;
+  padding: 10px;
+}
+</style>

+ 17 - 5
src/views/mb/task/index.vue

@@ -47,9 +47,20 @@
                     </div>
 
                     <van-row>
-                      <van-col span="24"
+                      <van-col span="12"
+                        ><div>
+                          工单来源:{{
+                            task_type.filter(
+                              (i) =>
+                                i.value.toString() ===
+                                (item.taskType ?? "").toString()
+                            )[0]?.label ?? "-"
+                          }}
+                        </div></van-col
+                      >
+                      <van-col span="12"
                         ><div>
-                          热线类型:{{
+                          事件类型:{{
                             task_event_type.filter(
                               (i) =>
                                 i.value.toString() ===
@@ -98,10 +109,11 @@ const loading = ref(false);
 const finished = ref(false);
 const refreshing = ref(false);
 
-const { task_status, task_event_category, task_event_type } = useDict(
+const { task_status, task_event_category, task_event_type,task_type } = useDict(
   "task_status",
   "task_event_category",
-  "task_event_type"
+  "task_event_type",
+  "task_type"
 );
 
 const bodyheight = ref(0);
@@ -166,7 +178,7 @@ const onClickLeft = () => {
   router.back();
 };
 const onClickRight = () => {
-  alert("add");
+  router.push("/mb/task/add")
 };
 </script>
 

+ 34 - 6
src/views/task/list/index.vue

@@ -123,7 +123,7 @@
     <el-dialog
       v-model="showadd"
       v-loading="loading"
-      title="新增任务"
+      :title="`${ (taskinfo.taskId==null||taskinfo.taskId==undefined) ?'新增任务':'编辑任务'}`"
       width="70%"
       draggable
     >
@@ -137,6 +137,9 @@
         </span>
       </template>
     </el-dialog>
+
+
+
   </div>
 </template>
 
@@ -144,6 +147,7 @@
 import { defineComponent, ref, reactive, onMounted, computed } from "vue";
 import { useDict } from "@/utils/dict";
 import TaskAdd from "@/components/Task/Add";
+import MapSelect from "@/components/MapSelect";
 import router from "../../../router";
 import { ElMessage } from "element-plus";
 // 分页组件
@@ -159,6 +163,7 @@ import { cloneDeep } from "lodash";
 import { isArray } from "@vue/shared";
 import { useRoute } from "vue-router";
 
+const formlocation = ref({ addr: "", locations: ""});
 
 const {
   task_status,
@@ -185,7 +190,31 @@ const showadd = ref(false);
 const qdate = ref([]);
 const tableData = ref([]);
 const pagedata = ref({});
-const taskinfo = ref();
+const taskinfo = ref({taskName: null,
+    taskContent: null,
+    taskAddr: null,
+    taskLocation: null,
+    taskCode: null,
+    taskType: null,
+    taskEventType: null,
+    taskEventCategory: null,
+    taskFromRemark: null,
+    taskAddrRoad: null,
+    taskOtherId: null,
+    taskTime: null,
+    taskArea: "1",
+    taskReqCompleteTime: null,
+    status: 1,
+    taskId:null,
+    remark: "",
+    taskCreater: null,
+    taskReporter: null,
+    taskPics: null,
+    taskVideos: null,
+    taskComplainConnect: null,
+    taskDeptRange: "",
+    taskFacilitieCode: "",
+    remark: "",});
 const taskaddref = ref();
 const route = useRoute();
 const currentstatus = computed(() => route.params.status);
@@ -208,6 +237,7 @@ const addtask = () => {
     taskArea: "1",
     taskReqCompleteTime: null,
     status: 1,
+    taskId: null,
     remark: "",
     taskCreater: null,
     taskReporter: null,
@@ -218,7 +248,6 @@ const addtask = () => {
     taskFacilitieCode: "",
     remark: "",
   };
-  // console.log(taskaddref.value)
   taskaddref.value?.doinit(taskinfo.value);
 };
 
@@ -227,6 +256,7 @@ const tblrowclick = (row) => {
   router.push(`/task/detail/${row.taskId}`);
 };
 const ontaskadd = async () => {
+  taskaddref.value?.updateallvalue();
   showadd.value = false;
   var taskobj = cloneDeep(taskinfo.value);
   taskobj.status = 1;
@@ -266,11 +296,9 @@ const getList = () => {
 };
 getList();
 const edittask = (row) => {
-  showadd.value = true;
   taskinfo.value = cloneDeep(row);
-
+  showadd.value = true;
   taskaddref.value?.doinit(taskinfo.value);
-
 }
 const deltask = (row) => {
   delTask(row.taskId).then(res => {