|
@@ -26,11 +26,11 @@
|
|
|
<el-table v-loading="loading" :data="tableData" border header-row-class-name="custom-table-header" @sort-change="sortChange">
|
|
|
<el-table-column align="center" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-checkbox @change="onChange(scope.row)" v-if="refresh"
|
|
|
- :checked="mergedList.indexOf(scope.row.name) !== -1"></el-checkbox>
|
|
|
+ <el-checkbox @change="(val)=>onChange(val,scope.row)" v-if="refresh"
|
|
|
+ :checked="mergedList.findIndex(item=> item.name == scope.row.name) !== -1"></el-checkbox>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="名称" sortable align="center" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="name" label="名称" align="center" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column prop="address" label="地址" align="center" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column label="操作" align="center" width="100">
|
|
@@ -56,12 +56,12 @@
|
|
|
<el-dialog :title="mergeTitle" :visible.sync="visible" width="500px" append-to-body destroy-on-close
|
|
|
:before-close="closeDialog" top="3vh">
|
|
|
<div class="patent-applicant-merge-select">
|
|
|
- <template v-if="ruleForm.id">
|
|
|
+ <div style="margin-bottom:20px">
|
|
|
<el-divider content-position="left">基本信息</el-divider>
|
|
|
- <div style="display:flex;justify-content: flex-end;margin: 10px 0 10px 0px;">
|
|
|
+ <!-- <div style="display:flex;justify-content: flex-end;margin: 10px 0 10px 0px;">
|
|
|
<el-button type="primary" size="small" :loading="btnLoading" @click="handleSave">保存</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ </div> -->
|
|
|
+ </div>
|
|
|
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="80px">
|
|
|
<el-form-item label="名称" prop="name">
|
|
|
<el-input v-model="ruleForm.name" placeholder="请输入名称"></el-input>
|
|
@@ -88,15 +88,18 @@
|
|
|
<el-input v-model="ruleForm.remark" placeholder="请输入备注" type="textarea"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <template v-if="ruleForm.id">
|
|
|
- <div style="margin: 20px 0px;">
|
|
|
+ <template >
|
|
|
+ <div style="margin: 20px 0px 0px 0px;">
|
|
|
<el-divider content-position="left">合并信息</el-divider>
|
|
|
+ <div style="display:flex;justify-content: flex-end;margin: 10px 0 10px 0px;">
|
|
|
+ <el-button type="primary" size="small" @click="addName">新增</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <el-table :data="ruleForm.mergedName" border header-row-class-name="custom-table-header">
|
|
|
+ <el-table :data="ruleFormTableData" border header-row-class-name="custom-table-header">
|
|
|
<el-table-column prop="name" label="合并人名称" align="center" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
- {{ scope.row }}
|
|
|
+ {{ scope.row.name }}
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -105,7 +108,7 @@
|
|
|
<el-table-column prop="address" label="地址" align="center" show-overflow-tooltip></el-table-column> -->
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-link type="danger" @click="handleDelete(scope.row)">移除</el-link>
|
|
|
+ <el-link type="danger" @click="handleDelete(scope)">移除</el-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -113,16 +116,19 @@
|
|
|
</div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="closeDialog">关 闭</el-button>
|
|
|
- <el-button v-if="!ruleForm.id" :loading="btnLoading" type="primary" @click="handleSave">确认</el-button>
|
|
|
+ <!-- <el-button v-if="!ruleForm.id" :loading="btnLoading" type="primary" @click="handleSave">确认</el-button> -->
|
|
|
+ <el-button :loading="btnLoading" type="primary" @click="handleSave">确认</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
+ <mergeTableDialog ref="mergeTableDialog" :projectId="projectId" :mergeType="mergeType" @checked="getChecked"></mergeTableDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import mergeTableDialog from './mergeTableDialog.vue'
|
|
|
export default {
|
|
|
components: {
|
|
|
+ mergeTableDialog
|
|
|
},
|
|
|
props: {
|
|
|
projectId: '',
|
|
@@ -137,8 +143,7 @@ export default {
|
|
|
loading: false,
|
|
|
// 表格的数据源
|
|
|
tableData: [],
|
|
|
- // 存放勾选的值的数据(已合并的)
|
|
|
- mergedData: {},
|
|
|
+ // 存放勾选的值的数据
|
|
|
mergedList: [],
|
|
|
//检索字段
|
|
|
searchFiled: [
|
|
@@ -171,6 +176,7 @@ export default {
|
|
|
mergeTitle: '',
|
|
|
// 基本信息的数据
|
|
|
ruleForm: {},
|
|
|
+ ruleFormTableData:[],
|
|
|
// 校验
|
|
|
rules: {
|
|
|
name: [{ required: true, message: '请输入名称', trigger: 'blur' },],
|
|
@@ -179,14 +185,10 @@ export default {
|
|
|
commonData: {},
|
|
|
// 省市区地址
|
|
|
areaOptions: [],
|
|
|
- // 合并信息的数据源
|
|
|
- // mergeTable: [],
|
|
|
- // 国家
|
|
|
- commonData: {},
|
|
|
- // 地区
|
|
|
- areaTree: [],
|
|
|
/**编辑合并人及基本信息 end*/
|
|
|
- btnLoading:false
|
|
|
+ btnLoading:false,
|
|
|
+ //是否有修改
|
|
|
+ hasChange:false,
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -211,35 +213,43 @@ export default {
|
|
|
this.ruleForm.province = this.$refs.myCascader.getCheckedNodes()[0].pathLabels[0]
|
|
|
},
|
|
|
// 移除合并人员
|
|
|
- handleDelete(row) {
|
|
|
- let params = {
|
|
|
- projectId: this.projectId,
|
|
|
- name: this.ruleForm.name,
|
|
|
- delName: row,
|
|
|
- type: this.mergeType,
|
|
|
+ handleDelete(scope) {
|
|
|
+ var row = scope.row
|
|
|
+ this.ruleFormTableData.splice(scope.$index, 1)
|
|
|
+ if(row.sign){
|
|
|
+ if(!this.ruleForm.delMergePersonDTOS){
|
|
|
+ this.ruleForm.delMergePersonDTOS = []
|
|
|
+ }
|
|
|
+ this.ruleForm.delMergePersonDTOS.push(row)
|
|
|
}
|
|
|
- this.$confirm('此操作将删除该人员, 是否继续?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.$api.delMergedName(params).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$message.success('移除人员成功')
|
|
|
- this.$emit('close')
|
|
|
|
|
|
- let index = this.ruleForm.mergedName.findIndex(item => {
|
|
|
- return item == row
|
|
|
- })
|
|
|
- if (index != -1) {
|
|
|
- this.ruleForm.mergedName.splice(index, 1)
|
|
|
- }
|
|
|
- // this.getMerge(this.ruleForm)
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(() => {
|
|
|
- this.$message.info('已取消操作');
|
|
|
- });
|
|
|
+ // let params = {
|
|
|
+ // projectId: this.projectId,
|
|
|
+ // name: this.ruleForm.name,
|
|
|
+ // delName: row.name,
|
|
|
+ // type: this.mergeType,
|
|
|
+ // }
|
|
|
+ // this.$confirm('此操作将删除该人员, 是否继续?', '提示', {
|
|
|
+ // confirmButtonText: '确定',
|
|
|
+ // cancelButtonText: '取消',
|
|
|
+ // type: 'warning'
|
|
|
+ // }).then(() => {
|
|
|
+ // this.$api.delMergedName(params).then(res => {
|
|
|
+ // if (res.code == 200) {
|
|
|
+ // this.$message.success('移除人员成功')
|
|
|
+ // // this.$emit('close')
|
|
|
+ // this.hasChange = true
|
|
|
+ // let index = this.ruleForm.mergedName.indexOf(row.name)
|
|
|
+ // if (index != -1) {
|
|
|
+ // this.ruleFormTableData.splice(scope.$index, 1)
|
|
|
+ // this.ruleForm.mergedName.splice(index, 1)
|
|
|
+ // }
|
|
|
+ // // this.getMerge(this.ruleForm)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }).catch(() => {
|
|
|
+ // this.$message.info('已取消操作');
|
|
|
+ // });
|
|
|
|
|
|
},
|
|
|
// 查询合并的数据
|
|
@@ -252,6 +262,13 @@ export default {
|
|
|
this.$api.selectMergePersonDetail(params).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
this.ruleForm = res.data
|
|
|
+ var data = this.ruleForm.mergedName
|
|
|
+ this.ruleFormTableData = data.map(item=>{
|
|
|
+ return {
|
|
|
+ name:item,
|
|
|
+ sign:true
|
|
|
+ }
|
|
|
+ })
|
|
|
this.getShowProvince()
|
|
|
}
|
|
|
})
|
|
@@ -298,20 +315,38 @@ export default {
|
|
|
// 关闭弹窗
|
|
|
closeDialog() {
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
- // if (this.ruleForm.needMergedName && this.ruleForm.needMergedName.length == 0) {
|
|
|
- if (this.ruleForm.id) {
|
|
|
- this.ruleForm = {
|
|
|
- needMergedName: [],
|
|
|
- mergedName: [],
|
|
|
- }
|
|
|
- this.$set(this, 'mergedList', [])
|
|
|
- this.refresh = false
|
|
|
- this.$nextTick(() => {
|
|
|
- this.refresh = true
|
|
|
- })
|
|
|
- }
|
|
|
this.visible = false
|
|
|
},
|
|
|
+ clearRuleForm(){
|
|
|
+ this.ruleForm = {}
|
|
|
+ this.$set(this, 'mergedList', [])
|
|
|
+ this.refresh = false
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.refresh = true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //编辑时候添加申请人
|
|
|
+ addName(){
|
|
|
+ var titles={
|
|
|
+ 0:'选择申请人/权利人',
|
|
|
+ 2:'选择发明人'
|
|
|
+ }
|
|
|
+ var data = this.ruleFormTableData.filter(item=>{
|
|
|
+ return !item.sign
|
|
|
+ })
|
|
|
+ var disabled = [
|
|
|
+ {
|
|
|
+ mergeId:this.ruleForm.id
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ this.$refs.mergeTableDialog.open(titles[this.mergeType],data,disabled)
|
|
|
+ },
|
|
|
+ getChecked(value){
|
|
|
+ var signData = this.ruleFormTableData.filter(item=>{
|
|
|
+ return item.sign
|
|
|
+ })
|
|
|
+ this.ruleFormTableData = signData.concat(value)
|
|
|
+ },
|
|
|
// 弹窗中的完成和保存事件
|
|
|
handleSave() {
|
|
|
this.$refs.ruleForm.validate((valid) => {
|
|
@@ -319,81 +354,76 @@ export default {
|
|
|
this.ruleForm.projectId = this.projectId
|
|
|
this.ruleForm.type = this.mergeType
|
|
|
this.btnLoading = true
|
|
|
- // if (this.title.indexOf('新增') != -1) {//新增
|
|
|
- if (this.ruleForm.needMergedName && this.ruleForm.needMergedName.length == 0) {//新增
|
|
|
- // this.ruleForm.mergedName = this.mergedName
|
|
|
- this.$api.mergePerson(this.ruleForm).then(res => {
|
|
|
+ var api = 'commonMerge'
|
|
|
+ var message = {
|
|
|
+ success:'',
|
|
|
+ error:''
|
|
|
+ }
|
|
|
+
|
|
|
+ // if(this.ruleFormTableData.length>0){
|
|
|
+ // for(var i =0;i<this.ruleFormTableData.length;i++){
|
|
|
+ // var item = this.ruleFormTableData[i]
|
|
|
+ // if(item.mergeId){
|
|
|
+ // this.ruleForm.needMergedName.push(item.name)
|
|
|
+ // }else{
|
|
|
+ // this.ruleForm.mergedName.push(item.name)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ this.ruleForm.mergePersonDTOS = this.ruleFormTableData.filter(item=>{
|
|
|
+ return !item.sign
|
|
|
+ })
|
|
|
+ if(this.ruleForm.id){//编辑
|
|
|
+ // api = 'updateMergePerson'
|
|
|
+ message = {
|
|
|
+ success:'编辑成功',
|
|
|
+ error:'编辑失败'
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ message = {
|
|
|
+ success:'合并成功',
|
|
|
+ error:'合并失败'
|
|
|
+ }
|
|
|
+ // if (this.ruleForm.needMergedName && this.ruleForm.needMergedName.length == 0) {//新增
|
|
|
+ // api = 'mergePerson'
|
|
|
+ // message = {
|
|
|
+ // success:'合并成功',
|
|
|
+ // error:'合并失败'
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // api = 'mergePersonAgain'
|
|
|
+ // message = {
|
|
|
+ // success:'合并成功',
|
|
|
+ // error:'合并失败'
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$api[api](this.ruleForm).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- this.$message.success('合并成功')
|
|
|
- this.$emit('close')
|
|
|
+ this.$message.success(message.success)
|
|
|
+ // this.$emit('close')
|
|
|
+ this.hasChange = true
|
|
|
this.mergedList = []
|
|
|
this.btnLoading = false
|
|
|
+ this.clearRuleForm()
|
|
|
this.closeDialog()
|
|
|
- // this.close()
|
|
|
this.getList()
|
|
|
}
|
|
|
}).catch(error=>{
|
|
|
- this.$message.error('合并失败')
|
|
|
+ this.$message.error(message.error)
|
|
|
this.btnLoading = false
|
|
|
})
|
|
|
- } else {
|
|
|
- if (this.ruleForm.needMergedName && this.ruleForm.needMergedName.length > 0) {//
|
|
|
- this.$api.mergePersonAgain(this.ruleForm).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$message.success('编辑成功')
|
|
|
- this.$emit('close')
|
|
|
- this.btnLoading = false
|
|
|
- this.closeDialog()
|
|
|
- // this.close()
|
|
|
- this.getList()
|
|
|
- }
|
|
|
- }).catch(error=>{
|
|
|
- this.$message.error('编辑失败')
|
|
|
- this.btnLoading = false
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$api.updateMergePerson(this.ruleForm).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$message.success('编辑成功')
|
|
|
- this.$emit('close')
|
|
|
- this.btnLoading = false
|
|
|
- this.closeDialog()
|
|
|
- // this.close()
|
|
|
- this.getList()
|
|
|
-
|
|
|
- }
|
|
|
- }).catch(error=>{
|
|
|
- this.$message.error('编辑失败')
|
|
|
- this.btnLoading = false
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- onChange(row) {
|
|
|
- const index = this.mergedList.indexOf(row.name)
|
|
|
- if (index === -1) {
|
|
|
- this.mergedList.push(row.name)
|
|
|
+ onChange(val,row) {
|
|
|
+ if (val) {
|
|
|
+ this.mergedList.push(row)
|
|
|
} else {
|
|
|
- this.mergedList.splice(index, 1)
|
|
|
- }
|
|
|
- if (row.mergeId) {//已合并过的名称
|
|
|
- const index2 = this.ruleForm.needMergedName.indexOf(row.name)
|
|
|
- if (index2 === -1) {
|
|
|
- this.ruleForm.needMergedName.push(row.name)
|
|
|
- } else {
|
|
|
- this.ruleForm.needMergedName.splice(index, 1)
|
|
|
- }
|
|
|
- for (let k in row) {
|
|
|
- this.$set(this.mergedData, [k], row[k])
|
|
|
- }
|
|
|
- } else {//未合并的名称
|
|
|
- const index3 = this.ruleForm.mergedName.indexOf(row.name)
|
|
|
- if (index3 === -1) {
|
|
|
- this.ruleForm.mergedName.push(row.name)
|
|
|
- } else {
|
|
|
- this.ruleForm.mergedName.splice(index, 1)
|
|
|
+ var index = this.mergedList.findIndex(item => item.name == row.name)
|
|
|
+ if(index!=-1){
|
|
|
+ this.mergedList.splice(index, 1)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -404,35 +434,24 @@ export default {
|
|
|
this.$message.error(text)
|
|
|
return false
|
|
|
}
|
|
|
-
|
|
|
- // if (this.title.indexOf('新增') != -1) {//新增
|
|
|
- if (this.ruleForm.needMergedName && this.ruleForm.needMergedName.length > 0) {//编辑直接合并,不填写信息
|
|
|
-
|
|
|
- this.mergeTitle = '编辑合并'
|
|
|
- if (this.ruleForm.needMergedName.length > 0) {
|
|
|
- for (let k in this.mergedData) {
|
|
|
- this.$set(this.ruleForm, [k], this.mergedData[k])
|
|
|
- }
|
|
|
- this.getShowProvince()
|
|
|
- } else {
|
|
|
- for (let k in this.mergedData) {
|
|
|
- this.$set(this.ruleForm, [k], '')
|
|
|
- }
|
|
|
- }
|
|
|
- this.visible = true
|
|
|
- } else {//新增
|
|
|
- this.ruleForm.id = null
|
|
|
- this.mergeTitle = '新增合并'
|
|
|
- this.visible = true
|
|
|
+ this.mergeTitle = '合并'
|
|
|
+ var mergedData = this.mergedList[this.mergedList.length-1]
|
|
|
+ // for (let k in mergedData) {
|
|
|
+ // this.$set(this.ruleForm, [k], mergedData[k])
|
|
|
+ // }
|
|
|
+ this.ruleForm = {
|
|
|
+ ...mergedData
|
|
|
}
|
|
|
+ this.getShowProvince()
|
|
|
+ this.ruleForm.id = null
|
|
|
+ this.ruleFormTableData = this.mergedList
|
|
|
+ this.visible = true
|
|
|
},
|
|
|
// 打开抽屉
|
|
|
open(row, title) {
|
|
|
this.mergeType = row.mergeType
|
|
|
this.title = title
|
|
|
- this.ruleForm.needMergedName = [],
|
|
|
- this.ruleForm.mergedName = [],
|
|
|
- this.getList()
|
|
|
+ this.getList()
|
|
|
this.drawer = true
|
|
|
// 获取国家和地区的数据
|
|
|
if (this.mergeType == 0) {
|
|
@@ -559,11 +578,16 @@ export default {
|
|
|
},
|
|
|
// 关闭抽屉
|
|
|
close() {
|
|
|
- this.ruleForm = {
|
|
|
- needMergedName: [],
|
|
|
- mergedName: [],
|
|
|
- }
|
|
|
+ this.queryParams ={
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ this.searchOption = {}
|
|
|
this.mergedList = []
|
|
|
+ if(this.hasChange){
|
|
|
+ this.$emit('close')
|
|
|
+ this.hasChange = false
|
|
|
+ }
|
|
|
this.drawer = false
|
|
|
},
|
|
|
// 获取国家和地区
|