From 05a1f184567c70b650924ff2a8353f3d599947b0 Mon Sep 17 00:00:00 2001 From: Tcsm <1377977403@qq.com> Date: 星期六, 05 八月 2023 16:38:42 +0800 Subject: [PATCH] 个人自传增加修改功能 --- ruoyi-ui/src/views/self/show.vue | 80 ++++++++++++++++++++++++++++------------ ruoyi-ui/src/assets/icons/edit.png | 0 2 files changed, 56 insertions(+), 24 deletions(-) diff --git a/ruoyi-ui/src/assets/icons/edit.png b/ruoyi-ui/src/assets/icons/edit.png new file mode 100644 index 0000000..de0504a --- /dev/null +++ b/ruoyi-ui/src/assets/icons/edit.png Binary files differ diff --git a/ruoyi-ui/src/views/self/show.vue b/ruoyi-ui/src/views/self/show.vue index 2ea3fd1..1a5b6c0 100644 --- a/ruoyi-ui/src/views/self/show.vue +++ b/ruoyi-ui/src/views/self/show.vue @@ -490,8 +490,12 @@ <div v-if="item.term === '鐮旂┒鐢�'"> {{item.content}}</div> <div v-if="item.term === '宸ヤ綔'"> {{item.content}}</div> <div v-if="item.term === '缁撳鍚�'"> {{item.content}}</div> + <el-button size='mini' type="text" class="btn_edit" @click="editData(item)" style='position: absolute;right:10px;top:5px;'> + <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn> + </el-button> </el-tab-pane> </el-tabs> + <el-button size='mini' type="text" class="btn_autobiography" @click="showDialog('autobiography')" style='position: absolute;right:10px;top:5px;'> <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn> </el-button> @@ -627,10 +631,16 @@ </div> </el-dialog> <!--鏂板鑷紶--> - <el-dialog :title="title" :visible.sync="dialogVisible.autobiography" width="900px" append-to-body> + <el-dialog :title="isEdit ? '缂栬緫璁板綍' : '鏂板璁板綍'" :visible.sync="dialogVisible.autobiography" width="900px" append-to-body> <el-col > <el-form ref="elForm" :model="formDat" :rules="rules" size="medium" label-position="left" > <el-row :span="5"> +<!-- <el-form-item label="闇�瑕佷慨鏀圭殑璁板綍锛�" prop="id">--> +<!-- <el-select v-model="formDat.id" placeholder="璇烽�夋嫨闇�瑕佷慨鏀圭殑璁板綍" clearable :style="{width: '50%'}" >--> +<!-- <el-option v-for="(item, index) in AutobiographyList" :key='item.id' :label="item.ageBegin+'~'+item.ageEnd+'宀�'+'('+item.term+')'"--> +<!-- ></el-option>--> +<!-- </el-select>--> +<!-- </el-form-item>--> <el-form-item label="骞撮緞娈碉細" prop="ageBegin ageEnd" label-width="70px"> <el-input v-model="formDat.ageBegin" placeholder="" clearable :style="{width: '20%'}" > </el-input> @@ -675,8 +685,8 @@ listExperience, addExperience, updateExperience, delExperience, getIndividualRelation, addRelation, updateRelation, delRelation, getCertificateList, addCertificate, updateCertificate, delCertificate, - getAbroadList, addAbroad,updateAbroad, delAbroad, - getAutobiographyList, getAutobiographyTermList, addAutobiography, + getAbroadList, addAbroad, updateAbroad, delAbroad, + getAutobiographyList, getAutobiographyTermList, addAutobiography,updateAutobiography, getCategory, } from "@/api/self/index"; import { delFamilyevent, uploadPic } from '../../api/bignote' @@ -766,15 +776,13 @@ dateRange: [], // 鏁版嵁鑼冨洿閫夐」 fot:[".jpg",".jif"], - fileList:[ - ], - fileListOther:[ - - ], + fileList:[], + fileListOther:[], dsb:true, btn:false, isShow:true, isShow_2:false, + isEdit:false, formDat: { //涓汉鍩烘湰淇℃伅 nickName:undefined, @@ -832,7 +840,6 @@ term:undefined, }, - AgeEnd:'', // 鑿滃崟鍒楄〃 menuOptions: [], // 閮ㄩ棬鍒楄〃 @@ -949,6 +956,7 @@ }], }, + selectedOption:'', typeOptions:[], typeOption: [{ value:'鎶ょ収', @@ -992,6 +1000,18 @@ this.getAutobiographyInfor(); // this.getSrc1(typeOptions) }, + //涓汉鑷紶缂栬緫 + editData(data) { + this.isEdit = true; // 璁剧疆涓虹紪杈戞搷浣� + // 灏嗚淇敼鐨勬暟鎹~鍏呭埌formDat瀵硅薄涓� + this.formDat.ageBegin = data.ageBegin; + this.formDat.ageEnd = data.ageEnd; + this.formDat.term = data.term; + this.formDat.content = data.content; + + // 鎵撳紑寮圭獥 + this.dialogVisible.autobiography = true; + }, //闅旇鍙樿壊 tableRowClassName({ row, rowIndex }) { @@ -1013,11 +1033,6 @@ return '鈥斺�斺�斺�斺�斺��' } }, - getSrc1(term){ - if(term==='7'){ - return '鐮旂┒鐢�' - } - }, /** 鏌ヨ瑙掕壊鍒楄〃 */ getList() { @@ -1032,7 +1047,6 @@ this.total = response.data.total; this.loading = false; } - ); //鎴愬憳鍏崇郴 getIndividualRelation(this.queryParams).then(response => { @@ -1087,7 +1101,6 @@ // this.total = response.data.total; // this.loading = false; // }); - }, //鍥剧墖鐨勪笂浼犲強涓婁紶鎸夐挳闅愯棌 @@ -1292,25 +1305,41 @@ this.formDat[key] = ''; }); }, - //涓汉鑷紶 + //涓汉鑷紶鐨勪繚瀛� submitDataScope6: function() { this.$refs["elForm"].validate(valid => { if (valid) { // 鏍规嵁鍊兼壘鍒伴�変腑鐨勯�夐」瀵硅薄 const selectedOption = this.typeOptions.find(option => option.value === this.formDat.term); - // 灏嗛�変腑閫夐」鐨勬枃鏈缃负"term"瀛楁鐨勫�� - this.formDat.term = selectedOption.label; - addAutobiography(this.formDat).then(response => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.dialogVisible.autobiography = false; - this.getList(); - }); + + if (this.isEdit) { + // 鎵ц淇敼鎿嶄綔 + updateAutobiography(this.formDat).then(response => { + // 灏嗛�変腑閫夐」鐨勬枃鏈缃负"term"瀛楁鐨勫�� + this.formDat.term = selectedOption.label; + this.formDat.id = selectedOption.id; + console.log("1") + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.dialogVisible.autobiography = false; + this.getList(); + }); + } else { + // 鎵ц鏂板鎿嶄綔 + addAutobiography(this.formDat).then(response => { + this.formDat.term = selectedOption.label; + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.dialogVisible.autobiography = false; + this.getList(); + }); + } } }); // 娓呯┖formDat瀵硅薄鐨勬暟鎹� Object.keys(this.formDat).forEach(key => { this.formDat[key] = ''; }); + // 閲嶇疆isEdit涓篺alse锛屼互渚夸笅娆$偣鍑绘柊澧炴椂涓烘柊澧炴搷浣� + this.isEdit = false; }, editRow(row) { @@ -1541,6 +1570,9 @@ .btn_autobiography{ background:center no-repeat url('../../assets/icons/add1.png') ; } +.btn_edit{ + background:center no-repeat url('../../assets/icons/edit.png') ; +} .button { background:center no-repeat url('../../assets/icons/add1.png') ; margin-left: 69.5vw; -- Gitblit v1.9.1