update 完成厂务,优化dialog

This commit is contained in:
g7hoo 2022-08-11 16:08:01 +08:00
parent 0ef30e1985
commit db5b5091e1
2 changed files with 49 additions and 4 deletions

View File

@ -163,7 +163,6 @@ export default {
} }
}, },
mounted() { mounted() {
console.log('mounted>..')
/** 计算 defaultPlaceholders */ /** 计算 defaultPlaceholders */
const prefix = '请输入' const prefix = '请输入'
Object.entries(this.defaultNames).map(([key, value]) => { Object.entries(this.defaultNames).map(([key, value]) => {
@ -254,7 +253,17 @@ export default {
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)] const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
if (opt) { if (opt) {
// if opt is valid // if opt is valid
return opt.placeholder ? opt.placeholder : this.defaultPlaceholders[opt.name] return opt.placeholder
? opt.placeholder
: this.defaultPlaceholders[opt.name]
? this.defaultPlaceholders[opt.name]
: opt.label
? (opt.type === 'select' ? '请选择' : '请输入') + opt.label
: null
// : opt.type === 'select'
// ? ''
// : ''
} }
}, },

View File

@ -62,12 +62,29 @@ const tableConfigs = [
{ prop: 'createTime', name: '添加时间' }, { prop: 'createTime', name: '添加时间' },
{ prop: 'name', name: '工段名称' }, { prop: 'name', name: '工段名称' },
{ prop: 'code', name: '工段编码' }, { prop: 'code', name: '工段编码' },
{ prop: 'productionLineId', name: '产线ID' }, // { prop: 'productionLineId', name: '线ID' },
{ prop: 'productionLineName', name: '产线' },
{ prop: 'remark', name: '备注' }, { prop: 'remark', 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',
infoUrl: '/monitoring/workshopSection',
fields: [
{ name: 'name', label: '工段名称' },
{ name: 'code', label: '工段编码', api: '/monitoring/workshopSection/getCode' },
{ name: 'productionLineId', label: '所属产线', type: 'select', options: [] },
'description',
'remark'
],
operations: [
{ name: 'reset', url: true, showAlways: true },
{ name: 'cancel', url: true, showAlways: true },
{ name: 'save', url: '/monitoring/workshopSection', permission: '', showOnEdit: false },
{ name: 'update', url: '/monitoring/workshopSection', permission: '', showOnEdit: true }
]
}
export default { export default {
data() { data() {
@ -78,6 +95,7 @@ export default {
key: '' key: ''
}, },
dataList: [], dataList: [],
plList: [],
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
totalPage: 0, totalPage: 0,
@ -91,9 +109,27 @@ export default {
BaseTable BaseTable
}, },
activated() { activated() {
this.getProductLine()
this.getDataList() this.getDataList()
}, },
methods: { methods: {
// 线
getProductLine() {
this.$http.get(this.$http.adornUrl('/monitoring/productionLine/list')).then(({ data: res }) => {
if (res && res.code === 0) {
// this.plList = res.data
console.log('res', res)
this.addOrUpdateConfigs.fields.forEach(item => {
if (item.name === 'productionLineId') item.options = res.data.map(item => ({ label: item.name, value: item.id }))
})
} else {
this.addOrUpdateConfigs.fields.forEach(item => {
if (item.name === 'productionLineId') item.options.splice(0)
})
// this.plList.splice(0)
}
})
},
// //
getDataList() { getDataList() {
this.addOrUpdateVisible = false this.addOrUpdateVisible = false