From e5fae45afc610c0cbc5620f2e9138e2188dcf243 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期四, 16 一月 2025 12:20:29 +0800 Subject: [PATCH] 资产管理权限、工单故障显示优化 --- src/views/system/contract/contract/index.vue | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 221 insertions(+), 8 deletions(-) diff --git a/src/views/system/contract/contract/index.vue b/src/views/system/contract/contract/index.vue index 3ad33e6..a62359a 100644 --- a/src/views/system/contract/contract/index.vue +++ b/src/views/system/contract/contract/index.vue @@ -23,7 +23,6 @@ </el-form-item> </el-form> - <el-row :gutter="10" class="mb8" style="margin-top: 10px"> <el-col :span="1.5"> <el-button @@ -88,8 +87,8 @@ :before-close="handleClose" size="40%"> <div style="margin-left: 20px;"> - <el-form :inline = "true" :model="form" class="table-expand" > - <el-form-item label="鍚堝悓鍚嶇О" prop="name" > + <el-form :inline="true" :model="form" class="table-expand"> + <el-form-item label="鍚堝悓鍚嶇О" prop="name"> <el-input v-model="form.name" style="width: 600px;"></el-input> </el-form-item> <el-form-item label="鍏徃鍚嶇О" prop="unitId"> @@ -171,13 +170,104 @@ </el-link > <div style="text-align: right; margin-top: 10px"> + <el-button type="primary" @click="handleImportRule">瀵煎叆瑙勫垯</el-button> <el-button type="primary" @click="submitForm">鎻愪氦</el-button> </div> </el-collapse> </el-form> </div> </el-drawer> + <!-- 瀵煎叆瑙勫垯瀵硅瘽妗� --> + <el-dialog + :title="importRule.title" + :visible.sync="importRule.open" + width="1000px" + append-to-body + > + <el-form ref="importRule" :model="importRule" :rules="importRuleRules" label-width="80px"> + <!-- <div class="row-right" style="margin-left: 80px">--> + <!-- <div class="margin-5">--> + <el-upload + ref="importRuleUpload" + :limit="1" + accept=".xlsx, .xls" + :headers="importRule.headers" + :action="importRule.url" + :disabled="importRule.isUploading" + :file-list="fileList" + :before-upload="beforeUpload" + drag + style="text-align: center" + > + <i class="el-icon-upload"></i> + <div class="el-upload__text"> + 灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em> + </div> + <div class="el-upload__tip text-center" slot="tip"> + <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span> + <el-link + type="primary" + :underline="false" + style="font-size: 0.7vw; vertical-align: baseline" + @click="importTemplate" + >涓嬭浇妯℃澘 + </el-link + > + </div> + </el-upload> + <!-- </div>--> + <!-- </div>--> + <el-divider content-position="left">鑰冩牳缁撴灉搴旂敤瑙勫垯</el-divider> + <div class="row-warp"> + <div + class="row" + v-for="(item, index) in importRule.ruleList" + :key="index" + > + <div class="row-left" style="flex: 0.7"> + <div class="block"> + <el-form-item label="鑰冩牳鏉′欢" prop="ruleList"> + <el-input + v-model="item.scoreCondition" + style="width: 250px" + /> + </el-form-item> + </div> + </div> + <div class="row-right"> + <div class="margin-5"> + <el-form-item label="瑙勫垯鎻忚堪" prop="ruleList"> + <el-input + type="textarea" + v-model="item.description" + style="width: 300px" + /> + <el-button + style="margin-left: 50px" + type="danger" + icon="el-icon-delete" + circle + @click="deleteImportRule(index)" + ></el-button> + </el-form-item> + </div> + </div> + </div> + </div> + <el-button + style="margin-left: 50px" + type="success" + icon="el-icon-plus" + circle + @click="addImportRule" + ></el-button> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="importRule.open = false">鍙� 娑�</el-button> + <el-button type="primary" @click="submitImportRule">纭� 瀹�</el-button> + </div> + </el-dialog> <!-- 鍚堝悓瀵煎叆瀵硅瘽妗� --> <el-dialog :title="upload.title" @@ -324,6 +414,7 @@ import {deptSelect} from "../../../../api/system/dept"; import {getToken} from "@/utils/auth"; import {ImagePreview} from "@/components/ImagePreview"; +import {importRule} from "../../../../api/platform/contract"; export default { name: "Contract", @@ -334,6 +425,7 @@ name: '', status: '' }, + fileList: [], drawer: false, direction: 'rtl', loading: false, @@ -355,6 +447,21 @@ startTime: "", endTime: "", }, + // 瑙勫垯瀵煎叆鍙傛暟 + importRule: { + // 鏄惁鏄剧ず寮瑰嚭灞傦紙鍚堝悓瀵煎叆锛� + open: false, + // 寮瑰嚭灞傛爣棰橈紙鍚堝悓瀵煎叆锛� + title: "", + // 鏄惁绂佺敤涓婁紶 + isUploading: false, + // 璁剧疆涓婁紶鐨勮姹傚ご閮� + headers: {Authorization: "Bearer " + getToken()}, + // 涓婁紶鐨勫湴鍧� + url: process.env.VUE_APP_BASE_API + "/system/contract/updateRule", + ruleList: [], + }, + dialogImageUrl: "", dialogVisible: false, disabled: false, @@ -416,6 +523,17 @@ }, ], }, + // 琛ㄥ崟鏍¢獙 + importRuleRules: { + ruleList: [ + { + type: "array", + required: true, + message: "鑰冩牳缁撴灉搴旂敤瑙勫垯涓嶈兘涓虹┖", + trigger: "submit", + }, + ], + }, }; }, created() { @@ -424,6 +542,11 @@ this.selectDept(); }, methods: { + beforeUpload(file) { + this.importRule.file = file + this.fileList = [file] + return false + }, handleClose(done) { this.$confirm('纭鍏抽棴锛�') .then(_ => { @@ -438,8 +561,17 @@ description: "", }); }, + addImportRule() { + this.importRule.ruleList.push({ + scoreCondition: "", + description: "", + }); + }, deleteRule(index) { this.upload.ruleList.splice(index, 1); + }, + deleteImportRule(index) { + this.importRule.ruleList.splice(index, 1); }, submitForm() { this.form.startTime = this.form.timezone[0] @@ -460,6 +592,12 @@ this.upload.title = "鍚堝悓瀵煎叆"; this.upload.open = true; }, + /** 瀵煎叆鎸夐挳鎿嶄綔 */ + handleImportRule() { + this.resetImportRule(); + this.importRule.title = "瑙勫垯瀵煎叆"; + this.importRule.open = true; + }, /** 涓嬭浇妯℃澘鎿嶄綔 */ importTemplate() { this.download("system/contract/importTemplate", {}, `鍚堝悓瀵煎叆妯℃澘.xlsx`); @@ -467,6 +605,22 @@ // 鏂囦欢涓婁紶涓鐞� handleFileUploadProgress(event, file, fileList) { this.upload.isUploading = true; + }, + // 鏂囦欢涓婁紶涓鐞� + handleRuleUploadProgress(event, file, fileList) { + this.importRule.isUploading = true; + }, + // 鏂囦欢涓婁紶鎴愬姛澶勭悊 + handleRuleSuccess(response, file, fileList) { + this.importRule.open = false; + this.importRule.isUploading = false; + this.$refs.importRule.clearFiles(); + if (response.code != 200) { + this.$message.warning(response.msg); + } else { + this.$message.success(response.msg); + } + this.getList(); }, // 鏂囦欢涓婁紶鎴愬姛澶勭悊 handleFileSuccess(response, file, fileList) { @@ -479,6 +633,27 @@ this.$message.success(response.msg); } this.getList(); + }, + // 鎻愪氦瀵煎叆瑙勫垯 + submitImportRule() { + let that = this; + that.importRule.id = this.form.id + that.importRule.ruleList = JSON.stringify(this.importRule.ruleList); + that.loading = true; + that.importRule.open = false; + const file = this.importRule.file; + let formData = new FormData() + if(file) { + formData.append("file", file) + } + formData.append('id', this.form.id); + formData.append('ruleList', this.importRule.ruleList); + importRule(formData).then(res => { + this.$message.success("瀵煎叆鎴愬姛") + that.loading = false; + that.getRuleListById(that.importRule.id) + }) + // that.resetImportRule(); }, // 鎻愪氦涓婁紶鏂囦欢 submitFileForm() { @@ -493,6 +668,20 @@ that.reset(); }); } + }); + }, + getRuleListById(id) { + getRuleListByContractId(id).then((response) => { + this.ruleData = response.data; + if (this.ruleData) { + this.ruleName = this.ruleData.map((item) => { + return item.ruleName; + }); + this.ruleName = [...new Set(this.ruleName)]; + } + }); + getMoneyRulesByContractId(id).then((response) => { + this.moneyRules = response.data; }); }, // 鏃堕棿閫夋嫨鍙戠敓鍙樺寲 @@ -554,8 +743,7 @@ }, /** 璇︽儏鎸夐挳鎿嶄綔 */ handleDetail(item) { - this.form = { - } + this.form = {} this.form.name = item.name this.form.unitId = item.unitId this.form.startTime = item.startTime @@ -581,13 +769,38 @@ handleDownload(data) { this.$download.resource(data); }, + resetImportRule() { + this.importRule = { + // 鏄惁鏄剧ず寮瑰嚭灞傦紙鍚堝悓瀵煎叆锛� + open: false, + // 寮瑰嚭灞傛爣棰橈紙鍚堝悓瀵煎叆锛� + title: "", + // 鏄惁绂佺敤涓婁紶 + isUploading: false, + // 璁剧疆涓婁紶鐨勮姹傚ご閮� + headers: {Authorization: "Bearer " + getToken()}, + // 涓婁紶鐨勫湴鍧� + url: process.env.VUE_APP_BASE_API + "/system/contract/updateRule", + ruleList: [], + }; + this.resetForm("importRule"); + }, reset() { this.upload = { + // 鏄惁鏄剧ず寮瑰嚭灞傦紙鍚堝悓瀵煎叆锛� open: false, - name: undefined, - unitId: undefined, - timezone: undefined, + // 寮瑰嚭灞傛爣棰橈紙鍚堝悓瀵煎叆锛� + title: "", + // 鏄惁绂佺敤涓婁紶 + isUploading: false, + // 璁剧疆涓婁紶鐨勮姹傚ご閮� + headers: {Authorization: "Bearer " + getToken()}, + // 涓婁紶鐨勫湴鍧� + url: process.env.VUE_APP_BASE_API + "/system/contract/importData", ruleList: [], + unitId: "", + startTime: "", + endTime: "", }; this.resetForm("form"); }, -- Gitblit v1.8.0