add CarPayloadDialog

This commit is contained in:
lb
2023-03-23 10:47:41 +08:00
parent 264d5cb3c7
commit 1df948e577
7 changed files with 266 additions and 87 deletions

View File

@@ -9,14 +9,14 @@
<!-- main content -->
<BaseListTable
v-loading="tableLoading"
:table-config="tableConfig.table"
:column-config="tableConfig.column"
:table-config="configs.tableConfig.table"
:column-config="configs.tableConfig.column"
:table-data="dataList"
@operate-event="handleOperate"
:current-page="page"
:current-size="size"
:refresh-layout-key="refreshLayoutKey"
/>
<!-- @operate-event="handleOperate" -->
<el-pagination
class="mt-5 flex justify-end"
@@ -28,22 +28,15 @@
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<!-- footer -->
<div slot="footer">
<!-- <template v-for="(operate, index) in configs.form.operations">
<el-button v-if="showButton(operate)" :key="'operation_' + index" :type="operate.type" @click="handleBtnClick(operate)">{{
operate.label
}}</el-button>
</template> -->
<el-button @click="handleBtnClick({ name: 'cancel' })">取消</el-button>
</div></el-dialog
>
</el-dialog>
</template>
<script>
import BaseListTable from "@/components/BaseListTable.vue";
export default {
name: "DialogCarPayload",
components: { BaseListTable },
props: {
configs: {
type: Object,
@@ -52,13 +45,6 @@ export default {
forms: null,
}),
},
tableConfigs: {
type: Object,
default: () => ({
table: null,
column: null
}),
},
dialogVisible: {
type: Boolean,
default: false,
@@ -77,12 +63,31 @@ export default {
totalPage: 0,
dataList: [],
tableLoading: false,
refreshLayoutKey: "",
refreshLayoutKey: null,
};
},
created() {},
mounted() {},
activated() {
this.refreshLayoutKey = Math.random();
},
methods: {
/** init **/
init(id) {
if (!id) {
this.$message({
message: `没有传 id!`,
type: "error",
duration: 1500,
});
console.log("[*] 传入car payload对话框的id是", id);
return;
}
this.tableLoading = true;
this.getList();
},
/** 获取 列表数据 */
getList(queryParams) {
this.tableLoading = true;
@@ -105,9 +110,6 @@ export default {
});
}
// if (this.urls.pageIsPostApi) {
// } else {
// 默认是 get 方式请求 page
this.$http[this.urls.pageIsPostApi ? "post" : "get"](
this.urls.page,
this.urls.pageIsPostApi
@@ -124,20 +126,8 @@ export default {
if (res.code === 0) {
// page 场景:
if ("list" in res.data) {
/** 破碎记录的特殊需求:数据要结合单位 material + materialUnitDictValue */
if ("attachDictValue" in this.tableConfig.column) {
this.dataList = res.data.list.map((row) => {
this.tableConfig.column.attachDictValue(row, "unit", "qty", "materialUnitDictValue");
return row;
});
} else this.dataList = res.data.list;
this.dataList = res.data.list;
this.totalPage = res.data.total;
} else if ("records" in res.data) {
this.dataList = res.data.records.map((item) => ({
...item,
id: item._id ?? item.id,
}));
this.totalPage = res.data.total;
} else {
this.dataList.splice(0);