This commit is contained in:
zxx 2023-11-14 15:24:39 +08:00
parent a86f76f505
commit 2c06689b3d
3 changed files with 429 additions and 0 deletions

View File

@ -0,0 +1,248 @@
<template>
<basic-page-edit :desc="desc" :dataId="getDataId()" :options="pageOptions"></basic-page-edit>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
export default {
i18n: require('./i18n'),
components: {},
props: {
pageMode: {
type: String,
default: "edit"
},
dataId: {
}
},
data() {
return {
pageOptions: {}
};
},
computed: {
desc() {
return this.$t('editPageDesc')
}
},
created() {
this.optionsInit();
this.dataInit();
},
//
methods: {
optionsInit() {
//
var pageData = {
//
currentConfigName: "",
// ID
currentBeid: 0,
addPageUrl: "/MesWarehouse/MesWarehousePositionAdd",
editPageUrl: "/MesWarehouse/MesWarehousePositionUpdate/",
listPageUrl: "/MesWarehouse/MesWarehousePositionList",
uploadDefaultImg: null,
detailDataFieldName: "warehouse_location",
actions: {
// =============================== Start ===============================
MesWarehouseList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`, //
MesWarehouseDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detail`, //
MesWarehouseCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/create`, //
MesWarehouseUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/update`, //
MesWarehouseDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/detele`, //
MesWarehouseBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchDelete`, //
MesWarehouseBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchUpdate`, //
MesWarehouseBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/batchCreate`, //
MesWarehouseExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/export/excel`, // EXCEL
MesWarehouseImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/import/excel`, // EXCEL
WarehouseLocationList: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`, //
WarehouseLocationDetail: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detail`, //
WarehouseLocationCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/create`, //
WarehouseLocationUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/update`, //
WarehouseLocationDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/detele`, //
WarehouseLocationBatchDelete: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchDelete`, //
WarehouseLocationBatchUpdate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchUpdate`, //
WarehouseLocationBatchCreate: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/batchCreate`, //
WarehouseLocationExportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/export/excel`, // EXCEL
WarehouseLocationImportExcel: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/import/excel`, // EXCEL
// =============================== End ===============================
},
keyName: 'id',
//
isEdit: false,
//
formOptions: {
data: {
// =============================== Start ===============================
id: 0,
warehouse_id: 0,
code: "",
warehouse_location_code: "",
warehouse_location_name: "",
warehouse_location_keeper_uid: 0,
warehouse_location_keeper_uname: "",
create_uid: 0,
update_uid: 0,
warehouse_location_status: 0,
create_time: new Date(2100, 1, 1).getTime() / 10000,
update_time: new Date(2100, 1, 1).getTime() / 10000,
is_default: 0,
// =============================== End ===============================
},
//
titleWidth: 150,
//
titleAlign: 'right',
//
rules: {
// =============================== Start ===============================
warehouse_id: [
{ required: true, message: '请选择仓库' }
],
code: [
{ required: true, message: '请输入编码' }
],
warehouse_location_code: [
{ message: '输入库位编号' }
],
warehouse_location_name: [
{ required: true, message: '请输入库位名称' }
],
warehouse_location_keeper_uid: [
{ required: true, message: '请输入库管员UID' }
],
warehouse_location_keeper_uname: [
{ required: true, message: '请输入库管员姓名' }
],
warehouse_location_status: [
{ required: true, message: '请输入库位状态:0.禁用,1.启用' }
],
is_default: [
{ required: true, message: '请输入是否默认库位:0.否,1.是' }
],
// =============================== End ===============================
},
//
items: [
// =============================== Start ===============================
{ field: 'warehouse_id', title: '选择仓库', span: 12, itemRender: { name: '$input' } },
{ field: 'code', title: '编码', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_location_code', title: '库位编码', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_location_name', title: '库位名称', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_location_keeper_uid', title: '选择管理员', span: 12, itemRender: { name: '$input' } },
{ field: 'warehouse_location_status', title: '库位状态', span: 12, itemRender: { name: '$switch' } },
{ field: 'is_default', title: '是否默认库位', span: 12, itemRender: { name: '$switch' } },
// =============================== End ===============================
]
},
//
addModeItems: [
],
};
pageData.actions.get = pageData.actions.MesWarehouseDetail;
pageData.actions.create = pageData.actions.MesWarehouseCreate;
pageData.actions.update = pageData.actions.MesWarehouseUpdate;
//
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
this.pageOptions = pageData;
},
dataInit() {
// id
let dataId = this.getDataId();
// id
if (dataId) {
const json = `{"id":${dataId}}`;
this.$mk.post({
url: this.pageOptions.actions.get,
loading: "加载中...",
data: json,
config: {
headers: {
'Content-Type': 'application/json'
}
}
}).then(a => {
let detailDataFieldName = this.pageOptions.detailDataFieldName;
if(a.data[detailDataFieldName].warehouse_effective_date){
a.data[detailDataFieldName].warehouse_effective_date = new Date(a.data[detailDataFieldName].warehouse_effective_date * 1000);
}
if(a.data[detailDataFieldName].warehouse_invalid_date){
a.data[detailDataFieldName].warehouse_invalid_date = new Date(a.data[detailDataFieldName].warehouse_invalid_date * 1000);
}
if (a.data[detailDataFieldName].create_time) {
a.data[detailDataFieldName].create_time = new Date(a.data[detailDataFieldName].create_time * 1000);
}
if (a.data[detailDataFieldName].update_time) {
a.data[detailDataFieldName].update_time = new Date(a.data[detailDataFieldName].update_time * 1000);
}
this.pageOptions.formOptions.data = a.data[detailDataFieldName];
this.$forceUpdate()
}).catch((a) => {
this.$mk.error(a.data.msg);
});
this.pageOptions.isEdit = true;
this.$forceUpdate()
} else {
// id
this.addModeItems.forEach(item => {
this.pageOptions.formOptions.items.push(item);
})
}
},
// id
getDataId() {
let dataId = this.dataId;
if (this.$route.params.id) {
dataId = this.$route.params.id;
}
if (!dataId) {
dataId = 0;
}
return dataId;
}
},
//
watch: {
}
};
</script>

View File

@ -0,0 +1,168 @@
<template>
<basic-page-list :desc="desc" :options="pageOptions" @loadData="loadData">
<!-- 如果为1-->
<template v-slot:column1="{ row }">
<a-tag v-if="row.is_default === 1" color="orange">
默认
</a-tag>
</template>
<template v-slot:column2="{ row }">
<a-tag v-if="row.warehouse_location_status === 0" color="red">
禁用
</a-tag>
<a-tag v-if="row.warehouse_location_status === 1" color="green">
启用
</a-tag>
</template>
</basic-page-list>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
export default {
i18n: require("./i18n"),
props: {
},
data() {
return {
pageOptions: {}
};
},
//
computed: {
//
desc() {
return this.$t("pageDesc");
}
},
//
created() {
this.optionsInit();
},
//
methods: {
optionsInit() {
//
var pageData = { //
keyName: 'id', //
listFieldName: 'MesStockPosition',
addPageUrl: "/MesWarehouse/MesWarehousePositionAdd",
editPageUrl: "/MesWarehouse/MesWarehousePositionUpdate/",
//
actions: { // Api
// =============================== Start ===============================
MesStockList: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/list`, //
MesStockDetail: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/detail`, //
MesStockCreate: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/create`, //
MesStockUpdate: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/update`, //
MesStockDelete: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/detele`, //
MesStockBatchDelete: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/batchDelete`, //
ProductStockOut: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/out`, //
ProductStockIn: `${BASE_URL.BASE_URL}/MesStock/v1/product/stock/in`, //
MesStockPositionList: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/list`, //
MesStockPositionDetail: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/detail`, //
MesStockPositionCreate: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/create`, //
MesStockPositionUpdate: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/update`, //
MesStockPositionDelete: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/detele`, //
MesStockPositionBatchDelete: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/batchDelete`, //
MesStockPositionBatchUpdate: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/batchUpdate`, //
MesStockPositionBatchCreate: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/batchCreate`, //
MesStockPositionBatchHandle: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/batchHandle`, //
// =============================== End ===============================
},
start_time: 0, //
end_time: 0, //
//
searchFormData: {
title: '',
desc: '',
},
//
searchRules: [
{ key: "title", mode: "like" },
{ key: "desc", mode: "like" }
],
//
searchFormItems: [ //
{ field: 'title', title: '标题', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入仓位名称' } } },
{ span: 8, slots: { default: 'date' } }, //
{
align: 'right', span: 4, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } }]
}
}
],
//
gridOptions: { //
height: '100%', // 100%
stripe: true, //
id: 'datagrid_1', //
columns: [
{ type: 'checkbox', width: '40' }, //
{ type: 'seq', width: '40' }, //
// =============================== Start ===============================
{ title: '操作', slots: { default: 'op' }, width: 120 },
{ field: 'product_id', sortable: true, title: '产品ID', width: 250 }, // ID
{ field: 'product_detail.name', sortable: true, title: '产品详情', width: 250 }, //
{ field: 'warehouse_id', sortable: true, title: '仓库ID', width: 250 }, // ID
{ field: 'warehouse_idetail.name', sortable: true, title: '仓库名称', width: 250 }, //
{ field: 'warehouse_pos_id', sortable: true, title: '库位ID', width: 250 }, // ID
{ field: 'warehouse_pos_idetail.name', sortable: true, title: '库位名称', width: 250 }, //
{ field: 'stock', sortable: true, title: '库存数量', width: 250 }, //
{ field: 'create_time', formatter: 'formatDate', width: 100, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ field: 'update_time', formatter: 'formatDate', width: 100, sortable: true, title: '更新时间', showHeaderOverflow: true }, //
{ field: 'stock_id', sortable: true, title: '库存id', width: 250 }, // id
// =============================== Start ===============================
]
}
};
pageData.actions.getList = pageData.actions.MesStockPositionList;
pageData.actions.delete = pageData.actions.MesStockPositionBatchDelete;
pageData.gridOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridOptions); //
this.pageOptions = pageData;
},
loadData(e) {
console.log(e.WarehouseLocation);
e.WarehouseLocation.forEach(item => {
console.log(item.is_default);
if (item.is_default === 1) {
item.__hide_delete = true
}
});
}
},
watch: {
},
};
</script>

View File

@ -63,6 +63,19 @@ routerMap[FunName + 'Update']= {
permission: [], permission: [],
} }
}; };
routerMap[FunName + 'PositionList']= {
name: FunTitle,
icon: 'idcard',
path: `/${FunName}/${FunName}PositionList`,
component: () => import(`@/pages/Middle/Mes/MesStock/MesStock/PositionList`),
meta:{
page:{ cacheAble:false}
},
authority: {
permission: [],
}
};
InvisibleRouters.forEach(item => { InvisibleRouters.forEach(item => {