From 83547aa105bdd175994cb3a40ef0b7d42228f0e5 Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期三, 04 六月 2025 17:21:09 +0800 Subject: [PATCH] 1 --- src/components/public/index.vue | 126 ++++++++++++++++++++++++++++++++---------- 1 files changed, 96 insertions(+), 30 deletions(-) diff --git a/src/components/public/index.vue b/src/components/public/index.vue index 036a5b3..edf5d28 100644 --- a/src/components/public/index.vue +++ b/src/components/public/index.vue @@ -1,15 +1,26 @@ <template> <div> - <el-dialog :title="title" :visible.sync="open" width="1080px" append-to-body> + <el-dialog + :title="title" + :visible.sync="open" + width="1080px" + append-to-body + > <h3 v-if="fList.proResult">妫�娴嬮」鐩� :{{ fList.project.proName }}</h3> <h3 v-if="fList.proResult"> 妫�娴嬬粨鏋� :{{ fList.proResult }}{{ fList.project.proMetering }} </h3> - <h2 style="text-align: center;">{{ proName || '鏆傛棤椤圭洰鍚嶇О' }}</h2> + <h2 style="text-align: center">{{ proName || "鏆傛棤椤圭洰鍚嶇О" }}</h2> <div style="display: flex; width: 100%"> <div style="width: 50%; margin-right: 40px"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px"> + <el-form + :model="queryParams" + ref="queryForm" + size="small" + :inline="true" + label-width="68px" + > <!-- <el-form-item label="鐥呯鍚嶇О" prop="bingzhong"> <el-input v-model="queryParams.bingzhong" @@ -20,11 +31,22 @@ /> </el-form-item>--> <el-form-item label="妫�鏌ョ粨璁�" prop="ruleStr"> - <el-input v-model="queryParams.ruleStr" placeholder="璇疯緭鍏ユ鏌ョ粨璁�" clearable @keyup.enter.native="getList" - style="width: 130px" /> + <el-input + v-model="queryParams.ruleStr" + placeholder="璇疯緭鍏ユ鏌ョ粨璁�" + clearable + @keyup.enter.native="getList" + style="width: 130px" + /> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="getList">鎼滅储</el-button> + <el-button + type="primary" + icon="el-icon-search" + size="mini" + @click="getList" + >鎼滅储</el-button + > </el-form-item> <!-- <el-form-item> <h3 >{{ queryParams.proName || '鏆傛棤椤圭洰鍚嶇О' }}</h3> @@ -33,25 +55,48 @@ <h3 style="margin-left: 160px">宸查�夐」鐩�</h3> </el-form-item> --> </el-form> - <el-table :data="dataList" ref="multipleTable" v-loading="loading" @selection-change="handleSelectionChange" - border height="480px"> + <el-table + :data="dataList" + ref="multipleTable" + v-loading="loading" + @selection-change="handleSelectionChange" + border + height="480px" + > <el-table-column type="selection" width="40" align="center" /> - <el-table-column label="搴忓彿" type="index" align="center" width="50px" /> + <el-table-column + label="搴忓彿" + type="index" + align="center" + width="50px" + /> <!-- <el-table-column label="瑙勫垯" align="center" prop="ruleStr" /> --> <el-table-column label="妫�鏌ユ墍瑙�" align="center" prop="yxbx" /> <el-table-column label="妫�鏌ョ粨璁�" align="center" prop="ruleStr" /> </el-table> <div class="pag"> <div class="pag1" style="margin-left: 630px"> - <pagination small v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" @pagination="getList" /> + <pagination + small + v-show="total > 0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> </div> </div> </div> <div class="jianc"> <!-- <h3 style="margin-top: -30px;">宸查�夐」鐩�</h3> --> - <el-form :model="form" ref="queryForm" size="small" label-width="68px" :label-position="labelPosition"> + <el-form + :model="form" + ref="queryForm" + size="small" + label-width="68px" + :label-position="labelPosition" + > <!-- :inline="true" --> <!-- <el-form-item> <el-input @@ -61,10 +106,22 @@ ></el-input> </el-form-item> --> <el-form-item label="妫�鏌ユ墍瑙�" prop="jcsj"> - <el-input v-model="form.jcsj" clearable type="textarea" :autosize="{ minRows: 7 }" style="width: 380px" /> + <el-input + v-model="form.jcsj" + clearable + type="textarea" + :autosize="{ minRows: 7 }" + style="width: 380px" + /> </el-form-item> <el-form-item label="妫�鏌ョ粨璁�" prop="desc"> - <el-input v-model="form.desc" clearable type="textarea" :autosize="{ minRows: 7 }" style="width: 380px" /> + <el-input + v-model="form.desc" + clearable + type="textarea" + :autosize="{ minRows: 7 }" + style="width: 380px" + /> </el-form-item> </el-form> </div> @@ -109,7 +166,7 @@ // 寮瑰嚭灞傛爣棰� title: "", yxbx: "", - proName: '', + proName: "", // lastDesc: "", total: 0, dataList: [], @@ -132,7 +189,7 @@ }, watch: { checkStatus(newValue) { - console.log(565658) + console.log(565658); if (newValue === "1") { this.updateData(this.proResult, this.conclusion); } @@ -147,14 +204,14 @@ const firstProject = newVal[0]; // 浣犱篃鍙互閬嶅巻鎵�鏈夐」鐩紝鐪嬩綘涓氬姟闇�姹� this.queryParams.proId = firstProject.proId; // 鍋囪椤圭洰涓彨 id //this.queryParams.proName = firstProject.proName; // 鍋囪鍙� proName - this.proName = firstProject.proName + this.proName = firstProject.proName; } }, }, }, - mounted() { }, + mounted() {}, - created() { }, + created() {}, methods: { async getList() { try { @@ -201,9 +258,8 @@ }, updateData(proResult, conclusion) { - console.log(proResult, conclusion, 5658) + console.log(proResult, conclusion, 5658); if (this.checkStatus == 1) { - this.form.jcsj = proResult; // 鏇存柊妫�鏌ユ墍瑙� this.form.desc = conclusion; // 鏇存柊妫�鏌ョ粨璁� } else { @@ -212,12 +268,12 @@ } if (this.list.length != 0) { - let desc = "" + let desc = ""; desc += this.list .map((item) => item.bingzhong || item.ruleStr) .filter(Boolean) .join(","); - let jcsj = "" + let jcsj = ""; jcsj += this.list .map((item) => item.yxbx) .filter(Boolean) @@ -258,12 +314,22 @@ }, handleOk() { - const jcsjTrim = this.form.jcsj?.trim(); - const descTrim = this.form.desc?.trim(); - - if (!jcsjTrim || !descTrim) { - this.$message.warning("妫�鏌ユ墍瑙佸拰妫�鏌ョ粨璁轰笉鑳戒负绌�"); + if (!this.form.desc && !this.form.jcsj) { + this.$message.warning("璇烽�夋嫨鏁版嵁"); return; + } else { + const desc = this.form.desc?.trim(); + const jcsj = this.form.jcsj?.trim(); + + // 濡傛灉娌℃湁閫変腑琛ㄦ牸椤� + if (!this.list || this.list.length === 0) { + if (!desc && !jcsj) { + this.$message.warning( + "璇峰~鍐欐湁鏁堢殑妫�鏌ユ墍瑙佸拰妫�鏌ョ粨璁猴紝鎴栭�夋嫨琛ㄦ牸鏁版嵁" + ); + return; + } + } } try { @@ -286,7 +352,7 @@ }, callcolos() { this.open = false; - } + }, }, computed: { isCheckMode() { @@ -318,6 +384,6 @@ .jianc { width: 100%; height: 600px; - padding-top: 40px + padding-top: 40px; } </style> \ No newline at end of file -- Gitblit v1.8.0