From 76af820e2e11366b322705b51c351ace3d40608a Mon Sep 17 00:00:00 2001 From: qx <1084500556@qq.com> Date: 星期二, 01 七月 2025 16:46:04 +0800 Subject: [PATCH] Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb_region --- src/views/hosp/biaoben/index.vue | 526 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 420 insertions(+), 106 deletions(-) diff --git a/src/views/hosp/biaoben/index.vue b/src/views/hosp/biaoben/index.vue index aacb526..4b0f0f1 100644 --- a/src/views/hosp/biaoben/index.vue +++ b/src/views/hosp/biaoben/index.vue @@ -1,123 +1,437 @@ <template> - <div class="app-container"> - - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px"> - <el-form-item label="椤圭洰鍚嶇О" prop="tjh"> - <el-input v-model="queryParams.tjh" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable /> - </el-form-item> - <el-form-item> - <el-button type="primary" size="mini" @click="handleManual">鏌ヨ</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> + <div class="app-container"> + <el-row :gutter="24"> + <!-- 绗竴鍒楋細鍗曢�夋爣鏈� --> + <el-col :span="6" :xs="24"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px" + style="height: 45px" @submit.native.prevent> + <el-form-item label="椤圭洰鍚嶇О" prop="tjh"> + <el-input style="width: 140px" v-model="queryParams.tjh" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable + @keyup.enter.native="handleManual" /> + </el-form-item> + <el-form-item> + <el-button type="primary" size="mini" @click="handleManual">鏌ヨ</el-button> + <el-button type="primary" size="mini" @click="handleAdd">鏂板</el-button> + </el-form-item> </el-form> - <el-table border v-loading="loading" :data="partList" height="350"> - <el-table-column type="selection" width="40px" align="center" /> - <el-table-column label="搴忓彿" align="center" prop="newID" width="50px" /> - <el-table-column label="椤圭洰鍚嶇О" align="center" prop="groupingName" /> + + <!-- 鏍囨湰鍗曢�夎〃鏍硷紙甯﹀閫夋鏍峰紡锛� --> + <el-table border v-loading="loading" :data="filteredSpecimenData" height="478" style="width: 100%" + ref="specimenTable" :row-key="row => row.value" @select="handleSpecimenSelect"> + <el-table-column type="selection" width="40px" align="center" /> + <el-table-column label="搴忓彿" align="center" type="index" width="50px" /> + <el-table-column label="鏍囨湰鍚嶇О" align="center" prop="label" show-overflow-tooltip /> </el-table> + </el-col> + + <!-- 绗簩鍒楋細涓棿閫変腑椤圭洰鍒楄〃 --> + <el-col :span="9" :xs="24"> + <el-form :model="queryParams2" ref="queryForm" size="small" :inline="true" v-show="showSearch" + label-width="68px" style="height: 45px" @submit.native.prevent> + <el-form-item label="椤圭洰鍚嶇О" prop="proName"> + <el-input ref="inputName" v-model="queryParams2.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable + @keyup.enter.native="handleyixuan" style="width: 140px" /> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleyixuan">鎼滅储</el-button> + </el-form-item> + </el-form> + <el-table border v-loading="loading" :data="OnenewpacName" height="478" ref="tres" style="width: 100%"> + <el-table-column label="宸查�夐」鐩垪琛�" align="center" prop="proName" /> + <el-table-column label="鎿嶄綔" align="center" width="85"> + <template slot-scope="scope"> + <el-button size="mini" type="text" icon="el-icon-delete" @click="handledbelete(scope.row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + <div class="dialog-footer1" style="margin-top: 60px; text-align: center;"> + <el-button type="primary" @click="submitrighr">纭骞朵繚瀛�</el-button> + <el-button @click="cancell">鍙� 娑�</el-button> + </div> + </el-col> + + <!-- 绗笁鍒楋細鎼滅储 + 椤圭洰閫夋嫨 --> + <el-col :span="9" :xs="24"> + <el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" v-show="showSearch" + label-width="68px" style="height: 45px" @submit.native.prevent> + <el-form-item label="椤圭洰鍚嶇О" prop="proName"> + <el-input ref="inputName" v-model="queryParams1.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable + @keyup.enter.native="handleSearchFor" style="width: 140px" /> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleSearchFor">鎼滅储</el-button> + </el-form-item> + </el-form> + <el-table border v-loading="loading" ref="tre" :data="Treedata" @selection-change="handleChangesingle" + height="478" style="width: 100%"> + <el-table-column type="selection" width="40px" align="center" /> + <el-table-column label="椤圭洰鍚嶇О" align="center" prop="proName" show-overflow-tooltip /> + </el-table> + </el-col> - <el-dialog :title="title" :visible.sync="openOne" width="1400px" append-to-body :close-on-click-modal="false"> - <el-row :gutter="24"> - <el-col :span="15" :xs="24"> - <el-form :model="form" ref="queryForm" size="small" :inline="true" label-width="46px" - style="height: 35px" @submit.native.prevent> - <el-form-item label="鏍囨湰绫诲瀷"> - <el-input ref="inputName" v-model="form.price" placeholder="鏍囨湰绫诲瀷" clearable - style="width: 140px" /> - </el-form-item> - <el-form-item> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuerys">閲嶇疆</el-button> - </el-form-item> - </el-form> - <el-table border v-loading="loading" :data="OnenewpacName" :row-class-name="tableRowClassName" - height="478"> - <el-table-column label="鍘熶环" align="center" prop="proPrice" width="85"></el-table-column> - <el-table-column label="鎿嶄綔" align="center" width="85"> - <template slot-scope="scope"> - <el-button size="mini" type="text" icon="el-icon-delete" - @click="handledbelete(scope.row)">鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - </el-col> - - <el-col :span="7" :xs="24"> - <el-form :model="queryParams1" ref="queryForm" size="small" :inline="true" v-show="showSearch" - label-width="68px" @submit.native.prevent> - - - <el-form-item label="椤圭洰鍚嶇О" prop="proName"> - <el-input ref="inputName" v-model="queryParams1.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable - @keyup.enter.native="handleSearchFor" style="width: 140px" /> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" - @click="handleSearchFor">鎼滅储</el-button> - </el-form-item> - </el-form> - <el-table border v-loading="loading" ref="tre" :data="Treedata" - @selection-change="handleChangesingle" height="478" style="width: 100%"> - <el-table-column type="selection" width="40px" align="center" /> - <el-table-column label="椤圭洰鍚嶇О" align="center" prop="proName" width="230px" /> - <el-table-column label="椤圭洰浠锋牸/鍏�" align="center" prop="proPrice" width="100px" /> - </el-table> - </el-col> - </el-row> - <div slot="footer" class="dialog-footer1"> - <el-button type="primary" @click="submitrighr">纭骞朵繚瀛�</el-button> - <el-button @click="cancell">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> + <!-- 娣诲姞鎴栦慨鏀瑰弬鏁伴厤缃璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="瀛楀吀绫诲瀷"> + <el-input v-model="form.dictType" :disabled="true" /> + </el-form-item> + <el-form-item label="鏁版嵁鍚嶇О" prop="dictLabel"> + <el-input v-model="form.dictLabel" placeholder="璇疯緭鍏ユ暟鎹悕绉�" /> + </el-form-item> + <el-form-item label="鏁版嵁閿��" prop="dictValue"> + <el-input v-model="form.dictValue" placeholder="璇疯緭鍏ユ暟鎹敭鍊�" /> + </el-form-item> + <el-form-item label="鏍峰紡灞炴��" prop="cssClass"> + <el-input v-model="form.cssClass" placeholder="璇疯緭鍏ユ牱寮忓睘鎬�" /> + </el-form-item> + <el-form-item label="鏄剧ず鎺掑簭" prop="dictSort"> + <el-input-number v-model="form.dictSort" controls-position="right" :min="0" /> + </el-form-item> + <el-form-item label="鍥炴樉鏍峰紡" prop="listClass"> + <el-select v-model="form.listClass"> + <el-option v-for="item in listClassOptions" :key="item.value" :label="item.label + '(' + item.value + ')'" + :value="item.value"></el-option> + </el-select> + </el-form-item> + <el-form-item label="鐘舵��" prop="status"> + <el-radio-group v-model="form.status"> + <el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label + }}</el-radio> + </el-radio-group> + </el-form-item> + <el-form-item label="澶囨敞" prop="remark"> + <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�"></el-input> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </el-row> + </div> </template> <script> -// import { } from "@/api/system/menu"; +import { searchBiaoben, delBiaoben, editBiaoben } from "@/api/hosp/biaoben"; +import { getDicts, addData, updateData } from "@/api/system/dict/data"; +import { debounce } from 'lodash'; + export default { - name: "Part", - // dicts: [ - // "", - // ], - data() { - return { - loading: false, - openOne: false, - partList: [], - Treedata: [], - queryParams: { - - }, - queryParams1: { - - }, - form: { - - }, - + name: "Part", + data() { + let checkPhoneNum = (rule, value, callback) => { + console.log(value) + let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/); + if (value == "" && value == undefined && !value) { + return callback(''); + } else if (value != undefined && value != "") { + return callback(); + } else if (!patter.test(value)) { + return callback(''); + } + }; + return { + loading: false, + open: false, + OnenewpacName: [], + Treedata: [], + originalTreedata: [], + Treedatas: [], + queryParams: { + tjh: '', + tjCategory: null, + }, + queryParams1: { + proName: '', + }, + queryParams2: { + proName: '', + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + title: "", + // 鏁版嵁鏍囩鍥炴樉鏍峰紡 + listClassOptions: [ + { + value: "default", + label: "榛樿" + }, + { + value: "primary", + label: "涓昏" + }, + { + value: "success", + label: "鎴愬姛" + }, + { + value: "info", + label: "淇℃伅" + }, + { + value: "warning", + label: "璀﹀憡" + }, + { + value: "danger", + label: "鍗遍櫓" } + ], + // 琛ㄥ崟鏍¢獙 + rules: { + dictLabel: [ + { required: true, validator: checkPhoneNum, trigger: "blur" } + ], + dictValue: [ + { required: true, validator: checkPhoneNum, trigger: "blur" } + ], + dictSort: [ + { required: true, validator: checkPhoneNum, trigger: "blur" } + ] + }, + showSearch: true, + filteredSpecimenData: [], + originalSpecimenData: [], + }; + }, + dicts: ["sys_dict_specimen", "sys_normal_disable"], + created() { + this.fetchInitialBiaobenData(); + this.initializeSpecimenData(); + this.debouncedFetchBiaobenData = debounce(this.fetchBiaobenData, 300); + }, + watch: { + 'dict.type.sys_dict_specimen': { + handler(newVal) { + if (newVal && newVal.length > 0) { + console.log('鏍囨湰瀛楀吀鏁版嵁鍔犺浇:', newVal); + this.originalSpecimenData = [...newVal]; + this.filteredSpecimenData = [...newVal]; + } else { + console.warn('鏍囨湰瀛楀吀鏁版嵁涓虹┖鎴栨湭鍔犺浇'); + } + }, + deep: true, + immediate: true, }, - created() { + }, + methods: { + initializeSpecimenData() { + if (this.dict?.type?.sys_dict_specimen) { + this.originalSpecimenData = [...this.dict.type.sys_dict_specimen]; + this.filteredSpecimenData = [...this.originalSpecimenData]; + console.log('鍒濆鍖栨爣鏈暟鎹�:', this.originalSpecimenData); + } else { + this.$message.warning('鏍囨湰鏁版嵁鏈姞杞斤紝璇锋鏌ュ瓧鍏搁厤缃�'); + this.originalSpecimenData = []; + this.filteredSpecimenData = []; + } }, - methods: { - getList() { + handleyixuan() { - }, - resetQuery() { - this.resetForm("queryForm"); - }, - handleManual() { + const searchText = this.queryParams2.proName?.trim().toLowerCase() || ''; + if (searchText) { + this.OnenewpacName = this.Treedatas.filter(item => + item.proName.toLowerCase().includes(searchText) + ); + this.OnenewpacName.length + ? this.$message.success('鏌ヨ鎴愬姛') + : this.$message.warning('鏈壘鍒板尮閰嶇殑椤圭洰'); + } else { + this.OnenewpacName = [...this.Treedatas]; + this.$message.info('宸叉樉绀烘墍鏈夐」鐩�'); + } + this.$refs.tres.clearSelection(); + }, + handleSearchFor() { + const searchText = this.queryParams1.proName?.trim().toLowerCase() || ''; + if (searchText) { + this.Treedata = this.originalTreedata.filter(item => + item.proName.toLowerCase().includes(searchText) + ); + this.Treedata.length + ? this.$message.success('鏌ヨ鎴愬姛') + : this.$message.warning('鏈壘鍒板尮閰嶇殑椤圭洰'); + } else { + this.Treedata = [...this.originalTreedata]; + this.$message.info('宸叉樉绀烘墍鏈夐」鐩�'); + } + this.$refs.tre.clearSelection(); + }, + resetQuery() { + this.$refs.queryForm.resetFields(); + this.queryParams.tjh = ''; + this.queryParams.tjCategory = null; + this.OnenewpacName = []; + this.filteredSpecimenData = [...this.originalSpecimenData]; + this.$refs.specimenTable.clearSelection(); + this.$message.success('宸查噸缃煡璇㈡潯浠跺拰鏍囨湰鏁版嵁'); + }, + handleManual() { + const searchText = this.queryParams.tjh?.trim().toLowerCase() || ''; + this.filteredSpecimenData = searchText + ? this.originalSpecimenData.filter(item => item.label.toLowerCase().includes(searchText)) + : [...this.originalSpecimenData]; - }, - handleChangesingle(selection) { + this.queryParams.tjCategory = null; + this.OnenewpacName = []; + this.$refs.specimenTable.clearSelection(); - }, - cancell() { - this.openOne = false - }, - submitrighr() { + this.$message[this.filteredSpecimenData.length ? 'success' : 'warning']( + this.filteredSpecimenData.length ? '鏌ヨ鎴愬姛' : '鏈壘鍒板尮閰嶇殑鏍囨湰' + ); + }, + handleSpecimenSelect(selection, row) { + console.log('鏍囨湰閫夋嫨瑙﹀彂:', { selection, row }); + this.$refs.specimenTable.clearSelection(); + if (selection.includes(row)) { + this.$refs.specimenTable.toggleRowSelection(row, true); + if (this.queryParams.tjCategory !== row.value) { + this.queryParams.tjCategory = row.value; + console.log('閫変腑鐨勬爣鏈� value:', this.queryParams.tjCategory); + this.debouncedFetchBiaobenData(row.value); + } + } else { + this.queryParams.tjCategory = null; + this.OnenewpacName = []; + console.log('鏍囨湰閫夋嫨宸叉竻绌�'); + } + }, + handleChangesingle(selection) { + if (selection.length > 0) { + selection.forEach(item => { + if (!this.OnenewpacName.some(existing => existing.proId === item.proId)) { + this.OnenewpacName.push({ ...item }); + } + }); + this.$refs.tre.clearSelection(); + } + }, - }, - } + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.open = true; + this.title = "娣诲姞瀛楀吀鏁版嵁"; + this.form.dictType = "sys_dict_specimen"; + }, + cancell() { + this.openOne = false; + }, + submitrighr() { + if (!this.queryParams.tjCategory) { + this.$message.error('璇峰厛閫夋嫨涓�涓爣鏈�'); + return; + } + if (!this.OnenewpacName.length) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�涓」鐩�'); + return; + } + const proIds = this.OnenewpacName.map(item => item.proId); + const bblx = this.queryParams.tjCategory; + this.loading = true; + editBiaoben({ proIds, bblx }) + .then(() => { + this.$message.success('淇濆瓨鎴愬姛'); + this.OnenewpacName = []; + this.queryParams.tjCategory = null; + this.$refs.specimenTable.clearSelection(); + this.loading = false; + }) + .catch(error => { + this.$message.error('淇濆瓨澶辫触'); + console.error(error); + this.loading = false; + }); + }, + handledbelete(row) { + this.loading = true; + delBiaoben({ proId: row.proId }) + .then(() => { + this.OnenewpacName = this.OnenewpacName.filter(item => item.proId !== row.proId); + this.$message.success('鍒犻櫎鎴愬姛'); + this.loading = false; + }) + .catch(error => { + this.$message.error('鍒犻櫎澶辫触'); + console.error(error); + this.loading = false; + }); + }, + fetchBiaobenData(bblx) { + console.log('璋冪敤 searchBiaoben锛堜腑闂磋〃鏍硷級锛屽弬鏁�:', { bblx }); + this.loading = true; + searchBiaoben({ bblx }) + .then(response => { + this.Treedatas = response.data || []; + this.OnenewpacName = [...this.Treedatas]; + this.loading = false; + }) + .catch(error => { + this.$message.error('鑾峰彇鏍囨湰鏁版嵁澶辫触'); + console.error(error); + this.loading = false; + }); + }, + fetchInitialBiaobenData() { + console.log('璋冪敤 searchBiaoben锛堝垵濮嬪姞杞斤紝鍙充晶琛ㄦ牸锛夛紝鍙傛暟: {}'); + this.loading = true; + searchBiaoben({}) + .then(response => { + this.originalTreedata = response.data || []; + this.Treedata = [...this.originalTreedata]; + this.loading = false; + }) + .catch(error => { + this.$message.error('鑾峰彇鍒濆椤圭洰鏁版嵁澶辫触'); + console.error(error); + this.loading = false; + }); + }, + + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + + /** 鎻愪氦鎸夐挳 */ + submitForm: function () { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.dictCode != undefined) { + updateData(this.form).then(response => { + this.$store.dispatch('dict/removeDict', this.queryParams.dictType); + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addData(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + let dictType = "sys_dict_specimen" + getDicts(dictType).then(response => { + this.originalSpecimenData= response.rows ||[] + this.filteredSpecimenData =[...this.originalSpecimenData]; + }); + }); + } + } + }); + }, + }, }; -</script> \ No newline at end of file +</script> + +<style scoped> +.app-container { + padding: 20px; +} + +.dialog-footer1 { + margin-top: 60px; + text-align: center; +} +</style> \ No newline at end of file -- Gitblit v1.8.0