This commit is contained in:
parent
a86f76f505
commit
2c06689b3d
|
|
@ -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>
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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 => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue