瀏覽代碼

新增工时与网页端同步

XuZinan 3 年之前
父節點
當前提交
90f2fe0c67
共有 1 個文件被更改,包括 36 次插入16 次删除
  1. 36 16
      pages/index/add.vue

+ 36 - 16
pages/index/add.vue

@@ -14,7 +14,11 @@
           />
         </uni-forms-item>
         <uni-forms-item
-          v-show="currentType.id === 2 || currentType.id === 3"
+          v-show="
+            currentType.id === 2 ||
+            currentType.id === 3 ||
+            currentType.id === 35
+          "
           label="项目"
         >
           <comboxSearch
@@ -43,7 +47,7 @@
             v-model="formData.subTypeId"
             labelKey="name"
             valueKey="id"
-            :disabled="currentType.id == 2"
+            :disabled="currentType.id == 2 || currentType.id == 35"
             @change="onChangeSubType"
           />
         </uni-forms-item>
@@ -69,14 +73,18 @@ export default {
     projectList() {
       let list = [];
       let type = this.currentType;
-      if (type.id == 2) {
-        list.push({
-          fullName: "售前支持(10100)",
-          ID: "0",
-        });
-        return list.concat(this.allProjectList["0"]);
+      switch (type.id) {
+        case 2:
+          list.push({
+            fullName: "售前支持(10100)",
+            ID: "0",
+          });
+          return list.concat(this.allProjectList["0"]);
+        case 3:
+          return this.allProjectList["1"];
+        case 35:
+          return this.allProjectList["7"];
       }
-      return this.allProjectList["1"];
     },
   },
   data() {
@@ -97,6 +105,7 @@ export default {
       let data = {};
       data["0"] = await queryProject({ stage: 0 });
       data["1"] = await queryProject({ stage: 1 });
+      data["7"] = await queryProject({ stage: 7 });
       this.allProjectList = data;
     },
     async submit() {
@@ -135,13 +144,24 @@ export default {
       uni.navigateBack();
     },
     onChangeType(value) {
-      this.formData = {
-        typeId: value,
-        projectId: null,
-        subTypeId: null,
-      };
-      this.currentType = this.typeList.find((item) => item.id == value) || {};
-      this.currentSubType = {};
+      let item = this.typeList.find((t) => t.id == value);
+      if (value == 33 || value == 35) {
+        this.formData = {
+          typeId: value,
+          project: null,
+          subType: item.children[0].id,
+        };
+		this.currentType = item;
+        this.onChangeSubType(item.children[0].id);
+      } else {
+        this.formData = {
+          typeId: value,
+          projectId: null,
+          subTypeId: null,
+        };
+		this.currentType = item;
+        this.currentSubType = {};
+      }
     },
     onChangeProject(index) {
       let project = this.projectList[index];