From 9f468e0447a71eb7fcc4f1d78df3be9d348f6fe0 Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期一, 25 三月 2024 11:33:02 +0800 Subject: [PATCH] 11 --- src/views/project/organization/index.vue | 363 ++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 280 insertions(+), 83 deletions(-) diff --git a/src/views/project/organization/index.vue b/src/views/project/organization/index.vue index 8055bc3..7cb588f 100644 --- a/src/views/project/organization/index.vue +++ b/src/views/project/organization/index.vue @@ -1,63 +1,151 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> + <el-form + :model="queryParams" + ref="queryForm" + :inline="true" + v-show="showSearch" + label-width="68px" + > <el-form-item label="缁勭粐鍚嶇О" prop="organizationname"> - <el-input v-model="queryParams.organizationname" placeholder="璇疯緭鍏ョ粍缁囧悕绉�" clearable size="small" - @keyup.enter.native="handleQuery" /> + <el-input + v-model="queryParams.organizationname" + placeholder="璇疯緭鍏ョ粍缁囧悕绉�" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> </el-form-item> <el-form-item label="鏈烘瀯绫诲瀷" prop="organizationtype"> - <el-select v-model="queryParams.organizationtype" placeholder="璇烽�夋嫨鏈烘瀯绫诲瀷" clearable size="small"> - <el-option v-for="dict in dict.type.sys_OrganizationType" :key="dict.value" :label="dict.label" - :value="dict.value" /> + <el-select + v-model="queryParams.organizationtype" + placeholder="璇烽�夋嫨鏈烘瀯绫诲瀷" + clearable + size="small" + > + <el-option + v-for="dict in dict.type.sys_OrganizationType" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> </el-select> </el-form-item> <el-form-item label="鎵�鍦ㄥ湴鍖�" prop="regionallevel"> - <el-select v-model="queryParams.regionallevel" placeholder="璇烽�夋嫨鎵�鍦ㄥ湴鍖�" clearable size="small"> - <el-option v-for="dict in dict.type.sys_RegionalLevel" :key="dict.value" :label="dict.label" - :value="dict.value" /> + <el-select + v-model="queryParams.regionallevel" + placeholder="璇烽�夋嫨鎵�鍦ㄥ湴鍖�" + clearable + size="small" + > + <el-option + v-for="dict in dict.type.sys_RegionalLevel" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> </el-select> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + <el-button + type="primary" + icon="el-icon-search" + size="mini" + @click="handleQuery" + >鎼滅储</el-button + > + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" + >閲嶇疆</el-button + > </el-form-item> </el-form> <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> - <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">鏂板</el-button> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + >鏂板</el-button + > </el-col> <el-col :span="1.5"> - <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" - @click="handleUpdate">淇敼</el-button> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + >淇敼</el-button + > </el-col> <el-col :span="1.5"> - <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" - @click="handleDelete">鍒犻櫎</el-button> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + >鍒犻櫎</el-button + > </el-col> <el-col :span="1.5"> - <el-button type="warning" plain icon="el-icon-download" size="mini" :loading="exportLoading" - @click="handleExport">瀵煎嚭</el-button> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + :loading="exportLoading" + @click="handleExport" + >瀵煎嚭</el-button + > </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + <right-toolbar + :showSearch.sync="showSearch" + @queryTable="getList" + ></right-toolbar> </el-row> - <el-table v-loading="loading" :data="organizationList" @selection-change="handleSelectionChange"> + <el-table + v-loading="loading" + :data="organizationList" + @selection-change="handleSelectionChange" + > <el-table-column type="selection" width="55" align="center" /> <!-- <el-table-column label="涓婚敭鑷" align="center" prop="id" /> --> <el-table-column label="鏈烘瀯绫诲瀷" align="center" prop="organizationtype"> <template slot-scope="scope"> - <dict-tag :options="dict.type.sys_OrganizationType" :value="scope.row.organizationtype" /> + <dict-tag + :options="dict.type.sys_OrganizationType" + :value="scope.row.organizationtype" + /> </template> </el-table-column> <el-table-column label="缁勭粐缂栧彿" align="left" prop="organizationid" /> - <el-table-column label="缁勭粐鍚嶇О" width="260px" align="left" prop="organizationname" /> + <el-table-column + label="缁勭粐鍚嶇О" + width="260px" + align="left" + prop="organizationname" + /> <el-table-column label="鎵�鍦ㄥ湴鍖�" align="left" prop="regionallevel"> <template slot-scope="scope"> - <dict-tag :options="dict.type.sys_RegionalLevel" :value="scope.row.regionallevel" /> + <dict-tag + :options="dict.type.sys_RegionalLevel" + :value="scope.row.regionallevel" + /> </template> </el-table-column> - <el-table-column label="鍦板潃" width="260px" align="left" prop="registeraddress" /> + <el-table-column + label="鍦板潃" + width="260px" + align="left" + prop="registeraddress" + /> <!-- <el-table-column label="鑱旂郴浜�" align="left" prop="contactperson" /> <el-table-column label="鑱旂郴鐢佃瘽" align="left" prop="contactnumber" /> @@ -67,66 +155,127 @@ </template> </el-table-column> --> - <el-table-column label="鎿嶄綔" align="left" class-name="small-padding fixed-width"> + <el-table-column + label="鎿嶄綔" + align="left" + class-name="small-padding fixed-width" + > <template slot-scope="scope"> - <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">淇敼</el-button> - <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">鍒犻櫎</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + >淇敼</el-button + > + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + >鍒犻櫎</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" /> + <pagination + v-show="total > 0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> <!-- 娣诲姞鎴栦慨鏀规満鏋勭鐞嗗璇濇 --> - <el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="60%" append-to-body> + <el-dialog + :title="title" + :close-on-click-modal="false" + :visible.sync="open" + width="60%" + append-to-body + > <el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-row style="overflow: hidden"> <el-col :span="5"> <el-form-item label="鎵�灞炲湴鍖�" prop="regionallevel"> <el-select v-model="form.regionallevel" placeholder="璇烽�夋嫨鍦板尯"> - <el-option v-for="dict in dict.type.sys_RegionalLevel" :key="dict.value" :label="dict.label" - :value="dict.value"></el-option> + <el-option + v-for="dict in dict.type.sys_RegionalLevel" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> </el-select> </el-form-item> </el-col> <el-col :span="10"> <el-form-item label="缁勭粐鍚嶇О" prop="organizationname"> - <el-input v-model="form.organizationname" placeholder="璇疯緭鍏ョ粍缁囧悕绉�" /> + <el-input + v-model="form.organizationname" + placeholder="璇疯緭鍏ョ粍缁囧悕绉�" + /> </el-form-item> </el-col> <el-col :span="7"> <el-form-item label="缁勭粐缂栧彿" prop="organizationid"> - <el-input v-model="form.organizationid" placeholder="璇疯緭鍏ョ粍缁囩紪鍙�" /> + <el-input + v-model="form.organizationid" + :disabled="true" + placeholder="璇疯緭鍏ョ粍缁囩紪鍙�" + /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="5"> <el-form-item label="鏈烘瀯绫诲瀷" prop="organizationtype"> - <el-select v-model="form.organizationtype" placeholder="璇烽�夋嫨鏈烘瀯绫诲瀷"> - <el-option v-for="dict in dict.type.sys_OrganizationType" :key="dict.value" :label="dict.label" - :value="dict.value"></el-option> + <el-select + v-model="form.organizationtype" + placeholder="璇烽�夋嫨鏈烘瀯绫诲瀷" + > + <el-option + v-for="dict in dict.type.sys_OrganizationType" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> </el-select> </el-form-item> </el-col> <el-col :span="5"> <el-form-item label="鍖婚櫌鎬ц川" prop="hospitalnature"> - <el-select v-model="form.hospitalnature" placeholder="璇烽�夋嫨鍖婚櫌鎬ц川"> - <el-option v-for="dict in dict.type.sys_HospitalNature" :key="dict.value" :label="dict.label" - :value="dict.value"></el-option> + <el-select + v-model="form.hospitalnature" + placeholder="璇烽�夋嫨鍖婚櫌鎬ц川" + > + <el-option + v-for="dict in dict.type.sys_HospitalNature" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> </el-select> </el-form-item> </el-col> <el-col :span="5"> <el-form-item label="鍖婚櫌缂栫爜" prop="medicalcode"> - <el-input v-model="form.medicalcode" placeholder="璇疯緭鍏ュ尰鐤楁満鏋勭紪鍙�" /> + <el-input + v-model="form.medicalcode" + placeholder="璇疯緭鍏ュ尰鐤楁満鏋勭紪鍙�" + /> </el-form-item> </el-col> <el-col :span="7"> <el-form-item label="娉ㄥ唽鏃堕棿" prop="registertime"> - <el-date-picker clearable size="small" v-model="form.registertime" type="datetime" - value-format="yyyy-MM-dd HH:mm:ss" placeholder="閫夋嫨娉ㄥ唽鏃堕棿"> + <el-date-picker + clearable + size="small" + v-model="form.registertime" + type="datetime" + value-format="yyyy-MM-dd HH:mm:ss" + placeholder="閫夋嫨娉ㄥ唽鏃堕棿" + > </el-date-picker> </el-form-item> </el-col> @@ -134,17 +283,26 @@ <el-row> <el-col :span="10"> <el-form-item label="娉ㄥ唽鍦板潃" prop="registeraddress"> - <el-input v-model="form.registeraddress" placeholder="璇疯緭鍏ユ敞鍐屽湴鐐硅缁嗗湴鍧�" /> + <el-input + v-model="form.registeraddress" + placeholder="璇疯緭鍏ユ敞鍐屽湴鐐硅缁嗗湴鍧�" + /> </el-form-item> </el-col> <el-col :span="5"> <el-form-item label="鑱旂郴浜�" prop="contactperson"> - <el-input v-model="form.contactperson" placeholder="璇疯緭鍏ヨ仈绯讳汉" /> + <el-input + v-model="form.contactperson" + placeholder="璇疯緭鍏ヨ仈绯讳汉" + /> </el-form-item> </el-col> <el-col :span="7"> <el-form-item label="鑱旂郴鐢佃瘽" prop="contactnumber"> - <el-input v-model="form.contactnumber" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" /> + <el-input + v-model="form.contactnumber" + placeholder="璇疯緭鍏ヨ仈绯荤數璇�" + /> </el-form-item> </el-col> </el-row> @@ -156,14 +314,21 @@ </el-col> <el-col :span="10"> <el-form-item label="閾惰璐﹀彿" prop="bankaccount"> - <el-input v-model="form.bankaccount" placeholder="璇疯緭鍏ラ摱琛岃处鍙�" /> + <el-input + v-model="form.bankaccount" + placeholder="璇疯緭鍏ラ摱琛岃处鍙�" + /> </el-form-item> </el-col> - </el-row> <el-row> <el-form-item label="浠嬬粛" prop="introduction"> - <el-input :rows="5" v-model="form.introduction" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> + <el-input + :rows="5" + v-model="form.introduction" + type="textarea" + placeholder="璇疯緭鍏ュ唴瀹�" + /> </el-form-item> </el-row> <el-row> @@ -189,7 +354,7 @@ delOrganization, addOrganization, updateOrganization, - exportOrganization, + exportOrganization } from "@/api/project/organization"; export default { @@ -223,22 +388,24 @@ pageSize: 10, organizationname: null, organizationtype: null, - province: null, + province: null }, + initregionallevel: "", + inithospitalnature: "", // 琛ㄥ崟鍙傛暟 form: {}, // 琛ㄥ崟鏍¢獙 rules: { organizationname: [ - { required: true, message: "缁勭粐鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }, + { required: true, message: "缁勭粐鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } ], - organizationid: [ - { required: true, message: "缁勭粐缂栧彿涓嶈兘涓虹┖", trigger: "blur" }, + hospitalnature: [ + { required: true, message: "鍖婚櫌鎬ц川涓嶈兘涓虹┖", trigger: "blur" }, ], regionallevel: [ - { required: true, message: "鎵�灞炲湴甯備笉鑳戒负绌�", trigger: "blur" }, - ], - }, + { required: true, message: "鎵�灞炲湴甯備笉鑳戒负绌�", trigger: "blur" } + ] + } }; }, created() { @@ -249,7 +416,7 @@ /** 鏌ヨ鏈烘瀯绠$悊鍒楄〃 */ getList() { this.loading = true; - listOrganization(this.queryParams).then((response) => { + listOrganization(this.queryParams).then(response => { this.organizationList = response.rows; this.total = response.total; this.loading = false; @@ -292,7 +459,7 @@ community: null, communityname: null, countycode: null, - countyname: null, + countyname: null }; this.resetForm("form"); }, @@ -308,7 +475,7 @@ }, // 澶氶�夋閫変腑鏁版嵁 handleSelectionChange(selection) { - this.ids = selection.map((item) => item.id); + this.ids = selection.map(item => item.id); this.single = selection.length !== 1; this.multiple = !selection.length; }, @@ -322,7 +489,9 @@ handleUpdate(row) { this.reset(); const id = row.id || this.ids; - getOrganization(id).then((response) => { + getOrganization(id).then(response => { + this.initregionallevel = response.data.regionallevel; + this.inithospitalnature = response.data.hospitalnature; this.form = response.data; this.open = true; this.title = "淇敼鏈烘瀯绠$悊"; @@ -330,37 +499,65 @@ }, /** 鎻愪氦鎸夐挳 */ submitForm() { - this.$refs["form"].validate((valid) => { - if (valid) { - if (this.form.id != null) { - updateOrganization(this.form).then((response) => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addOrganization(this.form).then((response) => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); + if ( + this.initregionallevel == this.form.regionallevel && + this.inithospitalnature == this.form.hospitalnature + ) { + this.$refs["form"].validate(valid => { + if (valid) { + if (this.form.id != null) { + updateOrganization(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }); + } else { + addOrganization(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } } + }); + } else { + if (this.form.id != null) { + this.$modal + .confirm("鏈淇敼娑夊強鍏抽敭瀛楁锛屼繚瀛樺皢浼氭洿鏂扮粍缁囩紪鍙锋槸鍚︾户缁紵") + .then(()=> { + console.log(this.form); + return delOrganization(this.form.id); + }) + .then(() => { + this.form.id = null; + addOrganization(this.form).then(response => { + this.$modal.msgSuccess("缂栬緫鎴愬姛"); + this.open = false; + this.getList(); + }); + }); + } else { + addOrganization(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); } - }); + } }, /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { const ids = row.id || this.ids; this.$modal .confirm('鏄惁纭鍒犻櫎鏈烘瀯绠$悊缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�') - .then(function () { + .then(function() { return delOrganization(ids); }) .then(() => { this.getList(); this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); }) - .catch(() => { }); + .catch(() => {}); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { @@ -371,12 +568,12 @@ this.exportLoading = true; return exportOrganization(queryParams); }) - .then((response) => { + .then(response => { this.$download.name(response.msg); this.exportLoading = false; }) - .catch(() => { }); - }, - }, + .catch(() => {}); + } + } }; -</script> \ No newline at end of file +</script> -- Gitblit v1.9.3