diff --git a/src/views/convenience/detail.vue b/src/views/convenience/detail.vue index fa9eefc..8062b11 100644 --- a/src/views/convenience/detail.vue +++ b/src/views/convenience/detail.vue @@ -1,44 +1,21 @@ @@ -962,65 +829,65 @@ import { communicationList, update, typeList -} from '@/api/convenience' -import { parseTime } from '@/utils' -import { staffList } from '@/api/staff' -import AliOss from '@/components/AliOSS/index.vue' +} from "@/api/convenience"; +import { parseTime } from "@/utils"; +import { staffList } from "@/api/staff"; +import AliOss from "@/components/AliOSS/index.vue"; export default { filters: { sponsorFilter(status) { const statusMap = { - SELF: '居民', - STAFF: '工作人员' - } - return statusMap[status] + SELF: "居民", + STAFF: "工作人员" + }; + return statusMap[status]; }, phaseFilter(status) { const statusMap = { - PENDING_ORDER: '待接单', - PREREQUISITES: '要件准备中', - PROCESSING: '办理中', - FINISH: '办结' - } - return statusMap[status] + PENDING_ORDER: "待接单", + PREREQUISITES: "要件准备中", + PROCESSING: "办理中", + FINISH: "办结" + }; + return statusMap[status]; }, statusFilter(status) { const statusMap = { - MINE: '待我处理', - FORWARDED: '已转交', - FORWARDED_APPLY: '转交超限审批中', - SUBMIT_APPLY: '已提交审批', - WAIT_APPLY: '待审核' - } - return statusMap[status] + MINE: "待我处理", + FORWARDED: "已转交", + FORWARDED_APPLY: "转交超限审批中", + SUBMIT_APPLY: "已提交审批", + WAIT_APPLY: "待审核" + }; + return statusMap[status]; }, typeFilter(status) { const statusMap = { - 1: '建立工单', - 2: '撤销工单', - 3: '沟通', - 4: '调整工单类别', - 5: '接单', - 6: '要件齐备', - 7: '办结', - 8: '转交超限审批提交', - 9: '转交超限审批撤销', - 10: '转交超限审批', - 11: '发起审批', - 12: '撤销审批', - 13: '审批操作', - 14: '转交' - } - return statusMap[status] + 1: "建立工单", + 2: "撤销工单", + 3: "沟通", + 4: "调整工单类别", + 5: "接单", + 6: "要件齐备", + 7: "办结", + 8: "转交超限审批提交", + 9: "转交超限审批撤销", + 10: "转交超限审批", + 11: "发起审批", + 12: "撤销审批", + 13: "审批操作", + 14: "转交" + }; + return statusMap[status]; }, evaluationFilter(status) { const statusMap = { - 1: '不满意', - 2: '满意', - 3: '非常满意' - } - return statusMap[status] + 1: "不满意", + 2: "满意", + 3: "非常满意" + }; + return statusMap[status]; } // 1 不满意, 2 满意, 3 非常满意 }, @@ -1044,7 +911,7 @@ export default { evaluation: undefined }, rules: { - ids: [{ required: true, message: '请选择操作对象', trigger: 'change' }] + ids: [{ required: true, message: "请选择操作对象", trigger: "change" }] // category: [{ required: true, message: '请选择栏目板块', trigger: 'change' }] }, updateType: undefined, @@ -1057,30 +924,30 @@ export default { prerequisitesInterval: undefined, preMsec: 0, prerequisitesTime: { - hour: '--', - minute: '--', - second: '--' + hour: "--", + minute: "--", + second: "--" }, finishTimeInterval: undefined, finishMsec: 0, finishTime: { - hour: '--', - minute: '--', - second: '--' + hour: "--", + minute: "--", + second: "--" }, acceptanceInterval: undefined, acceptanceMsec: 0, acceptanceTime: { - hour: '--', - minute: '--', - second: '--' + hour: "--", + minute: "--", + second: "--" }, totalTimeInterval: undefined, totalMsec: 0, totalTime: { - hour: '--', - minute: '--', - second: '--' + hour: "--", + minute: "--", + second: "--" }, dialogPreviewImg: false, dialogImageUrl: undefined, @@ -1088,69 +955,54 @@ export default { dialogEventType: false, typeOptions: [], eventTypeId: undefined, - applyDetail: false, - isEventTypeChange: false - } + applyDetail: false + }; }, created() { - this.getInfo() - this.getStaffList() - this.getCommunicationList() - this.getTypeList() + this.getInfo(); + this.getStaffList(); + this.getCommunicationList(); + this.getTypeList(); }, methods: { getInfo() { info({ id: this.id }).then(res => { - this.convenience = res.d - const tempData = Object.assign({}, this.convenience) - const now = Date.parse(new Date()).toString() / 1000 - clearInterval(this.acceptanceInterval) - clearInterval(this.prerequisitesInterval) - clearInterval(this.finishTimeInterval) - clearInterval(this.totalTimeInterval) + this.convenience = res.d; + const tempData = Object.assign({}, this.convenience); + const now = Date.parse(new Date()).toString() / 1000; + clearInterval(this.acceptanceInterval); + clearInterval(this.prerequisitesInterval); + clearInterval(this.finishTimeInterval); + clearInterval(this.totalTimeInterval); switch (tempData.phase) { // 待接单 - case 'PENDING_ORDER': + case "PENDING_ORDER": if (tempData.acceptanceTime === null) { - this.acceptanceMsec = now - this.convenience.createDate - this.countdown(tempData.phase) + this.acceptanceMsec = now - this.convenience.createDate; + this.countdown(tempData.phase); } - break + break; // 要件准备 - case 'PREREQUISITES': + case "PREREQUISITES": if (tempData.prerequisitesTime === null) { - this.preMsec = now - this.convenience.createDate - this.acceptanceMsec = tempData.acceptanceTime - this.timeFormat('acceptanceTime', this.acceptanceMsec) - this.countdown(tempData.phase) + this.preMsec = now - this.convenience.createDate; + this.acceptanceMsec = tempData.acceptanceTime; + this.timeFormat("acceptanceTime", this.acceptanceMsec); + this.countdown(tempData.phase); } - break - // 办理中 - case 'PROCESSING': + break; + // 办结 + case "PROCESSING": if (tempData.finishTime === null) { this.finishMsec = - now - this.preMsec - this.convenience.createDate - this.acceptanceMsec = tempData.acceptanceTime - this.preMsec = tempData.prerequisitesTime - this.timeFormat('acceptanceTime', this.acceptanceMsec) - this.timeFormat('prerequisitesTime', this.preMsec) - this.countdown(tempData.phase) + now - this.preMsec - this.convenience.createDate; + this.acceptanceMsec = tempData.acceptanceTime; + this.preMsec = tempData.prerequisitesTime; + this.timeFormat("acceptanceTime", this.acceptanceMsec); + this.timeFormat("prerequisitesTime", this.preMsec); + this.countdown(tempData.phase); } - break - // 办结 - case 'FINISH': - // console.log(123); - if (tempData.finishTime !== null) { - this.finishMsec = tempData.finishTime - this.acceptanceMsec = tempData.acceptanceTime - this.preMsec = tempData.prerequisitesTime - this.timeFormat('acceptanceTime', this.acceptanceMsec) - this.timeFormat('prerequisitesTime', this.preMsec) - this.timeFormat('finishTime', this.finishMsec) - - this.countdown(tempData.phase) - } - break + break; } // const now = Date.parse(new Date()).toString() / 1000; // switch (this.convenience.phase) { @@ -1186,199 +1038,73 @@ export default { // this.countdown(this.convenience.phase); // break; // } - }) + }); }, getTypeList() { typeList().then(res => { - this.typeOptions = [] + this.typeOptions = []; res.d.map(i => { - const children = [] + let children = []; i.eventTypesList.map(c => { - const level2 = { + let level2 = { label: c.eventName, value: c.id - } - children.push(level2) - }) - const level1 = { + }; + children.push(level2); + }); + let level1 = { label: i.eventName, children - } + }; - this.typeOptions.push(level1) - }) - }) + this.typeOptions.push(level1); + }); + }); }, countdown(phase) { - if (phase === 'PENDING_ORDER') { + if (phase === "PENDING_ORDER") { this.acceptanceInterval = setInterval(() => { - this.timeFormat('acceptanceTime', this.acceptanceMsec) - this.acceptanceMsec++ - }, 1000) + this.timeFormat("acceptanceTime", this.acceptanceMsec); + this.acceptanceMsec++; + }, 1000); // 当前阶段的时间加上 - this.totalMsec = this.acceptanceMsec + this.totalMsec = this.acceptanceMsec; this.totalTimeInterval = setInterval(() => { - this.timeFormat('totalTime', this.totalMsec) - this.totalMsec++ - }, 1000) - } else if (phase === 'PREREQUISITES') { + this.timeFormat("totalTime", this.totalMsec); + this.totalMsec++; + }, 1000); + } else if (phase === "PREREQUISITES") { this.prerequisitesInterval = setInterval(() => { - this.timeFormat('prerequisitesTime', this.preMsec) - this.preMsec++ - }, 1000) - this.totalMsec = this.convenience.acceptanceTime + this.preMsec + this.timeFormat("prerequisitesTime", this.preMsec); + this.preMsec++; + }, 1000); + this.totalMsec = this.convenience.acceptanceTime + this.preMsec; this.totalTimeInterval = setInterval(() => { - this.timeFormat('totalTime', this.totalMsec) - this.totalMsec++ - }, 1000) - } else if (phase === 'PROCESSING') { + this.timeFormat("totalTime", this.totalMsec); + this.totalMsec++; + }, 1000); + } else if (phase === "PROCESSING") { this.finishTimeInterval = setInterval(() => { - // console.log(233); - this.timeFormat('finishTime', this.finishMsec) - this.finishMsec++ - }, 1000) + this.timeFormat("finishTime", this.finishMsec); + this.finishMsec++; + }, 1000); this.totalMsec = this.convenience.acceptanceTime + this.convenience.prerequisitesTime + - this.finishMsec + this.finishMsec; this.totalTimeInterval = setInterval(() => { - this.timeFormat('totalTime', this.totalMsec) - this.totalMsec++ - }, 1000) - } else if (phase === 'FINISH') { - // console.log(233); - this.finishMsec - this.totalMsec = - this.convenience.acceptanceTime + - this.convenience.prerequisitesTime + - this.convenience.finishTime - this.timeFormat('totalTime', this.totalMsec) - // this.totalTimeInterval = setInterval(() => { - // this.totalMsec++; - // }, 1000); - } else { - // 除FINISH外total都要计时 - // this.totalTimeInterval = setInterval(() => { - // this.timeFormat(this.totalTime, this.totalMsec); - // this.totalMsec++; - // }, 1000); + this.timeFormat("totalTime", this.totalMsec); + this.totalMsec++; + }, 1000); + } else if (phase === "FINISH") { + this.finishMsec; } - - // if (phase === "PENDING_ORDER") { - // // 受理 - // if (this.convenience.acceptanceTime === null) { - // this.acceptanceInterval = setInterval(() => { - // this.acceptanceTime.hour = Math.floor(this.acceptanceMsec / 3600); - // this.acceptanceTime.minute = Math.floor( - // ((this.acceptanceMsec % 86400) % 3600) / 60 - // ); - // this.acceptanceTime.second = Math.floor( - // ((this.acceptanceMsec % 86400) % 3600) % 60 - // ); - // this.totalTime = this.acceptanceTime; - // this.acceptanceMsec++; - // }, 1000); - // } else { - // this.acceptanceTime.hour = Math.floor(this.acceptanceMsec / 3600); - // this.acceptanceTime.minute = Math.floor( - // ((this.acceptanceMsec % 86400) % 3600) / 60 - // ); - // this.acceptanceTime.second = Math.floor( - // ((this.acceptanceMsec % 86400) % 3600) % 60 - // ); - // } - // } else if (phase === "PREREQUISITES") { - // // 要件准备 - // if (this.convenience.prerequisitesTime === null) { - // this.prerequisitesInterval = setInterval(() => { - // this.prerequisitesTime.hour = Math.floor(this.preMsec / 3600); - // this.prerequisitesTime.minute = Math.floor( - // ((this.preMsec % 86400) % 3600) / 60 - // ); - // this.prerequisitesTime.second = Math.floor( - // ((this.preMsec % 86400) % 3600) % 60 - // ); - // // this.totalTime = this.acceptanceTime; - // this.totalMsec = this.acceptanceMsec + this.preMsec; - // this.totalTime.hour = Math.floor(this.totalMsec / 3600); - // this.totalTime.minute = Math.floor( - // ((this.totalMsec % 86400) % 3600) / 60 - // ); - // this.totalTime.second = Math.floor( - // ((this.totalMsec % 86400) % 3600) % 60 - // ); - // this.preMsec++; - // }, 1000); - // } else { - // this.prerequisitesTime.hour = Math.floor(this.preMsec / 3600); - // this.prerequisitesTime.minute = Math.floor( - // ((this.preMsec % 86400) % 3600) / 60 - // ); - // this.prerequisitesTime.second = Math.floor( - // ((this.preMsec % 86400) % 3600) % 60 - // ); - // } - // } else if (phase === "PROCESSING") { - // // 办结 - // if (this.convenience.finishTime === null) { - // this.finishTimeInterval = setInterval(() => { - // this.finishTime.hour = Math.floor(this.finishMsec / 3600); - // this.finishTime.minute = Math.floor( - // ((this.finishMsec % 86400) % 3600) / 60 - // ); - // this.finishTime.second = Math.floor( - // ((this.finishMsec % 86400) % 3600) % 60 - // ); - // this.finishMsec++; - // }, 1000); - // } else { - // this.finishTime.hour = Math.floor(this.finishMsec / 3600); - // this.finishTime.minute = Math.floor( - // ((this.finishMsec % 86400) % 3600) / 60 - // ); - // this.finishTime.second = Math.floor( - // ((this.finishMsec % 86400) % 3600) % 60 - // ); - // console.log(this.convenience.finishTime); - // } - // } else { - // this.acceptanceTime.hour = Math.floor(this.acceptanceMsec / 3600); - // this.acceptanceTime.minute = Math.floor( - // ((this.acceptanceMsec % 86400) % 3600) / 60 - // ); - // this.acceptanceTime.second = Math.floor( - // ((this.acceptanceMsec % 86400) % 3600) % 60 - // ); - // this.prerequisitesTime.hour = Math.floor(this.preMsec / 3600); - // this.prerequisitesTime.minute = Math.floor( - // ((this.preMsec % 86400) % 3600) / 60 - // ); - // this.prerequisitesTime.second = Math.floor( - // ((this.preMsec % 86400) % 3600) % 60 - // ); - // this.finishTime.hour = Math.floor(this.finishMsec / 3600); - // this.finishTime.minute = Math.floor( - // ((this.finishMsec % 86400) % 3600) / 60 - // ); - // this.finishTime.second = Math.floor( - // ((this.finishMsec % 86400) % 3600) % 60 - // ); - // } }, timeFormat(obj, timeStamp) { - this[obj].hour = - Math.floor(timeStamp / 3600) < 9 - ? '0' + Math.floor(timeStamp / 3600) - : Math.floor(timeStamp / 3600) - this[obj].minute = - Math.floor(((timeStamp % 86400) % 3600) / 60) < 9 - ? '0' + Math.floor(((timeStamp % 86400) % 3600) / 60) - : Math.floor(((timeStamp % 86400) % 3600) / 60) - this[obj].second = - Math.floor(((timeStamp % 86400) % 3600) % 60) < 9 - ? '0' + Math.floor(((timeStamp % 86400) % 3600) % 60) - : Math.floor(((timeStamp % 86400) % 3600) % 60) + this[obj].hour = Math.floor(timeStamp / 3600); + this[obj].minute = Math.floor(((timeStamp % 86400) % 3600) / 60); + this[obj].second = Math.floor(((timeStamp % 86400) % 3600) % 60); }, getCommunicationList() { communicationList({ id: this.id }).then(res => { @@ -1386,10 +1112,10 @@ export default { const obj = { label: item.name, value: item.id - } - this.communicationOptions.push(obj) - }) - }) + }; + this.communicationOptions.push(obj); + }); + }); }, getStaffList() { staffList().then(res => { @@ -1397,10 +1123,10 @@ export default { const obj = { label: item.name, value: item.id - } - this.staffOptions.push(obj) - }) - }) + }; + this.staffOptions.push(obj); + }); + }); }, resetPayload() { this.payload = { @@ -1411,36 +1137,36 @@ export default { attachmentList: undefined, approve: undefined, evaluation: undefined - } - this.spr = [] - this.bzjr = undefined + }; + this.spr = []; + this.bzjr = undefined; }, handleRevoke() { const payload = { id: this.id, version: this.convenience.version, type: 2 - } + }; update(payload).then(res => { - // console.log(res); - this.$notify.success('撤销成功') - }) + console.log(res); + this.$notify.success("撤销成功"); + }); }, handleContact() { this.$nextTick(() => { - this.$refs.contractForm.clearValidate() - }) - this.contactDialog = true - this.payload.type = 3 - this.payload.id = this.id - this.payload.version = this.convenience.version + this.$refs.contractForm.clearValidate(); + }); + this.contactDialog = true; + this.payload.type = 3; + this.payload.id = this.id; + this.payload.version = this.convenience.version; }, getNames(arr) { - const temp = [] + let temp = []; arr.map(item => { - temp.push(item.name) - }) - return temp.join(',') + temp.push(item.name); + }); + return temp.join(","); }, handlePreview() {}, handleRemove() {}, @@ -1461,27 +1187,27 @@ export default { update(this.payload).then(res => { // console.log(res); if (res.c === 200) { - this.$notify.success('提交成功') + this.$notify.success("提交成功"); } - this.getInfo() - this.contactDialog = false - }) + this.getInfo(); + this.contactDialog = false; + }); } - }) + }); }, handleApprove(approve) { - const applyType = this.convenience.applyType - this.updateType = applyType === 'FORWARDED' ? 10 : 13 - this.payload.id = this.convenience.id - this.payload.version = this.convenience.version - this.payload.type = this.updateType - this.payload.approve = approve + const applyType = this.convenience.applyType; + this.updateType = applyType === "FORWARDED" ? 10 : 13; + this.payload.id = this.convenience.id; + this.payload.version = this.convenience.version; + this.payload.type = this.updateType; + this.payload.approve = approve; if (approve) { // console.log(this.payload); - this.updateData() + this.updateData(); } else { - this.applyDialog = true + this.applyDialog = true; } // id: this.id, // version: undefined, @@ -1492,51 +1218,51 @@ export default { // evaluation: undefined }, handleApprovalReminder() { - this.dialogApprovalReminder = true + this.dialogApprovalReminder = true; }, handleConfirmApprovalReminder() { - this.dialogApprovalReminder = false - this.handleUpdate(11) + this.dialogApprovalReminder = false; + this.handleUpdate(11); }, handleUpdate(type) { - // console.log(type); - this.resetPayload() - this.updateType = type - this.payload.id = this.convenience.id - this.payload.version = this.convenience.version - this.payload.type = type + console.log(type); + this.resetPayload(); + this.updateType = type; + this.payload.id = this.convenience.id; + this.payload.version = this.convenience.version; + this.payload.type = type; switch (type) { case 6: // 要件齐备 - this.applyDialog = true - break + this.applyDialog = true; + break; case 7: // 办结 - this.applyDialog = true - break + this.applyDialog = true; + break; case 10: // 转交超限审批 // this.approve; - break + break; case 11: // 发起审批 - this.applyDialog = true - break + this.applyDialog = true; + break; - // case 12: - // // 撤销审批 - // break; + // case 12: + // // 撤销审批 + // break; case 13: // 审批操作 - this.applyDialog = true - break + this.applyDialog = true; + break; case 14: // console.log("handle14"); // 转交 - const frequencys = this.convenience.records.filter( + let frequencys = this.convenience.records.filter( m => m.frequency !== null - ) + ); if ( frequencys.filter( item => @@ -1544,37 +1270,24 @@ export default { this.convenience.eventType.referralRestrictions ).length > 0 ) { - this.updateType = 8 - this.confirmDialog = true + this.updateType = 8; + this.confirmDialog = true; } else { - this.updateType = 14 - this.applyDialog = true + this.updateType = 14; + this.applyDialog = true; } - break + break; case 16: // 评价申诉 - this.applyDialog = true - break + this.applyDialog = true; + break; default: - this.updateData() - break + this.updateData(); + break; } }, - handleEventTypeChange(val) { - // console.log(val); - // handle - this.payload = { - id: this.id, - type: 4, - version: this.convenience.version, - remark: val - } - this.updateType = 4 - this.updateData() - // this.dialogEventType = false; - }, handleChange(val) { - // console.log(val); + console.log(val); }, apply() { // this.$refs.updateForm.validate(valid=>{ @@ -1582,48 +1295,45 @@ export default { // }) // console.log(this.payload); // console.log(this.payload.type); - this.updateData() - this.applyDialog = false + this.updateData(); + this.applyDialog = false; }, handleContinue() { setTimeout(() => { - this.confirmDialog = false - }, 100) - this.applyDialog = true + this.confirmDialog = false; + }, 100); + this.applyDialog = true; }, updateData() { // console.log(this.updateType); switch (this.updateType) { case 6: - break + break; case 8: - this.payload.ids.push(this.spr) - this.payload.ids.push(this.bzjr) - this.payload.type = 8 - break + this.payload.ids.push(this.spr); + this.payload.ids.push(this.bzjr); + this.payload.type = 8; + break; case 11: - this.payload.id = this.convenience.id - this.payload.version = this.convenience.version - this.payload.ids = this.spr - break + this.payload.id = this.convenience.id; + this.payload.version = this.convenience.version; + this.payload.ids = this.spr; + break; case 14: - this.payload.type = 14 - this.payload.ids.push(this.bzjr) - break + this.payload.type = 14; + this.payload.ids.push(this.bzjr); + break; } update(this.payload).then(res => { if (res.c === 200) { - this.$notify.success('操作成功') + this.$notify.success("操作成功"); if (this.updateType === 13) { - this.$router.push('/convenience/list') - return + this.$router.push("/convenience/list"); + return; } - if (this.updateType === 4) { - this.isEventTypeChange = false - } - this.getInfo() + this.getInfo(); } - }) + }); }, // handlePreviewAttachment(url) { // const fileType = url.substr(url.lastIndexOf(".") + 1); @@ -1635,15 +1345,15 @@ export default { // }, isAssetTypeAnImage(ext) { return ( - ['png', 'jpg', 'jpeg', 'bmp', 'gif'].indexOf(ext.toLowerCase()) !== -1 - ) + ["png", "jpg", "jpeg", "bmp", "gif"].indexOf(ext.toLowerCase()) !== -1 + ); }, handleSetPreviewImg(imgurl) { - this.dialogImageUrl = imgurl - this.dialogPreviewImg = true + this.dialogImageUrl = imgurl; + this.dialogPreviewImg = true; }, handleChangeEventType() { - this.dialogEventType = true + this.dialogEventType = true; }, eventTypeUpdate() { this.payload = { @@ -1651,41 +1361,24 @@ export default { type: 4, version: this.convenience.version, remark: this.eventTypeId - } - this.updateType = 4 - this.updateData() - this.dialogEventType = false + }; + this.updateType = 4; + this.updateData(); + this.dialogEventType = false; } }, beforeRouteLeave(to, from, next) { - clearInterval(this.acceptanceInterval) - clearInterval(this.prerequisitesInterval) - clearInterval(this.finishTimeInterval) - next() + clearInterval(this.acceptanceInterval); + clearInterval(this.prerequisitesInterval); + clearInterval(this.finishTimeInterval); + next(); } - // timeFormat(timeStamp) { - // const timeStr = `${ - // Math.floor(timeStamp / 3600) < 9 - // ? "0" + Math.floor(timeStamp / 3600) - // : Math.floor(timeStamp / 3600) - // }:${ - // Math.floor(((timeStamp % 86400) % 3600) / 60) < 9 - // ? "0" + Math.floor(((timeStamp % 86400) % 3600) / 60) - // : Math.floor(((timeStamp % 86400) % 3600) / 60) - // }:${ - // Math.floor(((timeStamp % 86400) % 3600) % 60) < 9 - // ? "0" + Math.floor(((timeStamp % 86400) % 3600) % 60) - // : Math.floor(((timeStamp % 86400) % 3600) % 60) - // }`; - // return timeStr; - // } -} +};