This commit is contained in:
zxx 2023-11-14 14:44:18 +08:00
parent c53cb5bbd1
commit a86f76f505
5 changed files with 460 additions and 175 deletions

View File

@ -44,8 +44,10 @@
<vxe-grid ref='xGrid' v-bind="options.gridOptions" class="mytable-style" :row-class-name="rowClassName">
<template #op="{ row }">
<div class="oplinks">
<a @click.stop="pageEdit(row)" title="编辑"><a-icon type="edit" /></a>
<a @click.stop="pageDelete(row)" title="删除"><a-icon type="delete" /></a>
<a v-if="enabledOp({ name: 'edit', row: row })" @click.stop="pageEdit(row)" title="编辑"><a-icon
type="edit" /></a>
<a v-if="enabledOp({ name: 'delete', row: row })" @click.stop="pageDelete(row)" title="删除"><a-icon
type="delete" /></a>
</div>
</template>
@ -177,6 +179,13 @@ export default {
//
methods: {
enabledOp({ name, row }) {
if (name == 'delete' && row.__hide_delete) {
return false
}
return true;
},
pagePrint() {
let tableData = JSON.parse(JSON.stringify(this.$refs.xGrid.getTableData().fullData));
this.$emit("print", { tableData: tableData });

View File

@ -94,6 +94,9 @@ VXETable.formats.mixin({
formatYesNo({ cellValue }) { // 格式化是否
return cellValue ? '是' : '否'
},
formatStart({ cellValue }) { // 格式化启用禁用
return cellValue ? '启用' : '禁用'
},
formatRef({ cellValue, column }) { // 格式化参照
if (column && column.params

View File

@ -1,5 +1,12 @@
<template>
<basic-page-list :desc="desc" :options="pageOptions"></basic-page-list>
<basic-page-list :desc="desc" :options="pageOptions" @loadData="loadData">
<template v-slot:column1="{ row }">
<a-button type="default">出库</a-button>
{{ row.id }}
<a-button>入库</a-button>
</template>
</basic-page-list>
</template>
<script>
@ -37,24 +44,31 @@ export default {
var pageData = { //
keyName: 'id', //
listFieldName: 'MesUnit',
listFieldName: 'MesStock',
addPageUrl: "/MesUnit/MesUnitAdd",
editPageUrl: "/MesUnit/MesUnitUpdate/",
addPageUrl: "/MesWarehouse/MesWarehousePositionAdd",
editPageUrl: "/MesWarehouse/MesWarehousePositionUpdate/",
//
actions: { // Api
// =============================== Start ===============================
MesUnitList: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/list`, //
MesUnitDetail: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/detail`, //
MesUnitCreate: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/create`, //
MesUnitUpdate: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/update`, //
MesUnitDelete: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/detele`, //
MesUnitBatchDelete: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/batchDelete`, //
MesUnitBatchUpdate: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/batchUpdate`, //
MesUnitBatchCreate: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/batchCreate`, //
MesUnitExportExcel: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/export/excel`, // EXCEL
MesUnitImportExcel: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/import/excel`, // EXCEL
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 ===============================
},
@ -75,8 +89,7 @@ export default {
],
//
searchFormItems: [ //
{ field: 'title', title: '标题', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入标题' } } },
{ field: 'desc', title: '描述', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } },
{ field: 'title', title: '标题', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入库存编码' } } },
{ span: 8, slots: { default: 'date' } }, //
{
align: 'right', span: 4, itemRender: { //
@ -94,31 +107,47 @@ export default {
id: 'datagrid_1', //
columns: [
{ type: 'checkbox', width: '50' }, //
{ type: 'checkbox', width: '40' }, //
{ type: 'seq', width: '40' }, //
// =============================== Start ===============================
{ title: '操作', slots: { default: 'op' }, width: 120 },
{ field: 'code', sortable: true, title: '编码', width: 250 }, //
{ field: 'title', sortable: true, title: '库存名称', width: 250 }, //
{ field: 'name', sortable: true, title: '库存英文名称', width: 250 }, //
{ field: 'id' ,solts:{default:'column1'}, sortable: true, title: '出入库操作', width: 150 }, //
{ field: 'code', sortable: true, title: '库存编码', width: 100 }, //
{ field: 'product_detail.mes_materials_sort.name', sortable: true, title: '分类', width: 100 }, //
{ field: 'product_detail.name', sortable: true, title: '产品名称', width: 250 }, //
{ field: 'product_detail.code', sortable: true, title: '产品编码', width: 140 }, //
{ field: 'product_detail.spec', sortable: true, title: '规格型号', width: 250 }, //
{ field: 'product_detail.size', sortable: true, title: '尺寸', width: 100 }, //
{ field: 'product_detail.color', sortable: true, title: '颜色', width: 100 }, //
{ field: 'stock', sortable: true, title: '库存数量', width: 100 }, //
{ field: 'create_time', formatter: 'formatDate', width: 100, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ field: 'update_time', formatter: 'formatDate', width: 100, sortable: true, title: '更新时间', showHeaderOverflow: true }, //
// =============================== Start ===============================
]
}
};
pageData.actions.getList = pageData.actions.MesUnitList;
pageData.actions.delete = pageData.actions.MesUnitBatchDelete;
pageData.actions.getList = pageData.actions.MesStockList;
pageData.actions.delete = pageData.actions.MesStockBatchDelete;
pageData.gridOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridOptions); //
this.pageOptions = pageData;
},
},
watch: {
}
},
};
</script>

View File

@ -1,13 +1,248 @@
<template>
<div>
positionEdit
</div>
<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: {
}
</script>
},
<style></style>
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

@ -1,11 +1,27 @@
<template>
<basic-page-list :desc="desc" :options="pageOptions"></basic-page-list>
<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';
const settings = require('../../basic/settings.js');
export default {
i18n: require("./i18n"),
@ -38,10 +54,10 @@ export default {
var pageData = { //
keyName: 'id', //
listFieldName: 'MesWarehouse',
listFieldName: 'WarehouseLocation',
addPageUrl: "/MesWarehouse/MesWarehouseAdd",
editPageUrl: "/MesWarehouse/MesWarehouseUpdate/",
addPageUrl: "/MesWarehouse/MesWarehousePositionAdd",
editPageUrl: "/MesWarehouse/MesWarehousePositionUpdate/",
//
actions: { // Api
@ -86,8 +102,7 @@ export default {
],
//
searchFormItems: [ //
{ field: 'title', title: '标题', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入标题' } } },
{ field: 'desc', title: '描述', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } },
{ field: 'title', title: '标题', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入仓位名称' } } },
{ span: 8, slots: { default: 'date' } }, //
{
align: 'right', span: 4, itemRender: { //
@ -112,26 +127,13 @@ export default {
// =============================== Start ===============================
{ title: '操作', slots: { default: 'op' }, width: 120 },
{ field: 'code', sortable: true, title: '编码', width: 250 }, //
{ field: 'warehouse_title', sortable: true, title: '仓库名称', width: 250 }, //
{ field: 'warehouse_name', sortable: true, title: '仓库英文名称', width: 250 }, //
{ field: 'warehouse_code', sortable: true, title: '仓库编码', width: 250 }, //
{ field: 'warehouse_type', params: settings.options_warehouse_type, formatter: 'formatEnum', sortable: true, title: '仓库类型', width: 250 }, // :1.,2.,3.
{ field: 'warehouse_address', sortable: true, title: '仓库地址', width: 250 }, //
//{ field: 'warehouse_uid', sortable: true, title: 'UID', width: 250 }, // UID
{ field: 'warehouse_uname', sortable: true, title: '仓库负责人姓名', width: 250 }, //
{ field: 'warehouse_mobile', sortable: true, title: '仓库负责人手机号', width: 250 }, //
{ field: 'warehouse_phone', sortable: true, title: '仓库电话', width: 250 }, //
{ field: 'warehouse_remark', sortable: true, title: '仓库备注', width: 250 }, //
{ field: 'warehouse_negative_stock', params: settings.options_warehouse_negative_stock, formatter: 'formatEnum', sortable: true, title: '仓库是否允许负库存', width: 250 }, // :0.,1.
{ field: 'warehouse_location', params: settings.options_is_open, formatter: 'formatEnum', sortable: true, title: '是否启用库位管理', width: 250 }, // :0.,1.
{ field: 'warehouse_batch', params: settings.options_is_open, formatter: 'formatEnum', sortable: true, title: '是否启用批次管理', width: 250 }, // :0.,1.
{ field: 'warehouse_serial', params: settings.options_is_open, formatter: 'formatEnum', sortable: true, title: '是否启用序列号', width: 250 }, // :0.,1.
{ field: 'warehouse_storage_type', params: settings.options_warehouse_storage_type, formatter: 'formatEnum', sortable: true, title: '存储类型', width: 250 }, // :1.,2.,3.,4.,5.,6.
{ field: 'warehouse_effective_date', formatter: 'formatDate', sortable: true, title: '仓库生效日期', width: 250 }, //
{ field: 'warehouse_invalid_date', formatter: 'formatDate', sortable: true, title: '仓库失效日期', width: 250 }, //
{ field: 'warehouse_status', params: settings.options_is_enabled, formatter: 'formatEnum', sortable: true, title: '仓库状态', width: 250 }, // :0.,1.
{ field: 'warehouse_detail.warehouse_title', sortable: true, title: '仓库名称', width: 150 }, //
{ field: 'warehouse_detail.code', sortable: true, title: '仓库编码', width: 'auto' }, //
{ field: 'code', sortable: true, title: '库位编码', width: 'auto' }, //
{ field: 'warehouse_location_name', sortable: true, title: '库位名称', width: 'auto' }, //
{ field: 'warehouse_location_keeper_uname', sortable: true, title: '库管员姓名', width: 150 }, //
{ field: 'is_default', sortable: true, title: '默认库位', slots: { default: 'column1' }, width: 100 }, // :0.,1.
{ field: 'warehouse_location_status', sortable: true, title: '库位状态', slots: { default: 'column2' }, width: 100 }, // :0.,1.
{ field: 'create_time', formatter: 'formatDate', width: 100, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ field: 'update_time', formatter: 'formatDate', width: 100, sortable: true, title: '更新时间', showHeaderOverflow: true }, //
@ -143,19 +145,26 @@ export default {
};
pageData.actions.getList = pageData.actions.MesWarehouseList;
pageData.actions.delete = pageData.actions.MesWarehouseBatchDelete;
pageData.actions.getList = pageData.actions.WarehouseLocationList;
pageData.actions.delete = pageData.actions.WarehouseLocationBatchDelete;
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>