From 4641a877cd6a94e4d35dca7f7f14bc1443e2d2ad Mon Sep 17 00:00:00 2001 From: luobisheng <727299681@qq.com> Date: 星期二, 29 十一月 2022 17:59:55 +0800 Subject: [PATCH] 上传处置类型修改 --- src/views/systemSetting/platform/cockpitManage/index.vue | 186 +++++++++++++++++++--------------------------- 1 files changed, 76 insertions(+), 110 deletions(-) diff --git a/src/views/systemSetting/platform/cockpitManage/index.vue b/src/views/systemSetting/platform/cockpitManage/index.vue index 1777883..64dc551 100644 --- a/src/views/systemSetting/platform/cockpitManage/index.vue +++ b/src/views/systemSetting/platform/cockpitManage/index.vue @@ -12,11 +12,13 @@ <div class="search-item"> <span>鐘舵��:</span> <div class="option"> - <el-input v-model="searchStatus" placeholder="閫夋嫨鐘舵��"></el-input> + <el-select v-model="searchStatus" placeholder="閫夋嫨鐘舵��"> + <el-option v-for="{ label, value } in statusOptions" :key="value" :label="label" :value="value"></el-option> + </el-select> </div> </div> <div class="findBtn"> - <el-button type="primary" @click="getUserList">鏌ヨ</el-button> + <el-button type="primary" @click="getDepartmentList">鏌ヨ</el-button> </div> </div> </div> @@ -25,17 +27,16 @@ <div class="mainContent"> <div class="type-nav"> <el-upload - class="upload-demo" action="" + ref="uploadFile" :http-request="importTable" :show-file-list="false" :auto-upload="true" - multiple :limit="1"> <el-button type="primary">瀵煎叆</el-button> </el-upload> - <el-button type="primary" @click="exportTable">瀵煎嚭</el-button> - <el-button type="primary" @click="showAddDialog">娣诲姞</el-button> + <el-button style="margin-left: 10px" type="primary" @click="exportTable">瀵煎嚭</el-button> + <el-button class="button-addition" type="primary" @click="showAddDialog">娣诲姞</el-button> </div> <!-- 鏁版嵁灞曠ず --> <el-table ref="multipleTable" @@ -67,6 +68,9 @@ <el-table-column prop="reviewOrLawsuitNumber" label="澶嶈鎴栬瘔璁兼暟" min-width="15" v-if="mystatus === 1"> </el-table-column> <el-table-column prop="status" label="鐘舵��" min-width="15" v-if="mystatus === 1"> + <template slot-scope="scope"> + <span>{{scope.row. status=== 1? '鍚姩' : '绂佺敤'}}</span> + </template> </el-table-column> <el-table-column prop="operation" label="鎿嶄綔" min-width="15"> <template slot-scope="scope"> @@ -79,25 +83,30 @@ </el-table-column> </el-table> <!-- 璇︽儏椤靛睍绀� --> - <el-dialog :visible.sync="dialogView" width="80%" title="鍩虹淇℃伅(浜哄伐)" v-if="dialogView" + <el-dialog :visible.sync="dialogView" width="80%" title="鍩虹淇℃伅(浜哄伐)" :before-close="handleClose"> <MyDetail :info=info v-if="mystatus === 1"></MyDetail> <MyIllDetail :info=info v-else></MyIllDetail> </el-dialog> - <el-dialog :visible.sync="dialogUpdate" width="40%" title="淇敼閮ㄩ棬" v-if="dialogUpdate" + <el-dialog :visible.sync="dialogUpdate" width="40%" title="淇敼閮ㄩ棬" :before-close="handleClose"> - <updateUser @closeUpdateDialog="closeUpdateDialog()" :updateDepartmentData="updateDepartmentData" /> - + <update-user @closeUpdateDialog="closeUpdateDialog()" + :updateDepartmentData="updateDepartmentData" + :isUpdate="dialogType === 'update'" + /> </el-dialog> - <el-dialog :visible.sync="dialogcheck" width="40%" title="鏌ョ湅" v-if="dialogcheck" + <el-dialog :visible.sync="dialogcheck" width="40%" title="鏌ョ湅" :before-close="handleClose" > <detailUser /> </el-dialog> - <el-dialog :visible.sync="dialogAdd" width="40%" title="娣诲姞閮ㄩ棬" v-if="dialogAdd" + <el-dialog :visible.sync="dialogAdd" width="40%" title="娣诲姞閮ㄩ棬" :before-close="handleClose"> - <createUser @closeUpdateDialog="closeUpdateDialog()" /> + <update-user @closeUpdateDialog="closeUpdateDialog()" + :updateDepartmentData="updateDepartmentData" + :isUpdate="dialogType === 'add'" + /> </el-dialog> <div class="tools"> @@ -118,8 +127,7 @@ </div> <div class="pagination"> <el-pagination background :current-page="currentPage" layout="prev, pager, next" - :total="totalNum" :page-size="pageSize" @current-change="changeCurrentPage" - @prev-click="handlePrev" @next-click="handleNext"> + :total="totalNum" :page-size="pageSize" @current-change="changeCurrentPage"> </el-pagination> </div> </div> @@ -128,23 +136,20 @@ </div> </template> <script> -import createUser from "./createUser"; import updateUser from "./updateUser"; import detailUser from "./detailUser"; import { deleteTeam, exportTeamInfo, importTeamInfo, searchTeamInfo } from "@/api/system/portal/teamConstruction"; -import {SUCCESS_CODE} from "@/utils"; +import { SUCCESS_CODE } from "@/utils"; +import {downloadFile} from "@/utils/helper"; export default { - components: { - updateUser, createUser, detailUser - }, + components: { updateUser, detailUser }, data() { return { updateDepartmentData: null, - searchDepartment: '', - searchStatus: '', - tableFile: null, + searchDepartment: null, + searchStatus: null, dialogUpdate: false, dialogcheck: false, tableData: [], @@ -154,13 +159,28 @@ updateFlag: false, userInfo: {}, info: {}, - totalNum: 5, + totalNum: 1, pageSize: 10, currentPage: 1, all: false, unsame: false, myIdx: 0, preMyIdx: 0, + file: null, + statusOptions: [ + { + value: 2, + label: '鍏ㄩ儴' + }, + { + value: 1, + label: '鍚敤' + }, + { + value: 0, + label: '绂佺敤' + } + ], options: [ { value: 0, @@ -198,6 +218,7 @@ caseId: '', caseCode: null, dialogAdd: false, + dialogType: 'update' } }, @@ -207,8 +228,8 @@ if (item.checked) { this.statusArr[1] = item.value; } - }) - this.getUserList(); + }); + this.getDepartmentList(); }, methods: { @@ -219,34 +240,19 @@ this.updateDepartmentData = data; }, - // 鏌ョ湅 - showViewDialog() { - this.dialogcheck = true; - }, - // 娣诲姞鐣岄潰 showAddDialog() { this.dialogAdd = true; + this.dialogType = 'add'; }, // 瀵煎嚭 exportTable() { - exportTeamInfo({ current: this.currentPage, size: this.pageSize, departName: this.searchDepartment, status: this.searchStatus }) + const status = this.searchStatus === 2 ? null : this.searchStatus; + exportTeamInfo({ current: this.currentPage, size: this.pageSize, departName: this.searchDepartment, status }) .then(res => { - const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }); - const fileName = res.contentDisposition.split('=')[1]; - if (window.navigator && window.navigator.msSaveBlob) { - navigator.msSaveBlob(blob, fileName); - } else { - const link = document.createElement('a'); - link.style.display = 'none'; - link.href = URL.createObjectURL(blob); - link.setAttribute('download', decodeURI(fileName)); - document.body.appendChild(link); - link.click(); - URL.revokeObjectURL(link.href); - document.body.removeChild(link); - } + downloadFile(res); + this.$message({ type: 'success', message: '鎿嶄綔鎴愬姛' }); }) .catch(err => { this.$message({ type: 'error', message: err }); @@ -255,31 +261,31 @@ // 瀵煎叆 importTable(file) { - importTeamInfo({'multipartFile': file.file}) - .then(({ code, message }) => { - if (code === SUCCESS_CODE) { - this.$message({ type: 'success', message }); - this.getUserList(); - } else { - this.$message({ type: 'error', message }); - } + const formData = new FormData(); + formData.append('file', file.file); + importTeamInfo(formData) + .then(() => { + this.$message({ type: 'success', message: '鎿嶄綔鎴愬姛' }); + this.getDepartmentList(); + this.$refs.uploadFile.clearFiles(); }) .catch(err => { this.$message({ type: 'error', message: err }); + this.$refs.uploadFile.clearFiles(); }); }, closeUpdateDialog() { this.dialogAdd = false; this.dialogUpdate = false; - this.getUserList(); + this.getDepartmentList(); }, // 椤堕儴涓嬫媺妗� - setMystatus(value) { + setMyStatus(value) { this.statusArr[1] = value; this.changeTypeChecked(value - 1); - this.getUserList(); + this.getDepartmentList(); }, // 鎵归噺鍒犻櫎 @@ -288,7 +294,7 @@ method: 'delete', url: 'sccg/violations/batch_delete?ids=' + idArr, }).then(res => { - this.getUserList(); + this.getDepartmentList(); this.$message({ message: res.message, type: res.code === 200 ? 'success' : 'warning' @@ -341,7 +347,7 @@ .then(({ code, message }) => { if (code === SUCCESS_CODE) { this.$message({ type: 'success', message }); - this.getUserList(); + this.getDepartmentList(); } else { this.$message({ type: 'error', message }); } @@ -353,17 +359,18 @@ }, // 鑾峰彇鐢ㄦ埛鍒楄〃 - getUserList() { + getDepartmentList() { + const status = this.searchStatus === 2 ? null : this.searchStatus; const searchInfo = { - current: this.currentPage, size: this.pageSize, departName: this.searchDepartment, status: this.searchStatus + current: this.currentPage, size: this.pageSize, departName: this.searchDepartment, status }; searchTeamInfo(searchInfo) - .then(({ data }) => { - this.tableData = data.records; - this.totalNum = data.total; + .then(({ records, total }) => { + this.tableData = records; + this.totalNum = total; }) .catch(err => { - console.log(err); + this.$message({ type: 'error', message: err }); }); }, @@ -374,7 +381,7 @@ }) this.mystatus = idx + 1; this.statusArr[1] = this.typeList[idx].value; - this.getUserList(); + this.getDepartmentList(); }, // 璁剧疆琛ㄦ牸鏂戦┈绾� @@ -389,19 +396,7 @@ // 褰撳墠椤垫敼鍙樿Е鍙戜簨浠� changeCurrentPage(page) { this.currentPage = page; - this.getUserList(); - }, - - // 涓婁竴椤电偣鍑讳簨浠� - handlePrev(page) { - this.currentPage = page; - this.getUserList(); - }, - - // 涓嬩竴椤电偣鍑讳簨浠� - handleNext(page) { - this.currentPage = page; - this.getUserList(); + this.getDepartmentList(); }, handleClose(done) { @@ -438,12 +433,7 @@ // 鍏抽棴涓婁紶鐣岄潰 closeDialog({ flag }) { this.dialogUpload = flag; - this.getUserList(); - }, - - // 澶勭悊鏃堕棿 - filterTime(time) { - return helper(time); + this.getDepartmentList(); } } } @@ -494,13 +484,6 @@ border-radius: 20px; } } - - .addBtn { - background-color: #eb5d01; - border: none; - border-radius: 20px; - padding: 12px 30px; - } } } @@ -521,24 +504,7 @@ .type-nav { display: flex; line-height: 40px; - margin-left: 30px; - padding-top: 10px; - margin-bottom: 10px; - - .type-item { - width: 80px; - text-align: center; - - &:hover { - cursor: pointer; - } - } - - .is-active { - background-color: #070f22; - border-radius: 4px; - color: #fff; - } + align-items: center; } .tools { -- Gitblit v1.8.0