部门增加按名称模糊查询

This commit is contained in:
lizhicheng2 2022-11-08 18:01:20 +08:00
parent 7ba6767cda
commit de21518dbd
1 changed files with 11 additions and 60 deletions

View File

@ -2,6 +2,12 @@
<el-card shadow="never" class="aui-card--fill">
<div class="mod-sys__dept">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.deptName" :placeholder="$t('dept.name')" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:dept:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}
</el-button>
@ -42,77 +48,22 @@
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './dept-add-or-update'
import qs from 'qs'
export default {
mixins: [mixinViewModule],
data() {
return {
mixinViewModuleOptions: {
getDataListURL: '/sys/dept/list',
getDataListURL: '/sys/dept/page',
getDataListIsPage: true,
deleteURL: '/sys/dept'
},
total: 0,
limit: 10,
page: 1,
dataList: []
dataForm: {
deptName: ''
}
}
},
components: {
AddOrUpdate
},
watch: {
dataList: {
handler: function () {
this.getData()
}
}
},
methods: {
// ,
pageSizeChangeHandle (val) {
this.page = 1
this.limit = val
this.getData()
},
// ,
pageCurrentChangeHandle (val) {
this.page = val
this.getData()
},
getData() {
// debugger
let _data = {
limt: this.limit,
page: this.page,
}
this.$http.get('sys/dept/page', {
params: _data
}).then((res) => {
this.total = res.data.data.total;
res.data.data.list.map((item, index) => {
console.log('item, index------------>', item, index);
if (item.district != null || item.children.length >= 0) {
this.$http.get('/sys/region/' + item.district).then((data) => {
this.dataList[index].district = data.data.data.name
console.log('datafrom', this.dataList)
})
if (item.children.length > 0) {
item.children.map((item2, index2) => {
if (item2.district != null) {
this.$http.get('/sys/region/' + item2.district).then((data) => {
this.dataList[index].children[index2].district = data.data.data.name
console.log('datafrom', this.dataList)
})
}
})
}
}
})
})
},
},
created() {
this.getData()
}
}
</script>