From 64baa332eadfa521d6f8446fcd6053d1b1b69732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=BF=94=E5=AE=87-=E6=97=85=E7=AE=A1=E5=AE=B6?= <153298343@qq.com> Date: Mon, 18 Apr 2022 20:31:29 +0800 Subject: [PATCH] up --- src/api/common.js | 22 ++ src/views/accident/index.vue | 85 +++++-- src/views/daily/deptindex.vue | 15 +- src/views/system/user.vue | 25 +- src/views/training/index.vue | 416 +++++++++++++++++++++++++++++++++- 5 files changed, 517 insertions(+), 46 deletions(-) create mode 100644 src/api/common.js diff --git a/src/api/common.js b/src/api/common.js new file mode 100644 index 0000000..cbeb700 --- /dev/null +++ b/src/api/common.js @@ -0,0 +1,22 @@ +import request from '@/utils/request' + + + + + +export function listCommondepartment(params) { + return request({ + url: '/api/admin/other/admin-department-list', + method: 'get', + params:params + }) +} + + +export function listCommonuser(params) { + return request({ + url: '/api/admin/other/admin-user-list', + method: 'get', + params:params + }) +} diff --git a/src/views/accident/index.vue b/src/views/accident/index.vue index f2046e3..4da907c 100644 --- a/src/views/accident/index.vue +++ b/src/views/accident/index.vue @@ -156,7 +156,7 @@ + :on-exceed="handleExceed" :file-list="fileList.unit_overview_files"> 点击上传 @@ -168,7 +168,7 @@ + :on-exceed="handleExceed" :file-list="fileList.scene_condition_files"> 点击上传 @@ -180,7 +180,7 @@ + :on-exceed="handleExceed" :file-list="fileList.consequence_file"> 点击上传 @@ -191,7 +191,7 @@ + :on-exceed="handleExceed" :file-list="fileList.measure_file"> 点击上传 @@ -201,7 +201,7 @@ + :on-exceed="handleExceed" :file-list="fileList.other_file"> 点击上传 @@ -289,11 +289,11 @@ other_file_list: [], }, fileList: { - unit_overview_files_list: [], - scene_condition_files_list: [], - consequence_file_list: [], - measure_file_list: [], - other_file_list: [] + unit_overview_files: [], + scene_condition_files: [], + consequence_file: [], + measure_file: [], + other_file: [] }, tableData: [], rules: { @@ -497,15 +497,39 @@ that.form = result; that.form.type = parseInt(result.type); + + Object.keys(this.fileList).map(key => { + if (result[key].length != 0) { + let _files = []; + for (var mod of result[key]) { + let m = Object.assign({}, mod.files); + m.name = mod.files.original_name; + _files.push(m); + m.touploadType = key; + that.all_files.push(m); + } + that.fileList[key] = _files; + + } + + }) + + }).catch(error => { //reject(error) }) }, edit(obj) { + var that = this; this.form = this.$options.data().form; + that.fileList.consequence_file = []; + that.fileList.measure_file = []; + that.fileList.other_file = []; + that.fileList.scene_condition_files = []; + that.fileList.unit_overview_files = []; this.clientHeight = document.documentElement.clientHeight - 84 - 110; if (obj) { - var that = this; + that.info(obj); } else {} this.dialogFormVisible = true; @@ -536,11 +560,11 @@ //reject(error) }) } - that.fileList.consequence_file_list = []; - that.fileList.measure_file_list = []; - that.fileList.other_file_list = []; - that.fileList.scene_condition_files_list = []; - that.fileList.unit_overview_files_list = []; + that.fileList.consequence_file = []; + that.fileList.measure_file = []; + that.fileList.other_file = []; + that.fileList.scene_condition_files = []; + that.fileList.unit_overview_files = []; } else { this.$Message.error('数据校验失败'); console.log('error submit!!'); @@ -552,13 +576,20 @@ var _touploadType = this.all_files.filter((x) => { return x.uid == file.uid; })[0].touploadType; - console.log(_touploadType) + console.log(_touploadType); + var type = 1; let listUrl = []; for (var m of fileList) { if (m.response) - listUrl.push(m.response.id); + listUrl.push({ + upload_id: m.response.id, + type: type + }); else - listUrl.push(m.id); + listUrl.push({ + upload_id: m.id, + type: type + }); } this.form[_touploadType] = listUrl; }, @@ -569,11 +600,23 @@ handlesuccess(response, file, fileList) { //console.log(response,file,fileList); let listUrl = []; + var type = 1; + + Object.keys(this.fileList).map((key, index) => { + if (this.touploadType == key) + type = index + 1 + }) for (var m of fileList) { if (m.response) - listUrl.push(m.response.id); + listUrl.push({ + upload_id: m.response.id, + type: type + }); else - listUrl.push(m.id); + listUrl.push({ + upload_id: m.id, + type: type + }); } file.touploadType = this.touploadType; this.all_files.push(file); diff --git a/src/views/daily/deptindex.vue b/src/views/daily/deptindex.vue index 8eb8008..06b0b0d 100644 --- a/src/views/daily/deptindex.vue +++ b/src/views/daily/deptindex.vue @@ -68,12 +68,8 @@ del, get, listtask - } from "../../api/daily/index.js"; - import { - listdept - } from "../../api/system/department.js" export default { components: { LxHeader, @@ -167,21 +163,11 @@ }, created() { this.uploadOther.token = getToken(); - this.loadDeptOptions(); this.initLoad(); this.load(); }, methods: { - loadDeptOptions() { - listdept(). - then((res) => { - this.deptOptions = res; - }).catch(error => { - console.log(error) - reject(error) - }) - }, handleCheckAllChange(val) { console.log(val) let options = []; @@ -213,6 +199,7 @@ listtask({ page: this.paginations.page, page_size: this.paginations.page_size, + show_self: 1 }).then(response => { this.tableData = response.data; diff --git a/src/views/system/user.vue b/src/views/system/user.vue index 289ae53..952d04e 100644 --- a/src/views/system/user.vue +++ b/src/views/system/user.vue @@ -61,6 +61,12 @@ + + + + + +