jiangyy 3 years ago
parent
commit
57484ec802
  1. 78
      src/views/modules/communityService/policy/addPolicy.vue
  2. 8
      src/views/modules/communityService/policy/personListItem.vue
  3. 10
      src/views/modules/communityService/policy/policyList.vue
  4. 495
      src/views/modules/communityService/policy/rule.vue

78
src/views/modules/communityService/policy/addPolicy.vue

@ -10,9 +10,10 @@
class="div_form">
<el-form-item label="政策级别"
style="display: block"
label-width="150px"
prop="policyLevel">
<el-select class="item_width_1"
<el-select class="item_width_2"
v-model="formData.policyLevel"
placeholder="全部"
clearable>
@ -26,6 +27,7 @@
</el-form-item>
<el-form-item label="政策日期"
style="display: block"
label-width="150px"
prop="startDate">
<el-date-picker v-model="formData.startDate"
@ -146,7 +148,7 @@
size="small"
type="primary"
:disabled="btnDisable"
@click="handleComfirm"> </el-button>
@click="handleAdd"> </el-button>
</div>
</div>
</template>
@ -290,6 +292,7 @@ export default {
this.$nextTick(() => {
data.ruleList.forEach((element, index) => {
this.$refs['ref_rule' + index][0].setRule(element.resiRuleList, element.houseRuleList, element.statRuleList)
});
})
@ -363,28 +366,66 @@ export default {
},
async handleComfirm () {
this.handleAdd()
},
async handleAdd () {
let isOk = false
this.ruleList.forEach((oneRule, index) => {
if (!oneRule.ruleName) {
this.$message.error('政策细则不能为空')
isOk = false
}
// if (!oneRule.ruleName) {
// this.$message.error('')
// isOk = false
// }
let refObj = this.$refs['ref_rule' + index][0]
refObj.getRule()
if (refObj.okflag) {
oneRule.resiRuleList = refObj.resiRuleList
oneRule.resiRuleList.forEach(element => {
element.itemList = []
element.colOption = []
if (!element.colValLabel) {
element.colValLabel = element.colVal
}
if (!element.nextLogicalRelName) {
element.nextLogicalRelName = ''
}
element.ruleDesc = element.itemGroupName + element.itemLabel + element.queryTypeName + element.colValLabel + element.nextLogicalRelName
});
oneRule.houseRuleList = refObj.houseRuleList
oneRule.houseRuleList.forEach(element => {
element.itemList = []
element.colOption = []
if (!element.colValLabel) {
element.colValLabel = element.colVal
}
if (!element.nextLogicalRelName) {
element.nextLogicalRelName = ''
}
element.ruleDesc = element.itemGroupName + element.itemLabel + element.queryTypeName + element.colValLabel + element.nextLogicalRelName
});
oneRule.statRuleList = refObj.statRuleList
oneRule.statRuleList.forEach(element => {
element.itemList = []
element.colOption = []
if (!element.colValLabel) {
element.colValLabel = element.colVal
}
if (!element.nextLogicalRelName) {
element.nextLogicalRelName = ''
}
element.ruleDesc = element.itemGroupName + element.itemLabel + element.queryTypeName + element.colValLabel + element.nextLogicalRelName
});
isOk = true
} else {
@ -393,16 +434,21 @@ export default {
}
});
if (!isOk) {
return false
}
this.formData.ruleList = this.ruleList
console.log(this.formData.ruleList)
this.btnDisable = true
setTimeout(() => {
this.btnDisable = false
}, 10000)
}, 5000)
this.$refs['ref_form'].validate((valid, messageObj) => {
if (!valid) {
app.util.validateRule(messageObj)
@ -440,6 +486,7 @@ export default {
this.resetData()
this.$emit('handleOk')
} else {
this.btnDisable = false
this.$message.error(msg)
}
},
@ -616,8 +663,9 @@ export default {
@import "@/assets/scss/modules/management/form-main.scss";
.btn-add-rule {
margin-left: 70px;
display: flex;
justify-content: center;
justify-content: flex-start;
margin-bottom: 20px;
}

8
src/views/modules/communityService/policy/personListItem.vue

@ -274,7 +274,7 @@ export default {
async loadTable () {
this.tableLoading = true
const url = "/heart/policy/resiuserlist"
const url = "/data/aggregator/icuser/listByPolicyRules"
// const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/icEpidemicSpecialAttention/list"
let params = {
pageSize: this.pageSize,
@ -408,7 +408,7 @@ export default {
this.formData = {
ruleId: '',
ruleList: [],
ruleList: {},
name: '',
mobile: '',
idCard: '',
@ -520,9 +520,9 @@ export default {
required: ''
},
ruleList: {
type: Array,
type: Object,
default () {
return []
return {}
}
},

10
src/views/modules/communityService/policy/policyList.vue

@ -355,13 +355,13 @@ export default {
this.policyId = row.policyId
this.$confirm("确认取消服务?", "提示", {
this.$confirm("确认删除政策?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.cancelFuwu()
this.delPolicy()
})
.catch(err => {
if (err == "cancel") {
@ -370,18 +370,14 @@ export default {
// message: ""
// });
}
});
},
async cancelFuwu () {
async delPolicy () {
const url = `/heart/policy/delete/${this.policyId}`;
const { data, code, msg } = await requestPost(url, {});
if (code === 0) {

495
src/views/modules/communityService/policy/rule.vue

@ -27,8 +27,7 @@
<el-select class="item_width_1"
v-model="personItem.itemGroupId"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in groupList"
@click.native="handleSelGroup(personIndex,item)"
:key="item.id"
@ -39,8 +38,7 @@
<el-select class="item_width_1"
v-model="personItem.itemId"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in personItem.itemList"
@click.native="handleSelGroupItem(personIndex,item)"
:key="item.itemId"
@ -51,9 +49,9 @@
<el-select class="item_width_1"
v-model="personItem.queryType"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in queryList"
@click.native="handleSelPersonQuery(personIndex,item)"
:key="item.value"
:label="item.label"
:value="item.value">
@ -65,9 +63,9 @@
class="item_width_1"
v-model="personItem.colVal"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in personItem.colOption"
@click.native="handleSelPersonValue(personIndex,item)"
:key="item.value"
:label="item.label"
:value="item.value">
@ -100,9 +98,9 @@
class="item_width_1"
v-model="personItem.nextLogicalRel"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in logicalList"
@click.native="handleSelPersonLogical(personIndex,item)"
:key="item.value"
:label="item.label"
:value="item.value">
@ -131,8 +129,7 @@
<el-select class="item_width_1"
v-model="houseItem.colKey"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in houseItemList"
@click.native="handleSelHouseItem(houseIndex,item)"
:key="item.colKey"
@ -143,9 +140,9 @@
<el-select class="item_width_1"
v-model="houseItem.queryType"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in queryList"
@click.native="handleSelHouseQuery(houseIndex,item)"
:key="item.value"
:label="item.label"
:value="item.value">
@ -157,9 +154,9 @@
class="item_width_1"
v-model="houseItem.colVal"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in houseItem.colOption"
@click.native="handleSelHouseValue(houseIndex,item)"
:key="item.value"
:label="item.label"
:value="item.value">
@ -192,9 +189,9 @@
class="item_width_1"
v-model="houseItem.nextLogicalRel"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in logicalList"
@click.native="handleSelHouseLogical(houseIndex,item)"
:key="item.value"
:label="item.label"
:value="item.value">
@ -223,8 +220,7 @@
<el-select class="item_width_1"
v-model="staticItem.colKey"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in staticItemList"
@click.native="handleSelStaticItem(staticIndex,item)"
:key="item.colKey"
@ -235,9 +231,9 @@
<el-select class="item_width_1"
v-model="staticItem.queryType"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in queryList"
@click.native="handleSelStaticQuery(staticIndex,item)"
:key="item.value"
:label="item.label"
:value="item.value">
@ -249,9 +245,9 @@
class="item_width_1"
v-model="staticItem.colVal"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in staticItem.colOption"
@click.native="handleSelStaticValue(staticIndex,item)"
:key="item.value"
:label="item.label"
:value="item.value">
@ -283,9 +279,9 @@
class="item_width_1"
v-model="staticItem.nextLogicalRel"
size="mini"
placeholder="全部"
clearable>
placeholder="全部">
<el-option v-for="item in logicalList"
@click.native="handleSelStaticLogical(houseIndex,item)"
:key="item.value"
:label="item.label"
:value="item.value">
@ -368,6 +364,11 @@ export default {
itemList: [],
colType: '',//
colOption: [],
itemGroupName: '',
itemLabel: '',
queryTypeName: '',
colValLabel: '',
nextLogicalRelName: '',
}
],
@ -384,6 +385,11 @@ export default {
titleName: '房屋信息',
colType: '',//
colOption: [],
itemGroupName: '房屋信息',
itemLabel: '',
queryTypeName: '',
colValLabel: '',
nextLogicalRelName: '',
}
],
statRuleList: [],
@ -399,13 +405,18 @@ export default {
titleName: '统计信息',
colType: '',//
colOption: [],
itemGroupName: '统计信息',
itemLabel: '',
queryTypeName: '',
colValLabel: '',
nextLogicalRelName: '',
}
],
okflag: false,
showPersonList: false,
ruleList: []
ruleList: {}
}
},
@ -414,34 +425,52 @@ export default {
},
components: { personListItem },
async mounted () {
this.loadPersonGroup()
this.loadHouseItem()
this.loadStaticItem()
this.loadDicOption()
async created () {
this.startLoading()
await this.loadPersonGroup()
await this.loadHouseItem()
await this.loadStaticItem()
await this.loadDicOption()
},
methods: {
async setRule (resiRuleList, houseRuleList, statRuleList) {
// this.startLoading()
if (this.groupList.length == 0 || this.houseItemList.length === 0 || this.staticItemList.length === 0) {
setTimeout(() => {
this.setRule(resiRuleList, houseRuleList, statRuleList);
}, 500);
return false
}
this.resiRuleList = resiRuleList
this.resiRuleList.forEach((element, index) => {
if (this.resiRuleList && this.resiRuleList.length > 0) {
for (let i = 0; i < this.resiRuleList.length; i++) {
let element = this.resiRuleList[i]
let selGroup = this.groupList.filter((item) =>
element.itemGroupId === item.id
);
console.log(selGroup)
if (selGroup.length > 0) {
this.handleSelGroup(index, selGroup[0], true)
}
await this.handleSelGroup(i, selGroup[0], true)
});
let selItem = element.itemList.filter((item) =>
element.itemId === item.itemId);
if (selItem.length > 0) {
await this.handleSelGroupItem(i, selItem[0], true)
}
}
}
}
this.houseRuleList = houseRuleList
if (this.houseRuleList && this.houseRuleList.length > 0) {
this.houseRuleList.forEach((element, index) => {
let selHouseItem = this.houseItemList.filter((item) =>
@ -453,9 +482,9 @@ export default {
}
});
}
this.statRuleList = statRuleList
if (this.statRuleList && this.statRuleList.length > 0) {
this.statRuleList.forEach((element, index) => {
let selStaticItem = this.staticItemList.filter((item) =>
@ -467,6 +496,9 @@ export default {
}
});
}
this.endLoading()
},
@ -474,9 +506,9 @@ export default {
this.okflag = false
let messageObj = this.validateRule()
console.log('resiRuleList', this.resiRuleList)
console.log('houseRuleList', this.houseRuleList)
console.log('statRuleList', this.statRuleList)
// console.log('resiRuleList', this.resiRuleList)
// console.log('houseRuleList', this.houseRuleList)
// console.log('statRuleList', this.statRuleList)
if (messageObj) {
this.$message.error(messageObj)
@ -507,9 +539,7 @@ export default {
this.resiRuleList.forEach((item, index) => {
if (index === this.resiRuleList.length - 1) {
if (
item.ruleDesc === '' ||
item.itemGroupId === '' ||
if (item.itemGroupId === '' ||
item.itemId === '' ||
item.queryType === '' ||
item.colKey === '' ||
@ -520,7 +550,6 @@ export default {
}
} else {
if (item.nextLogicalRel === '' ||
item.ruleDesc === '' ||
item.itemGroupId === '' ||
item.itemId === '' ||
item.queryType === '' ||
@ -538,10 +567,7 @@ export default {
if (index === this.houseRuleList.length - 1) {
if (
item.ruleDesc === '' ||
item.queryType === '' ||
if (item.queryType === '' ||
item.colKey === '' ||
item.colVal === '') {
@ -550,7 +576,6 @@ export default {
}
} else {
if (item.nextLogicalRel === '' ||
item.ruleDesc === '' ||
item.queryType === '' ||
item.colKey === '' ||
item.colVal === '') {
@ -563,10 +588,7 @@ export default {
this.statRuleList.forEach((item, index) => {
if (index === this.statRuleList.length - 1) {
if (
item.ruleDesc === '' ||
item.queryType === '' ||
if (item.queryType === '' ||
item.colKey === '' ||
item.colVal === '') {
@ -574,9 +596,7 @@ export default {
return message
}
} else {
if (
item.nextLogicalRel === '' ||
item.ruleDesc === '' ||
if (item.nextLogicalRel === '' ||
item.queryType === '' ||
item.colKey === '' ||
item.colVal === '') {
@ -594,118 +614,32 @@ export default {
handlePreview () {
this.ruleList = {}
this.ruleList = {
resiRuleList: this.resiRuleList,
houseRuleList: this.houseRuleList,
statRuleList: this.statRuleList,
}
this.showPersonList = true
},
handleClose () {
this.showPersonList = false
},
clickTab (type) {
if (type === 'person') {
this.personSel = true
this.houseSel = false
this.staticSel = false
}
if (type === 'house') {
this.personSel = false
this.houseSel = true
this.staticSel = false
}
if (type === 'static') {
this.personSel = false
this.houseSel = false
this.staticSel = true
resiRuleList: [],
houseRuleList: [],
statRuleList: [],
}
},
addRule () {
if (this.personSel) {
this.addPerson()
if (this.personChecked) {
this.ruleList.resiRuleList = this.resiRuleList
}
if (this.houseSel) {
this.addHouse()
if (this.houseChecked) {
this.ruleList.houseRuleList = this.houseRuleList
}
if (this.staticSel) {
this.addStatic()
if (this.staticChecked) {
this.ruleList.statRuleList = this.statRuleList
}
},
addPerson () {
let obj = {
ruleDesc: '',//
nextLogicalRel: 'and',//andor
itemGroupId: '',
itemId: '',
queryType: '',
colTable: '',
colKey: '',
colVal: '',
itemList: [],
colType: '',//
colOption: [],
}
this.resiRuleList.push(obj)
},
delPerson (index) {
this.resiRuleList.splice(index, 1);
},
addHouse () {
let obj = {
ruleDesc: '房屋信息',
nextLogicalRel: 'and',//andor
queryType: '',
colTable: '',
colKey: '',
colVal: '',
titleName: '房屋信息',
colType: '',//
colOption: [],
}
this.houseRuleList.push(obj)
},
delHouse (index) {
this.houseRuleList.splice(index, 1);
this.showPersonList = true
},
addStatic () {
let obj = {
ruleDesc: '统计信息',
nextLogicalRel: 'and',//andor
queryType: '',
colTable: '',
colKey: '',
colVal: '',
titleName: '统计信息',
colType: '',//
colOption: [],
}
handleClose () {
this.showPersonList = false
this.statRuleList.push(obj)
},
delStatic (index) {
this.statRuleList.splice(index, 1);
},
//
async handleSelGroup (personIndex, item, isEdit) {
async handleSelGroup (personIndex, item, isSet) {
const url = '/oper/customize/icformitem/getItemListV2'
// const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree'
let params = {
@ -717,34 +651,41 @@ export default {
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
let oneData = this.resiRuleList[personIndex]
oneData.ruleDesc = item.label
oneData.itemGroupName = item.label
oneData.itemList = data
oneData.colTable = item.tableName
this.$set(this.resiRuleList, personIndex, oneData)
if (isEdit) {
let selItem = oneData.itemList.filter((item) =>
oneData.itemId === item.itemId);
if (selItem.length > 0) {
this.handleSelGroupItem(personIndex, selItem[0])
}
if (!isSet) {//
oneData.nextLogicalRel = ''
oneData.itemId = ''
oneData.queryType = ''
oneData.colKey = ''
oneData.colVal = ''
}
this.$set(this.resiRuleList, personIndex, oneData)
} else {
this.$message.error(msg)
}
},
//
async handleSelGroupItem (personIndex, item) {
async handleSelGroupItem (personIndex, item, isSet) {
let oneData = this.resiRuleList[personIndex]
oneData.colKey = item.columnName
oneData.colType = item.itemType
oneData.itemLabel = item.label
oneData.ruleDesc = oneData.ruleDesc + item.label
if (!isSet) {//
oneData.nextLogicalRel = ''
oneData.queryType = ''
oneData.colVal = ''
}
if (item.optionSourceType === 'remote') {
const url = item.optionSourceValue
@ -767,14 +708,49 @@ export default {
},
//
handleSelPersonQuery (personIndex, item) {
let oneData = this.resiRuleList[personIndex]
oneData.queryTypeName = item.label
oneData.nextLogicalRel = ''
oneData.colVal = ''
oneData.colValLabel = ''
this.$set(this.resiRuleList, personIndex, oneData)
},
//
handleSelPersonValue (personIndex, item) {
let oneData = this.resiRuleList[personIndex]
oneData.colValLabel = item.label
oneData.nextLogicalRel = ''
this.$set(this.resiRuleList, personIndex, oneData)
},
//
handleSelPersonLogical (personIndex, item) {
let oneData = this.resiRuleList[personIndex]
oneData.nextLogicalRelName = item.label
this.$set(this.resiRuleList, personIndex, oneData)
},
//
async handleSelHouseItem (houseIndex, item) {
async handleSelHouseItem (houseIndex, item, isSet) {
let oneData = this.houseRuleList[houseIndex]
oneData.colTable = item.tableName
oneData.colType = item.itemType
oneData.ruleDesc = oneData.ruleDesc + item.label
oneData.itemLabel = item.label
if (!isSet) {//
oneData.nextLogicalRel = ''
oneData.queryType = ''
oneData.colVal = ''
}
if (item.optionSourceType === 'remote') {
const url = item.optionSourceUrl
@ -796,18 +772,50 @@ export default {
oneData.colOption = []
}
this.$set(this.houseRuleList, houseIndex, oneData)
},
//
handleSelHouseQuery (houseIndex, item) {
let oneData = this.houseRuleList[houseIndex]
oneData.queryTypeName = item.label
oneData.nextLogicalRel = ''
oneData.colVal = ''
oneData.colValLabel = ''
this.$set(this.houseRuleList, houseIndex, oneData)
},
//
handleSelHouseValue (houseIndex, item) {
let oneData = this.houseRuleList[houseIndex]
oneData.colValLabel = item.label
oneData.nextLogicalRel = ''
this.$set(this.houseRuleList, houseIndex, oneData)
},
//
handleSelHouseLogical (houseIndex, item) {
let oneData = this.houseRuleList[houseIndex]
oneData.nextLogicalRelName = item.label
this.$set(this.houseRuleList, houseIndex, oneData)
},
//
async handleSelStaticItem (staticIndex, item) {
async handleSelStaticItem (staticIndex, item, isSet) {
let oneData = this.statRuleList[staticIndex]
oneData.colTable = item.tableName
oneData.colType = item.itemType
oneData.ruleDesc = oneData.ruleDesc + item.label
oneData.itemLabel = item.label
if (!isSet) {//
oneData.nextLogicalRel = ''
oneData.queryType = ''
oneData.colVal = ''
}
if (item.optionSourceType === 'remote') {
const url = item.optionSourceUrl
@ -834,6 +842,145 @@ export default {
},
//
handleSelStaticQuery (staticIndex, item) {
let oneData = this.statRuleList[staticIndex]
oneData.queryTypeName = item.label
oneData.nextLogicalRel = ''
oneData.colVal = ''
oneData.colValLabel = ''
this.$set(this.statRuleList, staticIndex, oneData)
},
//
handleSelStaticValue (staticIndex, item) {
let oneData = this.statRuleList[staticIndex]
oneData.colValLabel = item.label
oneData.nextLogicalRel = ''
this.$set(this.statRuleList, staticIndex, oneData)
},
//
handleSelStaticLogical (staticIndex, item) {
let oneData = this.statRuleList[staticIndex]
oneData.nextLogicalRelName = item.label
this.$set(this.statRuleList, staticIndex, oneData)
},
clickTab (type) {
if (type === 'person') {
this.personSel = true
this.houseSel = false
this.staticSel = false
}
if (type === 'house') {
this.personSel = false
this.houseSel = true
this.staticSel = false
}
if (type === 'static') {
this.personSel = false
this.houseSel = false
this.staticSel = true
}
},
addRule () {
if (this.personSel) {
this.addPerson()
}
if (this.houseSel) {
this.addHouse()
}
if (this.staticSel) {
this.addStatic()
}
},
addPerson () {
let obj = {
ruleDesc: '',//
nextLogicalRel: 'and',//andor
itemGroupId: '',
itemId: '',
queryType: '',
colTable: '',
colKey: '',
colVal: '',
itemList: [],
colType: '',//
colOption: [],
itemGroupName: '',
itemLabel: '',
queryTypeName: '',
colValLabel: '',
nextLogicalRelName: '',
}
this.resiRuleList.push(obj)
},
delPerson (index) {
this.resiRuleList.splice(index, 1);
},
addHouse () {
let obj = {
ruleDesc: '',
nextLogicalRel: 'and',//andor
queryType: '',
colTable: '',
colKey: '',
colVal: '',
titleName: '房屋信息',
colType: '',//
colOption: [],
itemGroupName: '房屋信息',
itemLabel: '',
queryTypeName: '',
colValLabel: '',
nextLogicalRelName: '',
}
this.houseRuleList.push(obj)
},
delHouse (index) {
this.houseRuleList.splice(index, 1);
},
addStatic () {
let obj = {
ruleDesc: '',
nextLogicalRel: 'and',//andor
queryType: '',
colTable: '',
colKey: '',
colVal: '',
titleName: '统计信息',
colType: '',//
colOption: [],
itemGroupName: '统计信息',
itemLabel: '',
queryTypeName: '',
colValLabel: '',
nextLogicalRelName: '',
}
this.statRuleList.push(obj)
},
delStatic (index) {
this.statRuleList.splice(index, 1);
},
// ---
async loadPersonGroup () {
const url = '/oper/customize/icformitemgroup/list'

Loading…
Cancel
Save