add 新增导入组件; update 更新配方bom的导入功能
This commit is contained in:
@@ -4,23 +4,54 @@
|
||||
<!-- <head-form :form-config="headFormConfig" @headBtnClick="btnClick" /> -->
|
||||
<BaseSearchForm :head-config="headConfig" @btn-click="handleBtnClick" />
|
||||
|
||||
<BaseListTable v-loading="tableLoading" :table-config="tableConfig.table" :column-config="tableConfig.column"
|
||||
:table-data="dataList" @operate-event="handleOperate" :current-page="page" :current-size="size"
|
||||
<BaseListTable
|
||||
v-loading="tableLoading"
|
||||
:table-config="tableConfig.table"
|
||||
:column-config="tableConfig.column"
|
||||
:table-data="dataList"
|
||||
@operate-event="handleOperate"
|
||||
:current-page="page"
|
||||
:current-size="size"
|
||||
:refresh-layout-key="refreshLayoutKey" />
|
||||
|
||||
<el-pagination class="mt-5 flex justify-end" @size-change="handleSizeChange" @current-change="handlePageChange"
|
||||
:current-page.sync="page" :page-sizes="[1, 5, 10, 20, 50, 100]" :page-size="size" :total="totalPage"
|
||||
<el-pagination
|
||||
class="mt-5 flex justify-end"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
:current-page.sync="page"
|
||||
:page-sizes="[1, 5, 10, 20, 50, 100]"
|
||||
:page-size="size"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
<!-- :current-page.sync="currentPage"
|
||||
<!-- :current-page.sync="currentPage"
|
||||
:page-size.sync="pageSize" -->
|
||||
|
||||
<DialogWithMenu ref="edit-dialog" v-if="!!dialogConfigs && dialogType === DIALOG_WITH_MENU"
|
||||
:dialog-visible.sync="dialogVisible" :configs="dialogConfigs" @refreshDataList="getList" />
|
||||
<DialogJustForm ref="edit-dialog" v-if="!!dialogConfigs && dialogType === DIALOG_JUST_FORM"
|
||||
:dialog-visible.sync="dialogVisible" :configs="dialogConfigs" @refreshDataList="getList"
|
||||
<DialogWithMenu
|
||||
ref="edit-dialog"
|
||||
v-if="!!dialogConfigs && dialogType === DIALOG_WITH_MENU"
|
||||
:dialog-visible.sync="dialogVisible"
|
||||
:configs="dialogConfigs"
|
||||
@refreshDataList="getList" />
|
||||
<DialogJustForm
|
||||
ref="edit-dialog"
|
||||
v-if="!!dialogConfigs && dialogType === DIALOG_JUST_FORM"
|
||||
:dialog-visible.sync="dialogVisible"
|
||||
:configs="dialogConfigs"
|
||||
@refreshDataList="getList"
|
||||
@emit-data="handleOperate" />
|
||||
<DialogCarPayload ref="car-payload-dialog" v-if="!!carPayloadDialogConfigs"
|
||||
:dialog-visible.sync="carPayloadDialogVisible" :configs="carPayloadDialogConfigs" @refreshDataList="getList" />
|
||||
<DialogCarPayload
|
||||
ref="car-payload-dialog"
|
||||
v-if="!!carPayloadDialogConfigs"
|
||||
:dialog-visible.sync="carPayloadDialogVisible"
|
||||
:configs="carPayloadDialogConfigs"
|
||||
@refreshDataList="getList" />
|
||||
<DialogUpload
|
||||
ref="upload-dialog"
|
||||
v-if="uploadDialogVisible"
|
||||
title="导入配方"
|
||||
url="/importTemplates/bomImport.xlsx"
|
||||
filename="bomTemplate.xlsx"
|
||||
@refresh-list="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -30,6 +61,7 @@ import BaseSearchForm from "@/components/BaseSearchForm.vue";
|
||||
import DialogWithMenu from "@/components/DialogWithMenu.vue";
|
||||
import DialogJustForm from "@/components/DialogJustForm.vue";
|
||||
import DialogCarPayload from "@/components/DialogCarPayload.vue";
|
||||
import DialogUpload from "@/components/DialogUpload.vue";
|
||||
import moment from "moment";
|
||||
|
||||
const DIALOG_WITH_MENU = "DialogWithMenu";
|
||||
@@ -38,7 +70,7 @@ const DIALOG_CARPAYLOAD = "DialogCarPayload";
|
||||
|
||||
export default {
|
||||
name: "ListViewWithHead",
|
||||
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload },
|
||||
components: { BaseSearchForm, BaseListTable, DialogWithMenu, DialogJustForm, DialogCarPayload, DialogUpload },
|
||||
props: {
|
||||
tableConfig: {
|
||||
type: Object,
|
||||
@@ -109,6 +141,7 @@ export default {
|
||||
dataList: [],
|
||||
tableLoading: false,
|
||||
refreshLayoutKey: null,
|
||||
uploadDialogVisible: false,
|
||||
};
|
||||
},
|
||||
inject: ["urls"],
|
||||
@@ -123,9 +156,9 @@ export default {
|
||||
const params = queryParams
|
||||
? { ...queryParams, page: this.page, limit: this.size }
|
||||
: {
|
||||
page: this.page,
|
||||
limit: this.size,
|
||||
};
|
||||
page: this.page,
|
||||
limit: this.size,
|
||||
};
|
||||
|
||||
if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) {
|
||||
this.listQueryExtra.map((nameOrObj) => {
|
||||
@@ -138,18 +171,15 @@ export default {
|
||||
});
|
||||
}
|
||||
|
||||
// if (this.urls.pageIsPostApi) {
|
||||
// } else {
|
||||
// 默认是 get 方式请求 page
|
||||
this.$http[this.urls.pageIsPostApi ? "post" : "get"](
|
||||
this.urls.page,
|
||||
this.urls.pageIsPostApi
|
||||
? {
|
||||
...params,
|
||||
}
|
||||
...params,
|
||||
}
|
||||
: {
|
||||
params,
|
||||
}
|
||||
params,
|
||||
}
|
||||
)
|
||||
.then(({ data: res }) => {
|
||||
console.log("[http response] res is: ", res);
|
||||
@@ -245,7 +275,7 @@ export default {
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => { });
|
||||
.catch((err) => {});
|
||||
}
|
||||
case "edit": {
|
||||
this.openDialog(data); /** data is ==> id */
|
||||
@@ -300,7 +330,7 @@ export default {
|
||||
break;
|
||||
}
|
||||
case "to-bom-detail": {
|
||||
console.log('to-bom-detail', data)
|
||||
console.log("to-bom-detail", data);
|
||||
// 查看配方详情
|
||||
return this.$router.push({
|
||||
name: "pms-bomDetails",
|
||||
@@ -381,40 +411,39 @@ export default {
|
||||
});
|
||||
}
|
||||
case "detach": {
|
||||
|
||||
return this.$confirm('是否下发?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http
|
||||
.post(this.urls.detach, data /* { id: data } */, { headers: { "Content-Type": "application/json" } })
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: "下发成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
message: `${res.code}: ${res.msg}`,
|
||||
type: "error",
|
||||
duration: 1500,
|
||||
});
|
||||
}
|
||||
return this.$confirm("是否下发?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.$http
|
||||
.post(this.urls.detach, data /* { id: data } */, { headers: { "Content-Type": "application/json" } })
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: "下发成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
message: `${res.code}: ${res.msg}`,
|
||||
type: "error",
|
||||
duration: 1500,
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: "warning",
|
||||
message: "已取消下发",
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'warning',
|
||||
message: '已取消下发'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
case "to-car-history": {
|
||||
return this.$router.push({
|
||||
@@ -431,19 +460,21 @@ export default {
|
||||
}
|
||||
case "sync": {
|
||||
// 同步单个料仓数据
|
||||
this.$http.post(this.urls.syncSingleUrl, data, {
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}).then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: '同步成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
this.$http
|
||||
.post(this.urls.syncSingleUrl, data, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: "同步成功",
|
||||
type: "success",
|
||||
});
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -461,7 +492,9 @@ export default {
|
||||
case "新增":
|
||||
this.openDialog();
|
||||
break;
|
||||
|
||||
case "导入":
|
||||
this.openUploadDialog();
|
||||
break;
|
||||
case "手动添加": {
|
||||
this.openDialog();
|
||||
return;
|
||||
@@ -502,9 +535,9 @@ export default {
|
||||
case "同步":
|
||||
case "全部同步":
|
||||
this.$http.post(this.urls.syncUrl).then(({ data: res }) => {
|
||||
console.log('全部同步', res)
|
||||
console.log("全部同步", res);
|
||||
if (res.code === 0) {
|
||||
this.$message({ message: '同步成功', type: 'success' })
|
||||
this.$message({ message: "同步成功", type: "success" });
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
@@ -540,6 +573,14 @@ export default {
|
||||
this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode, tag_info, extraParams);
|
||||
});
|
||||
},
|
||||
|
||||
openUploadDialog() {
|
||||
this.uploadDialogVisible = true;
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs["upload-dialog"].init();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -251,6 +251,7 @@ export default function () {
|
||||
copyUrl: "/pms/bom/copy",
|
||||
subase: "/pms/bomMaterial",
|
||||
subpage: "/pms/bomMaterial/page",
|
||||
importOrderUrl: '/pms/order/importExcelBom', // 导入的api
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user