Browse Source

Merge branch 'dev-eventedit'

feature/dev_worklog2
13176889840 3 years ago
parent
commit
15daae1252
  1. 100
      src/views/modules/shequzhili/event/eventList.vue

100
src/views/modules/shequzhili/event/eventList.vue

@ -46,7 +46,26 @@
placeholder="请输入">
</el-input>
</el-form-item>
<el-form-item label="事件类型"
prop="firstIdList">
<el-cascader ref="cascaderEvent" v-model="eventTypeCheck" :options="cateOptions"
collapse-tags
:show-all-levels="false"
:props="{
multiple: true,
checkStrictly: false,
emitPath: false,
children:'subCategory',
label:'name',
value:'id'
}" clearable class="item_width_2" @change="handleEventType" />
<!-- <template slot-scope="{ node, data }">
<div @click="cascaderClick(node, data)">
<span>{{ data.name }}</span>
</div>
</template>
</el-cascader> -->
</el-form-item>
<el-form-item label="报事人"
prop="name">
<el-input v-model="formData.name"
@ -158,7 +177,17 @@
label="所属网格"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="categoryName"
label="事件类型"
min-width="140"
align="center"
:show-overflow-tooltip="true"
/>
<!-- <template slot-scope="scope">
{{ scope.row.firstName + '-' + scope.row.secondName }}
</template>
</el-table-column> -->
<el-table-column prop="eventContent"
label="事件内容"
align="center"
@ -419,8 +448,12 @@ export default {
startTime: '',
endTime: '',
status: '',
firstIdList: [],
secondIdList: [],
},
cateOptions: [],
eventTypeCheck: [],
pageNo: 1,
pageSize: window.localStorage.getItem("pageSize") || 20,
total: 1,
@ -465,8 +498,29 @@ export default {
this.agencyId = this.user.agencyId
this.loadGrid();
this.getTableData();
this.getCateOptions()
},
methods: {
handleEventType(val) {
// console.log('val-----eee', val)
console.log('nodes---', this.$refs.cascaderEvent.getCheckedNodes())
const nodes = this.$refs.cascaderEvent.getCheckedNodes()
this.formData.firstIdList = []
this.formData.secondIdList = []
let level1 = nodes.filter(item => item.level === 1)
let level2 = nodes.filter(item => item.level === 2)
console.log('level2----1', level2)
level1.forEach(item => {
console.log('level2----2', level2)
if (item.hasChildren) {
for (let i = level2.length - 1; i >= 0; i--) {
if (level2[i].parent.value === item.value) level2.splice(i, 1)
}
}
})
this.formData.firstIdList = level1.map(item => item.value)
this.formData.secondIdList = level2.map(item => item.value)
},
handleSelectionChange (val) {
this.multipleSelection = [];
val.forEach(element => {
@ -692,6 +746,23 @@ export default {
this.$message.error(msg);
}
},
async getCateOptions() {
const url = "/gov/issue/issueprojectcategorydict/list";
const { data, code, msg } = await requestPost(url, {});
if (code === 0) {
// this.cateOptions = data.map((item) => {
// item.subCategory.forEach((subitem) => {
// delete subitem.subCategory;
// });
// return item;
// });
this.cateOptions = this.deepTree(data, 'subCategory')
} else {
this.$message.error(msg);
}
},
handleSizeChange (val) {
@ -715,12 +786,27 @@ export default {
startTime: '',
endTime: '',
status: '',
firstIdList: [],
secondIdList: [],
}
this.eventTypeCheck = []
// this.pageNo = 1
this.pageNo = 1
this.getTableData();
// this.loadTable()
},
deepTree(arr, child) {
if (Array.isArray(arr) && arr.length > 0) {
return arr.map(item => {
// if (child === 'subAgencyList') item.value = item.orgType + '-' + item.orgId
return {
...item,
[child]: item[child] && item[child].length > 0 && this.deepTree(item[child], child) || null
}
})
}
}
},
};
</script>
@ -729,4 +815,10 @@ export default {
@import "@/assets/scss/buttonstyle.scss";
@import "@/assets/scss/modules/management/list-main.scss";
@import "@/assets/scss/modules/shequzhili/event-info.scss";
.div_search {
.item_width_2 {
width: 200px;
}
}
</style>

Loading…
Cancel
Save