update 产品属性表

This commit is contained in:
g7hoo 2022-08-11 16:24:14 +08:00
parent db5b5091e1
commit 3f2e8e8b9e

View File

@ -7,7 +7,6 @@
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <el-button @click="getDataList()">查询</el-button>
<el-button v-if="$hasPermission('monitoring:productarrt:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <el-button v-if="$hasPermission('monitoring:productarrt:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;"> <!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
@ -63,25 +62,14 @@ const tableConfigs = [
{ prop: 'createTime', name: '添加时间' }, { prop: 'createTime', name: '添加时间' },
{ prop: 'name', name: '属性名称' }, { prop: 'name', name: '属性名称' },
{ prop: 'code', name: '属性编码' }, { prop: 'code', name: '属性编码' },
{ prop: 'productId', name: '产品id,关联产品表' }, { prop: 'productId', name: '产品id' },
{ prop: 'value', name: '属性值' }, { prop: 'value', name: '属性值' },
{ prop: 'description', name: '描述' }, { prop: 'description', name: '描述' },
// { prop: 'id', name: 'ID' },
// { prop: 'externalCode', name: '' },
// { prop: 'enabled', name: ':0 1' },
// { prop: 'remark', name: '' },
// { prop: 'valid', name: ':1 0' },
// { prop: 'creatorId', name: '' },
// { prop: 'creatorName', name: '' },
// { prop: 'updaterId', name: '' },
// { prop: 'updaterName', name: '' },
// { prop: 'updateTime', name: '' },
// { prop: 'version', name: '' },
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] } { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
] ]
const addOrUpdateConfigs = { const addOrUpdateConfigs = {
type: 'dialog', type: 'dialog',
infoUrl: '/monitoring/productArrt', infoUrl: '/monitoring/productArrt',
fields: [ fields: [
{ {
@ -112,9 +100,9 @@ const addOrUpdateConfigs = {
} }
], ],
operations: [ operations: [
{name: 'cancel', showAlways: true}, { name: 'cancel', showAlways: true },
{name: 'save', url: '/monitoring/productArrt', permission: '', showOnEdit: false}, { name: 'save', url: '/monitoring/productArrt', permission: '', showOnEdit: false },
{name: 'update', url: '/monitoring/productArrt', permission: '', showOnEdit: true}, { name: 'update', url: '/monitoring/productArrt', permission: '', showOnEdit: true }
] ]
} }
@ -140,9 +128,32 @@ export default {
BaseTable BaseTable
}, },
activated() { activated() {
this.getProductList()
this.getDataList() this.getDataList()
}, },
methods: { methods: {
//
getProductList() {
this.$http({
url: this.$http.adornUrl('/monitoring/product/page'),
method: 'get',
params: this.$http.adornParams({
limit: 999,
page: 1
})
}).then(({ data: res }) => {
if (res && res.code === 0) {
this.addOrUpdateConfigs.fields.forEach(item => {
if (item.name === 'productId') item.options = res.data.list.map(item => ({ label: item.name, value: item.id }))
})
} else {
this.addOrUpdateConfigs.fields.forEach(item => {
if (item.name === 'productId') item.options.splice(0)
})
// this.plList.splice(0)
}
})
},
// //
getDataList() { getDataList() {
this.dataListLoading = true this.dataListLoading = true
@ -180,7 +191,7 @@ export default {
selectionChangeHandle(val) { selectionChangeHandle(val) {
this.dataListSelections = val this.dataListSelections = val
}, },
handleOperations({type, data : id }) { handleOperations({ type, data: id }) {
switch (type) { switch (type) {
case 'edit': case 'edit':
return this.addOrUpdateHandle(id) return this.addOrUpdateHandle(id)