From df59cae6f3c73605a3f3b4055fdca5b4dabde2c2 Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期四, 05 九月 2024 18:32:17 +0800 Subject: [PATCH] 测试完成 --- src/views/patient/patient/profile/index.vue | 219 ++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 138 insertions(+), 81 deletions(-) diff --git a/src/views/patient/patient/profile/index.vue b/src/views/patient/patient/profile/index.vue index 3c3304d..66ceabc 100644 --- a/src/views/patient/patient/profile/index.vue +++ b/src/views/patient/patient/profile/index.vue @@ -113,81 +113,101 @@ <el-button type="primary" @click="savefile">淇濆瓨鎮h�呮。妗�</el-button> </div> <div class="detailed"> - <el-row :gutter="20"> - <el-col :span="12" - ><div class="grid-content bg-purple"> - 鎮h�呭鍚嶏細<span class="spanvalue">{{ userform.name }}</span> - </div></el-col - > - <el-col :span="12" - ><div class="grid-content bg-purple"> - 鑱旂郴鐢佃瘽锛�<span class="spanvalue">{{ userform.telcode }}</span> - </div></el-col - > - </el-row> - <el-row :gutter="20"> - <el-col :span="24" - ><div class="grid-content bg-purple"> - 鍑虹敓鍦帮細<span class="spanvalue">{{ userform.birthplace }}</span> - </div></el-col - > - </el-row> - <el-row :gutter="20"> - <el-col :span="24" - ><div class="grid-content bg-purple"> - 灞呬綇鍦帮細<span class="spanvalue">{{ - userform.placeOfResidence - }}</span> - </div></el-col - > - </el-row> - <el-row :gutter="20"> - <el-col :span="24" - ><div class="xinz-inf"> - <el-tag - :key="tag.tagname" - type="success" - v-for="tag in dynamicTags" - closable - :disable-transitions="false" - @close="handleClose(tag)" - > - {{ tag.tagname }} - </el-tag> - <el-select - v-if="inputVisible" - v-model="inputValue" - @change="handleInputConfirm" - filterable - allow-create - default-first-option - placeholder="璇烽�夋嫨/鏌ヨ" - > - <el-option - v-for="item in options" - :key="item.tagid" - :label="item.tagname" - :value="item.tagname" - > - </el-option> - </el-select> + <el-form + ref="userform" + :model="userform" + :rules="rules" + label-width="100px" + > + <el-row :gutter="20"> + <el-col :span="12"> + <el-form-item label="鎮h�呭鍚�" prop="name"> + <el-input + v-model="userform.name" + placeholder="璇疯緭鍏ュ鍚�" + maxlength="30" + ></el-input> </el-form-item + ></el-col> + <el-col :span="12" + ><el-form-item label="鑱旂郴鏂瑰紡" prop="telcode"> + <el-input + v-model="userform.telcode" + placeholder="璇疯緭鍏ヨ仈绯绘柟寮�" + maxlength="30" + /> </el-form-item + ></el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="24"> + <el-form-item label="鍑虹敓鍦�" prop="birthplace"> + <el-input + v-model="userform.birthplace" + placeholder="鍥姐�佺渷銆佸湴甯傘�佸尯鍘裤�佽閬撶瓑璇︾粏淇℃伅" + maxlength="50" + /> </el-form-item + ></el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="24" + ><el-form-item label="灞呬綇鍦�" prop="placeOfResidence"> + <el-input + v-model="userform.placeOfResidence" + placeholder="鍥姐�佺渷銆佸湴甯傘�佸尯鍘裤�佽閬撶瓑璇︾粏淇℃伅" + maxlength="50" + /> </el-form-item + ></el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="24"> + <el-form-item label="鏍囩" prop="desc"> + <div class="xinz-inf"> + <el-tag + :key="tag.tagname" + type="success" + v-for="tag in dynamicTags" + v-if="tag.isoperation != 3" + closable + :disable-transitions="false" + @close="handleClose(tag)" + > + {{ tag.tagname }} + </el-tag> + <el-select + v-if="inputVisible" + v-model="inputValue" + @change="handleInputConfirm" + filterable + allow-create + default-first-option + placeholder="璇烽�夋嫨/鏌ヨ" + > + <el-option + v-for="item in options" + :key="item.tagid" + :label="item.tagname" + :value="item.tagname" + > + </el-option> + </el-select> - <el-button - v-else - class="button-new-tag" - size="small" - @click="showInput" - >+ 鏂板鏍囩</el-button - > - </div></el-col - > - </el-row> + <el-button + v-else + class="button-new-tag" + size="small" + @click="showInput" + >+ 鏂板鏍囩</el-button + > + </div> + </el-form-item> + </el-col> + </el-row> + </el-form> </div> </div> <div class="top-message"> <div class="headline">鐥呭彶</div> <div class="detailed"> - <el-form ref="form" :model="form" label-width="100px"> + <el-form :model="form" label-width="100px"> <el-row> <el-col :span="8"> <el-form-item label="杩囧線鐤剧梾" prop="name"> @@ -860,6 +880,39 @@ { label: "娴嬮噺鏃堕棿", width: "", prop: "name" }, { label: "浣撴俯", width: "", prop: "sex" }, ], + // 琛ㄥ崟鏍¢獙 + rules: { + name: [ + { required: true, message: "鐢ㄦ埛鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }, + { + min: 2, + max: 20, + message: "鐢ㄦ埛鍚嶇О闀垮害蹇呴』浠嬩簬 2 鍜� 20 涔嬮棿", + trigger: "blur", + }, + ], + + sex: [{ required: true, message: "鎬у埆涓嶈兘涓虹┖", trigger: "blur" }], + age: [{ required: true, message: "骞撮緞涓嶈兘涓虹┖", trigger: "blur" }], + nation: [{ required: true, message: "姘戞棌涓嶈兘涓虹┖", trigger: "blur" }], + telcode: [ + { required: true, message: "鑱旂郴鏂瑰紡涓嶈兘涓虹┖", trigger: "blur" }, + { + pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, + message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", + trigger: "blur", + }, + ], + idcardtype: [ + { required: true, message: "璇佷欢绫诲瀷涓嶈兘涓虹┖", trigger: "blur" }, + ], + idcardno: [ + { required: true, message: "璇佷欢鍙疯兘涓虹┖", trigger: "blur" }, + ], + placeOfResidence: [ + { required: true, message: "灞呬綇鍦颁笉鑳戒负绌�", trigger: "blur" }, + ], + }, }; }, created() { @@ -941,17 +994,21 @@ }, // 淇濆瓨鎮h�呮。妗� savefile() { - // this.userform.tagList = this.dynamicTags; - this.userform.isoperation = 2; - alterpatient(this.userform).then((res) => { - if (res.code == 200) { - this.$modal.msgSuccess("鍩虹淇℃伅淇濆瓨鎴愬姛"); - } else { - this.$modal.msgError("鍩虹淇℃伅淇敼澶辫触"); + this.$refs["userform"].validate((valid) => { + if (valid) { + this.userform.isoperation = 2; + this.userform.tagList = this.dynamicTags; + alterpatient(this.userform).then((res) => { + if (res.code == 200) { + this.$modal.msgSuccess("鍩虹淇℃伅淇濆瓨鎴愬姛"); + } else { + this.$modal.msgError("鍩虹淇℃伅淇敼澶辫触"); + } + }); + // 鐥呭彶 + this.medicalhistory(); } }); - // 鐥呭彶 - this.medicalhistory(); }, // 鐥呭彶 medicalhistory() { @@ -1099,8 +1156,8 @@ }, handleClose(tag) { const lindex = this.dynamicTags.indexOf(tag); - this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1); - this.userform.tagList[lindex].isoperation = 3; + // this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1); + this.dynamicTags[lindex].isoperation = 3; }, showInput() { @@ -1128,7 +1185,7 @@ }; } console.log(tagvalue); - this.userform.tagList.push(tagvalue); + // this.userform.tagList.push(tagvalue); this.dynamicTags.push(tagvalue); console.log(this.userform.tagList); console.log(this.dynamicTags); -- Gitblit v1.9.3