Browse Source

Merge branch 'dev-policy0718' into dev

test
jiangyy 3 years ago
parent
commit
6aa5b872a3
  1. BIN
      src/assets/img/icon-del.png
  2. 89
      src/views/modules/communityService/policy/addPolicy.vue
  3. 2
      src/views/modules/communityService/policy/personList.vue
  4. 143
      src/views/modules/communityService/policy/personListItem.vue
  5. 12
      src/views/modules/communityService/policy/policyList.vue
  6. 586
      src/views/modules/communityService/policy/rule.vue

BIN
src/assets/img/icon-del.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

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

@ -10,9 +10,10 @@
class="div_form"> class="div_form">
<el-form-item label="政策级别" <el-form-item label="政策级别"
style="display: block"
label-width="150px" label-width="150px"
prop="policyLevel"> prop="policyLevel">
<el-select class="item_width_1" <el-select class="item_width_2"
v-model="formData.policyLevel" v-model="formData.policyLevel"
placeholder="全部" placeholder="全部"
clearable> clearable>
@ -26,6 +27,7 @@
</el-form-item> </el-form-item>
<el-form-item label="政策日期" <el-form-item label="政策日期"
style="display: block"
label-width="150px" label-width="150px"
prop="startDate"> prop="startDate">
<el-date-picker v-model="formData.startDate" <el-date-picker v-model="formData.startDate"
@ -92,13 +94,13 @@
prop="principalName" prop="principalName"
label-width="150px" label-width="150px"
style="display: block"> style="display: block">
<rule :ref="'ref_rule'+index"></rule> <rule :ref="'ref_rule'+index"
:formType="formType"></rule>
</el-form-item> </el-form-item>
<div v-if="index===(ruleList.length-1)" <div v-if="index===(ruleList.length-1)"
class="btn-add-rule"> class="btn-add-rule">
<el-button type="primary" <el-button type="primary"
size="mini" size="mini"
plain
@click="addRule">增加细则</el-button> @click="addRule">增加细则</el-button>
</div> </div>
</div> </div>
@ -146,7 +148,7 @@
size="small" size="small"
type="primary" type="primary"
:disabled="btnDisable" :disabled="btnDisable"
@click="handleComfirm"> </el-button> @click="handleAdd"> </el-button>
</div> </div>
</div> </div>
</template> </template>
@ -287,9 +289,14 @@ export default {
this.formData = data this.formData = data
if (data.attachmentList) {
this.fileList = data.attachmentList
}
this.$nextTick(() => { this.$nextTick(() => {
data.ruleList.forEach((element, index) => { data.ruleList.forEach((element, index) => {
this.$refs['ref_rule' + index][0].setRule(element.resiRuleList, element.houseRuleList, element.statRuleList) this.$refs['ref_rule' + index][0].setRule(element.resiRuleList, element.houseRuleList, element.statRuleList)
}); });
}) })
@ -363,28 +370,66 @@ export default {
}, },
async handleComfirm () {
this.handleAdd()
},
async handleAdd () { async handleAdd () {
let isOk = false let isOk = false
this.ruleList.forEach((oneRule, index) => { this.ruleList.forEach((oneRule, index) => {
if (!oneRule.ruleName) { // if (!oneRule.ruleName) {
this.$message.error('政策细则不能为空') // this.$message.error('')
isOk = false // isOk = false
} // }
let refObj = this.$refs['ref_rule' + index][0] let refObj = this.$refs['ref_rule' + index][0]
refObj.getRule() refObj.getRule(true, true, true)
if (refObj.okflag) { if (refObj.okflag) {
oneRule.resiRuleList = refObj.resiRuleList 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 = 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 = 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 isOk = true
} else { } else {
@ -393,16 +438,21 @@ export default {
} }
}); });
if (!isOk) { if (!isOk) {
return false return false
} }
this.formData.ruleList = this.ruleList this.formData.ruleList = this.ruleList
console.log(this.formData.ruleList)
this.btnDisable = true this.btnDisable = true
setTimeout(() => { setTimeout(() => {
this.btnDisable = false this.btnDisable = false
}, 10000) }, 5000)
this.$refs['ref_form'].validate((valid, messageObj) => { this.$refs['ref_form'].validate((valid, messageObj) => {
if (!valid) { if (!valid) {
app.util.validateRule(messageObj) app.util.validateRule(messageObj)
@ -418,6 +468,7 @@ export default {
async addFuwu () { async addFuwu () {
console.log(this.formData) console.log(this.formData)
this.formData.attachmentList = [...this.fileList]
let url = '/heart/policy/add' let url = '/heart/policy/add'
if (this.formType === 'add') { if (this.formType === 'add') {
@ -440,6 +491,7 @@ export default {
this.resetData() this.resetData()
this.$emit('handleOk') this.$emit('handleOk')
} else { } else {
this.btnDisable = false
this.$message.error(msg) this.$message.error(msg)
} }
}, },
@ -616,8 +668,9 @@ export default {
@import "@/assets/scss/modules/management/form-main.scss"; @import "@/assets/scss/modules/management/form-main.scss";
.btn-add-rule { .btn-add-rule {
margin-left: 150px;
display: flex; display: flex;
justify-content: center; justify-content: flex-start;
margin-bottom: 20px; margin-bottom: 20px;
} }

2
src/views/modules/communityService/policy/personList.vue

@ -1,5 +1,5 @@
<template> <template>
<div class="div_main"> <div class="dialog-h-content scroll-h div_main">
<div v-for="(item,index) in ruleList" <div v-for="(item,index) in ruleList"
:key="index"> :key="index">
<div class="div_name">{{'政策细则'+(index+1)}}{{item.ruleName}}</div> <div class="div_name">{{'政策细则'+(index+1)}}{{item.ruleName}}</div>

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

@ -7,20 +7,15 @@
ref="ref_searchform" ref="ref_searchform"
:label-width="'90px'"> :label-width="'90px'">
<div> <div>
<el-form-item label="所属网格" <el-form-item label="所属组织"
prop="orgId"> prop="orgId">
<el-select v-model.trim="formData.orgId" <el-cascader class="customer_cascader"
placeholder="请选择" ref="myCascader"
size="small" v-model="agencyIdArray"
clearable :options="orgOptions"
class="item_width_2" :props="orgOptionProps"
@change="handleChangeGrid"> :show-all-levels="false"
<el-option v-for="item in optionsG" @change="handleChangeAgency"></el-cascader>
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item> </el-form-item>
@ -127,7 +122,7 @@
class="diy-button--reset" class="diy-button--reset"
@click="resetSearch">重置</el-button> @click="resetSearch">重置</el-button>
<el-button style="margin-left:10px" <el-button style="margin-left:10px"
class="diy-button--reset" class="diy-button--add"
size="small" size="small"
@click="handleExport">导出</el-button> @click="handleExport">导出</el-button>
</div> </div>
@ -226,13 +221,16 @@ export default {
], ],
formData: { formData: {
gridId: '',
agencyId: '',
orgId: '',
orgType: '',
ruleId: '', ruleId: '',
ruleList: {}, ruleList: {},
name: '', name: '',
mobile: '', mobile: '',
idCard: '', idCard: '',
remark: '',
reason: '',
neighborHoodId: '', neighborHoodId: '',
buildingId: '', buildingId: '',
unitId: '', unitId: '',
@ -243,9 +241,18 @@ export default {
optionsH: [], optionsH: [],
optionsD: [], optionsD: [],
optionsG: [], optionsG: [],
orgOptions: [],
agencyIdArray: [],
tableData: [], tableData: [],
orgOptionProps: {
multiple: false,
value: 'agencyId',
label: 'agencyName',
children: 'subAgencyList',
checkStrictly: true
}
} }
}, },
components: { components: {
@ -259,7 +266,7 @@ export default {
}, },
async mounted () { async mounted () {
this.getGridList() this.getOrgTreeList()
await this.loadTable() await this.loadTable()
@ -274,7 +281,7 @@ export default {
async loadTable () { async loadTable () {
this.tableLoading = true 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" // const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/icEpidemicSpecialAttention/list"
let params = { let params = {
pageSize: this.pageSize, pageSize: this.pageSize,
@ -296,14 +303,38 @@ export default {
this.tableLoading = false this.tableLoading = false
}, },
handleChangeGrid (val) {
console.log('val', val) handleChangeAgency (val) {
let obj = this.$refs["myCascader"].getCheckedNodes()[0].data
if (obj) {
if (obj.level === 'grid') {
this.formData.orgId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.formData.orgType = 'grid'
this.formData.gridId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.formData.agencyId = ''
} else {
this.formData.orgId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.formData.orgType = 'agency'
this.formData.agencyId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : '';
this.formData.gridId = ''
}
} else {
this.formData.orgId = ''
this.formData.orgType = ''
this.formData.agencyId = ''
this.formData.gridId = ''
}
this.formData.neighborHoodId = '' this.formData.neighborHoodId = ''
this.formData.buildingId = '' this.formData.buildingId = ''
this.formData.unitId = '' this.formData.unitId = ''
this.formData.houseId = '' this.formData.houseId = ''
this.getValiheList() this.getValiheList()
}, },
handleChangeV (val) { handleChangeV (val) {
console.log('val', val) console.log('val', val)
this.formData.buildingId = '' this.formData.buildingId = ''
@ -324,16 +355,17 @@ export default {
this.formData.houseId = '' this.formData.houseId = ''
this.getHouseList() this.getHouseList()
}, },
getGridList () { getOrgTreeList () {
const { user } = this.$store.state const { user } = this.$store.state
this.$http this.$http
.post('/gov/org/customergrid/gridoption', { agencyId: user.agencyId, purpose: 'query' }) .post('/gov/org/customeragency/agencygridtree', {})
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} else { } else {
console.log('获取查询详情成功', res.data) console.log('获取组织树成功', res.data)
this.optionsG = res.data this.orgOptions = []
this.orgOptions.push(res.data)
} }
}) })
.catch(() => { .catch(() => {
@ -343,7 +375,7 @@ export default {
getValiheList () { getValiheList () {
const { user } = this.$store.state const { user } = this.$store.state
this.$http this.$http
.post('/gov/org/icneighborhood/neighborhoodoption', { orgId: this.formData.GRID_ID, agencyId: user.agencyId }) .post('/gov/org/icneighborhood/neighborhoodoption', { gridId: this.formData.gridId, agencyId: this.formData.agencyId })
.then(({ data: res }) => { .then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
@ -405,15 +437,16 @@ export default {
// //
resetSearch () { resetSearch () {
this.agencyIdArray = []
this.formData = { this.formData = {
orgId: '',
orgType: '',
ruleId: '', ruleId: '',
ruleList: [], ruleList: {},
name: '', name: '',
mobile: '', mobile: '',
idCard: '', idCard: '',
remark: '',
reason: '',
neighborHoodId: '', neighborHoodId: '',
buildingId: '', buildingId: '',
unitId: '', unitId: '',
@ -437,21 +470,41 @@ export default {
// //
async handleExport () { async handleExport () {
let title = '核酸检测关注名单' this.exportBtn = true
this.exportBtnTitle = '正在导出...'
const url = "/epmetuser/icEpidemicSpecialAttention/vaccination-export" let params = {
...this.formData
}
app.ajax.exportFilePost(
url,
this.formData,
(data, rspMsg) => {
this.download(data, title + '.xlsx') await this.$http({
}, method: 'POST',
(rspMsg, data) => { url: '/heart/policy/export-resiuser',
this.$message.error(rspMsg); responseType: 'blob',
} data: params
); })
.then(res => {
console.log('resllll', res)
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1])
console.log('filename', fileName)
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
var url = window.URL.createObjectURL(blob)
var aLink = document.createElement('a')
aLink.style.display = 'none'
aLink.href = url
aLink.setAttribute('download', fileName)
document.body.appendChild(aLink)
aLink.click()
document.body.removeChild(aLink) //
window.URL.revokeObjectURL(url) //blob
})
.catch((err) => {
console.log('获取导出情失败', err)
this.$message.error('获取导出失败')
})
this.exportBtnTitle = '导出'
this.exportBtn = false
}, },
@ -520,9 +573,9 @@ export default {
required: '' required: ''
}, },
ruleList: { ruleList: {
type: Array, type: Object,
default () { default () {
return [] return {}
} }
}, },

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

@ -131,7 +131,7 @@
<el-button @click="handleDetail(scope.row)" <el-button @click="handleDetail(scope.row)"
type="text" type="text"
size="small" size="small"
class=".div-table-button--detail">详情</el-button> class="div-table-button--detail">详情</el-button>
<el-button @click="handleEdit(scope.row)" <el-button @click="handleEdit(scope.row)"
type="text" type="text"
size="small" size="small"
@ -355,13 +355,13 @@ export default {
this.policyId = row.policyId this.policyId = row.policyId
this.$confirm("确认取消服务?", "提示", { this.$confirm("确认删除政策?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}) })
.then(() => { .then(() => {
this.cancelFuwu() this.delPolicy()
}) })
.catch(err => { .catch(err => {
if (err == "cancel") { if (err == "cancel") {
@ -370,18 +370,14 @@ export default {
// message: "" // message: ""
// }); // });
} }
}); });
}, },
async cancelFuwu () { async delPolicy () {
const url = `/heart/policy/delete/${this.policyId}`; const url = `/heart/policy/delete/${this.policyId}`;
const { data, code, msg } = await requestPost(url, {}); const { data, code, msg } = await requestPost(url, {});
if (code === 0) { if (code === 0) {

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

@ -11,12 +11,17 @@
<span @click="clickTab('static')" <span @click="clickTab('static')"
:class="['tab-title',{'tab-title-sel':staticSel}]">统计信息</span> :class="['tab-title',{'tab-title-sel':staticSel}]">统计信息</span>
<el-button class="diy-button--search" <el-button v-if="formType!=='detail'"
class="diy-button--search"
@click="handlePreview" @click="handlePreview"
plain
:disabled="formType!=='detail' "
size="mini">预览</el-button> size="mini">预览</el-button>
<el-button class="diy-button--add" <el-button v-if="formType!=='detail'"
class="diy-button--add"
@click="addRule" @click="addRule"
plain
size="mini">增加</el-button> size="mini">增加</el-button>
</div> </div>
@ -27,8 +32,7 @@
<el-select class="item_width_1" <el-select class="item_width_1"
v-model="personItem.itemGroupId" v-model="personItem.itemGroupId"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in groupList" <el-option v-for="item in groupList"
@click.native="handleSelGroup(personIndex,item)" @click.native="handleSelGroup(personIndex,item)"
:key="item.id" :key="item.id"
@ -39,8 +43,7 @@
<el-select class="item_width_1" <el-select class="item_width_1"
v-model="personItem.itemId" v-model="personItem.itemId"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in personItem.itemList" <el-option v-for="item in personItem.itemList"
@click.native="handleSelGroupItem(personIndex,item)" @click.native="handleSelGroupItem(personIndex,item)"
:key="item.itemId" :key="item.itemId"
@ -51,9 +54,9 @@
<el-select class="item_width_1" <el-select class="item_width_1"
v-model="personItem.queryType" v-model="personItem.queryType"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in queryList" <el-option v-for="item in queryList"
@click.native="handleSelPersonQuery(personIndex,item)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
@ -65,9 +68,9 @@
class="item_width_1" class="item_width_1"
v-model="personItem.colVal" v-model="personItem.colVal"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in personItem.colOption" <el-option v-for="item in personItem.colOption"
@click.native="handleSelPersonValue(personIndex,item)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
@ -83,9 +86,9 @@
<el-date-picker v-else-if="personItem.colType==='datepicker'||personItem.colType==='date'" <el-date-picker v-else-if="personItem.colType==='datepicker'||personItem.colType==='date'"
v-model="personItem.colVal" v-model="personItem.colVal"
class="item_width_1" class="item_width_1"
type="date" type="datetime"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
value="yyyy-MM-dd" value="yyyy-MM-dd HH:mm:ss"
placeholder="开始时间"> placeholder="开始时间">
</el-date-picker> </el-date-picker>
<el-input v-else <el-input v-else
@ -100,19 +103,19 @@
class="item_width_1" class="item_width_1"
v-model="personItem.nextLogicalRel" v-model="personItem.nextLogicalRel"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in logicalList" <el-option v-for="item in logicalList"
@click.native="handleSelPersonLogical(personIndex,item)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<el-button icon="el-icon-remove-outline" <img v-if="formType!=='detail'"
circle class="img_del"
@click="delPerson(personIndex)" src="@/assets/img/icon-del.png"
type="danger"></el-button> @click="delPerson(personIndex)">
</div> </div>
@ -126,13 +129,12 @@
size="mini" size="mini"
placeholder="请输入" placeholder="请输入"
:disabled="true" :disabled="true"
v-model="houseItem.titleName"> v-model="houseTitleName">
</el-input> </el-input>
<el-select class="item_width_1" <el-select class="item_width_1"
v-model="houseItem.colKey" v-model="houseItem.colKey"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in houseItemList" <el-option v-for="item in houseItemList"
@click.native="handleSelHouseItem(houseIndex,item)" @click.native="handleSelHouseItem(houseIndex,item)"
:key="item.colKey" :key="item.colKey"
@ -143,9 +145,9 @@
<el-select class="item_width_1" <el-select class="item_width_1"
v-model="houseItem.queryType" v-model="houseItem.queryType"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in queryList" <el-option v-for="item in queryList"
@click.native="handleSelHouseQuery(houseIndex,item)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
@ -157,9 +159,9 @@
class="item_width_1" class="item_width_1"
v-model="houseItem.colVal" v-model="houseItem.colVal"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in houseItem.colOption" <el-option v-for="item in houseItem.colOption"
@click.native="handleSelHouseValue(houseIndex,item)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
@ -174,10 +176,10 @@
<el-date-picker v-else-if="houseItem.colType==='datepicker'||houseItem.colType==='date'" <el-date-picker v-else-if="houseItem.colType==='datepicker'||houseItem.colType==='date'"
v-model="houseItem.colVal" v-model="houseItem.colVal"
class="item_width_1" class="item_width_1"
type="date" type="datetime"
size="mini" size="mini"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
value="yyyy-MM-dd" value="yyyy-MM-dd HH:mm:ss"
placeholder="开始时间"> placeholder="开始时间">
</el-date-picker> </el-date-picker>
<el-input v-else <el-input v-else
@ -192,19 +194,23 @@
class="item_width_1" class="item_width_1"
v-model="houseItem.nextLogicalRel" v-model="houseItem.nextLogicalRel"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in logicalList" <el-option v-for="item in logicalList"
@click.native="handleSelHouseLogical(houseIndex,item)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<el-button icon="el-icon-remove-outline" <img v-if="formType!=='detail'"
class="img_del"
src="@/assets/img/icon-del.png"
@click="delHouse(houseIndex)">
<!-- <el-button icon="el-icon-remove-outline"
circle circle
@click="delHouse(houseIndex)" @click="delHouse(houseIndex)"
type="danger"></el-button> type="danger"></el-button> -->
</div> </div>
@ -218,13 +224,12 @@
size="mini" size="mini"
placeholder="请输入" placeholder="请输入"
:disabled="true" :disabled="true"
v-model="staticItem.titleName"> v-model="statTitleName">
</el-input> </el-input>
<el-select class="item_width_1" <el-select class="item_width_1"
v-model="staticItem.colKey" v-model="staticItem.colKey"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in staticItemList" <el-option v-for="item in staticItemList"
@click.native="handleSelStaticItem(staticIndex,item)" @click.native="handleSelStaticItem(staticIndex,item)"
:key="item.colKey" :key="item.colKey"
@ -235,9 +240,9 @@
<el-select class="item_width_1" <el-select class="item_width_1"
v-model="staticItem.queryType" v-model="staticItem.queryType"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in queryList" <el-option v-for="item in queryList"
@click.native="handleSelStaticQuery(staticIndex,item)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
@ -249,9 +254,9 @@
class="item_width_1" class="item_width_1"
v-model="staticItem.colVal" v-model="staticItem.colVal"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in staticItem.colOption" <el-option v-for="item in staticItem.colOption"
@click.native="handleSelStaticValue(staticIndex,item)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
@ -266,9 +271,9 @@
<el-date-picker v-else-if="staticItem.colType==='datepicker'||staticItem.colType==='date'" <el-date-picker v-else-if="staticItem.colType==='datepicker'||staticItem.colType==='date'"
v-model="staticItem.colVal" v-model="staticItem.colVal"
class="item_width_1" class="item_width_1"
type="date" type="datetime"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
value="yyyy-MM-dd" value="yyyy-MM-dd HH:mm:ss"
placeholder="开始时间"> placeholder="开始时间">
</el-date-picker> </el-date-picker>
<el-input v-else <el-input v-else
@ -283,19 +288,19 @@
class="item_width_1" class="item_width_1"
v-model="staticItem.nextLogicalRel" v-model="staticItem.nextLogicalRel"
size="mini" size="mini"
placeholder="全部" placeholder="全部">
clearable>
<el-option v-for="item in logicalList" <el-option v-for="item in logicalList"
@click.native="handleSelStaticLogical(houseIndex,item)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<el-button icon="el-icon-remove-outline" <img v-if="formType!=='detail'"
circle class="img_del"
@click="delStatic(staticIndex)" src="@/assets/img/icon-del.png"
type="danger"></el-button> @click="delStatic(staticIndex)">
</div> </div>
</div> </div>
@ -368,10 +373,16 @@ export default {
itemList: [], itemList: [],
colType: '',// colType: '',//
colOption: [], colOption: [],
itemGroupName: '',
itemLabel: '',
queryTypeName: '',
colValLabel: '',
nextLogicalRelName: '',
} }
], ],
houseRuleList: [], houseRuleList: [],
houseTitleName: '房屋信息',
houseRuleList1: [ houseRuleList1: [
{ {
ruleDesc: '', ruleDesc: '',
@ -384,8 +395,14 @@ export default {
titleName: '房屋信息', titleName: '房屋信息',
colType: '',// colType: '',//
colOption: [], colOption: [],
itemGroupName: '房屋信息',
itemLabel: '',
queryTypeName: '',
colValLabel: '',
nextLogicalRelName: '',
} }
], ],
statTitleName: '统计信息',
statRuleList: [], statRuleList: [],
statRuleList1: [ statRuleList1: [
{ {
@ -399,13 +416,18 @@ export default {
titleName: '统计信息', titleName: '统计信息',
colType: '',// colType: '',//
colOption: [], colOption: [],
itemGroupName: '统计信息',
itemLabel: '',
queryTypeName: '',
colValLabel: '',
nextLogicalRelName: '',
} }
], ],
okflag: false, okflag: false,
showPersonList: false, showPersonList: false,
ruleList: [] ruleList: {}
} }
}, },
@ -414,34 +436,52 @@ export default {
}, },
components: { personListItem }, components: { personListItem },
async mounted () { async created () {
this.loadPersonGroup() // this.startLoading()
this.loadHouseItem() await this.loadPersonGroup()
this.loadStaticItem() await this.loadHouseItem()
this.loadDicOption() await this.loadStaticItem()
await this.loadDicOption()
}, },
methods: { methods: {
async setRule (resiRuleList, houseRuleList, statRuleList) { 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 = resiRuleList
if (this.resiRuleList && this.resiRuleList.length > 0) {
for (let i = 0; i < this.resiRuleList.length; i++) {
this.resiRuleList.forEach((element, index) => { let element = this.resiRuleList[i]
let selGroup = this.groupList.filter((item) => let selGroup = this.groupList.filter((item) =>
element.itemGroupId === item.id element.itemGroupId === item.id
); );
console.log(selGroup)
if (selGroup.length > 0) { 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 }
}
}
this.houseRuleList = houseRuleList
if (this.houseRuleList && this.houseRuleList.length > 0) {
this.houseRuleList.forEach((element, index) => { this.houseRuleList.forEach((element, index) => {
let selHouseItem = this.houseItemList.filter((item) => let selHouseItem = this.houseItemList.filter((item) =>
@ -453,9 +493,9 @@ export default {
} }
}); });
}
this.statRuleList = statRuleList this.statRuleList = statRuleList
if (this.statRuleList && this.statRuleList.length > 0) {
this.statRuleList.forEach((element, index) => { this.statRuleList.forEach((element, index) => {
let selStaticItem = this.staticItemList.filter((item) => let selStaticItem = this.staticItemList.filter((item) =>
@ -467,16 +507,20 @@ export default {
} }
}); });
}
// this.endLoading()
}, },
getRule () { getRule (valPerson, valHouse, valStatic) {
this.okflag = false this.okflag = false
let messageObj = this.validateRule()
console.log('resiRuleList', this.resiRuleList) let messageObj = this.validateRule(valPerson, valHouse, valStatic)
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) { if (messageObj) {
this.$message.error(messageObj) this.$message.error(messageObj)
@ -500,16 +544,14 @@ export default {
}, },
validateRule () { validateRule (valPerson, valHouse, valStatic) {
let message = '' let message = ''
if (valPerson) {
this.resiRuleList.forEach((item, index) => { this.resiRuleList.forEach((item, index) => {
if (index === this.resiRuleList.length - 1) { if (index === this.resiRuleList.length - 1) {
if ( if (item.itemGroupId === '' ||
item.ruleDesc === '' ||
item.itemGroupId === '' ||
item.itemId === '' || item.itemId === '' ||
item.queryType === '' || item.queryType === '' ||
item.colKey === '' || item.colKey === '' ||
@ -520,7 +562,6 @@ export default {
} }
} else { } else {
if (item.nextLogicalRel === '' || if (item.nextLogicalRel === '' ||
item.ruleDesc === '' ||
item.itemGroupId === '' || item.itemGroupId === '' ||
item.itemId === '' || item.itemId === '' ||
item.queryType === '' || item.queryType === '' ||
@ -533,15 +574,16 @@ export default {
} }
}); });
}
if (valHouse) {
this.houseRuleList.forEach((item, index) => { this.houseRuleList.forEach((item, index) => {
if (index === this.houseRuleList.length - 1) { if (index === this.houseRuleList.length - 1) {
if ( if (item.queryType === '' ||
item.ruleDesc === '' ||
item.queryType === '' ||
item.colKey === '' || item.colKey === '' ||
item.colVal === '') { item.colVal === '') {
@ -550,7 +592,6 @@ export default {
} }
} else { } else {
if (item.nextLogicalRel === '' || if (item.nextLogicalRel === '' ||
item.ruleDesc === '' ||
item.queryType === '' || item.queryType === '' ||
item.colKey === '' || item.colKey === '' ||
item.colVal === '') { item.colVal === '') {
@ -560,13 +601,12 @@ export default {
} }
} }
}); });
}
if (valStatic) {
this.statRuleList.forEach((item, index) => { this.statRuleList.forEach((item, index) => {
if (index === this.statRuleList.length - 1) { if (index === this.statRuleList.length - 1) {
if ( if (item.queryType === '' ||
item.ruleDesc === '' ||
item.queryType === '' ||
item.colKey === '' || item.colKey === '' ||
item.colVal === '') { item.colVal === '') {
@ -574,9 +614,7 @@ export default {
return message return message
} }
} else { } else {
if ( if (item.nextLogicalRel === '' ||
item.nextLogicalRel === '' ||
item.ruleDesc === '' ||
item.queryType === '' || item.queryType === '' ||
item.colKey === '' || item.colKey === '' ||
item.colVal === '') { item.colVal === '') {
@ -586,126 +624,50 @@ export default {
} }
} }
}); });
}
return message return message
}, },
handlePreview () { handlePreview () {
this.ruleList = {} if (!this.personChecked && !this.houseChecked && !this.staticChecked) {
this.ruleList = { this.$message.info('请勾选要预览的规则')
resiRuleList: this.resiRuleList, return false
houseRuleList: this.houseRuleList,
statRuleList: this.statRuleList,
} }
this.showPersonList = true this.getRule(this.personChecked, this.houseChecked, this.staticChecked)
}, if (!this.okflag) {
return false
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
}
},
addRule () {
if (this.personSel) {
this.addPerson()
} }
this.ruleList = {}
if (this.houseSel) { this.ruleList = {
this.addHouse() resiRuleList: [],
houseRuleList: [],
statRuleList: [],
} }
if (this.staticSel) { if (this.personChecked) {
this.addStatic() this.ruleList.resiRuleList = this.resiRuleList
} }
}, if (this.houseChecked) {
this.ruleList.houseRuleList = this.houseRuleList
addPerson () {
let obj = {
ruleDesc: '',//
nextLogicalRel: 'and',//andor
itemGroupId: '',
itemId: '',
queryType: '',
colTable: '',
colKey: '',
colVal: '',
itemList: [],
colType: '',//
colOption: [],
} }
if (this.staticChecked) {
this.resiRuleList.push(obj) this.ruleList.statRuleList = this.statRuleList
},
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) this.showPersonList = true
},
delHouse (index) {
this.houseRuleList.splice(index, 1);
}, },
addStatic () { handleClose () {
let obj = { this.showPersonList = false
ruleDesc: '统计信息',
nextLogicalRel: 'and',//andor
queryType: '',
colTable: '',
colKey: '',
colVal: '',
titleName: '统计信息',
colType: '',//
colOption: [],
}
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 = '/oper/customize/icformitem/getItemListV2'
// const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree' // const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree'
let params = { let params = {
@ -717,34 +679,41 @@ export default {
const { data, code, msg } = await requestPost(url, params) const { data, code, msg } = await requestPost(url, params)
if (code === 0) { if (code === 0) {
let oneData = this.resiRuleList[personIndex] let oneData = this.resiRuleList[personIndex]
oneData.ruleDesc = item.label oneData.itemGroupName = item.label
oneData.itemList = data oneData.itemList = data
oneData.colTable = item.tableName oneData.colTable = item.tableName
this.$set(this.resiRuleList, personIndex, oneData)
if (isEdit) { if (!isSet) {//
let selItem = oneData.itemList.filter((item) => oneData.nextLogicalRel = ''
oneData.itemId === item.itemId); oneData.itemId = ''
if (selItem.length > 0) { oneData.queryType = ''
this.handleSelGroupItem(personIndex, selItem[0]) oneData.colKey = ''
} oneData.colVal = ''
} }
this.$set(this.resiRuleList, personIndex, oneData)
} else { } else {
this.$message.error(msg) this.$message.error(msg)
} }
}, },
// //
async handleSelGroupItem (personIndex, item) { async handleSelGroupItem (personIndex, item, isSet) {
let oneData = this.resiRuleList[personIndex] let oneData = this.resiRuleList[personIndex]
oneData.colKey = item.columnName oneData.colKey = item.columnName
oneData.colType = item.itemType 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') { if (item.optionSourceType === 'remote') {
const url = item.optionSourceValue const url = item.optionSourceValue
@ -767,14 +736,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] let oneData = this.houseRuleList[houseIndex]
oneData.colTable = item.tableName oneData.colTable = item.tableName
oneData.colType = item.itemType 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') { if (item.optionSourceType === 'remote') {
const url = item.optionSourceUrl const url = item.optionSourceUrl
@ -796,18 +800,50 @@ export default {
oneData.colOption = [] 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) 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] let oneData = this.statRuleList[staticIndex]
oneData.colTable = item.tableName oneData.colTable = item.tableName
oneData.colType = item.itemType 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') { if (item.optionSourceType === 'remote') {
const url = item.optionSourceUrl const url = item.optionSourceUrl
@ -834,6 +870,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 () { async loadPersonGroup () {
const url = '/oper/customize/icformitemgroup/list' const url = '/oper/customize/icformitemgroup/list'
@ -962,6 +1137,10 @@ export default {
}, },
props: { props: {
formType: {
type: String,
required: 'true'
},
} }
} }
@ -996,4 +1175,11 @@ export default {
/deep/.el-checkbox:last-of-type { /deep/.el-checkbox:last-of-type {
margin-right: 10px; margin-right: 10px;
} }
.img_del {
width: 25px;
height: 25px;
margin-top: 6px;
cursor: pointer;
}
</style> </style>

Loading…
Cancel
Save