From f1bd530bc3fcfc006426ebd2e79d0b09c31ba41f Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期二, 24 六月 2025 16:34:47 +0800 Subject: [PATCH] 1 --- src/views/hosp/advicerules/index.vue | 396 +++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 275 insertions(+), 121 deletions(-) diff --git a/src/views/hosp/advicerules/index.vue b/src/views/hosp/advicerules/index.vue index 8eeb164..b61755d 100644 --- a/src/views/hosp/advicerules/index.vue +++ b/src/views/hosp/advicerules/index.vue @@ -50,7 +50,6 @@ <el-col :span="1.5"> <el-button type="primary" - plain icon="el-icon-plus" size="mini" @click="handleAdd" @@ -60,8 +59,7 @@ </el-col> <el-col :span="1.5"> <el-button - type="success" - plain + type="primary" icon="el-icon-edit" size="mini" :disabled="single" @@ -72,8 +70,7 @@ </el-col> <el-col :span="1.5"> <el-button - type="danger" - plain + type="primary" icon="el-icon-delete" size="mini" :disabled="multiple" @@ -82,119 +79,147 @@ >鍒犻櫎 </el-button> </el-col> - <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-upload2" - size="mini" - @click="handleImport" - >瀵煎叆 + <!-- <el-col :span="1.5"> + <el-button type="primary" icon="el-icon-upload2" size="mini" @click="handleImport">瀵煎叆 </el-button> </el-col> <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-download" - size="mini" - @click="handleExport" - v-hasPermi="['hosp:advicerules:export']" - >瀵煎嚭 + <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport" + v-hasPermi="['hosp:advicerules:export']">瀵煎嚭 </el-button> - </el-col> - <right-toolbar + </el-col> --> + <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" - ></right-toolbar> + ></right-toolbar> --> </el-row> - <el-table - v-loading="loading" - :data="advicerulesList" - @selection-change="handleSelectionChange" - > - <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="搴忓彿" width="50" align="center"> - <template slot-scope="scope"> - {{ scope.$index + 1 }} - <!-- 浣跨敤 $index 鏉ユ樉绀哄簭鍙凤紝浠�1寮�濮� --> - </template> - </el-table-column> - <el-table-column label="缂栫爜" align="center" prop="bm" /> - <el-table-column label="绉戝" align="center" prop="ks" /> - <el-table-column label="妫�鏌ラ」鐩�" align="center" prop="jcxm" /> - <el-table-column - label="涓昏璇婃柇" - align="center" - :show-overflow-tooltip="true" - width="120" - prop="zyzd" - /> - <el-table-column - label="寤鸿鍚嶇О" - align="center" - :show-overflow-tooltip="true" - width="150" - prop="jymc" - /> - <el-table-column - label="寤鸿鍐呭" - align="center" - :show-overflow-tooltip="true" - width="200" - prop="jynr" - /> - <el-table-column label="鎬у埆" align="center" prop="xb" :formatter="formatSex" /> - <el-table-column label="鑼冨洿" align="center" prop="fwz" /> - <el-table-column label="鑼冨洿鏈�灏忓��" align="center" prop="fwzxz" /> - <el-table-column label="鑼冨洿鏈�澶у��" align="center" prop="fwzdz" /> - <el-table-column label="寮傚父鏍囧織" align="center" prop="ycbz" /> - <el-table-column label="鏄惁鐤剧梾" align="center" prop="sfjb"> - </el-table-column> - <el-table-column label="鏄惁甯歌鐥�" align="center" prop="sfcjb"> - </el-table-column> - <el-table-column label="鏄惁鎱㈡�х梾" align="center" prop="sfmxb"> - </el-table-column> - <el-table-column - label="鏄惁閲嶅ぇ鐤剧梾" - align="center" - width="120" - prop="sfzdjb" - ></el-table-column> - <el-table-column - label="鎿嶄綔" - align="center" - class-name="small-padding fixed-width" - > - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['hosp:advicerules:edit']" + <el-row :gutter="20" style="display: flex"> + <el-col :span="3" :xs="24"> + <div class="head-container"> + <el-input + v-model="xmmc" + placeholder="璇疯緭鍏ラ」鐩悕" + clearable + size="small" + prefix-icon="el-icon-search" + style="margin-bottom: 20px" + /> + </div> + <div class="scrollable-container"> + <div class="content"> + <el-tree + :data="deptOptions" + :props="defaultProps" + :expand-on-click-node="false" + :filter-node-method="filterNode" + ref="tree" + node-key="id" + :default-expanded-keys="treeId" + highlight-current + @node-click="handleNodeClick" + /> + </div> + </div> + </el-col> + <el-col :span="20" :xs="24"> + <el-table + v-loading="loading" + :data="advicerulesList" + @selection-change="handleSelectionChange" + height="520" + > + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="搴忓彿" width="50" align="center"> + <template slot-scope="scope"> + {{ scope.$index + 1 }} + <!-- 浣跨敤 $index 鏉ユ樉绀哄簭鍙凤紝浠�1寮�濮� --> + </template> + </el-table-column> + <el-table-column label="缂栫爜" align="center" prop="bm" /> + <el-table-column label="绉戝" align="center" prop="ks" /> + <el-table-column label="妫�鏌ラ」鐩�" align="center" prop="jcxm" /> + <el-table-column + label="涓昏璇婃柇" + align="center" + :show-overflow-tooltip="true" + width="120" + prop="zyzd" + /> + <el-table-column + label="寤鸿鍚嶇О" + align="center" + :show-overflow-tooltip="true" + width="150" + prop="jymc" + /> + <el-table-column + label="寤鸿鍐呭" + align="center" + :show-overflow-tooltip="true" + width="200" + prop="jynr" + /> + <el-table-column + label="鎬у埆" + align="center" + prop="xb" + :formatter="formatSex" + /> + <el-table-column label="鑼冨洿" align="center" prop="fwz" /> + <el-table-column label="鑼冨洿鏈�灏忓��" align="center" prop="fwzxz" /> + <el-table-column label="鑼冨洿鏈�澶у��" align="center" prop="fwzdz" /> + <el-table-column label="寮傚父鏍囧織" align="center" prop="ycbz" /> + <el-table-column label="鏄惁鐤剧梾" align="center" prop="sfjb"> + </el-table-column> + <el-table-column label="鏄惁甯歌鐥�" align="center" prop="sfcjb"> + </el-table-column> + <el-table-column label="鏄惁鎱㈡�х梾" align="center" prop="sfmxb"> + </el-table-column> + <el-table-column + label="鏄惁閲嶅ぇ鐤剧梾" + align="center" + width="120" + prop="sfzdjb" + ></el-table-column> + <el-table-column + label="鎿嶄綔" + align="center" + class-name="small-padding fixed-width" > - </el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['hosp:advicerules:remove']" - > - </el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total > 0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['hosp:advicerules:edit']" + > + </el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['hosp:advicerules:remove']" + > + </el-button> + </template> + </el-table-column> + </el-table> + <div class="pag"> + <div class="pag1"> + <pagination + v-show="total > 0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getListByXmId" + /> + </div> + </div> + </el-col> + </el-row> <!-- 娣诲姞鎴栦慨鏀逛綋妫�椤圭洰寤鸿瑙勫垯鏂拌〃瀵硅瘽妗� --> <el-dialog @@ -213,6 +238,7 @@ > <el-form-item label="绉戝" prop="ks"> <el-select + :rules="rules" v-model="form.ks" placeholder="璇烽�夋嫨绉戝" style="width: 200px" @@ -263,11 +289,24 @@ /> </el-form-item> <el-form-item label="寮傚父鏍囧織" prop="ycbz"> - <el-input + <!-- <el-input v-model="form.ycbz" style="width: 200px" placeholder="璇疯緭鍏ュ紓甯告爣蹇�" - /> + /> --> + <el-select + v-model="form.ycbz" + placeholder="璇烽�夋嫨寮傚父鏍囧織" + style="width: 200px" + clearable + > + <el-option + v-for="item in ycdata" + :key="item.value" + :label="item.label" + :value="item.label" + ></el-option> + </el-select> </el-form-item> <el-form-item label="鐤剧梾" prop="sfjb"> @@ -486,6 +525,7 @@ delAdvicerules, addAdvicerules, updateAdvicerules, + getTjProAdvicerulesKsList, } from "@/api/hosp/advicerules"; import { listAdvice } from "@/api/advice/advice"; import { getToken } from "@/utils/auth"; @@ -500,6 +540,22 @@ loading: true, // 閫変腑鏁扮粍 ids: [], + ycdata: [ + { label: "鈫�", value: "up" }, + { label: "鈫�", value: "down" }, + { label: "闃虫��", value: "positive" }, + { label: "寮遍槼鎬�", value: "weak_positive" }, + { label: "4+", value: "4plus" }, + { label: "3+", value: "3plus" }, + { label: "2+", value: "2plus" }, + { label: "1+", value: "1plus" }, + { label: "+1", value: "plus1" }, + { label: "+2", value: "plus2" }, + { label: "+3", value: "plus3" }, + { label: "+4", value: "plus4" }, + { label: "+", value: "plus" }, + { label: "+-", value: "plus_minus" }, + ], // 闈炲崟涓鐢� single: true, // 闈炲涓鐢� @@ -512,8 +568,11 @@ // 浣撴椤圭洰寤鸿瑙勫垯鏂拌〃琛ㄦ牸鏁版嵁 advicerulesList: [], adviceList: [], + deptOptions: [], + treeId: [], // 寮瑰嚭灞傛爣棰� title: "", + xmmc: "", // 鏄惁鏄剧ず寮瑰嚭灞� open: false, key: "", @@ -521,6 +580,10 @@ businessName: "exampleBusiness", // 绀轰緥涓氬姟鍚� objs: {}, departmentOptions: [], + defaultProps: { + children: "children", + label: "label", + }, // 鏌ヨ鍙傛暟 queryParams: { pageNum: 1, @@ -549,10 +612,12 @@ }, // 琛ㄥ崟鍙傛暟 form: { - xb: "2", + // xb: "2", }, // 琛ㄥ崟鏍¢獙 - rules: {}, + rules: { + ks: [{ required: true, message: " ", trigger: ["blur", "change"] }], + }, upload: { // 鏄惁鏄剧ず寮瑰嚭灞傦紙鐢ㄦ埛瀵煎叆锛� open: false, @@ -573,15 +638,81 @@ created() { this.getList(); }, + watch: { + // 鏍规嵁鍚嶇О绛涢�夐儴闂ㄦ爲 + xmmc(val) { + this.$refs.tree.filter(val); + }, + treeId(newVal, oldVal) { + if (newVal) { + this.$nextTick(() => { + const node = document.querySelector( + ".el-tree-node__children .el-tree-node__content" + ); + if (node) { + node.click(); + } else { + console.warn("娌℃湁鎵惧埌 el-tree 鑺傜偣锛屾棤娉曡Е鍙戠偣鍑�"); + } + }); + } + }, + }, methods: { /** 鏌ヨ浣撴椤圭洰寤鸿瑙勫垯鏂拌〃鍒楄〃 */ getList() { - this.loading = true; + /* this.loading = true; listAdvicerules(this.queryParams).then((response) => { this.advicerulesList = response.rows; this.total = response.total; this.loading = false; + }); */ + + getTjProAdvicerulesKsList().then((response) => { + this.deptOptions = response.data.map((name, index) => { + return { + id: index + 1, // 鍙嚜瀹氫箟鍞竴 ID + label: name, // el-tree 榛樿鐨勬樉绀哄瓧娈� + }; + }); + + // 璁剧疆榛樿灞曞紑椤� + this.treeId = [this.deptOptions[0]?.id]; + this.queryParams.proId = this.deptOptions[0]?.id; + this.getListByXmId(); }); + }, + getListByXmId() { + this.loading = true; + listAdvicerules(this.queryParams).then((response) => { + console.log(response,123456); + + response.rows.forEach((item, index) => { + item.newID = + (this.queryParams.pageNum - 1) * this.queryParams.pageSize + + index + + 1; + }); + this.advicerulesList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + handleNodeClick(data) { + this.formIn = data; + this.queryParams.ks = data.label; + this.getListByXmId(); + }, + + // 绛涢�夎妭鐐� + filterNode(value, data) { + if (!value) return true; + // return data.label.indexOf(value) !== -1; + return ( + data.label && + typeof data.label === "string" && + data.label.indexOf(value) !== -1 + ); }, idFn(value) { @@ -620,7 +751,7 @@ createBy: null, updateBy: null, deleted: null, - xb: "2", + // xb: "2", }; if (this.$refs.form) { this.$refs.form.resetFields(); @@ -629,7 +760,7 @@ /** 鎼滅储鎸夐挳鎿嶄綔 */ handleQuery() { this.queryParams.pageNum = 1; - this.getList(); + this.getListByXmId(); }, handlecharge() { this.querycharge.pageNum = 1; @@ -644,7 +775,7 @@ const dictItem = this.dict.type.sys_user_sex.find( (item) => item.value === row.xb ); - return dictItem ? dictItem.label : "鏈煡"; + return dictItem ? dictItem.label : ""; }, handleSelectionChange1(selection) { @@ -729,19 +860,18 @@ submitForm() { this.$refs["form"].validate((valid) => { if (valid) { + this.form.xb = this.form.xb === "1" ? "1" : null; if (this.form.id != null) { updateAdvicerules(this.form).then((response) => { - console.log(response, 1111333); - this.$modal.msgSuccess("淇敼鎴愬姛"); this.open = false; - this.getList(); + this.getListByXmId(); }); } else { addAdvicerules(this.form).then((response) => { this.$modal.msgSuccess("鏂板鎴愬姛"); this.open = false; - this.getList(); + this.getListByXmId(); }); } } @@ -820,4 +950,28 @@ }, }; </script> +<style scoped> +.scrollable-container { + width: 200px; + height: 520px; + overflow: auto; + border: 1px solid #ccc; + position: relative; +} +.content { + width: 1000px; + /* 璁剧疆鍐呭鐨勫搴︼紝浠ヨЕ鍙戞按骞虫粴鍔ㄦ潯 */ + height: 1000px; + /* 璁剧疆鍐呭鐨勯珮搴︼紝浠ヨЕ鍙戝瀭鐩存粴鍔ㄦ潯 */ +} +.pag { + width: 100%; + display: flex; + justify-content: center; +} + +.pag1 { + width: 65%; +} +</style> -- Gitblit v1.8.0