From cb8e2abfe05c493b3648bf0d48949891a93993a2 Mon Sep 17 00:00:00 2001 From: wangxl <123456> Date: Fri, 29 Nov 2024 19:31:58 +0800 Subject: [PATCH] 33333 --- .../report/project/components/memberEdit.vue | 59 +++++++++---------- .../project/components/projectMemberEdit.vue | 27 +++++++-- 2 files changed, 49 insertions(+), 37 deletions(-) diff --git a/src/views/report/project/components/memberEdit.vue b/src/views/report/project/components/memberEdit.vue index 70ba6a3..f5c6f76 100644 --- a/src/views/report/project/components/memberEdit.vue +++ b/src/views/report/project/components/memberEdit.vue @@ -3,7 +3,7 @@ <div class="app-content" style="height: 50vh;overflow: auto;"> <a-spin :spinning="loading" style="width: 100%;height: 100%;"> <div class="page-content"> - <a-form-model ref="form" :model="formData" :rules="rules" style="border-top: 0px" class="from-table font-line-space"> + <a-form-model ref="form" :model="memObject" :rules="rules" style="border-top: 0px" class="from-table font-line-space"> <a-row type="flex"> <a-col :span="4" class="bg-gray"> <div class="special-middle"> @@ -12,7 +12,7 @@ </a-col> <a-col :span="20"> <a-form-model-item prop="name"> - <a-input v-model="formData.name" :maxLength="20" placeholder="姓名" style="width: 40%" /> + <a-input v-model="memObject.name" :maxLength="20" placeholder="姓名" style="width: 40%" /> </a-form-model-item> </a-col> </a-row> @@ -24,7 +24,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="certificateType"> - <para-select v-model="formData.certificateType" :typeId="49" :width="120" @changeTitle="(e)=>{ formData.certificateTypeName = e}" /> + <para-select v-model="memObject.certificateType" :typeId="49" :width="120" @changeTitle="(e)=>{ memObject.certificateTypeName = e}" /> </a-form-model-item> </a-col> <a-col :span="4" class="bg-gray"> @@ -34,7 +34,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="certId"> - <a-input v-model="formData.certId" :maxLength="20" placeholder="证件号" style="width: 60%" /> + <a-input v-model="memObject.certId" :maxLength="20" placeholder="证件号" style="width: 60%" /> </a-form-model-item> </a-col> </a-row> @@ -46,7 +46,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="sex"> - <base-select v-model="formData.sex" :type="16" :isAll="true" :width="120" /> + <base-select v-model="memObject.sex" :type="16" :isAll="true" :width="120" /> </a-form-model-item> </a-col> <a-col :span="4" class="bg-gray"> @@ -56,7 +56,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="birthday"> - <a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" v-model="formData.birthday" style="width: 60%" /> + <a-date-picker format="YYYY-MM-DD" valueFormat="YYYY-MM-DD HH:mm:ss" v-model="memObject.birthday" style="width: 60%" /> </a-form-model-item> </a-col> </a-row> @@ -69,7 +69,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="nation"> - <para-select v-model="formData.nation" :typeId="11" :width="120" @changeTitle="(e)=>{ formData.nationName = e}" /> + <para-select v-model="memObject.nation" :typeId="11" :width="120" @changeTitle="(e)=>{ memObject.nationName = e}" /> </a-form-model-item> </a-col> <a-col :span="4" class="bg-gray"> @@ -79,7 +79,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="country"> - <a-input v-model="formData.country" :maxLength="50" placeholder="国别或地区" style="width: 60%" /> + <a-input v-model="memObject.country" :maxLength="50" placeholder="国别或地区" style="width: 60%" /> </a-form-model-item> </a-col> </a-row> @@ -91,7 +91,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="workUnit"> - <a-input v-model="formData.workUnit" :maxLength="50" placeholder="工作单位" style="width: 60%" /> + <a-input v-model="memObject.workUnit" :maxLength="50" placeholder="工作单位" style="width: 60%" /> </a-form-model-item> </a-col> <a-col :span="4" class="bg-gray"> @@ -101,7 +101,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="degree"> - <para-select v-model="formData.degree" :typeId="9" :width="120" @changeTitle="(e)=>{ formData.degreeName = e}" /> + <para-select v-model="memObject.degree" :typeId="9" :width="120" @changeTitle="(e)=>{ memObject.degreeName = e}" /> </a-form-model-item> </a-col> </a-row> @@ -113,7 +113,7 @@ </a-col> <a-col :span="20"> <a-form-model-item prop="spec"> - <para-multi-select v-model="formData.spec" :typeId="42" :width="120" @changeTitle="(e)=>{ formData.specName = e}" /> + <para-multi-select v-model="memObject.spec" :typeId="42" :width="120" @changeTitle="(e)=>{ memObject.specName = e}" /> </a-form-model-item> </a-col> </a-row> @@ -125,7 +125,7 @@ </a-col> <a-col :span="20"> <a-form-model-item prop="title"> - <para-multi-select v-model="formData.title" :typeId="7" :width="120" @changeTitle="(e)=>{ formData.titleName = e}" /> + <para-multi-select v-model="memObject.title" :typeId="7" :width="120" @changeTitle="(e)=>{ memObject.titleName = e}" /> </a-form-model-item> </a-col> </a-row> @@ -137,7 +137,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="email"> - <a-input v-model="formData.email" :maxLength="50" placeholder="电子邮箱" style="width: 60%" /> + <a-input v-model="memObject.email" :maxLength="50" placeholder="电子邮箱" style="width: 60%" /> </a-form-model-item> </a-col> <a-col :span="4" class="bg-gray"> @@ -147,7 +147,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="mobile"> - <a-input v-model="formData.mobile" :maxLength="20" placeholder="手机" style="width: 60%" /> + <a-input v-model="memObject.mobile" :maxLength="20" placeholder="手机" style="width: 60%" /> </a-form-model-item> </a-col> </a-row> @@ -159,7 +159,7 @@ </a-col> <a-col :span="20"> <a-form-model-item prop="telephone"> - <a-input v-model="formData.telephone" :maxLength="20" placeholder="电话号码" style="width: 60%" /> + <a-input v-model="memObject.telephone" :maxLength="20" placeholder="电话号码" style="width: 60%" /> </a-form-model-item> </a-col> </a-row> @@ -171,7 +171,7 @@ </a-col> <a-col :span="20"> <a-form-model-item prop="fax"> - <a-input v-model="formData.fax" :maxLength="20" placeholder="传真" style="width: 60%" /> + <a-input v-model="memObject.fax" :maxLength="20" placeholder="传真" style="width: 60%" /> </a-form-model-item> </a-col> </a-row> --> @@ -183,7 +183,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="projWork"> - <a-input v-model="formData.projWork" :maxLength="20" placeholder="项目分工" style="width: 60%" /> + <a-input v-model="memObject.projWork" :maxLength="20" placeholder="项目分工" style="width: 60%" /> </a-form-model-item> </a-col> <a-col :span="4" class="bg-gray"> @@ -193,7 +193,7 @@ </a-col> <a-col :span="8"> <a-form-model-item prop="forMonths"> - <a-input-number v-model="formData.forMonths" :min="0" :step="0.1" style="width: 60%" /> + <a-input-number v-model="memObject.forMonths" :min="0" :step="0.1" style="width: 60%" /> </a-form-model-item> </a-col> </a-row> @@ -249,7 +249,7 @@ export default { return [] } }, - formData: { + memObject: { type: Object, default: () => { return {} @@ -261,18 +261,15 @@ export default { }, methods: { submit () { - this.formData._key = Math.random().toString(16).substring(2, 8) - this.$emit('close', this.formData) - // this.$refs.form.validate(valid => { - // if (valid) { - // this.members.push(this.formData) - // this.$emit('close', 'value') - // console.log(this.members) - // } else { - // this.$message.error('项目信息未填写完全!') - // return false - // } - // }) + this.memObject._key = Math.random().toString(16).substring(2, 8) + this.$refs.form.validate(valid => { + if (valid) { + this.$emit('close', this.memObject) + } else { + this.$message.error('项目信息未填写完全!') + return false + } + }) }, }, } diff --git a/src/views/report/project/components/projectMemberEdit.vue b/src/views/report/project/components/projectMemberEdit.vue index 6ae4af6..8398281 100644 --- a/src/views/report/project/components/projectMemberEdit.vue +++ b/src/views/report/project/components/projectMemberEdit.vue @@ -240,6 +240,7 @@ <a-popconfirm title="确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="removeMembers(item)"> <a-button type="link" size="small">删除</a-button> </a-popconfirm> + <a-button type="link" size="small" @click="editMember(item,index)">修改</a-button> </div> </div> </a-col> @@ -247,7 +248,7 @@ </div> <a-modal v-model="visibleEdit" v-if="visibleEdit" title="项目组成员(添加/修改)" width="60%" :footer="null" :dialog-style="{ top: '20%' }" destroyOnClose :maskClosable="false"> - <member-edit :formData.sync="memObject" @close="closeWindow" /> + <member-edit :memObject.sync="memObject" @close="closeWindow" /> </a-modal> </div> </template> @@ -287,6 +288,8 @@ export default { data () { return { memObject: {}, + isEdit: false, + memIndex: 0, visibleEdit: false, } }, @@ -305,10 +308,23 @@ export default { }, methods: { closeWindow (value) { - this.memObject = {} - this.visibleEdit = false - this.dataList.push(value) - console.log(this.dataList) + if (!this.isEdit) { + this.memObject = {} + this.dataList.push(value) + this.visibleEdit = false + } else { + this.dataList.splice(this.memIndex, 1, value); + this.memObject = {} + this.memIndex = 0 + this.isEdit = false + this.visibleEdit = false + } + }, + editMember (obj, index) { + this.memObject = obj + this.isEdit = true + this.memIndex = index + this.visibleEdit = true }, addMember () {//添加成员 this.memObject = { ...Member } @@ -339,5 +355,4 @@ export default { } </script> <style scoped lang="less"> - </style> -- 2.18.0