|
@ -1,437 +1,488 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div class="my_form"> |
|
|
<div class="my_form"> |
|
|
<el-table border :data="tableData" style="width: 100%" height="200"> |
|
|
<el-table border :data="tableData" style="width: 100%" height="200"> |
|
|
<el-table-column label="选择数据源" align="center" width="120"> |
|
|
<el-table-column label="选择数据源" align="center" width="120"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-select v-model="scope.row.dataSource" placeholder="请选择" |
|
|
<el-select |
|
|
@change="handleChangeSource(scope.row, scope.$index)" clearable> |
|
|
v-model="scope.row.dataSource" |
|
|
<el-option v-for="item in dataSourceOpction" :label="item.label" :value="item.value" |
|
|
placeholder="请选择" |
|
|
:key="item.value"> |
|
|
@change="handleChangeSource(scope.row, scope.$index)" |
|
|
</el-option> |
|
|
clearable |
|
|
</el-select> |
|
|
> |
|
|
</template> |
|
|
<el-option |
|
|
</el-table-column> |
|
|
v-for="item in dataSourceOpction" |
|
|
<el-table-column label="字段类别" align="center" width="120"> |
|
|
:label="item.label" |
|
|
<template slot-scope="scope" v-if="scope.row.dataSource == 'resi'"> |
|
|
:value="item.value" |
|
|
<el-select v-model="scope.row.itemGroupId" placeholder="请选择" clearable |
|
|
:key="item.value" |
|
|
@change="handleChangeFieldsType(scope.row, scope.$index)"> |
|
|
> |
|
|
<el-option v-for="item in scope.row.itemGroupIdOpction" :label="item.label" :value="item.id" |
|
|
</el-option> |
|
|
:key="item.id"> |
|
|
</el-select> |
|
|
</el-option> |
|
|
</template> |
|
|
</el-select> |
|
|
</el-table-column> |
|
|
</template> |
|
|
<el-table-column label="字段类别" align="center" width="120"> |
|
|
</el-table-column> |
|
|
<template slot-scope="scope" v-if="scope.row.dataSource == 'resi'"> |
|
|
<el-table-column label="字段名称" align="center" width="120"> |
|
|
<el-select |
|
|
<template slot-scope="scope"> |
|
|
v-model="scope.row.itemGroupId" |
|
|
<el-select v-model="scope.row.itemId" placeholder="请选择" |
|
|
placeholder="请选择" |
|
|
@change="handleChangeFieldsName(scope.row, scope.$index)" |
|
|
clearable |
|
|
@clear="handleClearItemId(scope.row, scope.$index)" clearable> |
|
|
@change="handleChangeFieldsType(scope.row, scope.$index)" |
|
|
<el-option v-for="item in scope.row.itemIdOpction" :label="item.label" :value="scope.row.dataSource == 'resi' ? item.itemId : item.colKey |
|
|
> |
|
|
" :key="scope.row.dataSource == 'resi' ? item.itemId : item.colKey"> |
|
|
<el-option |
|
|
</el-option> |
|
|
v-for="item in scope.row.itemGroupIdOpction" |
|
|
</el-select> |
|
|
:label="item.label" |
|
|
</template> |
|
|
:value="item.id" |
|
|
</el-table-column> |
|
|
:key="item.id" |
|
|
<el-table-column label="比较符" align="center" width="120"> |
|
|
> |
|
|
<template slot-scope="scope"> |
|
|
</el-option> |
|
|
<el-select v-model="scope.row.queryType" placeholder="请选择" clearable> |
|
|
</el-select> |
|
|
<el-option v-for="item in queryTypeOpction" :label="item.label" :value="item.value" |
|
|
</template> |
|
|
:key="item.value"> |
|
|
</el-table-column> |
|
|
</el-option> |
|
|
<el-table-column label="字段名称" align="center" width="120"> |
|
|
</el-select> |
|
|
<template slot-scope="scope"> |
|
|
</template> |
|
|
<el-select |
|
|
</el-table-column> |
|
|
v-model="scope.row.itemId" |
|
|
<el-table-column label="对应值" width="120" align="center"> |
|
|
placeholder="请选择" |
|
|
<template slot-scope="scope"> |
|
|
@change="handleChangeFieldsName(scope.row, scope.$index)" |
|
|
<template v-for="item in scope.row.correspondingOpction"> |
|
|
@clear="handleClearItemId(scope.row, scope.$index)" |
|
|
<el-select v-if="item.itemType == 'select' || |
|
|
clearable |
|
|
item.itemType == 'radio' || |
|
|
> |
|
|
item.itemType == 'checkbox' |
|
|
<el-option |
|
|
" v-model="scope.row.colVal" placeholder="请选择" clearable> |
|
|
v-for="item in scope.row.itemIdOpction" |
|
|
<el-option v-for="items in item.options" :label="items.label" :value="items.value" |
|
|
:label="item.label" |
|
|
:key="items.label"> |
|
|
:value=" |
|
|
</el-option> |
|
|
scope.row.dataSource == 'resi' ? item.itemId : item.colKey |
|
|
</el-select> |
|
|
" |
|
|
<el-input v-else-if="item.itemType === 'input' || item.itemType === 'textarea' |
|
|
:key="scope.row.dataSource == 'resi' ? item.itemId : item.colKey" |
|
|
" v-model="scope.row.colVal" placeholder="请输入" clearable> |
|
|
> |
|
|
</el-input> |
|
|
</el-option> |
|
|
<el-input-number v-else-if="item.itemType === 'inputNum'" class="item_width_2" |
|
|
</el-select> |
|
|
v-model="scope.row.colVal" :min="0" size="mini" label="请输入"></el-input-number> |
|
|
</template> |
|
|
<el-date-picker v-else-if="item.itemType === 'datepicker' || item.itemType === 'date' |
|
|
</el-table-column> |
|
|
" v-model="scope.row.colVal" class="item_width_2" type="datetime" |
|
|
<el-table-column label="比较符" align="center" width="120"> |
|
|
value-format="yyyy-MM-dd HH:mm:ss" value="yyyy-MM-dd HH:mm:ss" placeholder="开始时间"> |
|
|
<template slot-scope="scope"> |
|
|
</el-date-picker> |
|
|
<el-select |
|
|
<el-input v-else class="item_width_2" size="mini" placeholder="请输入" v-model="personItem.colVal"> |
|
|
v-model="scope.row.queryType" |
|
|
</el-input> |
|
|
placeholder="请选择" |
|
|
</template> |
|
|
clearable |
|
|
</template> |
|
|
> |
|
|
</el-table-column> |
|
|
<el-option |
|
|
<el-table-column label="条件关系" align="center" width="100"> |
|
|
v-for="item in queryTypeOpction" |
|
|
<template slot-scope="scope" v-if="scope.$index != tableData.length - 1"> |
|
|
:label="item.label" |
|
|
<el-select v-model="scope.row.nextLogicalRel" placeholder="请选择" clearable disabled> |
|
|
:value="item.value" |
|
|
<el-option v-for="item in nextLogicalRelOpction" :label="item.label" :value="item.value" |
|
|
:key="item.value" |
|
|
:key="item.value"> |
|
|
> |
|
|
</el-option> |
|
|
</el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column fixed="right" label="操作" align="center" width="120"> |
|
|
<el-table-column label="对应值" width="120" align="center"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-button type="primary" @click="handleClickAddRow" v-if="scope.$index == tableData.length - 1" |
|
|
<template v-for="item in scope.row.correspondingOpction"> |
|
|
size="small" icon="el-icon-plus" circle></el-button> |
|
|
<el-select |
|
|
|
|
|
v-if=" |
|
|
|
|
|
item.itemType == 'select' || |
|
|
|
|
|
item.itemType == 'radio' || |
|
|
|
|
|
item.itemType == 'checkbox' |
|
|
|
|
|
" |
|
|
|
|
|
v-model="scope.row.colVal" |
|
|
|
|
|
placeholder="请选择" |
|
|
|
|
|
clearable |
|
|
|
|
|
> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="items in item.options" |
|
|
|
|
|
:label="items.label" |
|
|
|
|
|
:value="items.value" |
|
|
|
|
|
:key="items.label" |
|
|
|
|
|
> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-else-if=" |
|
|
|
|
|
item.itemType === 'input' || item.itemType === 'textarea' |
|
|
|
|
|
" |
|
|
|
|
|
v-model="scope.row.colVal" |
|
|
|
|
|
placeholder="请输入" |
|
|
|
|
|
clearable |
|
|
|
|
|
> |
|
|
|
|
|
</el-input> |
|
|
|
|
|
<el-input-number |
|
|
|
|
|
v-else-if="item.itemType === 'inputNum'" |
|
|
|
|
|
class="item_width_2" |
|
|
|
|
|
v-model="scope.row.colVal" |
|
|
|
|
|
:min="0" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
label="请输入" |
|
|
|
|
|
></el-input-number> |
|
|
|
|
|
<el-date-picker |
|
|
|
|
|
v-else-if=" |
|
|
|
|
|
item.itemType === 'datepicker' || item.itemType === 'date' |
|
|
|
|
|
" |
|
|
|
|
|
v-model="scope.row.colVal" |
|
|
|
|
|
class="item_width_2" |
|
|
|
|
|
type="datetime" |
|
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss" |
|
|
|
|
|
value="yyyy-MM-dd HH:mm:ss" |
|
|
|
|
|
placeholder="开始时间" |
|
|
|
|
|
> |
|
|
|
|
|
</el-date-picker> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-else |
|
|
|
|
|
class="item_width_2" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
placeholder="请输入" |
|
|
|
|
|
v-model="personItem.colVal" |
|
|
|
|
|
> |
|
|
|
|
|
</el-input> |
|
|
|
|
|
</template> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column label="条件关系" align="center" width="100"> |
|
|
|
|
|
<template |
|
|
|
|
|
slot-scope="scope" |
|
|
|
|
|
v-if="scope.$index != tableData.length - 1" |
|
|
|
|
|
> |
|
|
|
|
|
<el-select |
|
|
|
|
|
v-model="scope.row.nextLogicalRel" |
|
|
|
|
|
placeholder="请选择" |
|
|
|
|
|
clearable |
|
|
|
|
|
disabled |
|
|
|
|
|
> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="item in nextLogicalRelOpction" |
|
|
|
|
|
:label="item.label" |
|
|
|
|
|
:value="item.value" |
|
|
|
|
|
:key="item.value" |
|
|
|
|
|
> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column fixed="right" label="操作" align="center" width="120"> |
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
@click="handleClickAddRow" |
|
|
|
|
|
v-if="scope.$index == tableData.length - 1" |
|
|
|
|
|
size="small" |
|
|
|
|
|
icon="el-icon-plus" |
|
|
|
|
|
circle |
|
|
|
|
|
></el-button> |
|
|
|
|
|
|
|
|
<el-button type="danger" @click="handleClickDelete(scope.$index)" |
|
|
<el-button |
|
|
v-if="scope.$index != tableData.length - 1 || (tableData.length - 1 >= 1 && scope.$index != '0')" |
|
|
type="danger" |
|
|
size="small" icon="el-icon-minus" circle> </el-button> |
|
|
@click="handleClickDelete(scope.$index)" |
|
|
</template> |
|
|
v-if=" |
|
|
</el-table-column> |
|
|
scope.$index != tableData.length - 1 || |
|
|
</el-table> |
|
|
(tableData.length - 1 >= 1 && scope.$index != '0') |
|
|
<div class="div_btn"> |
|
|
" |
|
|
<el-button size="small" @click="handleCancle">取 消</el-button> |
|
|
size="small" |
|
|
<el-button size="small" type="primary" @click="handleComfirm">确 定</el-button> |
|
|
icon="el-icon-minus" |
|
|
</div> |
|
|
circle |
|
|
|
|
|
> |
|
|
|
|
|
</el-button> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
</el-table> |
|
|
|
|
|
<div class="div_btn"> |
|
|
|
|
|
<el-button size="small" @click="handleCancle">取 消</el-button> |
|
|
|
|
|
<el-button size="small" type="primary" @click="handleComfirm" |
|
|
|
|
|
>确 定</el-button |
|
|
|
|
|
> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { requestPost, requestGet } from "@/js/dai/request"; |
|
|
import { requestPost, requestGet } from "@/js/dai/request"; |
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
tableData: [ |
|
|
tableData: [ |
|
|
{ |
|
|
{ |
|
|
dataSource: "", //数据源 |
|
|
dataSource: "", //数据源 |
|
|
itemGroupId: "", //字段类别 |
|
|
itemGroupId: "", //字段类别 |
|
|
itemId: "", //字段名称 |
|
|
itemId: "", //字段名称 |
|
|
queryType: "", //比较符 |
|
|
queryType: "", //比较符 |
|
|
colVal: "", //对应值 |
|
|
colVal: "", //对应值 |
|
|
nextLogicalRel: "and", //条件关系, |
|
|
nextLogicalRel: "and", //条件关系, |
|
|
tableName: "", //数据库表名 |
|
|
tableName: "", //数据库表名 |
|
|
colKey: "", |
|
|
colKey: "", |
|
|
itemIdOpction: [], |
|
|
itemIdOpction: [], |
|
|
itemGroupIdOpction: [], |
|
|
itemGroupIdOpction: [], |
|
|
correspondingOpction: [], |
|
|
correspondingOpction: [], |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
dataSourceOpction: [ |
|
|
|
|
|
{ label: "人员信息", value: "resi" }, |
|
|
|
|
|
{ label: "房屋信息", value: "house" }, |
|
|
|
|
|
], |
|
|
|
|
|
queryTypeOpction: [], |
|
|
|
|
|
nextLogicalRelOpction: [ |
|
|
|
|
|
{ label: "并且", value: "and" }, |
|
|
|
|
|
{ label: "或者", value: "or" }, |
|
|
|
|
|
], |
|
|
|
|
|
}; |
|
|
|
|
|
}, |
|
|
|
|
|
created() { }, |
|
|
|
|
|
async mounted() { |
|
|
|
|
|
}, |
|
|
|
|
|
methods: { |
|
|
|
|
|
async initForm(data) { |
|
|
|
|
|
// await this.getFormEdit(); |
|
|
|
|
|
this.tableData = data |
|
|
|
|
|
console.log(data); |
|
|
|
|
|
for (let i in this.tableData) { |
|
|
|
|
|
this.handleChangeSource(this.tableData[i], [i]); |
|
|
|
|
|
this.handleChangeFieldsType(this.tableData[i], [i]); |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.handleChangeFieldsName(this.tableData[i], [i]); |
|
|
|
|
|
}, 300); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
dataSourceOpction: [ |
|
|
|
|
|
{ label: "人员信息", value: "resi" }, |
|
|
|
|
|
{ label: "房屋信息", value: "house" }, |
|
|
|
|
|
], |
|
|
|
|
|
queryTypeOpction: [], |
|
|
|
|
|
nextLogicalRelOpction: [ |
|
|
|
|
|
{ label: "并且", value: "and" }, |
|
|
|
|
|
{ label: "或者", value: "or" }, |
|
|
|
|
|
], |
|
|
|
|
|
}; |
|
|
|
|
|
}, |
|
|
|
|
|
created() {}, |
|
|
|
|
|
async mounted() {}, |
|
|
|
|
|
methods: { |
|
|
|
|
|
async initForm(data) { |
|
|
|
|
|
this.tableData = data; |
|
|
|
|
|
for (let i in this.tableData) { |
|
|
|
|
|
this.handleChangeSource(this.tableData[i], [i], "init"); |
|
|
|
|
|
this.handleChangeFieldsType(this.tableData[i], [i], "init"); |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
this.handleChangeFieldsName(this.tableData[i], [i], "init"); |
|
|
|
|
|
}, 300); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 选择数据源 |
|
|
|
|
|
async handleChangeSource(row, index, type) { |
|
|
|
|
|
let url, params; |
|
|
|
|
|
|
|
|
// 选择数据源 |
|
|
if (row.dataSource === "resi") { |
|
|
async handleChangeSource(row, index) { |
|
|
url = "/oper/customize/icformitemgroup/list"; |
|
|
console.log(row); |
|
|
params = { |
|
|
if (row.dataSource == "resi") { |
|
|
formCode: "resi_base_info", |
|
|
let url = "/oper/customize/icformitemgroup/list"; |
|
|
policyFlag: "1", |
|
|
let params = { |
|
|
}; |
|
|
formCode: "resi_base_info", |
|
|
} else if (row.dataSource === "house") { |
|
|
policyFlag: "1", |
|
|
url = "/governance/policy/item-list/house"; |
|
|
}; |
|
|
params = {}; |
|
|
let { data, code, msg } = await requestPost(url, params); |
|
|
} |
|
|
if (code == 0) { |
|
|
|
|
|
this.$set(this.tableData[index], "itemGroupIdOpction", data); |
|
|
|
|
|
console.log(this.tableData[index].itemGroupIdOpction); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error(msg); |
|
|
|
|
|
} |
|
|
|
|
|
this.hadeleClearForm(this.tableData[index], index); |
|
|
|
|
|
// if (!type) { |
|
|
|
|
|
// this.tableData[index].itemGroupId = ""; |
|
|
|
|
|
// this.tableData[index].itemId = ""; |
|
|
|
|
|
// this.tableData[index].colKey = ""; |
|
|
|
|
|
// this.tableData[index].colVal = ""; |
|
|
|
|
|
// this.tableData[index].nextLogicalRel = ""; |
|
|
|
|
|
// this.tableData[index].queryType = ""; |
|
|
|
|
|
// this.tableData[index].itemIdOpction = []; |
|
|
|
|
|
// } |
|
|
|
|
|
} else if (row.dataSource == "house") { |
|
|
|
|
|
let url = "/governance/policy/item-list/house"; |
|
|
|
|
|
let params = {}; |
|
|
|
|
|
let { data, code, msg } = await requestPost(url, params); |
|
|
|
|
|
if (code == 0) { |
|
|
|
|
|
this.tableData[index].itemIdOpction = data; |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error(msg); |
|
|
|
|
|
} |
|
|
|
|
|
this.hadeleClearForm(this.tableData[index], index); |
|
|
|
|
|
// if (!type) { |
|
|
|
|
|
// this.tableData[index].itemGroupId = ""; |
|
|
|
|
|
// this.tableData[index].itemId = ""; |
|
|
|
|
|
// this.tableData[index].colKey = ""; |
|
|
|
|
|
// this.tableData[index].colVal = ""; |
|
|
|
|
|
// this.tableData[index].nextLogicalRel = ""; |
|
|
|
|
|
// this.tableData[index].queryType = ""; |
|
|
|
|
|
// } |
|
|
|
|
|
} else if (row.dataSource == "stat") { |
|
|
|
|
|
let url = "/governance/policy/item-list/stat"; |
|
|
|
|
|
let params = {}; |
|
|
|
|
|
let { data, code, msg } = await requestPost(url, params); |
|
|
|
|
|
if (code == 0) { |
|
|
|
|
|
this.tableData[index].itemIdOpction = data; |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error(msg); |
|
|
|
|
|
} |
|
|
|
|
|
this.hadeleClearForm(this.tableData[index], index); |
|
|
|
|
|
// if (!type) { |
|
|
|
|
|
// this.tableData[index].itemGroupId = ""; |
|
|
|
|
|
// this.tableData[index].itemId = ""; |
|
|
|
|
|
// this.tableData[index].colKey = ""; |
|
|
|
|
|
// this.tableData[index].colVal = ""; |
|
|
|
|
|
// this.tableData[index].nextLogicalRel = ""; |
|
|
|
|
|
// this.tableData[index].queryType = ""; |
|
|
|
|
|
// } |
|
|
|
|
|
} else { |
|
|
|
|
|
this.hadeleClearForm(this.tableData[index], index); |
|
|
|
|
|
this.tableData[index].itemGroupId = ""; |
|
|
|
|
|
this.tableData[index].itemId = ""; |
|
|
|
|
|
this.tableData[index].colKey = ""; |
|
|
|
|
|
this.tableData[index].colVal = ""; |
|
|
|
|
|
this.tableData[index].nextLogicalRel = ""; |
|
|
|
|
|
this.tableData[index].queryType = ""; |
|
|
|
|
|
this.tableData[index].itemIdOpction = []; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getCompareList(); |
|
|
if (url && params) { |
|
|
}, |
|
|
const { data, code, msg } = await requestPost(url, params); |
|
|
|
|
|
if (code === 0) { |
|
|
|
|
|
this.$set(this.tableData[index], "itemGroupIdOpction", data); |
|
|
|
|
|
console.log(this.tableData[index].itemGroupIdOpction); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error(msg); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
this.hadeleClearForm(this.tableData[index], index); |
|
|
|
|
|
if (!type) { |
|
|
|
|
|
this.tableData[index].itemGroupId = ""; |
|
|
|
|
|
this.tableData[index].itemId = ""; |
|
|
|
|
|
this.tableData[index].colKey = ""; |
|
|
|
|
|
this.tableData[index].colVal = ""; |
|
|
|
|
|
this.tableData[index].nextLogicalRel = "and"; |
|
|
|
|
|
this.tableData[index].queryType = ""; |
|
|
|
|
|
|
|
|
// 字段类别修改 |
|
|
if (row.dataSource === "house") { |
|
|
async handleChangeFieldsType(row, index) { |
|
|
this.tableData[index].itemIdOpction = []; |
|
|
console.log(row, index, "字段类别row"); |
|
|
} |
|
|
if (row.dataSource != "resi") return; |
|
|
} |
|
|
const url = "/oper/customize/icformitem/getItemListV2"; |
|
|
this.getCompareList(); |
|
|
let params = { |
|
|
}, |
|
|
groupId: row.itemGroupId, |
|
|
|
|
|
policyFlag: "1", |
|
|
|
|
|
}; |
|
|
|
|
|
this.hadeleClearForm(this.tableData[index], index); |
|
|
|
|
|
// if (!type) { |
|
|
|
|
|
// this.tableData[index].itemId = ""; |
|
|
|
|
|
// this.tableData[index].colKey = ""; |
|
|
|
|
|
// this.tableData[index].colVal = ""; |
|
|
|
|
|
// this.tableData[index].nextLogicalRel = ""; |
|
|
|
|
|
// this.tableData[index].queryType = ""; |
|
|
|
|
|
// this.tableData[index].itemIdOpction = []; |
|
|
|
|
|
// } |
|
|
|
|
|
let { data, code, msg } = await requestPost(url, params); |
|
|
|
|
|
if (code == 0) { |
|
|
|
|
|
this.$set(this.tableData[index], "itemIdOpction", data); |
|
|
|
|
|
console.log(this.tableData[index].itemIdOpction, "see"); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error(msg); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 字段名称修改 |
|
|
|
|
|
async handleChangeFieldsName(row, index) { |
|
|
|
|
|
console.log(row, "字段名称row"); |
|
|
|
|
|
var arr = []; |
|
|
|
|
|
// 人的信息中colKey的字段是columnName要做一下判断 |
|
|
|
|
|
if (row.dataSource == "house" || row.dataSource == "stat") { |
|
|
|
|
|
arr = row.itemIdOpction.filter((item) => item.colKey == row.itemId); |
|
|
|
|
|
this.tableData[index].tableName = arr[0].tableName; |
|
|
|
|
|
this.tableData[index].colKey = arr[0].colKey; |
|
|
|
|
|
// if (!type) { |
|
|
|
|
|
// this.tableData[index].colVal = ""; |
|
|
|
|
|
// this.tableData[index].nextLogicalRel = ""; |
|
|
|
|
|
// this.tableData[index].queryType = ""; |
|
|
|
|
|
// } |
|
|
|
|
|
// this.tableData[index].colVal = '' |
|
|
|
|
|
// this.tableData[index].queryType = '' |
|
|
|
|
|
} else if (row.dataSource == "resi" && row.itemId != "") { |
|
|
|
|
|
arr = row.itemIdOpction.filter((item) => item.itemId == row.itemId); |
|
|
|
|
|
this.tableData[index].tableName = arr[0].tableName; |
|
|
|
|
|
this.tableData[index].colKey = arr[0].columnName; |
|
|
|
|
|
// if (!type) { |
|
|
|
|
|
// this.tableData[index].colVal = ""; |
|
|
|
|
|
// this.tableData[index].nextLogicalRel = ""; |
|
|
|
|
|
// this.tableData[index].queryType = ""; |
|
|
|
|
|
// } |
|
|
|
|
|
// this.tableData[index].colVal = '' |
|
|
|
|
|
// this.tableData[index].queryType = '' |
|
|
|
|
|
} |
|
|
|
|
|
if (row.itemId == "") return; |
|
|
|
|
|
// 列表对应值的option有的是通过接口获取的就需要再通过optionSourceType判断下 |
|
|
|
|
|
console.log(arr[0].optionSourceType); |
|
|
|
|
|
if (arr[0].optionSourceType == "remote") { |
|
|
|
|
|
let url = ""; |
|
|
|
|
|
let params = {}; |
|
|
|
|
|
if (row.dataSource == "house") { |
|
|
|
|
|
url = arr[0].optionSourceUrl; |
|
|
|
|
|
params = JSON.parse(arr[0].optionSourceParam); |
|
|
|
|
|
} else { |
|
|
|
|
|
url = arr[0].optionSourceValue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { data, code, msg } = await requestPost(url, params); |
|
|
// 字段类别修改 |
|
|
if (code == 0) { |
|
|
async handleChangeFieldsType(row, index, type) { |
|
|
arr[0].options = data; |
|
|
console.log(row, index, "字段类别row"); |
|
|
this.$set(this.tableData[index], "correspondingOpction", arr); |
|
|
if (row.dataSource != "resi") return; |
|
|
} else { |
|
|
const url = "/oper/customize/icformitem/getItemListV2"; |
|
|
this.$message.error(msg); |
|
|
let params = { |
|
|
} |
|
|
groupId: row.itemGroupId, |
|
|
} else { |
|
|
policyFlag: "1", |
|
|
this.$set(this.tableData[index], "correspondingOpction", arr); |
|
|
}; |
|
|
} |
|
|
console.log(this.tableData[index], index); |
|
|
|
|
|
this.hadeleClearForm(this.tableData[index], index); |
|
|
|
|
|
if (!type) { |
|
|
|
|
|
this.tableData[index].itemId = ""; |
|
|
|
|
|
this.tableData[index].colKey = ""; |
|
|
|
|
|
this.tableData[index].colVal = ""; |
|
|
|
|
|
this.tableData[index].nextLogicalRel = "and"; |
|
|
|
|
|
this.tableData[index].queryType = ""; |
|
|
|
|
|
this.tableData[index].itemIdOpction = []; |
|
|
|
|
|
} |
|
|
|
|
|
let { data, code, msg } = await requestPost(url, params); |
|
|
|
|
|
if (code == 0) { |
|
|
|
|
|
this.$set(this.tableData[index], "itemIdOpction", data); |
|
|
|
|
|
console.log(this.tableData[index].itemIdOpction, "see"); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error(msg); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 字段名称修改 |
|
|
|
|
|
async handleChangeFieldsName(row, index) { |
|
|
|
|
|
console.log(row, "字段名称row"); |
|
|
|
|
|
var arr = []; |
|
|
|
|
|
// 人的信息中colKey的字段是columnName要做一下判断 |
|
|
|
|
|
if (row.dataSource == "house" || row.dataSource == "stat") { |
|
|
|
|
|
arr = row.itemIdOpction.filter((item) => item.colKey == row.itemId); |
|
|
|
|
|
this.tableData[index].tableName = arr[0].tableName; |
|
|
|
|
|
this.tableData[index].colKey = arr[0].colKey; |
|
|
|
|
|
} else if (row.dataSource == "resi" && row.itemId != "") { |
|
|
|
|
|
arr = row.itemIdOpction.filter((item) => item.itemId == row.itemId); |
|
|
|
|
|
this.tableData[index].tableName = arr[0].tableName; |
|
|
|
|
|
this.tableData[index].colKey = arr[0].columnName; |
|
|
|
|
|
} |
|
|
|
|
|
if (row.itemId == "") return; |
|
|
|
|
|
// 列表对应值的option有的是通过接口获取的就需要再通过optionSourceType判断下 |
|
|
|
|
|
console.log(arr[0].optionSourceType); |
|
|
|
|
|
if (arr[0].optionSourceType == "remote") { |
|
|
|
|
|
let url = ""; |
|
|
|
|
|
let params = {}; |
|
|
|
|
|
if (row.dataSource == "house") { |
|
|
|
|
|
url = arr[0].optionSourceUrl; |
|
|
|
|
|
params = JSON.parse(arr[0].optionSourceParam); |
|
|
|
|
|
} else { |
|
|
|
|
|
url = arr[0].optionSourceValue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
console.log(this.tableData); |
|
|
const { data, code, msg } = await requestPost(url, params); |
|
|
}, |
|
|
if (code == 0) { |
|
|
async getCompareList() { |
|
|
arr[0].options = data; |
|
|
const url = "/sys/dict/data/dictlist"; |
|
|
this.$set(this.tableData[index], "correspondingOpction", arr); |
|
|
let params = { |
|
|
} else { |
|
|
dictType: "sql_query_type", |
|
|
this.$message.error(msg); |
|
|
}; |
|
|
} |
|
|
let { data, code, msg } = await requestPost(url, params); |
|
|
} else { |
|
|
if (code == 0) { |
|
|
this.$set(this.tableData[index], "correspondingOpction", arr); |
|
|
this.queryTypeOpction = data; |
|
|
} |
|
|
} else if (code >= 8000) { |
|
|
|
|
|
this.$message.error(msg); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 选中标签其他清空 |
|
|
|
|
|
hadeleClearForm(row, index) { |
|
|
|
|
|
let obj = {}; |
|
|
|
|
|
obj = { |
|
|
|
|
|
dataSource: row.dataSource ? row.dataSource : "", |
|
|
|
|
|
itemId: row.itemId ? row.itemId : "", |
|
|
|
|
|
queryType: row.queryType ? row.queryType : "", |
|
|
|
|
|
colVal: row.colVal ? row.colVal : "", |
|
|
|
|
|
colKey: row.colKey ? row.colKey : "", |
|
|
|
|
|
nextLogicalRel: row.nextLogicalRel ? row.nextLogicalRel : "", |
|
|
|
|
|
tableName: row.tableName ? row.tableName : "", |
|
|
|
|
|
itemGroupId: row.itemGroupId ? row.itemGroupId : "", |
|
|
|
|
|
itemIdOpction: row.itemIdOpction ? row.itemIdOpction : [], |
|
|
|
|
|
itemGroupIdOpction: row.itemGroupIdOpction |
|
|
|
|
|
? row.itemGroupIdOpction |
|
|
|
|
|
: [], |
|
|
|
|
|
}; |
|
|
|
|
|
this.$set(this.tableData, index, obj); |
|
|
|
|
|
}, |
|
|
|
|
|
async handleComfirm() { |
|
|
|
|
|
let messageObj = {}; |
|
|
|
|
|
messageObj = this.validateRule(this.tableData); |
|
|
|
|
|
if (messageObj) { |
|
|
|
|
|
this.$message.error(messageObj); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
for (let i in this.tableData) { |
|
|
|
|
|
for (let j in this.tableData[i]) { |
|
|
|
|
|
if ( |
|
|
|
|
|
typeof this.tableData[i][j] != "string" && |
|
|
|
|
|
typeof this.tableData[i][j] != "number" |
|
|
|
|
|
) { |
|
|
|
|
|
this.$delete(this.tableData[i], j); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
this.$emit("dialogOk", this.tableData); |
|
|
|
|
|
|
|
|
|
|
|
// this.addSubmit(); |
|
|
console.log(this.tableData); |
|
|
}, |
|
|
}, |
|
|
handleCancle() { |
|
|
async getCompareList() { |
|
|
this.$emit("dialogCancle"); |
|
|
const url = "/sys/dict/data/dictlist"; |
|
|
}, |
|
|
let params = { |
|
|
validateRule(tabList) { |
|
|
dictType: "sql_query_type", |
|
|
console.log(tabList); |
|
|
}; |
|
|
let message = ""; |
|
|
let { data, code, msg } = await requestPost(url, params); |
|
|
tabList.forEach((item, index) => { |
|
|
if (code == 0) { |
|
|
if ( |
|
|
this.queryTypeOpction = data; |
|
|
(item.itemGroupId === "" && item.dataSource == "resi") || |
|
|
} else if (code >= 8000) { |
|
|
item.itemId === "" || |
|
|
this.$message.error(msg); |
|
|
item.queryType === "" || |
|
|
} |
|
|
item.colKey === "" |
|
|
}, |
|
|
) { |
|
|
// 选中标签其他清空 |
|
|
message = `匹配规则${item.dataSource == "resi" |
|
|
hadeleClearForm(row, index) { |
|
|
? "人员" |
|
|
console.log(row, index); |
|
|
: item.dataSource == "house" |
|
|
let obj = {}; |
|
|
? "房屋" |
|
|
obj = { |
|
|
: item.dataSource == "stat" |
|
|
dataSource: row.dataSource ? row.dataSource : "", |
|
|
? "统计" |
|
|
itemId: row.itemId ? row.itemId : "", |
|
|
: "" |
|
|
queryType: row.queryType ? row.queryType : "", |
|
|
}信息不完整,请填写完整 !`; |
|
|
colVal: row.colVal ? row.colVal : "", |
|
|
return message; |
|
|
colKey: row.colKey ? row.colKey : "", |
|
|
} |
|
|
nextLogicalRel: row.nextLogicalRel ? row.nextLogicalRel : "", |
|
|
if (index != this.tableData.length - 1 && item.nextLogicalRel === "") { |
|
|
tableName: row.tableName ? row.tableName : "", |
|
|
message = `匹配规则${item.dataSource == "resi" |
|
|
itemGroupId: row.itemGroupId ? row.itemGroupId : "", |
|
|
? "人员" |
|
|
itemIdOpction: row.itemIdOpction ? row.itemIdOpction : [], |
|
|
: item.dataSource == "house" |
|
|
itemGroupIdOpction: row.itemGroupIdOpction |
|
|
? "房屋" |
|
|
? row.itemGroupIdOpction |
|
|
: item.dataSource == "stat" |
|
|
: [], |
|
|
? "统计" |
|
|
}; |
|
|
: "" |
|
|
this.$set(this.tableData, index, obj); |
|
|
}信息不完整,请填写完整 !`; |
|
|
console.log(this.tableData); |
|
|
console.log(item); |
|
|
}, |
|
|
return message; |
|
|
async handleComfirm() { |
|
|
} |
|
|
let messageObj = {}; |
|
|
if ( |
|
|
messageObj = this.validateRule(this.tableData); |
|
|
item.queryType !== "is_null" && |
|
|
if (messageObj) { |
|
|
item.queryType !== "is_not_null" && |
|
|
this.$message.error(messageObj); |
|
|
item.colVal === "" |
|
|
return; |
|
|
) { |
|
|
} |
|
|
message = `匹配规则${item.dataSource == "resi" |
|
|
for (let i in this.tableData) { |
|
|
? "人员" |
|
|
for (let j in this.tableData[i]) { |
|
|
: item.dataSource == "house" |
|
|
if ( |
|
|
? "房屋" |
|
|
typeof this.tableData[i][j] != "string" && |
|
|
: item.dataSource == "stat" |
|
|
typeof this.tableData[i][j] != "number" |
|
|
? "统计" |
|
|
) { |
|
|
: "" |
|
|
this.$delete(this.tableData[i], j); |
|
|
}信息不完整,请填写完整 !`; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
this.$emit("dialogOk", this.tableData); |
|
|
|
|
|
|
|
|
return message; |
|
|
// this.addSubmit(); |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
return message; |
|
|
|
|
|
}, |
|
|
|
|
|
handleClickAddRow() { |
|
|
|
|
|
if (this.tableData === undefined) this.tableData = []; |
|
|
|
|
|
let obj = {}; |
|
|
|
|
|
obj.dataSource = ""; |
|
|
|
|
|
obj.itemGroupId = ""; |
|
|
|
|
|
obj.itemId = ""; |
|
|
|
|
|
obj.queryType = ""; |
|
|
|
|
|
obj.colVal = ""; |
|
|
|
|
|
obj.nextLogicalRel = "and"; |
|
|
|
|
|
obj.itemIdOpction = []; |
|
|
|
|
|
this.tableData.push(obj); |
|
|
|
|
|
}, |
|
|
|
|
|
// 删除一行 |
|
|
|
|
|
handleClickDelete(index) { |
|
|
|
|
|
this.tableData.splice(index, 1); |
|
|
|
|
|
}, |
|
|
|
|
|
handleClearItemId(row, index) { |
|
|
|
|
|
this.tableData[index].colVal = ""; |
|
|
|
|
|
this.tableData[index].queryType = ""; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
props: { |
|
|
handleCancle() { |
|
|
rulesData: { |
|
|
this.$emit("dialogCancle"); |
|
|
type: Array, |
|
|
}, |
|
|
default: () => [] |
|
|
validateRule(tabList) { |
|
|
|
|
|
console.log(tabList); |
|
|
|
|
|
let message = ""; |
|
|
|
|
|
tabList.forEach((item, index) => { |
|
|
|
|
|
if ( |
|
|
|
|
|
(item.itemGroupId === "" && item.dataSource == "resi") || |
|
|
|
|
|
item.itemId === "" || |
|
|
|
|
|
item.queryType === "" || |
|
|
|
|
|
item.colKey === "" |
|
|
|
|
|
) { |
|
|
|
|
|
message = `匹配规则${ |
|
|
|
|
|
item.dataSource == "resi" |
|
|
|
|
|
? "人员" |
|
|
|
|
|
: item.dataSource == "house" |
|
|
|
|
|
? "房屋" |
|
|
|
|
|
: item.dataSource == "stat" |
|
|
|
|
|
? "统计" |
|
|
|
|
|
: "" |
|
|
|
|
|
}信息不完整,请填写完整 !`; |
|
|
|
|
|
return message; |
|
|
|
|
|
} |
|
|
|
|
|
if (index != this.tableData.length - 1 && item.nextLogicalRel === "") { |
|
|
|
|
|
message = `匹配规则${ |
|
|
|
|
|
item.dataSource == "resi" |
|
|
|
|
|
? "人员" |
|
|
|
|
|
: item.dataSource == "house" |
|
|
|
|
|
? "房屋" |
|
|
|
|
|
: item.dataSource == "stat" |
|
|
|
|
|
? "统计" |
|
|
|
|
|
: "" |
|
|
|
|
|
}信息不完整,请填写完整 !`; |
|
|
|
|
|
console.log(item); |
|
|
|
|
|
return message; |
|
|
|
|
|
} |
|
|
|
|
|
if ( |
|
|
|
|
|
item.queryType !== "is_null" && |
|
|
|
|
|
item.queryType !== "is_not_null" && |
|
|
|
|
|
item.colVal === "" |
|
|
|
|
|
) { |
|
|
|
|
|
message = `匹配规则${ |
|
|
|
|
|
item.dataSource == "resi" |
|
|
|
|
|
? "人员" |
|
|
|
|
|
: item.dataSource == "house" |
|
|
|
|
|
? "房屋" |
|
|
|
|
|
: item.dataSource == "stat" |
|
|
|
|
|
? "统计" |
|
|
|
|
|
: "" |
|
|
|
|
|
}信息不完整,请填写完整 !`; |
|
|
|
|
|
|
|
|
|
|
|
return message; |
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
return message; |
|
|
|
|
|
}, |
|
|
|
|
|
handleClickAddRow() { |
|
|
|
|
|
if (this.tableData === undefined) this.tableData = []; |
|
|
|
|
|
let obj = {}; |
|
|
|
|
|
obj.dataSource = ""; |
|
|
|
|
|
obj.itemGroupId = ""; |
|
|
|
|
|
obj.itemId = ""; |
|
|
|
|
|
obj.queryType = ""; |
|
|
|
|
|
obj.colVal = ""; |
|
|
|
|
|
obj.nextLogicalRel = "and"; |
|
|
|
|
|
obj.itemIdOpction = []; |
|
|
|
|
|
this.tableData.push(obj); |
|
|
|
|
|
}, |
|
|
|
|
|
// 删除一行 |
|
|
|
|
|
handleClickDelete(index) { |
|
|
|
|
|
this.tableData.splice(index, 1); |
|
|
|
|
|
}, |
|
|
|
|
|
handleClearItemId(row, index) { |
|
|
|
|
|
this.tableData[index].colVal = ""; |
|
|
|
|
|
this.tableData[index].queryType = ""; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
props: { |
|
|
|
|
|
rulesData: { |
|
|
|
|
|
type: Array, |
|
|
|
|
|
default: () => [], |
|
|
}, |
|
|
}, |
|
|
computed: {}, |
|
|
}, |
|
|
watch: {}, |
|
|
computed: {}, |
|
|
|
|
|
watch: {}, |
|
|
}; |
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
@ -439,20 +490,20 @@ export default { |
|
|
@import "@/assets/scss/modules/management/list-main.scss"; |
|
|
@import "@/assets/scss/modules/management/list-main.scss"; |
|
|
|
|
|
|
|
|
.imgBtn { |
|
|
.imgBtn { |
|
|
width: 25px; |
|
|
width: 25px; |
|
|
height: 25px; |
|
|
height: 25px; |
|
|
margin-top: 3px; |
|
|
margin-top: 3px; |
|
|
cursor: pointer; |
|
|
cursor: pointer; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.div_btn { |
|
|
.div_btn { |
|
|
display: flex; |
|
|
display: flex; |
|
|
justify-content: flex-end; |
|
|
justify-content: flex-end; |
|
|
margin-top: 10px; |
|
|
margin-top: 10px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.my_form { |
|
|
.my_form { |
|
|
padding: 10px 20px 0; |
|
|
padding: 10px 20px 0; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |
|
|
|
|
|
|