wenhongquan 3 năm trước cách đây
mục cha
commit
ae7144c1a1
1 tập tin đã thay đổi với 337 bổ sung44 xóa
  1. 337 44
      src/views/mb/task/add/index.vue

+ 337 - 44
src/views/mb/task/add/index.vue

@@ -11,28 +11,85 @@
         <van-cell-group inset>
           <van-field
             v-model="taskinfo.taskCode"
-            name="工单号"
-            label="工单号"
-            placeholder="工单号"
+            name="工单号"
+            label="工单号"
+            placeholder="工单号"
           />
           <van-field
-            v-model="taskinfo.taskName"
-            name="工单名称"
-            label="工单名称"
-            placeholder="工单名称"
+            v-model="taskinfo.taskOtherId"
+            name="其他工单号"
+            label="其他工单号"
+            placeholder="其他工单号"
+          />
+
+          <van-field
+            v-model="taskdfrom"
+            name="事件来源"
+            label="事件来源"
+            placeholder="点击选择事件来源"
+            is-link
+            readonly
+            @click="showPicker3 = true"
+          />
+          <van-popup v-model:show="showPicker3" position="bottom">
+            <van-picker
+              v-model="taskdfrom"
+              title="选择事件来源"
+              :columns="allfrom"
+              @confirm="onConfirm3"
+              @cancel="showPicker3 = false"
+            />
+          </van-popup>
+
+          <van-field
+            v-model="taskdarea"
+            name="行政区"
+            label="行政区"
+            placeholder="点击选择行政区"
+            is-link
+            readonly
+            @click="showPicker2 = true"
+          />
+          <van-popup v-model:show="showPicker2" position="bottom">
+            <van-picker
+              v-model="taskdarea"
+              title="选择行政区"
+              :columns="allarea"
+              @confirm="onConfirm2"
+              @cancel="showPicker2 = false"
+            />
+          </van-popup>
+
+          <van-field
+            v-model="taskinfo.taskAddrRoad"
+            name="道路名"
+            label="道路名"
+            placeholder="道路名"
           />
           <van-field
-            v-model="taskinfo.taskcode"
-            name="工单名称"
-            label="工单名称"
-            placeholder="工单名称"
+            v-model="taskinfo.taskComplainConnect"
+            name="投诉人电话"
+            label="投诉人电话"
+            placeholder="投诉人电话"
           />
+
+          <van-field label="班组区域" name="班组区域">
+            <template #input>
+              <el-tree-select
+                v-model="taskinfo.taskDeptRange"
+                multiple
+                :data="treedept"
+                check-strictly="true"
+              />
+            </template>
+          </van-field>
+
           <van-field
             v-model="taskinfo.taskTime"
             is-link
             readonly
             name="picker"
-            label="工单时间"
+            label="来件时间"
             placeholder="点击选择时间"
             @click="showPicker = true"
           />
@@ -48,15 +105,25 @@
           </van-popup>
 
           <van-field
-            name="工单内容"
-            label="工单内容"
-            v-model="taskinfo.taskContent"
-            rows="2"
-            autosize
-            type="textarea"
-            placeholder="请输入工单内容"
+            v-model="taskinfo.taskReqCompleteTime"
+            is-link
+            readonly
+            name="picker1"
+            label="要求完成时间"
+            placeholder="点击选择时间"
+            @click="showPicker4 = true"
           />
 
+          <van-popup v-model:show="showPicker4" position="bottom">
+            <van-datetime-picker
+              v-model="taskdate1"
+              type="datetime"
+              title="选择完整时间"
+              @confirm="onConfirm4"
+              @cancel="showPicker4 = false"
+            />
+          </van-popup>
+
           <van-field
             v-model="taskdtype"
             name="事件类型"
@@ -78,10 +145,80 @@
           </van-popup>
 
           <van-field
-            v-model="taskinfo.taskFacilitieCode"
-            name="设施编号"
-            label="设施编号"
-            placeholder="设施编号"
+            v-model="taskdcategory"
+            name="事件分类"
+            label="事件分类"
+            is-link
+            readonly
+            placeholder="点击选择事件分类"
+            @click="showPicker5 = true"
+          />
+
+          <van-popup v-model:show="showPicker5" position="bottom">
+            <van-picker
+              v-model="taskdcategory"
+              title="选择事件类型"
+              :columns="allcategory"
+              @confirm="onConfirm5"
+              @cancel="showPicker5 = false"
+            />
+          </van-popup>
+          <van-field
+            name="任务内容"
+            label="任务内容"
+            v-model="taskinfo.taskContent"
+            rows="2"
+            autosize
+            type="textarea"
+            placeholder="请输入任务内容"
+          />
+
+          <van-field
+            v-model="taskdisconfirm"
+            name="是否需要确认"
+            label="是否需要确认"
+            is-link
+            readonly
+            placeholder="点击选择"
+            @click="showPicker6 = true"
+          />
+          <van-popup v-model:show="showPicker6" position="bottom">
+            <van-picker
+              v-model="taskdisconfirm"
+              title="是否需要确认"
+              :columns="allconfirm"
+              @confirm="onConfirm6"
+              @cancel="showPicker6 = false"
+            />
+          </van-popup>
+
+          <van-field name="接单人员" label="接单人员">
+            <template #input>
+              <el-select
+                v-model="taskinfo.taskReporter"
+                filterable
+                default-first-option
+                :reserve-keyword="false"
+                placeholder="请输入组员"
+              >
+                <el-option
+                  v-for="item in allusers"
+                  :key="item.userId"
+                  :label="item.nickName"
+                  :value="item.userId"
+                />
+              </el-select>
+            </template>
+          </van-field>
+
+          <van-field
+            v-model="taskinfo.taskFromRemark"
+            name="来件备注"
+            label="来件备注"
+            rows="2"
+            autosize
+            type="textarea"
+            placeholder="来件备注"
           />
           <van-field
             v-model="taskinfo.taskAddr"
@@ -101,6 +238,12 @@
           <div style="padding-top: 10px">
             <MapSelect ref="mapSelect" v-model:formv="formlocation"></MapSelect>
           </div>
+
+          <van-field name="照片附件" label="照片附件">
+            <template #input>
+              <ImageUpload v-model="fileList"></ImageUpload>
+            </template>
+          </van-field>
         </van-cell-group>
 
         <div style="margin: 16px">
@@ -118,6 +261,7 @@ import { defineComponent, ref, onMounted, watch } from "vue";
 import { cloneDeep } from "lodash";
 import { listDept, getDept } from "@/api/system/dept";
 import ImagePreview from "@/components/ImagePreview";
+import ImageUpload from "@/components/ImageUpload";
 import { useDict } from "@/utils/dict";
 import { useRoute } from "vue-router";
 import MapSelect from "@/components/MapSelect";
@@ -147,18 +291,47 @@ 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(
+const {
+  task_status,
+  task_event_category,
+  task_event_type,
+  sys_area,
+  task_type,
+} = useDict(
   "task_status",
   "task_event_category",
-  "task_event_type"
+  "task_event_type",
+  "sys_area",
+  "task_type"
 );
 const bodyheight = ref(0);
 const showPicker = ref(false);
 const showPicker1 = ref(false);
+const showPicker2 = ref(false);
+const showPicker3 = ref(false);
+const showPicker4 = ref(false);
+const showPicker5 = ref(false);
+const showPicker6 = ref(false);
 const taskdate = ref(new Date());
+const taskdate1 = ref(new Date());
+const taskdate2 = ref(new Date());
+const taskdate3 = ref(new Date());
+const taskdate4 = ref(new Date());
+
+const fileList = ref([]);
 
 const taskdtype = ref("");
+const taskdarea = ref("");
+const taskdfrom = ref("");
+const taskdcategory = ref("");
+const taskdisconfirm = ref("");
+
 const alltype = ref([]);
+const allarea = ref([]);
+const allfrom = ref([]);
+const allcategory = ref([]);
+const allconfirm = ref(["是", "否"]);
+
 bodyheight.value = document.body.clientHeight - 48;
 
 const onConfirm = () => {
@@ -176,6 +349,45 @@ const onConfirm1 = (value) => {
       (i) => i.label.toString() === (taskdtype.value ?? "").toString()
     )[0]?.value ?? null;
 };
+const onConfirm2 = (value) => {
+  showPicker2.value = false;
+  taskdarea.value = value;
+
+  taskinfo.value.taskArea =
+    sys_area.value.filter(
+      (i) => i.label.toString() === (taskdarea.value ?? "").toString()
+    )[0]?.value ?? null;
+};
+const onConfirm3 = (value) => {
+  showPicker3.value = false;
+  taskdfrom.value = value;
+
+  taskinfo.value.taskType =
+    task_type.value.filter(
+      (i) => i.label.toString() === (taskdfrom.value ?? "").toString()
+    )[0]?.value ?? null;
+};
+const onConfirm4 = () => {
+  showPicker4.value = false;
+  taskinfo.value.taskReqCompleteTime = moment(taskdate1.value).format(
+    "YYYY-MM-DD HH:mm:ss"
+  );
+};
+const onConfirm5 = (value) => {
+  showPicker5.value = false;
+  taskdcategory.value = value;
+
+  taskinfo.value.taskEventCategory =
+    task_event_category.value.filter(
+      (i) => i.label.toString() === (taskdcategory.value ?? "").toString()
+    )[0]?.value ?? null;
+};
+const onConfirm6 = (value) => {
+  showPicker6.value = false;
+  taskdisconfirm.value = value;
+
+  taskinfo.value.remark = value === "是" ? "1" : "0";
+};
 
 const searchaddr = () => {
   if (taskinfo.value.taskAddr) {
@@ -196,14 +408,35 @@ listUser({ pageSize: 1000 }).then((res) => {
 
 const taskinfo = ref({
   taskName: null,
-  taskCode: null,
   taskContent: null,
-  taskTime: null,
-  taskEventType: null,
-  taskFacilitieCode: "",
   taskAddr: null,
   taskLocation: null,
-  status:1
+  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: "",
+});
+
+listTask({ taskCode: moment().year() + "" }).then((res) => {
+  taskinfo.value.taskCode =
+    moment().year() + (Array(3).join(0) + (res.total + 1)).slice(-3);
 });
 
 const mapSelect = ref(null);
@@ -212,7 +445,6 @@ watch(
   () => formlocation.value.addr,
   () => {
     taskinfo.value.taskAddr = formlocation.value.addr;
-
   }
 );
 watch(
@@ -221,26 +453,88 @@ watch(
     taskinfo.value.taskLocation = formlocation.value.locations;
     if (formlocation.value.locations != "") {
       mapSelect.value.getlocationaddr(formlocation.value.locations, (data) => {
-         var qu = data.regeocode.addressComponent.district;
-            if (qu) {
-              for (var i in sys_area.value) {
-                if (sys_area.value[i].label == qu) {
-                  taskinfo.value.taskArea = sys_area.value[i].value
-                }
-              }
+        var qu = data.regeocode.addressComponent.district;
+        if (qu) {
+          for (var i in sys_area.value) {
+            if (sys_area.value[i].label == qu) {
+              taskinfo.value.taskArea = sys_area.value[i].value;
+              taskdarea.value = sys_area.value[i].label;
             }
-      })
+          }
+        }
+      });
     }
+  }
+);
 
+watch(
+  () => fileList.value,
+  () => {
+    taskinfo.value.taskPics = fileList.value;
   }
 );
 
-watch(() => task_event_type.value, () => {
-  alltype.value = task_event_type.value.map(i => i.label);
-})
+watch(
+  () => task_event_type.value,
+  () => {
+    alltype.value = task_event_type.value.map((i) => i.label);
+  }
+);
+watch(
+  () => sys_area.value,
+  () => {
+    allarea.value = sys_area.value.map((i) => i.label);
+  }
+);
+watch(
+  () => task_type.value,
+  () => {
+    allfrom.value = task_type.value.map((i) => i.label);
+  }
+);
+watch(
+  () => task_event_category.value,
+  () => {
+    allcategory.value = task_event_category.value.map((i) => i.label);
+  }
+);
+
+const store = useStore();
+const getters = computed(() => store.getters);
+
+taskinfo.value.taskReporter = getters.value.userId;
+
+function setdatakey(dept) {
+  if (dept.children) {
+    dept.children = dept.children.map((i) => {
+      return setdatakey(i);
+    });
+  }
+  dept["value"] = dept.id;
+  return dept;
+}
+
+const treedept = ref([
+  {
+    value: "1",
+    label: "ss",
+  },
+  {
+    value: "2",
+    label: "ss1",
+  },
+]);
+deptTreeselect().then((res) => {
+  treedept.value = [setdatakey(res.data[0])];
+});
 
 const onSubmit = async () => {
-  if (taskinfo.taskName === null || taskinfo.taskName === '' || taskinfo.taskCode === null || taskinfo.taskCode === '') {
+  if (
+    taskinfo.taskName === null ||
+    taskinfo.taskName === "" ||
+    taskinfo.taskCode === null ||
+    taskinfo.taskCode === ""
+  ) {
     Toast.fail("请填写完整");
     return;
   }
@@ -248,7 +542,6 @@ const onSubmit = async () => {
   await addTask(taskinfo.value);
   Toast.success("添加成功");
   router.back();
-
 };
 
 const onClickLeft = () => {