update attr-form 的逻辑,TODO:检查产品池和设备信息的编辑子表单
This commit is contained in:
parent
3c4af47e2d
commit
a15e78dcaf
@ -66,8 +66,14 @@ export default {
|
|||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
/** 表单提交需要的属性 */
|
/** 表单提交需要的属性 */
|
||||||
pId: {
|
relatedId: {
|
||||||
type: String,
|
type: String,
|
||||||
|
required: true,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
relatedField: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
default: null
|
default: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -97,7 +103,7 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.getDataList()
|
this.getDataList()
|
||||||
/** 设置 AttrForm 的 rules */
|
/** 设置 AttrForm 的 rules */
|
||||||
for(const config of this.tableConfigs) {
|
for (const config of this.tableConfigs) {
|
||||||
if (config.rules) {
|
if (config.rules) {
|
||||||
this.$set(this.AttrFormRules, [config.prop], config.rules)
|
this.$set(this.AttrFormRules, [config.prop], config.rules)
|
||||||
}
|
}
|
||||||
@ -127,7 +133,7 @@ export default {
|
|||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
page: this.pageIndex,
|
page: this.pageIndex,
|
||||||
limit: this.pageSize,
|
limit: this.pageSize,
|
||||||
productId: this.pId
|
[this.relatedField]: this.relatedId
|
||||||
// order: 'asc/desc',
|
// order: 'asc/desc',
|
||||||
// orderField: 'name'
|
// orderField: 'name'
|
||||||
})
|
})
|
||||||
@ -210,7 +216,7 @@ export default {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
data: JSON.stringify({ ...this.AttrForm, productId: this.pId })
|
data: JSON.stringify({ ...this.AttrForm, [this.relatedField]: this.relatedId })
|
||||||
}).then(({ data }) => {
|
}).then(({ data }) => {
|
||||||
if (data && data.code === 0) {
|
if (data && data.code === 0) {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<template v-if="dataForm.id && configs.subtable">
|
<template v-if="dataForm.id && configs.subtable">
|
||||||
<attr-form :pId="dataForm.id" v-bind="configs.subtable" />
|
<attr-form :related-id="dataForm.id" v-bind="configs.subtable" />
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
|
@ -154,6 +154,18 @@ const addOrUpdateConfigs = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
subtable: {
|
||||||
|
title: '查看设备属性',
|
||||||
|
url: '/monitoring/equipmentAttr',
|
||||||
|
relatedField: 'equipmentId',
|
||||||
|
tableConfigs: [
|
||||||
|
{ type: 'index', name: '序号' },
|
||||||
|
{ prop: 'createTime', name: '创建时间' },
|
||||||
|
{ prop: 'attrName', name: '属性名称', formField: true },
|
||||||
|
{ prop: 'attrValue', name: '属性值', formField: true },
|
||||||
|
{ prop: 'operate', name: '操作', options: ['edit', 'delete'] }
|
||||||
|
]
|
||||||
|
},
|
||||||
operations: [
|
operations: [
|
||||||
{ name: 'cancel', showAlways: true },
|
{ name: 'cancel', showAlways: true },
|
||||||
{ name: 'save', url: '/monitoring/equipment', permission: '', showOnEdit: false },
|
{ name: 'save', url: '/monitoring/equipment', permission: '', showOnEdit: false },
|
||||||
|
@ -140,6 +140,7 @@ const addOrUpdateConfigs = {
|
|||||||
// for i18n
|
// for i18n
|
||||||
title: '动态属性',
|
title: '动态属性',
|
||||||
url: '/monitoring/productArrt',
|
url: '/monitoring/productArrt',
|
||||||
|
relatedField: 'productId',
|
||||||
tableConfigs: [
|
tableConfigs: [
|
||||||
{ type: 'index', name: '序号' },
|
{ type: 'index', name: '序号' },
|
||||||
{ prop: 'createTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') },
|
{ prop: 'createTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') },
|
||||||
|
Loading…
Reference in New Issue
Block a user