rev:平均分配页面显示问题

This commit is contained in:
2024-01-10 18:16:16 +08:00
parent f928a093db
commit db4d0db124
8 changed files with 94 additions and 36 deletions

View File

@@ -16,7 +16,8 @@ export default {
'destination_configuration': 'Destination Configuration',
'operation': 'Operation',
'device_is_not_null': 'Device Code Cannot Be Empty',
'mapping_relationship': 'Mapping Relationship'
'mapping_relationship': 'Mapping Relationship',
'inOut': 'Bidirectional point position'
},
'rules': {
}

View File

@@ -16,7 +16,8 @@ export default {
'destination_configuration': 'Konfigurasi Tujuan',
'operation': 'Operasi',
'device_is_not_null': 'Kode Perangkat Tidak Boleh Kosong',
'mapping_relationship': 'Hubungan Pemetaan'
'mapping_relationship': 'Hubungan Pemetaan',
'inOut': 'Posisi titik bidireksi'
},
'rules': {
}

View File

@@ -16,7 +16,8 @@ export default {
'destination_configuration': '终点配置',
'operation': '操作',
'device_is_not_null': '设备编码不能为空',
'mapping_relationship': '映射关系'
'mapping_relationship': '映射关系',
'inOut': '双向点位'
},
'rules': {
}

View File

@@ -31,7 +31,7 @@
</el-form-item>
<el-form-item :label="$t('config.table.end_of_instruction')" prop="inst_nextDevice_code">
<el-select
v-model="form.inst_nextdevice_code"
v-model="form.inst_nextDevice_code"
multiple
filterable
:placeholder="$t('config.table.please_select')"
@@ -48,7 +48,7 @@
</el-form-item>
<el-form-item :label="$t('config.table.end_of_task')" prop="task_nextDevice_code">
<el-select
v-model="form.task_nextdevice_code"
v-model="form.task_nextDevice_code"
filterable
multiple
:placeholder="$t('config.table.please_select')"
@@ -83,12 +83,25 @@
<el-input v-model="form.tableData[scope.$index].scale" size="mini" class="edit-input" />
</template>
</el-table-column>
<el-table-column prop="inOut" :label="$t('config.table.inOut')">
<template slot-scope="scope">
<el-switch
v-model="form.tableData[scope.$index].inOut"
:value="false"
active-color="#13ce66"
inactive-color="#ff4949"
/>
</template>
</el-table-column>
</el-table>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">{{ $t('config.table.cancel') }}</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">{{ $t('config.table.confirm') }}</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">{{
$t('config.table.confirm')
}}
</el-button>
</div>
</el-dialog>
<!--表格渲染-->
@@ -104,8 +117,8 @@
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="assigned_id" label="任务标识" />
<el-table-column prop="device_code" :label="$t('config.table.device_code')" />
<el-table-column prop="task_nextdevice_code" :label="$t('config.table.destination_device')" />
<el-table-column prop="inst_nextdevice_code" :label="$t('config.table.inst_nextdevice_code')" />
<el-table-column prop="task_nextDevice_code" :label="$t('config.table.destination_device')" />
<el-table-column prop="inst_nextDevice_code" :label="$t('config.table.inst_nextdevice_code')" />
<el-table-column prop="param" :label="$t('config.table.destination_configuration')" :formatter="paramFormate" />
<el-table-column
v-permission="['admin','AcsDeviceAssigned:edit','AcsDeviceAssigned:del']"
@@ -139,8 +152,8 @@ import i18n from '@/i18n'
const defaultForm = {
assigned_id: null,
device_code: null,
task_nextdevice_code: null,
inst_nextdevice_code: null,
task_nextDevice_code: null,
inst_nextDevice_code: null,
param: null,
tableData: []
}
@@ -150,11 +163,16 @@ export default {
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: i18n.t('config.table.mapping_relationship'), url: 'api/deviceAssigned', idField: 'assigned_id', sort: 'assignned_id', optShow: {
title: i18n.t('config.table.mapping_relationship'),
url: 'api/deviceAssigned',
idField: 'assigned_id',
sort: 'assigned_id',
optShow: {
add: true,
edit: true,
del: true
}, crudMethod: { ...crudAcsDeviceAssigned }
},
crudMethod: { ...crudAcsDeviceAssigned }
})
},
data() {
@@ -188,6 +206,26 @@ export default {
[CRUD.HOOK.beforeRefresh]() {
return true
},
[CRUD.HOOK.beforeToEdit](data) {
const form = JSON.stringify(data.form)
const formObj = JSON.parse(form)
this.form.assigned_id = formObj.assigned_id
this.form.device_code = formObj.device_code
this.form.task_nextDevice_code = formObj.task_nextDevice_code.split(',')
this.form.inst_nextDevice_code = formObj.inst_nextDevice_code.split(',')
const param = JSON.parse(formObj.param)
const tableData = []
Object.keys(param).forEach(key => {
tableData.push({
device: key,
inOut: param[key].inOut,
limit: param[key].limit,
scale: param[key].scale
})
})
this.form.tableData = tableData
return true
},
paramFormate(row, index) {
return JSON.stringify(row.param)
},
@@ -199,13 +237,23 @@ export default {
}
},
getValue: function(value) {
console.log(value)
const tableData = []
value.forEach(item => {
tableData.push({
device: item
if (!(value && typeof value === 'object' && Object.keys(value).length === 0)) {
// const oldTableData = JSON.parse(JSON.stringify(this.form.tableData))
// if (oldTableData && oldTableData.length > 0) {
// oldTableData.forEach(row => {
// console.log(row)
// })
// }
value.forEach(item => {
tableData.push({
device: item,
limit: 50,
scale: 50,
inOut: false
})
})
})
}
this.form.tableData = tableData
},
changeNextDevice(value) {