Lou
2024-01-16 db8e416fec0ab844026eb7bc91d9f59a457f4e6e
subPackage/workbench/views/workLog.vue
@@ -157,19 +157,19 @@
               //    trigger: ['blur', 'change']
               // },
               'type': {
               'info.type': {
                  type: 'string',
                  required: true,
                  message: '请选择走访类型',
                  trigger: ['blur', 'change']
               },
               'householdId': {
               'info.householdId': {
                  type: 'string',
                  required: true,
                  message: '请选择被访问人',
                  trigger: ['blur', 'change']
               },
               'context': {
               'info.context': {
                  type: 'string',
                  required: true,
                  message: '请输入工作内容',
@@ -206,7 +206,7 @@
      async onLoad(option) {
         await this.getTypeList();
         await this.getLabelLit();
         await this.getLabelList();
         if (option.id) {
            this.isEdit = true;
            this.id = option.id;
@@ -214,9 +214,7 @@
         }
      },
      methods: {
         getDetail(id) {
            getWorkLogDetail({
@@ -225,43 +223,24 @@
               console.log(res);
               if (res.code == 200) {
                  let data = res.data
                  this.typeIndex = this.getTypeValue(data.type).index;
                  this.typeName = this.getTypeValue(data.type).name;
                  this.workTime = Number(new Date(data.workTime))
                  this.tyepIndex = this.$getIndex(this.typeList[0], data.type, "dictKey", "dictValue").index;
                  this.typeName = this.$getIndex(this.typeList[0], data.type, "dictKey", "dictValue").name;
                  if (data.workTime) {
                     this.workTime = Number(new Date(data.workTime))
                  }
                  this.info.type = data.type;
                  this.info.workTime = data.workTime;
                  this.info.context = data.context;
                  this.info.householdId = data.householdId;
                  this.info.personType = data.personType;
                  this.labelIndex = this.getLabelValue(data.personType).index;
                  this.labelName = this.getLabelValue(data.personType).name;
                  this.labelIndex = this.$getIndex(this.labelList[0], data.personType, "id", "name").index;
                  this.labelName = this.$getIndex(this.labelList[0], data.personType, "id", "name").name;
                  this.getHouseholdList();
                  this.getHousehold(data.householdId);
                  this.form.images = this.$setImageUrl(data.url, 2);
                  this.info.id = data.id;
               }
            })
         },
         getTypeValue(value) {
            for (let i = 0, ii = this.typeList[0].length; i < ii; i++) {
               if (value == this.typeList[0][i].dictKey) {
                  return {
                     index: [i],
                     name: this.typeList[0][i].dictValue
                  }
               }
            }
         },
         getLabelValue(value) {
            for (let i = 0, ii = this.labelList[0].length; i < ii; i++) {
               if (value == this.labelList[0][i].id) {
                  return {
                     index: [i],
                     name: this.labelList[0][i].name
                  }
               }
            }
         },
         getTypeList() {
@@ -273,7 +252,7 @@
            })
         },
         getLabelLit() {
         getLabelList() {
            getLabelListByParentId({
               parentId: 100
            }).then(res => {
@@ -378,7 +357,6 @@
               } else {
                  this.addWorkLogRequest()
               }
            })
         },
@@ -386,13 +364,11 @@
            addWorkLog(this.info).then(res => {
               uni.showToast({
                  icon: 'success',
                  title: '提交成功',
                  success() {
                     setTimeout(() => {
                        uni.navigateBack()
                     }, 1000)
                  }
                  title: '提交成功'
               })
               setTimeout(() => {
                  uni.navigateBack()
               }, 300)
            })
         },
@@ -401,14 +377,21 @@
               uni.showToast({
                  icon: 'success',
                  title: '提交成功',
                  success() {
                     setTimeout(() => {
                        uni.navigateBack()
                     }, 1000)
                  }
               })
               setTimeout(() => {
                  this.reLoadPrePage()
               }, 300)
            })
         }
         },
         //刷新上一页数据后返回
         reLoadPrePage() {
            let pages = getCurrentPages();
            let prePage = pages[pages.length - 2];
            prePage.$vm.resetParams();
            prePage.$vm.getList();
            uni.navigateBack();
         },
      }
   }