|
|
@@ -54,14 +54,13 @@
|
|
|
</vab-query-form-left-panel>
|
|
|
<vab-query-form-right-panel>
|
|
|
<table-tool :check-list.sync="checkList" :columns="columns" />
|
|
|
-
|
|
|
- <el-button icon="el-icon-download" style="float: right" />
|
|
|
</vab-query-form-right-panel>
|
|
|
|
|
|
<el-table
|
|
|
v-loading="listLoading"
|
|
|
border
|
|
|
:data="list"
|
|
|
+ :height="$baseTableHeight(2)"
|
|
|
style="width: 100%; height: 500px"
|
|
|
@selection-change="setSelectRows">
|
|
|
<el-table-column
|
|
|
@@ -97,20 +96,20 @@
|
|
|
@size-change="handleSizeChange" />
|
|
|
</div>
|
|
|
</div>
|
|
|
- <edit ref="edit" @fetch-data="fetchData" />
|
|
|
- <reg-edit ref="reg-edit" @fetch-data="fetchData" />
|
|
|
+ <region-edit ref="region-edit" @fetch-data="getRegionList" />
|
|
|
+ <region-details-edit ref="details-edit" @fetch-data="fetchData" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import Edit from './components/RegionEdit'
|
|
|
- import RegEdit from './components/RegEdit'
|
|
|
- import regionApi from '@/api/base/region/region'
|
|
|
+ import regionApi from '@/api/base/region'
|
|
|
import TableTool from '@/components/table/TableTool'
|
|
|
+ import RegionDetailsEdit from './components/RegionDetailsEdit.vue'
|
|
|
+ import RegionEdit from './components/RegionEdit'
|
|
|
|
|
|
export default {
|
|
|
- name: 'Distr',
|
|
|
- components: { Edit, RegEdit, TableTool },
|
|
|
+ name: 'Region',
|
|
|
+ components: { RegionDetailsEdit, RegionEdit, TableTool },
|
|
|
data() {
|
|
|
return {
|
|
|
current: '',
|
|
|
@@ -183,8 +182,8 @@
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
- this.fetchData()
|
|
|
- this.getRegion()
|
|
|
+ // this.fetchData()
|
|
|
+ this.getRegionList()
|
|
|
this.getOptions()
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -204,18 +203,16 @@
|
|
|
})
|
|
|
.catch((err) => console.log(err))
|
|
|
},
|
|
|
- async getRegion() {
|
|
|
- const { data: data } = await regionApi.getRegion({})
|
|
|
- var first_id = data.list[0].id
|
|
|
-
|
|
|
+ async getRegionList() {
|
|
|
+ const { data: data } = await regionApi.getRegionList()
|
|
|
this.deptOptions = data.list
|
|
|
- this.queryForm.regionId = first_id //data.list[0].id
|
|
|
- this.$refs['edit'].setRegion(first_id)
|
|
|
+
|
|
|
+ this.regionId = data.list[0].id
|
|
|
//默认第一选中
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.tree.setCurrentKey(first_id)
|
|
|
+ this.$refs.tree.setCurrentKey(this.regionId)
|
|
|
})
|
|
|
- this.fetchData()
|
|
|
+ await this.fetchData()
|
|
|
},
|
|
|
// 筛选节点
|
|
|
filterNode(value, data) {
|
|
|
@@ -224,9 +221,7 @@
|
|
|
},
|
|
|
// 节点单击事件
|
|
|
handleNodeClick(data) {
|
|
|
- console.log('ID', data.id)
|
|
|
- this.$refs['edit'].setRegion(data.id)
|
|
|
- this.queryForm.regionId = data.id
|
|
|
+ this.regionId = data.id
|
|
|
this.fetchData()
|
|
|
},
|
|
|
|
|
|
@@ -234,29 +229,28 @@
|
|
|
this.selectRows = val
|
|
|
},
|
|
|
getCheckedNodes() {
|
|
|
- this.$refs['reg-edit'].showEdit()
|
|
|
+ this.$refs['region-edit'].showEdit()
|
|
|
},
|
|
|
handleEdit(row) {
|
|
|
+ this.$refs['details-edit'].setRegion(this.regionId)
|
|
|
if (row.id) {
|
|
|
- this.$refs['edit'].showEdit(row)
|
|
|
+ this.$refs['details-edit'].showEdit(row)
|
|
|
} else {
|
|
|
- this.$refs['edit'].showEdit()
|
|
|
+ this.$refs['details-edit'].showEdit()
|
|
|
}
|
|
|
},
|
|
|
handleDelete(row) {
|
|
|
if (row.id) {
|
|
|
- console.log('deletedId', row.id)
|
|
|
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
|
|
- const { msg } = await regionApi.doDelete({ ids: row.id })
|
|
|
+ const { msg } = await regionApi.deleteRegionDetail({ ids: [row.id] })
|
|
|
this.$baseMessage(msg, 'success', 'vab-hey-message-success')
|
|
|
await this.fetchData()
|
|
|
})
|
|
|
} else {
|
|
|
if (this.selectRows.length > 0) {
|
|
|
const ids = this.selectRows.map((item) => parseInt(item.id))
|
|
|
- console.log(ids)
|
|
|
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
|
|
- const { msg } = await regionApi.doDelete({ ids })
|
|
|
+ const { msg } = await regionApi.deleteRegionDetail({ ids })
|
|
|
this.$baseMessage(msg, 'success', 'vab-hey-message-success')
|
|
|
await this.fetchData()
|
|
|
})
|
|
|
@@ -265,6 +259,7 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
handleSizeChange(val) {
|
|
|
this.queryForm.pageSize = val
|
|
|
this.fetchData()
|
|
|
@@ -274,16 +269,16 @@
|
|
|
this.fetchData()
|
|
|
},
|
|
|
queryData() {
|
|
|
- console.log('ffff')
|
|
|
this.queryForm.pageNum = 1
|
|
|
this.fetchData()
|
|
|
},
|
|
|
|
|
|
async fetchData() {
|
|
|
+ this.queryForm.regionId = this.regionId
|
|
|
this.listLoading = true
|
|
|
const {
|
|
|
data: { list, total },
|
|
|
- } = await regionApi.getList(this.queryForm)
|
|
|
+ } = await regionApi.getRegionDetailList(this.queryForm)
|
|
|
this.list = list
|
|
|
this.total = total
|
|
|
this.listLoading = false
|