| | |
| | | // 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: '请输入工作内容', |
| | |
| | | |
| | | async onLoad(option) { |
| | | await this.getTypeList(); |
| | | await this.getLabelLit(); |
| | | await this.getLabelList(); |
| | | if (option.id) { |
| | | this.isEdit = true; |
| | | this.id = option.id; |
| | |
| | | } |
| | | }, |
| | | |
| | | |
| | | methods: { |
| | | |
| | | |
| | | getDetail(id) { |
| | | getWorkLogDetail({ |
| | |
| | | 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() { |
| | |
| | | }) |
| | | }, |
| | | |
| | | getLabelLit() { |
| | | getLabelList() { |
| | | getLabelListByParentId({ |
| | | parentId: 100 |
| | | }).then(res => { |
| | |
| | | } else { |
| | | this.addWorkLogRequest() |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | |
| | |
| | | addWorkLog(this.info).then(res => { |
| | | uni.showToast({ |
| | | icon: 'success', |
| | | title: '提交成功', |
| | | success() { |
| | | setTimeout(() => { |
| | | uni.navigateBack() |
| | | }, 1000) |
| | | } |
| | | title: '提交成功' |
| | | }) |
| | | setTimeout(() => { |
| | | uni.navigateBack() |
| | | }, 300) |
| | | }) |
| | | }, |
| | | |
| | |
| | | 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(); |
| | | }, |
| | | |
| | | } |
| | | } |