update 添加载砖的逻辑“

This commit is contained in:
lb 2023-03-24 16:29:58 +08:00
parent 13561c2acc
commit 4f6d27692e
5 changed files with 35 additions and 14 deletions

View File

@ -1,13 +1,18 @@
<template> <template>
<el-dialog <el-dialog
class="dialog-car-payload" class="dialog-car-payload"
title="装载详情"
:visible="dialogVisible" :visible="dialogVisible"
@close="handleClose" @close="handleClose"
:destroy-on-close="false" :destroy-on-close="false"
:close-on-click-modal="configs.clickModalToClose ?? true" :close-on-click-modal="configs.clickModalToClose ?? true"
:width="configs.dialogWidth ?? '50%'" :width="configs.dialogWidth ?? '50%'"
> >
<!-- title -->
<div slot="title" class="dialog-title" style="display: flex; align-items: center;">
<span style="font-size: 18px;">装载详情</span>
<el-button v-if="configs.showAdd ?? false" size="small" type="primary" plain style="margin-left: 16px;" @click="$emit('add-record', id)">添加记录</el-button>
</div>
<!-- main content --> <!-- main content -->
<BaseListTable <BaseListTable
v-loading="tableLoading" v-loading="tableLoading"
@ -52,6 +57,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
updateKey: {
type: Number,
default: 1
}
// extraParams: { // extraParams: {
// type: Object, // type: Object,
// default: () => ({}) // default: () => ({})
@ -71,8 +80,13 @@ export default {
showPaination: false, showPaination: false,
}; };
}, },
created() {}, watch: {
mounted() {}, updateKey(val, oldVal) {
if (val !== oldVal) {
this.getList()
}
}
},
activated() { activated() {
this.refreshLayoutKey = Math.random(); this.refreshLayoutKey = Math.random();
}, },
@ -190,5 +204,4 @@ export default {
.dialog-car-payload >>> .el-dialog__body { .dialog-car-payload >>> .el-dialog__body {
padding: 5px 20px 20px; padding: 5px 20px 20px;
} }
</style> </style>

View File

@ -40,7 +40,7 @@
v-if="!!carPayloadAddConfigs" v-if="!!carPayloadAddConfigs"
:dialog-visible.sync="carPayloadAddVisible" :dialog-visible.sync="carPayloadAddVisible"
:configs="carPayloadAddConfigs" :configs="carPayloadAddConfigs"
@refreshDataList="getList" @refreshDataList="updateCarPayloadKey = Math.random()"
/> />
<DialogCarPayload <DialogCarPayload
ref="car-payload-dialog" ref="car-payload-dialog"
@ -49,6 +49,8 @@
:dialog-visible.sync="carPayloadDialogVisible" :dialog-visible.sync="carPayloadDialogVisible"
:configs="carPayloadDialogConfigs" :configs="carPayloadDialogConfigs"
@refreshDataList="getList" @refreshDataList="getList"
:update-key="updateCarPayloadKey"
@add-record="openCarPayloadAddDialog($event)"
/> />
</div> </div>
</template> </template>
@ -143,6 +145,7 @@ export default {
dataList: [], dataList: [],
tableLoading: false, tableLoading: false,
refreshLayoutKey: null, refreshLayoutKey: null,
updateCarPayloadKey: 1
}; };
}, },
inject: ["urls"], inject: ["urls"],
@ -191,7 +194,7 @@ export default {
this.dataList = res.data.list; this.dataList = res.data.list;
this.totalPage = res.data.total; this.totalPage = res.data.total;
} else if (Array.isArray(res.data)) { } else if (Array.isArray(res.data)) {
this.dataList = res.data this.dataList = res.data;
this.totalPage = null; this.totalPage = null;
} else { } else {
this.dataList.splice(0); this.dataList.splice(0);

View File

@ -23,7 +23,7 @@ export default function () {
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [ options: [
{ name: "to-car-payload", label: "装载详情", icon: 'document' }, { name: "to-car-payload", label: "装载详情", icon: 'document' },
{ name: "edit-payload", label: "输入载砖详情", icon: 'edit' }, // { name: "edit-payload", label: "输入载砖详情", icon: 'edit' },
], ],
}, },
]; ];
@ -206,6 +206,7 @@ export default function () {
}; };
const carPayloadDialogConfigs = { const carPayloadDialogConfigs = {
showAdd: true, // 是否显示新增 装载详情,默认为 否
dialogWidth: '70%', dialogWidth: '70%',
carPayloadDialog: true, carPayloadDialog: true,
clickModalToClose: true, clickModalToClose: true,

View File

@ -40,7 +40,7 @@
v-if="!!carPayloadAddConfigs" v-if="!!carPayloadAddConfigs"
:dialog-visible.sync="carPayloadAddVisible" :dialog-visible.sync="carPayloadAddVisible"
:configs="carPayloadAddConfigs" :configs="carPayloadAddConfigs"
@refreshDataList="getList" @refreshDataList="updateCarPayloadKey = Math.random()"
/> />
<DialogCarPayload <DialogCarPayload
ref="car-payload-dialog" ref="car-payload-dialog"
@ -49,6 +49,8 @@
:dialog-visible.sync="carPayloadDialogVisible" :dialog-visible.sync="carPayloadDialogVisible"
:configs="carPayloadDialogConfigs" :configs="carPayloadDialogConfigs"
@refreshDataList="getList" @refreshDataList="getList"
:update-key="updateCarPayloadKey"
@add-record="openCarPayloadAddDialog($event)"
/> />
</div> </div>
</template> </template>
@ -143,6 +145,7 @@ export default {
dataList: [], dataList: [],
tableLoading: false, tableLoading: false,
refreshLayoutKey: null, refreshLayoutKey: null,
updateCarPayloadKey: 1
}; };
}, },
inject: ["urls"], inject: ["urls"],
@ -191,7 +194,7 @@ export default {
this.dataList = res.data.list; this.dataList = res.data.list;
this.totalPage = res.data.total; this.totalPage = res.data.total;
} else if (Array.isArray(res.data)) { } else if (Array.isArray(res.data)) {
this.dataList = res.data this.dataList = res.data;
this.totalPage = null; this.totalPage = null;
} else { } else {
this.dataList.splice(0); this.dataList.splice(0);

View File

@ -23,7 +23,7 @@ export default function () {
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [ options: [
{ name: "to-car-payload", label: "装载详情", icon: 'document' }, { name: "to-car-payload", label: "装载详情", icon: 'document' },
{ name: "edit-payload", label: "输入载砖详情", icon: 'edit' }, // { name: "edit-payload", label: "输入载砖详情", icon: 'edit' },
], ],
}, },
]; ];
@ -196,6 +196,7 @@ export default function () {
}; };
const carPayloadDialogConfigs = { const carPayloadDialogConfigs = {
showAdd: true,
dialogWidth: '70%', dialogWidth: '70%',
carPayloadDialog: true, carPayloadDialog: true,
clickModalToClose: true, clickModalToClose: true,