From eb641af2646e8d20efb67bf27545bcecc5a7b821 Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期五, 13 十二月 2024 13:51:59 +0800 Subject: [PATCH] 搜索 --- src/views/advice/advice/index.vue | 86 +++++++++++++++++++++++++++++-------------- 1 files changed, 58 insertions(+), 28 deletions(-) diff --git a/src/views/advice/advice/index.vue b/src/views/advice/advice/index.vue index 3b9dd6e..d739abe 100644 --- a/src/views/advice/advice/index.vue +++ b/src/views/advice/advice/index.vue @@ -91,7 +91,6 @@ align="center" prop="newID" width="55px" - fixed /> <el-table-column label="鎵�閫夐」鐩�" @@ -155,7 +154,7 @@ </div> <!-- 娣诲姞鎴栦慨鏀筧dvice瀵硅瘽妗� --> - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body> <el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form-item label="妫�鏌ラ」鐩�" prop="proName"> <el-select @@ -166,8 +165,24 @@ clearable > <el-option - v-for="dict in projectList" - :key="dict.proName" + v-for="(dict,index) in projectList" + :key="index" + :label="dict.proName" + :value="dict.proId" + /> + </el-select> + </el-form-item> + <el-form-item label="閫夋嫨绉戝"> + <el-select + v-model="form.proId" + placeholder="璇烽�夋嫨绉戝" + filterable + style="width: 240px" + clearable + > + <el-option + v-for="(dict,index) in projectList" + :key="index" :label="dict.proName" :value="dict.proId" /> @@ -184,9 +199,9 @@ > 蹇嵎鏍囩 </span> - <el-checkbox-group v-model="form.kjbq"> + <el-checkbox-group v-model="kjbq" @change="handleCheckedCitiesChange"> <el-checkbox - v-for="(item, index) in dataList" + v-for="(item,index) in dataList" :key="index" :label="item.id" >{{ item.kjbq }}</el-checkbox @@ -210,7 +225,7 @@ <el-dialog title="娣诲姞蹇嵎鏍囩" :visible.sync="kjbqopen" width="500px" append-to-body> <el-form ref="form" :model="form" label-width="80px"> <el-form-item label="鍚嶇О" prop="kjbq"> - <el-input v-model="form.kjbq" placeholder="璇疯緭鍏ュ悕绉�" /> + <el-input v-model="formss.kjbq" placeholder="璇疯緭鍏ュ悕绉�" /> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> @@ -264,6 +279,7 @@ // advice琛ㄦ牸鏁版嵁 adviceList: [], dataList: [], + kjbq:[], // 寮瑰嚭灞傛爣棰� title: "", // 鏄惁鏄剧ず寮瑰嚭灞� @@ -277,7 +293,9 @@ }, // 琛ㄥ崟鍙傛暟 form: { - kjbq:[], + }, + formss:{ + }, // 琛ㄥ崟鏍¢獙 rules: { @@ -287,7 +305,7 @@ }, created() { this.getList(); - this.getlistProject(); + }, methods: { /** 鏌ヨadvice鍒楄〃 */ @@ -310,7 +328,23 @@ }, getlistProject() { listProject(this.queryParams).then((response) => { - this.projectList = response.data; + if(response.data){ + this.projectList = response.data; + } + }); + getInfo().then((res) => { + this.formss.userId = res.user.userId; + let data = { + pageNum: 1, + pageSize: 10, + userId: res.user.userId, + qyzt: 0, + }; + getTjAdviceKjbqByFl(data).then((res) => { + if (res.data) { + this.dataList = res.data.records; + } + }); }); }, // 鍙栨秷鎸夐挳 @@ -354,28 +388,21 @@ handleAdd() { this.reset(); this.title = "浣撴寤鸿淇℃伅缁存姢"; - getInfo().then((res) => { - let data = { - pageNum: 1, - pageSize: 10, - userId: res.user.userId, - qyzt: 0, - }; - getTjAdviceKjbqByFl(data).then((res) => { - if (res.data) { - this.dataList = res.data.records; + this.getlistProject(); this.open = true; - console.log(this.dataList ) - } - }); - }); + }, /** 淇敼鎸夐挳鎿嶄綔 */ handleUpdate(row) { this.reset(); const id = row.id || this.ids; + this.kjbq = [] getAdvice(id).then((response) => { this.form = response.data; + if(response.data.kjbqz != null){ + this.kjbq = response.data.kjbqz.map(Number) + } + this.getlistProject(); this.open = true; this.title = "浣撴寤鸿淇℃伅缁存姢"; }); @@ -384,32 +411,35 @@ this.$refs["form"].validate((valid) => { if (valid) { if (this.form.id != null) { - updateTjAdviceKjbq(this.form).then((response) => { + updateTjAdviceKjbq(this.formss).then((response) => { this.$modal.msgSuccess("淇敼鎴愬姛"); this.kjbqopen = false; - this.getList(); + this.getlistProject(); }); } else { - addTjAdviceKjbq(this.form).then((response) => { + addTjAdviceKjbq(this.formss).then((response) => { this.$modal.msgSuccess("鏂板鎴愬姛"); this.kjbqopen = false; - this.getList(); + this.getlistProject(); }); } } }); }, + handleCheckedCitiesChange(val) {}, /** 鎻愪氦鎸夐挳 */ submitForm() { this.$refs["form"].validate((valid) => { if (valid) { if (this.form.id != null) { + this.form.kjbq = this.kjbq.toString() updateAdvice(this.form).then((response) => { this.$modal.msgSuccess("淇敼鎴愬姛"); this.open = false; this.getList(); }); } else { + this.form.kjbq = this.kjbq.toString() addAdvice(this.form).then((response) => { this.$modal.msgSuccess("鏂板鎴愬姛"); this.open = false; -- Gitblit v1.8.0