|
@@ -6,8 +6,17 @@
|
|
|
<el-header style="display:flex;align-items:center;justify-content: space-between;">
|
|
|
<!-- 检索 -->
|
|
|
<div>
|
|
|
- <mySearch style="width: 500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption">
|
|
|
- </mySearch>
|
|
|
+ <el-form :inline="true" class="margin-left_20">
|
|
|
+ <el-form-item label="名称">
|
|
|
+ <el-input v-model="queryParams.name" size="small" placeholder="请输入名称"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" size="small" @click="getList">查询</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <!-- 后端没有根据检索式检索 -->
|
|
|
+ <!-- <mySearch style="width: 500px" :SearchFields="searchFiled" @search="search" :searchValue="searchOption">
|
|
|
+ </mySearch> -->
|
|
|
</div>
|
|
|
<el-button type="primary" size="small" @click="handleMerge">合并</el-button>
|
|
|
</el-header>
|
|
@@ -60,12 +69,12 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="国家" prop="country">
|
|
|
<el-select v-model="ruleForm.country" placeholder="请选择" filterable class="width_100">
|
|
|
- <el-option v-for="(item, index) in commonData.COUNTRIES" :label="item.label" :key="index"
|
|
|
- :value="item.value"></el-option>
|
|
|
+ <el-option v-for="(item, index) in commonData" :label="item.label" :key="index"
|
|
|
+ :value="item.label"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="地址" prop="addressIds">
|
|
|
- <el-cascader @change="onChangeAddress" v-model="addressIds" :options="areaOptions" :props="props"
|
|
|
+ <el-form-item label="地址" prop="province">
|
|
|
+ <el-cascader ref="myCascader" @change="changeCas" v-model="ruleForm.provinceOld" :options="areaOptions"
|
|
|
class="width_100"></el-cascader>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
@@ -126,7 +135,7 @@ export default {
|
|
|
// 表格的数据源
|
|
|
tableData: [],
|
|
|
// 存放勾选的值的数据(已合并的)
|
|
|
- mergedData: null,
|
|
|
+ mergedData: {},
|
|
|
mergedList: [],
|
|
|
//检索字段
|
|
|
searchFiled: [
|
|
@@ -179,6 +188,9 @@ export default {
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
+ changeCas(val) {
|
|
|
+ this.ruleForm.province=this.$refs.myCascader.getCheckedNodes()[0].pathLabels[0]
|
|
|
+ },
|
|
|
// 移除合并人员
|
|
|
handleDelete(row) {
|
|
|
let params = {
|
|
@@ -196,6 +208,13 @@ export default {
|
|
|
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)
|
|
|
}
|
|
|
})
|
|
@@ -226,12 +245,12 @@ export default {
|
|
|
// 关闭弹窗
|
|
|
closeDialog() {
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
- if (this.ruleForm.needMergedName && this.ruleForm.needMergedName.length == 0) {
|
|
|
- this.ruleForm = {
|
|
|
- needMergedName: [],
|
|
|
- mergeName: [],
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (this.ruleForm.needMergedName && this.ruleForm.needMergedName.length == 0) {
|
|
|
+ // this.ruleForm = {
|
|
|
+ // needMergedName: [],
|
|
|
+ // mergedName: [],
|
|
|
+ // }
|
|
|
+ // }
|
|
|
this.visible = false
|
|
|
},
|
|
|
// 弹窗中的完成和保存事件
|
|
@@ -240,31 +259,48 @@ export default {
|
|
|
if (valid) {
|
|
|
this.ruleForm.projectId = this.projectId
|
|
|
this.ruleForm.type = this.mergeType
|
|
|
- if (this.title.indexOf('新增') != -1) {//新增
|
|
|
+ // 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 => {
|
|
|
if (res.code == 200) {
|
|
|
this.$message.success('合并成功')
|
|
|
this.$emit('close')
|
|
|
this.mergedList = []
|
|
|
- this.getList()
|
|
|
this.closeDialog()
|
|
|
- // this.close()
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$api.save(this.ruleForm).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$message.success('编辑成功')
|
|
|
- this.$emit('close')
|
|
|
+ this.close()
|
|
|
this.getList()
|
|
|
}
|
|
|
})
|
|
|
+ } 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.closeDialog()
|
|
|
+ this.close()
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$api.updateMergePerson(this.ruleForm).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success('编辑成功')
|
|
|
+ this.$emit('close')
|
|
|
+ this.closeDialog()
|
|
|
+ this.close()
|
|
|
+ this.getList()
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
onChange(row) {
|
|
|
+ console.log(row);
|
|
|
const index = this.mergedList.indexOf(row.name)
|
|
|
if (index === -1) {
|
|
|
this.mergedList.push(row.name)
|
|
@@ -278,16 +314,18 @@ export default {
|
|
|
} else {
|
|
|
this.ruleForm.needMergedName.splice(index, 1)
|
|
|
}
|
|
|
- this.mergedData = row
|
|
|
-
|
|
|
+ for (let k in row) {
|
|
|
+ this.$set(this.mergedData, [k], row[k])
|
|
|
+ }
|
|
|
} else {//未合并的名称
|
|
|
- const index3 = this.ruleForm.mergeName.indexOf(row.name)
|
|
|
+ const index3 = this.ruleForm.mergedName.indexOf(row.name)
|
|
|
if (index3 === -1) {
|
|
|
- this.ruleForm.mergeName.push(row.name)
|
|
|
+ this.ruleForm.mergedName.push(row.name)
|
|
|
} else {
|
|
|
- this.ruleForm.mergeName.splice(index, 1)
|
|
|
+ this.ruleForm.mergedName.splice(index, 1)
|
|
|
}
|
|
|
}
|
|
|
+ console.log(row, this.ruleForm,this.mergedList);
|
|
|
},
|
|
|
// 合并事件
|
|
|
handleMerge() {
|
|
@@ -296,22 +334,28 @@ export default {
|
|
|
this.$message.error(text)
|
|
|
return false
|
|
|
}
|
|
|
- if (this.title.indexOf('新增') != -1) {//新增
|
|
|
- this.mergeTitle = '新增合并'
|
|
|
- this.visible = true
|
|
|
- } else {//编辑直接合并,不填写信息
|
|
|
+
|
|
|
+ console.log(this.ruleForm);
|
|
|
+ // 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.ruleForm[k] = this.mergedData[k]
|
|
|
+ this.$set(this.ruleForm, [k], this.mergedData[k])
|
|
|
}
|
|
|
} else {
|
|
|
for (let k in this.mergedData) {
|
|
|
- this.ruleForm[k] = ''
|
|
|
+ this.$set(this.ruleForm, [k], '')
|
|
|
}
|
|
|
+ console.log(123);
|
|
|
}
|
|
|
console.log(this.ruleForm);
|
|
|
this.visible = true
|
|
|
+ } else {//新增
|
|
|
+ this.ruleForm.id = null
|
|
|
+ this.mergeTitle = '新增合并'
|
|
|
+ this.visible = true
|
|
|
}
|
|
|
},
|
|
|
// 打开抽屉
|
|
@@ -319,12 +363,13 @@ export default {
|
|
|
this.mergeType = row.mergeType
|
|
|
this.title = title
|
|
|
this.ruleForm.needMergedName = [],
|
|
|
- this.ruleForm.mergeName = [],
|
|
|
+ this.ruleForm.mergedName = [],
|
|
|
this.getList()
|
|
|
this.drawer = true
|
|
|
// 获取国家和地区的数据
|
|
|
if (this.mergeType == 0) {
|
|
|
this.getAllCountry()
|
|
|
+ this.getAreaList()
|
|
|
}
|
|
|
},
|
|
|
//获取检索条件检索
|
|
@@ -373,6 +418,11 @@ export default {
|
|
|
},
|
|
|
// 关闭抽屉
|
|
|
close() {
|
|
|
+ this.ruleForm = {
|
|
|
+ needMergedName: [],
|
|
|
+ mergedName: [],
|
|
|
+ }
|
|
|
+ this.mergedList = []
|
|
|
this.drawer = false
|
|
|
},
|
|
|
// 获取国家和地区
|
|
@@ -383,8 +433,8 @@ export default {
|
|
|
},
|
|
|
// 获取中国所有地区(省、自治区、特别行政区)
|
|
|
getAreaList() {
|
|
|
- this.$api.getArea().then(response => {
|
|
|
- this.areaTree = response.data
|
|
|
+ this.$api.getAllProvince().then(response => {
|
|
|
+ this.areaOptions = response.data
|
|
|
})
|
|
|
},
|
|
|
},
|