|
@@ -47,18 +47,19 @@
|
|
|
</basic-container>
|
|
|
<el-dialog
|
|
|
:visible.sync="dialogFormVisible"
|
|
|
- :table-loading="tableLoading"
|
|
|
title="字典项管理"
|
|
|
width="90%"
|
|
|
@close="dialogFormVisible=false">
|
|
|
<avue-crud
|
|
|
ref="crudItem"
|
|
|
+ :page="itemPage"
|
|
|
:data="tableDictItemData"
|
|
|
:permission="permissionList"
|
|
|
v-model="form"
|
|
|
:before-open="handleBeforeOpen"
|
|
|
:option="tableDictItemOption"
|
|
|
- :table-loading="tableLoading"
|
|
|
+ @size-change="itemSizeChange"
|
|
|
+ @current-change="itemCurrentChange"
|
|
|
@row-update="handleItemUpdate"
|
|
|
@row-save="handleItemSave"
|
|
|
@row-del="rowItemDel"/>
|
|
@@ -90,15 +91,16 @@
|
|
|
currentPage: 1, // 当前页数
|
|
|
pageSize: 20 // 每页显示多少条
|
|
|
},
|
|
|
+ itemPage: {
|
|
|
+ total: 0, // 总页数
|
|
|
+ currentPage: 1, // 当前页数
|
|
|
+ pageSize: 20 // 每页显示多少条
|
|
|
+ },
|
|
|
tableLoading: false,
|
|
|
tableOption: tableOption,
|
|
|
tableDictItemOption: tableDictItemOption
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- },
|
|
|
- mounted: function () {
|
|
|
- },
|
|
|
computed: {
|
|
|
...mapGetters(['permissions']),
|
|
|
permissionList() {
|
|
@@ -110,6 +112,7 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ //======字典表格相关=====
|
|
|
getList(page, params) {
|
|
|
this.tableLoading = true
|
|
|
fetchList(Object.assign({
|
|
@@ -121,27 +124,7 @@
|
|
|
this.tableLoading = false
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- getDictItemList(dictId, type) {
|
|
|
- this.dictType = type
|
|
|
- this.dictId = dictId
|
|
|
- this.dialogFormVisible = true
|
|
|
- this.tableLoading = true
|
|
|
- fetchItemList(Object.assign({
|
|
|
- current: this.page.currentPage,
|
|
|
- size: this.page.pageSize
|
|
|
- }, {dictId: dictId})).then(response => {
|
|
|
- this.tableDictItemData = response.data.data.records
|
|
|
- this.tableLoading = false
|
|
|
- })
|
|
|
- },
|
|
|
- handleBeforeOpen(done) {
|
|
|
- this.form.type = this.dictType
|
|
|
- this.form.dictId = this.dictId
|
|
|
- done()
|
|
|
- },
|
|
|
rowDel: function (row) {
|
|
|
- var _this = this
|
|
|
this.$confirm('是否确认删除数据类型为"' + row.type + '"的数据项?', '警告', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -150,7 +133,7 @@
|
|
|
return delObj(row)
|
|
|
}).then(() => {
|
|
|
this.getList(this.page)
|
|
|
- _this.$message.success('删除成功')
|
|
|
+ this.$message.success('删除成功')
|
|
|
}).catch(function () {
|
|
|
})
|
|
|
},
|
|
@@ -168,6 +151,38 @@
|
|
|
done()
|
|
|
})
|
|
|
},
|
|
|
+ searchChange(form, done) {
|
|
|
+ this.searchForm = form
|
|
|
+ this.getList(this.page, form)
|
|
|
+ done()
|
|
|
+ },
|
|
|
+ sizeChange(pageSize) {
|
|
|
+ this.page.pageSize = pageSize
|
|
|
+ },
|
|
|
+ currentChange(current) {
|
|
|
+ this.page.currentPage = current
|
|
|
+ },
|
|
|
+ //======字典项表格相关=====
|
|
|
+ handleItem: function (row) {
|
|
|
+ this.getDictItemList(row.id, row.type)
|
|
|
+ },
|
|
|
+ getDictItemList(dictId, type) {
|
|
|
+ this.dictType = type
|
|
|
+ this.dictId = dictId
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ fetchItemList(Object.assign({
|
|
|
+ current: this.itemPage.currentPage,
|
|
|
+ size: this.itemPage.pageSize
|
|
|
+ }, {dictId: dictId})).then(response => {
|
|
|
+ this.tableDictItemData = response.data.data.records
|
|
|
+ this.itemPage.total = response.data.data.total
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleBeforeOpen(done) {
|
|
|
+ this.form.type = this.dictType
|
|
|
+ this.form.dictId = this.dictId
|
|
|
+ done()
|
|
|
+ },
|
|
|
handleItemSave: function (row, done) {
|
|
|
addItemObj(row).then(() => {
|
|
|
this.$message.success('添加成功')
|
|
@@ -182,22 +197,15 @@
|
|
|
done()
|
|
|
})
|
|
|
},
|
|
|
- searchChange(form, done) {
|
|
|
- this.searchForm = form
|
|
|
- this.getList(this.page, form)
|
|
|
- done()
|
|
|
- },
|
|
|
- sizeChange(pageSize) {
|
|
|
- this.page.pageSize = pageSize
|
|
|
- },
|
|
|
- currentChange(current) {
|
|
|
- this.page.currentPage = current
|
|
|
+ itemSizeChange(pageSize) {
|
|
|
+ this.itemPage.pageSize = pageSize
|
|
|
+ this.getDictItemList(this.dictId, this.type)
|
|
|
},
|
|
|
- handleItem: function (row) {
|
|
|
- this.getDictItemList(row.id, row.type)
|
|
|
+ itemCurrentChange(current) {
|
|
|
+ this.itemPage.currentPage = current
|
|
|
+ this.getDictItemList(this.dictId, this.type)
|
|
|
},
|
|
|
rowItemDel: function (row) {
|
|
|
- var _this = this
|
|
|
this.$confirm('是否确认删除数据为"' + row.label + '"的数据项?', '警告', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -206,7 +214,7 @@
|
|
|
return delItemObj(row.id)
|
|
|
}).then(() => {
|
|
|
this.getDictItemList(row.dictId, row.type)
|
|
|
- _this.$message.success('删除成功')
|
|
|
+ this.$message.success('删除成功')
|
|
|
}).catch(function () {
|
|
|
})
|
|
|
}
|