From d194f4cd74da499f741100e5e3da5bcc3a0dc387 Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期六, 07 十二月 2024 18:07:44 +0800 Subject: [PATCH] danwei --- src/views/hosp/customer/index.vue | 65 ++++++++++++++++++-------------- 1 files changed, 36 insertions(+), 29 deletions(-) diff --git a/src/views/hosp/customer/index.vue b/src/views/hosp/customer/index.vue index 8108ad8..ae5970f 100644 --- a/src/views/hosp/customer/index.vue +++ b/src/views/hosp/customer/index.vue @@ -632,27 +632,27 @@ style="width: 200px" /> </el-form-item> - <el-form-item label="鍗曚綅鍚嶇О" prop="dictCompId"> - <el-select - :remote-method="getRemoteData" - v-model="form.compName" - remote - - style="width: 300px" - placeholder="璇烽�夋嫨鍗曚綅鍚嶇О" - clearable - - @change="idFn1" - > - <el-option - v-for="dict in CompanyList" - :key="dict.cnName" - :label="dict.cnName" - :value="dict.drugManufacturerId" - /> - </el-select> - <i class="el-icon-circle-plus-outline" @click="handleAdd1"></i> - </el-form-item> + <el-form-item label="鍗曚綅鍚嶇О" prop="compName"> + <el-select + v-model="form.compName" + remote + default-first-option + allow-create + filterable + style="width: 200px" + placeholder="璇烽�夋嫨鍗曚綅鍚嶇О" + clearable + @change="idFn1" + > + <el-option + v-for="dict in CompanyList" + :key="dict.cnName" + :label="dict.cnName" + :value="dict.cnName" + /> + </el-select> + <i class="el-icon-circle-plus-outline" @click="handleAdd1"></i> + </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> @@ -1128,6 +1128,7 @@ submitFormS() { this.$refs["form1"].validate((valid) => { if (valid) { + addComp(this.form1).then((response) => { this.$modal.msgSuccess("鏂板鎴愬姛"); this.open1 = false; @@ -1137,14 +1138,24 @@ }); }, idFn1(value) { - console.log(value); if (value) { - this.form.dictCompId = value; + // 淇濆瓨淇敼鍓嶇殑 dictCompId + const originalCompId = this.form.dictCompId; + + // 鏇存柊鍏徃鍚嶇О + this.form.compName = value; + + // 閬嶅巻鍏徃鍒楄〃锛屾牴鎹叕鍙稿悕绉拌缃搴旂殑 drugManufacturerId this.CompanyList.forEach((item) => { - if (item.drugManufacturerId == this.form.dictCompId) { - this.form.compName = item.cnName; + if (item.cnName == this.form.compName) { + this.form.dictCompId = item.drugManufacturerId; } }); + + // 濡傛灉 dictCompId 娌℃湁鍙樺寲锛岄噸缃负绌� + if (this.form.dictCompId === originalCompId) { + this.form.dictCompId = ''; + } } }, // 鎼滅储 @@ -1427,10 +1438,6 @@ .dialog-footer { display: flex; justify-content: center; -} -.el-icon-circle-plus-outline { - line-height: 20px; - font-size: 20px; } .dialog-footer2 { width: 960px; -- Gitblit v1.8.0