diff --git a/src/views/modules/communityParty/comPromotion/index.vue b/src/views/modules/communityParty/comPromotion/index.vue index 4d29c1c0d..b3b4a90d1 100644 --- a/src/views/modules/communityParty/comPromotion/index.vue +++ b/src/views/modules/communityParty/comPromotion/index.vue @@ -86,7 +86,7 @@ + width="450px" top="5vh" class="dialog-h" @closed="diaClose"> diff --git a/src/views/modules/communityService/fuwuzhaoren/personList.vue b/src/views/modules/communityService/fuwuzhaoren/personList.vue index 0e37dd04d..531857f8b 100644 --- a/src/views/modules/communityService/fuwuzhaoren/personList.vue +++ b/src/views/modules/communityService/fuwuzhaoren/personList.vue @@ -451,7 +451,9 @@ sendFindPeopleMsg(){ categoryCode: this.selfObj.categoryCode, resiList: this.selectedPersonListIds, serviceTimeStart: this.selfObj.serviceTimeStart, - serviceTimeEnd: this.selfObj.serviceTimeEnd + serviceTimeEnd: this.selfObj.serviceTimeEnd, + serviceRecordId:this.selfObj.serviceRecordId, + serviceName:this.selfObj.serviceName } this.$http .post("/actual/base/communityPublicity/sendFindPeopleMsg",parm) diff --git a/src/views/modules/communityService/policy/personList.vue b/src/views/modules/communityService/policy/personList.vue index 0c404b7b9..2ab77460c 100644 --- a/src/views/modules/communityService/policy/personList.vue +++ b/src/views/modules/communityService/policy/personList.vue @@ -458,7 +458,9 @@ export default { categoryCode: this.selfObj.categoryCode, resiList: this.selectedPersonListIds, serviceTimeStart: this.selfObj.serviceTimeStart, - serviceTimeEnd: this.selfObj.serviceTimeEnd + serviceTimeEnd: this.selfObj.serviceTimeEnd, + serviceRecordId:this.selfObj.id, + serviceName:this.selfObj.title } this.$http .post("/actual/base/communityPublicity/sendFindPeopleMsg",parm) diff --git a/src/views/modules/shequzhili/Delivery/index.vue b/src/views/modules/shequzhili/Delivery/index.vue index 6f1d1bdea..0c1d83b2c 100644 --- a/src/views/modules/shequzhili/Delivery/index.vue +++ b/src/views/modules/shequzhili/Delivery/index.vue @@ -4,24 +4,24 @@ -
- -
+ + this.getOrgTreeList() + this.getGridList() + this.getTableData(); + this.getCateOptions(); + }, + methods: { + handleEventType(val) { + const nodes = this.$refs.cascaderEvent.getCheckedNodes(); + this.formData.firstIdList = []; + this.formData.secondIdList = []; + let level1 = nodes.filter((item) => item.level === 1); + let level2 = nodes.filter((item) => item.level === 2); + level1.forEach((item) => { + if (item.hasChildren) { + for (let i = level2.length - 1; i >= 0; i--) { + if (level2[i].parent.value === item.value) level2.splice(i, 1); + } + } + }); + this.formData.firstIdList = level1.map((item) => item.value); + this.formData.secondIdList = level2.map((item) => item.value); + }, + handleSelectionChange(val) { + this.multipleSelection = []; + val.forEach((element) => { + this.multipleSelection.push(element.icEventId); + }); + }, + async handleMarkDiffcult(command) { + const url = "/governance/icEvent/difficultpointevent"; + if (this.multipleSelection.length == 0) { + this.$message.warning('请选择需要标记的事件') + return + } + let params = { + icEventIdList: this.multipleSelection, + type: command, + }; + const { data, code, msg } = await requestPost(url, params); + if (code === 0) { + this.$message.success("标记成功"); + this.getTableData(); + } else { + this.$message.error(msg); + } + }, + async handleCancalDiffcult() { + const url = "/governance/icEvent/difficultpointevent"; + if (this.multipleSelection.length == 0) { + this.$message.warning('请选择取消标记的事件') + return + } + let params = { + icEventIdList: this.multipleSelection, + type: "0", + }; + const { data, code, msg } = await requestPost(url, params); + if (code === 0) { + this.$message.success("取消标记成功"); + this.getTableData(); + } else { + this.$message.error(msg); + } + }, + + handleSearch(val) { + console.log(val,"skjhfjbhjksdh"); + this.pageNo = 1; + this.getTableData(); + }, + + // 查看 + async handleLook(row) { + + let { agencyId, gridId, gridName, name, reportUserId } = row + const resiId = reportUserId; + this.$store.dispatch('saveData', { agencyId, gridId, gridName, name, resiId }); + this.$router.push({ name: 'jumin-huaxiang' }); + this.$store.state.contentTabs = this.$store.state.contentTabs.map(item => { + if (item.name === "jumin-huaxiang") { + return {...item, title: name }; + } + return item; + }); + }, + + async handleExport() { + const url = "/governance/icEvent/export"; + const { pageSize, pageNo, formData } = this; + axios({ + url: window.SITE_CONFIG["apiURL"] + url, + method: "post", + data: { + pageSize, + pageNo, + ...formData, + }, + responseType: "blob", + }) + .then((res) => { + let fileName = window.decodeURI( + res.headers["content-disposition"].split(";")[1].split("=")[1] + ); + let blob = new Blob([res.data], { type: "application/vnd.ms-excel" }); + var url = window.URL.createObjectURL(blob); + var aLink = document.createElement("a"); + aLink.style.display = "none"; + aLink.href = url; + aLink.setAttribute("download", fileName); + document.body.appendChild(aLink); + aLink.click(); + document.body.removeChild(aLink); //下载完成移除元素 + window.URL.revokeObjectURL(url); //释放掉blob对象 + }) + .catch((err) => { + return this.$message.error("网络错误"); + }); + }, + + async handleAdd() { + this.pageType = "add"; + }, + + async handleWatch(row) { + this.eventId = row.icEventId; + const url = "/governance/icEvent/detail"; + const { data, code, msg } = await requestPost(url, { + icEventId: this.eventId, + }); + if (code === 0) { + this.eventDetailData = { ...data }; + this.pageType = "info"; + } else { + this.$message.error(msg); + } + }, + + async handleDispose(row) { + console.log("row",row); + }, + //下载模版 + async handleExportModule() { + let url = '/governance/icEvent/downloadTemplate'; + let params = {}; + await this.$http({ + method: 'POST', + url, + responseType: 'blob', + data: params + }) + .then(res => { + if (res.headers['content-disposition']) { + let fileName = window.decodeURI(res.headers['content-disposition'].split(';')[1].split('=')[1]); + let blob = new Blob([res.data], { + type: 'application/vnd.ms-excel' + }); + var url = window.URL.createObjectURL(blob); + var aLink = document.createElement('a'); + aLink.style.display = 'none'; + aLink.href = url; + aLink.setAttribute('download', fileName); + document.body.appendChild(aLink); + aLink.click(); + document.body.removeChild(aLink); //下载完成移除元素 + window.URL.revokeObjectURL(url); //释放掉blob对象 + } else this.$message.error('下载失败'); + }) + .catch(err => { + console.log('err', err); + return this.$message.error('网络错误'); + }); + }, + handleExcelSuccess(res, file) { + if (!res.code === 0 && !res.msg === 'success') { + this.$message.error(res.msg); + } + }, + handleProgress(event, file, fileList) { + + }, + beforeExcelUpload(file) { + const isType = file.type === 'application/vnd.ms-excel'; + const isTypeComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + const fileType = isType || isTypeComputer; + const isLt1M = file.size / 1024 / 1024 < 10; + if (!fileType) { + this.$message.error('上传文件只能是xls/xlsx格式!'); + } + + if (!isLt1M) { + this.$message.error('上传文件大小不能超过 10MB!'); + } + return fileType && isLt1M; + }, + importTypeChange(val) { + this.importType = val + }, + async uploadHttpRequest(file) { + this.importLoading = true; + this.importBtnTitle = '正在上传中...'; + this.$message({ + showClose: true, + dangerouslyUseHTMLString: true, + message: "导入中,请到系统管理-导入记录中查看进度", + duration: 3000 + }); + let than = this; + document.getElementById('clickA').addEventListener('click', function () { + than.$router.replace('/main/importRecord-index'); + }); + const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 + formData.append('file', file.file); //添加文件对象 + formData.append('code', ''); //添加文件对象 + let url = '/governance/icEvent/importEvent' + if (this.importType == 2) { + url = '/governance/icEvent/importAwo' + } + console.log(url) + await this.$http + .post(url, formData) + .then(res => { + if (res.data.code == 0 && res.data.msg == 'success') { + const data = res.data.data; + this.dataList = [ + ...Object.keys(data.option.exist).map(k => { + return { + index: k, + srcField: data.option.exist[k], + exist: true, + field: data.option.exist[k] + }; + }), + ...Object.keys(data.option.notExist).map(k => { + return { + index: k, + srcField: data.option.notExist[k], + exist: false, + field: '' + }; + }) + ]; + this.importOption = data.option; + this.importCode = data.code; + this.fileData = file; + } else this.$message.error(res.data.msg); + }) + .catch(err => { + console.log('失败', err); + file.onError(); //上传失败的文件会从文件列表中删除 + }); + this.importLoading = false; + this.importBtnTitle = '导入'; + this.$refs.upload.clearFiles(); + this.getTableData(); + }, + + //显示语音窗口 + handleShowVoice(url) { + this.selVoiceUrl = url; + this.showVoice = true; + }, + + handleClose() { + this.pageType = "list"; + this.eventId = ""; + this.getTableData(); + }, + handleOk() { + this.pageType = "list"; + this.eventId = ""; + this.pageNo = 1; + this.getTableData(); + }, + + handleEditSuccess() { + this.handleClose(); + this.getTableData(); + }, + + async handleDel(rowData) { + let message = "确认删除?"; + this.$confirm(message, "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }).then(() => { + this.delEvent(rowData.icEventId); + }).catch((err) => { }); + }, + async delEvent(eventId) { + const url = "/governance/icEvent/delete"; + let idsArr = [eventId]; + const { data, code, msg } = await requestPost(url, idsArr); + if (code === 0) { + this.$message.success("删除成功!"); + this.getTableData(); + } else { + this.$message.error("操作失败!"); + } + }, + async getTableData() { + const url = "/governance/icEvent/list"; + // if (this.eventTypeCheck) { + // this.formData.secondIdList = this.eventTypeCheck + // } + console.log(this.formData); + const { pageSize, pageNo, formData } = this; + // 创建新的 formData 对象,保留原始值 + const newFormData = { ...formData }; + // // 处理 agencyId + // if (Array.isArray(newFormData.agencyId) && newFormData.agencyId.length) { + // if (this.level == "grid") { + // newFormData.gridId = newFormData.agencyId[newFormData.agencyId.length - 1]; + // newFormData.agencyId = ""; + // } else { + // newFormData.agencyId = newFormData.agencyId[newFormData.agencyId.length - 1]; + // newFormData.gridId = ""; + // } + // } else { + // newFormData.agencyId = ""; + // newFormData.gridId = ""; + // } + const { data, code, msg } = await requestPost(url, { + pageSize, + pageNo, + ...newFormData, + }); + if (code === 0) { + this.total = data.total || 0; + this.tableData = data.list ? data.list.map((item) => { return item; }) : []; + } else { + this.$message.error(msg); + } + }, + async getCateOptions() { + const url = "/governance/icEvent/getCategoryTree"; + const { data, code, msg } = await requestPost(url, {}); + if (code === 0) { + this.cateOptions = this.deepTree(data, "children"); + } else { + this.$message.error(msg); + } + }, + + handleSizeChange(val) { + this.pageSize = val; + window.localStorage.setItem("pageSize", val); + this.getTableData(); + }, + handleCurrentChange(val) { + this.pageNo = val; + this.getTableData(); + }, + + + getOrgTreeList() { + this.$http + .post('/gov/org/customeragency/agencygridtree', {}) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('获取组织树成功', res.data) + this.orgOptions = [] + this.orgOptions.push(res.data) + } + }) + .catch(() => { + return this.$message.error('网络错误') + }) + }, + getGridList() { + this.$http + .post('/gov/org/customergrid/gridoption', { agencyId: this.agencyId, purpose: 'addorupdate' }) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('获取查询详情成功', res.data) + this.optionsG = res.data + } + }) + .catch(() => { + return this.$message.error('网络错误') + }) + }, + handleChangeAgency(val) { + + this.sarr = [] + const map = new Map(); + this.getLastItem( + this.orgOptions, + val, + "agencyId" + ); + this.level = this.sarr[this.sarr.length - 1].level + }, + getLastItem(list, vals, key) { + let LIST = list || []; + for (let item of LIST) { + // console.log(item[key]); + for (let i of vals) { + if (item[key] === i) { + this.sarr.push(item); + } else { + this.getLastItem(item.subAgencyList, vals, key); + } + } + } + }, + + resetSearch() { + this.formData = { + agencyId: "", + gridId: "", + sourceType: "", + eventContent: "", + name: "", + mobile: "", + startTime: "", + endTime: "", + limitStartTime: "", + limitEndTime: "", + status: "", + firstIdList: [], + secondIdList: [], + }; + this.eventTypeCheck = []; + this.pageNo = 1; + this.getTableData(); + // this.loadTable() + }, + deepTree(arr, children) { + if (Array.isArray(arr) && arr.length > 0) { + return arr.map((item) => { + return { + ...item, + [children]: + (item[children] && + item[children].length > 0 && + this.deepTree(item[children], children)) || + null, + }; + }); + } + }, + showAwoList(row) { + this.$refs.awoList.open(row) + } + }, +}; + + + \ No newline at end of file diff --git a/src/views/modules/shequzhili/eventHandling/index.vue b/src/views/modules/shequzhili/eventHandling/index.vue index 6f1d1bdea..e88d87c29 100644 --- a/src/views/modules/shequzhili/eventHandling/index.vue +++ b/src/views/modules/shequzhili/eventHandling/index.vue @@ -4,35 +4,36 @@ -
- -
+ + this.getOrgTreeList() + this.getGridList() + this.getTableData(); + this.getCateOptions(); + }, + methods: { + handleEventType(val) { + const nodes = this.$refs.cascaderEvent.getCheckedNodes(); + this.formData.firstIdList = []; + this.formData.secondIdList = []; + let level1 = nodes.filter((item) => item.level === 1); + let level2 = nodes.filter((item) => item.level === 2); + level1.forEach((item) => { + if (item.hasChildren) { + for (let i = level2.length - 1; i >= 0; i--) { + if (level2[i].parent.value === item.value) level2.splice(i, 1); + } + } + }); + this.formData.firstIdList = level1.map((item) => item.value); + this.formData.secondIdList = level2.map((item) => item.value); + }, + handleSelectionChange(val) { + this.multipleSelection = []; + val.forEach((element) => { + this.multipleSelection.push(element.icEventId); + }); + }, + async handleMarkDiffcult(command) { + const url = "/governance/icEvent/difficultpointevent"; + if (this.multipleSelection.length == 0) { + this.$message.warning('请选择需要标记的事件') + return + } + let params = { + icEventIdList: this.multipleSelection, + type: command, + }; + const { data, code, msg } = await requestPost(url, params); + if (code === 0) { + this.$message.success("标记成功"); + this.getTableData(); + } else { + this.$message.error(msg); + } + }, + async handleCancalDiffcult() { + const url = "/governance/icEvent/difficultpointevent"; + if (this.multipleSelection.length == 0) { + this.$message.warning('请选择取消标记的事件') + return + } + let params = { + icEventIdList: this.multipleSelection, + type: "0", + }; + const { data, code, msg } = await requestPost(url, params); + if (code === 0) { + this.$message.success("取消标记成功"); + this.getTableData(); + } else { + this.$message.error(msg); + } + }, + + handleSearch(val) { + this.pageNo = 1; + this.getTableData(); + }, + + // 查看 + async handleLook(row) { + + let { agencyId, gridId, gridName, name, reportUserId } = row + const resiId = reportUserId; + this.$store.dispatch('saveData', { agencyId, gridId, gridName, name, resiId }); + this.$router.push({ name: 'jumin-huaxiang' }); + this.$store.state.contentTabs = this.$store.state.contentTabs.map(item => { + if (item.name === "jumin-huaxiang") { + return {...item, title: name }; + } + return item; + }); + }, + + async handleExport() { + const url = "/governance/icEvent/export"; + const { pageSize, pageNo, formData } = this; + axios({ + url: window.SITE_CONFIG["apiURL"] + url, + method: "post", + data: { + pageSize, + pageNo, + ...formData, + }, + responseType: "blob", + }) + .then((res) => { + let fileName = window.decodeURI( + res.headers["content-disposition"].split(";")[1].split("=")[1] + ); + let blob = new Blob([res.data], { type: "application/vnd.ms-excel" }); + var url = window.URL.createObjectURL(blob); + var aLink = document.createElement("a"); + aLink.style.display = "none"; + aLink.href = url; + aLink.setAttribute("download", fileName); + document.body.appendChild(aLink); + aLink.click(); + document.body.removeChild(aLink); //下载完成移除元素 + window.URL.revokeObjectURL(url); //释放掉blob对象 + }) + .catch((err) => { + return this.$message.error("网络错误"); + }); + }, + + async handleAdd() { + this.pageType = "add"; + }, + + async handleWatch(row) { + this.eventId = row.icEventId; + const url = "/governance/icEvent/detail"; + const { data, code, msg } = await requestPost(url, { + icEventId: this.eventId, + }); + if (code === 0) { + this.eventDetailData = { ...data }; + this.pageType = "info"; + } else { + this.$message.error(msg); + } + }, + + async handleDispose(row) { + console.log("row",row); + }, + //下载模版 + async handleExportModule() { + let url = '/governance/icEvent/downloadTemplate'; + let params = {}; + await this.$http({ + method: 'POST', + url, + responseType: 'blob', + data: params + }) + .then(res => { + if (res.headers['content-disposition']) { + let fileName = window.decodeURI(res.headers['content-disposition'].split(';')[1].split('=')[1]); + let blob = new Blob([res.data], { + type: 'application/vnd.ms-excel' + }); + var url = window.URL.createObjectURL(blob); + var aLink = document.createElement('a'); + aLink.style.display = 'none'; + aLink.href = url; + aLink.setAttribute('download', fileName); + document.body.appendChild(aLink); + aLink.click(); + document.body.removeChild(aLink); //下载完成移除元素 + window.URL.revokeObjectURL(url); //释放掉blob对象 + } else this.$message.error('下载失败'); + }) + .catch(err => { + console.log('err', err); + return this.$message.error('网络错误'); + }); + }, + handleExcelSuccess(res, file) { + if (!res.code === 0 && !res.msg === 'success') { + this.$message.error(res.msg); + } + }, + handleProgress(event, file, fileList) { + }, + beforeExcelUpload(file) { + const isType = file.type === 'application/vnd.ms-excel'; + const isTypeComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + const fileType = isType || isTypeComputer; + const isLt1M = file.size / 1024 / 1024 < 10; + if (!fileType) { + this.$message.error('上传文件只能是xls/xlsx格式!'); + } + + if (!isLt1M) { + this.$message.error('上传文件大小不能超过 10MB!'); + } + return fileType && isLt1M; + }, + importTypeChange(val) { + this.importType = val + }, + async uploadHttpRequest(file) { + this.importLoading = true; + this.importBtnTitle = '正在上传中...'; + this.$message({ + showClose: true, + dangerouslyUseHTMLString: true, + message: "导入中,请到系统管理-导入记录中查看进度", + duration: 3000 + }); + let than = this; + document.getElementById('clickA').addEventListener('click', function () { + than.$router.replace('/main/importRecord-index'); + }); + const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 + formData.append('file', file.file); //添加文件对象 + formData.append('code', ''); //添加文件对象 + let url = '/governance/icEvent/importEvent' + if (this.importType == 2) { + url = '/governance/icEvent/importAwo' + } + console.log(url) + await this.$http + .post(url, formData) + .then(res => { + if (res.data.code == 0 && res.data.msg == 'success') { + const data = res.data.data; + this.dataList = [ + ...Object.keys(data.option.exist).map(k => { + return { + index: k, + srcField: data.option.exist[k], + exist: true, + field: data.option.exist[k] + }; + }), + ...Object.keys(data.option.notExist).map(k => { + return { + index: k, + srcField: data.option.notExist[k], + exist: false, + field: '' + }; + }) + ]; + this.importOption = data.option; + this.importCode = data.code; + this.fileData = file; + } else this.$message.error(res.data.msg); + }) + .catch(err => { + console.log('失败', err); + file.onError(); //上传失败的文件会从文件列表中删除 + }); + this.importLoading = false; + this.importBtnTitle = '导入'; + this.$refs.upload.clearFiles(); + this.getTableData(); + }, + + //显示语音窗口 + handleShowVoice(url) { + this.selVoiceUrl = url; + this.showVoice = true; + }, + + handleClose() { + this.pageType = "list"; + this.eventId = ""; + this.getTableData(); + }, + handleOk() { + this.pageType = "list"; + this.eventId = ""; + this.pageNo = 1; + this.getTableData(); + }, + + handleEditSuccess() { + this.handleClose(); + this.getTableData(); + }, + + async handleDel(rowData) { + let message = "确认删除?"; + this.$confirm(message, "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }).then(() => { + this.delEvent(rowData.icEventId); + }).catch((err) => { }); + }, + async delEvent(eventId) { + const url = "/governance/icEvent/delete"; + let idsArr = [eventId]; + const { data, code, msg } = await requestPost(url, idsArr); + if (code === 0) { + this.$message.success("删除成功!"); + this.getTableData(); + } else { + this.$message.error("操作失败!"); + } + }, + async getTableData() { + const url = "/governance/icEvent/list"; + if (this.eventTypeCheck) { + this.formData.secondIdList = this.eventTypeCheck + } + + const { pageSize, pageNo, formData } = this; + // 创建新的 formData 对象,保留原始值 + const newFormData = { ...formData }; + + // 处理 agencyId + if (Array.isArray(newFormData.agencyId) && newFormData.agencyId.length) { + if (this.level == "grid") { + newFormData.gridId = newFormData.agencyId[newFormData.agencyId.length - 1]; + newFormData.agencyId = ""; + } else { + newFormData.agencyId = newFormData.agencyId[newFormData.agencyId.length - 1]; + newFormData.gridId = ""; + } + } else { + newFormData.agencyId = ""; + newFormData.gridId = ""; + } + + const { data, code, msg } = await requestPost(url, { + pageSize, + pageNo, + ...newFormData, + }); + if (code === 0) { + this.total = data.total || 0; + // this.tableData = data.list ? data.list.map((item) => { return item; }) : []; + } else { + this.$message.error(msg); + } + }, + async getCateOptions() { + const url = "/governance/icEvent/getCategoryTree"; + const { data, code, msg } = await requestPost(url, {}); + if (code === 0) { + this.cateOptions = this.deepTree(data, "children"); + } else { + this.$message.error(msg); + } + }, + + handleSizeChange(val) { + this.pageSize = val; + window.localStorage.setItem("pageSize", val); + this.getTableData(); + }, + handleCurrentChange(val) { + this.pageNo = val; + this.getTableData(); + }, + + + getOrgTreeList() { + this.$http + .post('/gov/org/customeragency/agencygridtree', {}) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('获取组织树成功', res.data) + this.orgOptions = [] + this.orgOptions.push(res.data) + } + }) + .catch(() => { + return this.$message.error('网络错误') + }) + }, + getGridList() { + this.$http + .post('/gov/org/customergrid/gridoption', { agencyId: this.agencyId, purpose: 'addorupdate' }) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('获取查询详情成功', res.data) + this.optionsG = res.data + } + }) + .catch(() => { + return this.$message.error('网络错误') + }) + }, + + getLastItem(list, vals, key) { + let LIST = list || []; + for (let item of LIST) { + // console.log(item[key]); + for (let i of vals) { + if (item[key] === i) { + this.sarr.push(item); + } else { + this.getLastItem(item.subAgencyList, vals, key); + } + } + } + }, + + resetSearch() { + this.formData = { + agencyId: "", + gridId: "", + sourceType: "", + eventContent: "", + name: "", + mobile: "", + startTime: "", + endTime: "", + limitStartTime: "", + limitEndTime: "", + status: "", + firstIdList: [], + secondIdList: [], + }; + this.eventTypeCheck = []; + this.pageNo = 1; + this.getTableData(); + // this.loadTable() + }, + deepTree(arr, children) { + if (Array.isArray(arr) && arr.length > 0) { + return arr.map((item) => { + return { + ...item, + [children]: + (item[children] && + item[children].length > 0 && + this.deepTree(item[children], children)) || + null, + }; + }); + } + }, + showAwoList(row) { + this.$refs.awoList.open(row) + } + }, +}; + \ No newline at end of file diff --git a/src/views/modules/shequzhili/timeOut/index.vue b/src/views/modules/shequzhili/timeOut/index.vue index 6f1d1bdea..e0b00e49b 100644 --- a/src/views/modules/shequzhili/timeOut/index.vue +++ b/src/views/modules/shequzhili/timeOut/index.vue @@ -4,24 +4,24 @@ -
- -
+ + + + + 取 消 + 确 定 + + + this.getOrgTreeList() + this.getGridList() + this.getTableData(); + this.getCateOptions(); + }, + methods: { + handleEventType(val) { + const nodes = this.$refs.cascaderEvent.getCheckedNodes(); + this.formData.firstIdList = []; + this.formData.secondIdList = []; + let level1 = nodes.filter((item) => item.level === 1); + let level2 = nodes.filter((item) => item.level === 2); + level1.forEach((item) => { + if (item.hasChildren) { + for (let i = level2.length - 1; i >= 0; i--) { + if (level2[i].parent.value === item.value) level2.splice(i, 1); + } + } + }); + this.formData.firstIdList = level1.map((item) => item.value); + this.formData.secondIdList = level2.map((item) => item.value); + }, + handleSelectionChange(val) { + this.multipleSelection = []; + val.forEach((element) => { + this.multipleSelection.push(element.icEventId); + }); + }, + async handleMarkDiffcult(command) { + const url = "/governance/icEvent/difficultpointevent"; + if (this.multipleSelection.length == 0) { + this.$message.warning('请选择需要标记的事件') + return + } + let params = { + icEventIdList: this.multipleSelection, + type: command, + }; + const { data, code, msg } = await requestPost(url, params); + if (code === 0) { + this.$message.success("标记成功"); + this.getTableData(); + } else { + this.$message.error(msg); + } + }, + async handleCancalDiffcult() { + const url = "/governance/icEvent/difficultpointevent"; + if (this.multipleSelection.length == 0) { + this.$message.warning('请选择取消标记的事件') + return + } + let params = { + icEventIdList: this.multipleSelection, + type: "0", + }; + const { data, code, msg } = await requestPost(url, params); + if (code === 0) { + this.$message.success("取消标记成功"); + this.getTableData(); + } else { + this.$message.error(msg); + } + }, + + handleSearch(val) { + this.pageNo = 1; + this.getTableData(); + }, + + // 查看 + async handleLook(row) { + + let { agencyId, gridId, gridName, name, reportUserId } = row + const resiId = reportUserId; + this.$store.dispatch('saveData', { agencyId, gridId, gridName, name, resiId }); + this.$router.push({ name: 'jumin-huaxiang' }); + this.$store.state.contentTabs = this.$store.state.contentTabs.map(item => { + if (item.name === "jumin-huaxiang") { + return {...item, title: name }; + } + return item; + }); + }, + async handleExport() { + const url = "/governance/icEvent/export"; + const { pageSize, pageNo, formData } = this; + axios({ + url: window.SITE_CONFIG["apiURL"] + url, + method: "post", + data: { + pageSize, + pageNo, + ...formData, + }, + responseType: "blob", + }) + .then((res) => { + let fileName = window.decodeURI( + res.headers["content-disposition"].split(";")[1].split("=")[1] + ); + let blob = new Blob([res.data], { type: "application/vnd.ms-excel" }); + var url = window.URL.createObjectURL(blob); + var aLink = document.createElement("a"); + aLink.style.display = "none"; + aLink.href = url; + aLink.setAttribute("download", fileName); + document.body.appendChild(aLink); + aLink.click(); + document.body.removeChild(aLink); //下载完成移除元素 + window.URL.revokeObjectURL(url); //释放掉blob对象 + }) + .catch((err) => { + return this.$message.error("网络错误"); + }); + }, + + async handleAdd() { + this.pageType = "add"; + }, + + async handleWatch(row) { + this.eventId = row.icEventId; + const url = "/governance/icEvent/detail"; + const { data, code, msg } = await requestPost(url, { + icEventId: this.eventId, + }); + if (code === 0) { + this.eventDetailData = { ...data }; + this.pageType = "info"; + } else { + this.$message.error(msg); + } + }, + + async handleDispose(row) { + console.log(row,"row"); + this.dialogVisible=true + + }, + //下载模版 + async handleExportModule() { + let url = '/governance/icEvent/downloadTemplate'; + let params = {}; + await this.$http({ + method: 'POST', + url, + responseType: 'blob', + data: params + }) + .then(res => { + if (res.headers['content-disposition']) { + let fileName = window.decodeURI(res.headers['content-disposition'].split(';')[1].split('=')[1]); + let blob = new Blob([res.data], { + type: 'application/vnd.ms-excel' + }); + var url = window.URL.createObjectURL(blob); + var aLink = document.createElement('a'); + aLink.style.display = 'none'; + aLink.href = url; + aLink.setAttribute('download', fileName); + document.body.appendChild(aLink); + aLink.click(); + document.body.removeChild(aLink); //下载完成移除元素 + window.URL.revokeObjectURL(url); //释放掉blob对象 + } else this.$message.error('下载失败'); + }) + .catch(err => { + console.log('err', err); + return this.$message.error('网络错误'); + }); + }, + handleExcelSuccess(res, file) { + if (!res.code === 0 && !res.msg === 'success') { + this.$message.error(res.msg); + } + }, + handleProgress(event, file, fileList) { + + }, + beforeExcelUpload(file) { + const isType = file.type === 'application/vnd.ms-excel'; + const isTypeComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + const fileType = isType || isTypeComputer; + const isLt1M = file.size / 1024 / 1024 < 10; + if (!fileType) { + this.$message.error('上传文件只能是xls/xlsx格式!'); + } + + if (!isLt1M) { + this.$message.error('上传文件大小不能超过 10MB!'); + } + return fileType && isLt1M; + }, + importTypeChange(val) { + this.importType = val + }, + async uploadHttpRequest(file) { + this.importLoading = true; + this.importBtnTitle = '正在上传中...'; + this.$message({ + showClose: true, + dangerouslyUseHTMLString: true, + message: "导入中,请到系统管理-导入记录中查看进度", + duration: 3000 + }); + let than = this; + document.getElementById('clickA').addEventListener('click', function () { + than.$router.replace('/main/importRecord-index'); + }); + const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 + formData.append('file', file.file); //添加文件对象 + formData.append('code', ''); //添加文件对象 + let url = '/governance/icEvent/importEvent' + if (this.importType == 2) { + url = '/governance/icEvent/importAwo' + } + console.log(url) + await this.$http + .post(url, formData) + .then(res => { + if (res.data.code == 0 && res.data.msg == 'success') { + const data = res.data.data; + this.dataList = [ + ...Object.keys(data.option.exist).map(k => { + return { + index: k, + srcField: data.option.exist[k], + exist: true, + field: data.option.exist[k] + }; + }), + ...Object.keys(data.option.notExist).map(k => { + return { + index: k, + srcField: data.option.notExist[k], + exist: false, + field: '' + }; + }) + ]; + this.importOption = data.option; + this.importCode = data.code; + this.fileData = file; + } else this.$message.error(res.data.msg); + }) + .catch(err => { + console.log('失败', err); + file.onError(); //上传失败的文件会从文件列表中删除 + }); + this.importLoading = false; + this.importBtnTitle = '导入'; + this.$refs.upload.clearFiles(); + this.getTableData(); + }, + + //显示语音窗口 + handleShowVoice(url) { + this.selVoiceUrl = url; + this.showVoice = true; + }, + + handleClose() { + this.pageType = "list"; + this.eventId = ""; + this.getTableData(); + }, + handleOk() { + this.pageType = "list"; + this.eventId = ""; + this.pageNo = 1; + this.getTableData(); + }, + + handleEditSuccess() { + this.handleClose(); + this.getTableData(); + }, + + async handleDel(rowData) { + let message = "确认删除?"; + this.$confirm(message, "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }).then(() => { + this.delEvent(rowData.icEventId); + }).catch((err) => { }); + }, + async delEvent(eventId) { + const url = "/governance/icEvent/delete"; + let idsArr = [eventId]; + const { data, code, msg } = await requestPost(url, idsArr); + if (code === 0) { + this.$message.success("删除成功!"); + this.getTableData(); + } else { + this.$message.error("操作失败!"); + } + }, + async getTableData() { + const url = "/governance/icEvent/list"; + if (this.eventTypeCheck) { + this.formData.secondIdList = this.eventTypeCheck + } + + const { pageSize, pageNo, formData } = this; + // 创建新的 formData 对象,保留原始值 + const newFormData = { ...formData }; + + // 处理 agencyId + if (Array.isArray(newFormData.agencyId) && newFormData.agencyId.length) { + if (this.level == "grid") { + newFormData.gridId = newFormData.agencyId[newFormData.agencyId.length - 1]; + newFormData.agencyId = ""; + } else { + newFormData.agencyId = newFormData.agencyId[newFormData.agencyId.length - 1]; + newFormData.gridId = ""; + } + } else { + newFormData.agencyId = ""; + newFormData.gridId = ""; + } + + const { data, code, msg } = await requestPost(url, { + pageSize, + pageNo, + ...newFormData, + }); + if (code === 0) { + this.total = data.total || 0; + // this.tableData = data.list ? data.list.map((item) => { return item; }) : []; + } else { + this.$message.error(msg); + } + }, + async getCateOptions() { + const url = "/governance/icEvent/getCategoryTree"; + const { data, code, msg } = await requestPost(url, {}); + if (code === 0) { + this.cateOptions = this.deepTree(data, "children"); + } else { + this.$message.error(msg); + } + }, + + handleSizeChange(val) { + this.pageSize = val; + window.localStorage.setItem("pageSize", val); + this.getTableData(); + }, + handleCurrentChange(val) { + this.pageNo = val; + this.getTableData(); + }, + + + getOrgTreeList() { + this.$http + .post('/gov/org/customeragency/agencygridtree', {}) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('获取组织树成功', res.data) + this.orgOptions = [] + this.orgOptions.push(res.data) + } + }) + .catch(() => { + return this.$message.error('网络错误') + }) + }, + getGridList() { + this.$http + .post('/gov/org/customergrid/gridoption', { agencyId: this.agencyId, purpose: 'addorupdate' }) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('获取查询详情成功', res.data) + this.optionsG = res.data + } + }) + .catch(() => { + return this.$message.error('网络错误') + }) + }, + + + getLastItem(list, vals, key) { + let LIST = list || []; + for (let item of LIST) { + // console.log(item[key]); + for (let i of vals) { + if (item[key] === i) { + this.sarr.push(item); + } else { + this.getLastItem(item.subAgencyList, vals, key); + } + } + } + }, + + resetSearch() { + this.formData = { + agencyId: "", + gridId: "", + sourceType: "", + eventContent: "", + name: "", + mobile: "", + startTime: "", + endTime: "", + limitStartTime: "", + limitEndTime: "", + status: "", + firstIdList: [], + secondIdList: [], + }; + this.eventTypeCheck = []; + this.pageNo = 1; + this.getTableData(); + // this.loadTable() + }, + deepTree(arr, children) { + if (Array.isArray(arr) && arr.length > 0) { + return arr.map((item) => { + return { + ...item, + [children]: + (item[children] && + item[children].length > 0 && + this.deepTree(item[children], children)) || + null, + }; + }); + } + }, + showAwoList(row) { + this.$refs.awoList.open(row) + } + }, +}; +