This commit is contained in:
xielue 2023-11-16 17:08:23 +08:00
parent 4f14b07bef
commit 45055c2776
11 changed files with 656 additions and 227 deletions

View File

@ -22,7 +22,7 @@
<vxe-toolbar ref="xToolbar" custom> <vxe-toolbar ref="xToolbar" custom>
<template #buttons> <template #buttons>
<a-button type="primary" icon="delete" @click="pageDelete()">批量删除</a-button> <a-button type="primary" icon="delete" @click="pageDelete()" v-if="options.disabledDelete !== true">批量删除</a-button>
<a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint" <a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint"
@click="pagePrint()">打印</a-button> @click="pagePrint()">打印</a-button>
<a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint2" <a-button type="primary" style="margin-left: 5px;" icon="print" v-if="options.enabledPrint2"
@ -627,9 +627,15 @@ export default {
loading: "删除中...", // loading: "删除中...", //
data: delParms, data: delParms,
useBigInt: true useBigInt: true
}).then(() => { // }).then((r) => { //
if(r.code == 200){
this.$mk.success("删除成功"); // this.$mk.success("删除成功"); //
this.$refs.xGrid.commitProxy('query') // this.$refs.xGrid.commitProxy('query') //
}else{
this.$mk.error(r.msg);
}
}).catch((a) => { // }).catch((a) => { //
this.$mk.error(a.data.msg); // this.$mk.error(a.data.msg); //
}); });

View File

@ -121,6 +121,10 @@ export default {
} else { } else {
this.textboxValue = ""; this.textboxValue = "";
} }
},
params(){
console.log(this.params)
} }
}, },
methods: { methods: {
@ -235,10 +239,28 @@ export default {
}); });
}, },
clickEvent() { // clickEvent() { //
const { params } = this
if (this.readonly) { // if (this.readonly) { //
return; // return; //
} }
if(params.isClickToLoad){
const cellValue = this.textboxValue;
let f = params.listdataFieldName || "Records";
this.loading = true
this.getData(cellValue).then(data => {
this.loading = false
if ('Total' in data) {
this.tablePage.total = data.Total;
} else {
this.tablePage.total = data.total;
}
this.tableData = data[f];
})
}
this.$refs.xDown.showPanel() // this.$refs.xDown.showPanel() //
}, },
handleScanInput(event) { handleScanInput(event) {
@ -257,7 +279,6 @@ export default {
}, 10); }, 10);
if (params.scan) { if (params.scan) {
console.log(inputValue)
params.scan({ value: inputValue, input: input }) params.scan({ value: inputValue, input: input })
} }
@ -284,7 +305,6 @@ export default {
if (keyCode == 40) { if (keyCode == 40) {
this.$refs.xDown.showPanel() this.$refs.xDown.showPanel()
const grid = this.$refs.xgrid; const grid = this.$refs.xgrid;
console.log(grid)
if (!grid) return; if (!grid) return;
grid.focus(); grid.focus();
@ -343,7 +363,6 @@ export default {
}, },
onFocus(){ onFocus(){
const { params } = this const { params } = this
console.log(params)
if (params.focusToLoad) { if (params.focusToLoad) {
const cellValue = this.textboxValue; const cellValue = this.textboxValue;
let f = params.listdataFieldName || "Records"; let f = params.listdataFieldName || "Records";
@ -412,7 +431,6 @@ export default {
}, },
popupEvent() { popupEvent() {
console.log("popupEvent");
this.modalVisible = true; this.modalVisible = true;
}, },
confirmEvent() { confirmEvent() {

View File

@ -147,17 +147,31 @@ export default {
let treedata = { let treedata = {
title: "全部", title: "全部",
titleSys: "系统预置",
key: "root" key: "root"
}; };
treedata[childrenFieldName] = r.data.MesEnum; //
let treedata1 = {
title: "系统内置",
key: "root1"
};
let treedata2 = {
title: "自定义",
key: "root2"
};
let arr1 = r.data.MesEnum.filter(a=>a.type == 0);
let arr2 = r.data.MesEnum.filter(a=>a.type != 0);
treedata1[childrenFieldName] = arr1; //
treedata2[childrenFieldName] = arr2; //
treedata[childrenFieldName] = [
treedata1,
treedata2
]
console.log(treedata)
function formatTreedata(d) { // function formatTreedata(d) { //
if (d.id) { if (d.id) {
d.key = d.id.toString(); d.key = d.id.toString();
} else {
d.key = "root";
} }
if (d.name) { if (d.name) {
d.title = d.name; d.title = d.name;

View File

@ -42,6 +42,7 @@ export default {
data: { data: {
"name": "", "name": "",
"code": "", "code": "",
type:0,
enum_id: "0" enum_id: "0"
}, },
@ -60,9 +61,8 @@ export default {
{ field: 'type', title: '是否系统内置', span: 24, itemRender: { name: '$switch', props: { openLabel: '是', openValue: 1, closeValue: 0, closeLabel: '否' } } }, { field: 'type', title: '是否系统内置', span: 24, itemRender: { name: '$switch', props: { openLabel: '是', openValue: 1, closeValue: 0, closeLabel: '否' } } },
// sys_name // sys_name
{ field: 'sys_name', title: '系统内置名称', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入系统内置名称' } } }, //{ field: 'sys_name', title: '', span: 24, itemRender: { name: '$input', props: { placeholder: '' } } },
{ field: 'code', title: '编号', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入编号' } } }, { field: 'code', title: '编号', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入编号' } } }
{ field: 'enum_id', title: '上级分类', span: 24, itemRender: { name: '$select', props: { placeholder: '请输入上级分类', options: [] } } }
] ]
} }

View File

@ -228,12 +228,14 @@ export default {
}, },
// //
items: [ items: [
{
title: '左侧',
span: 20,
children: [
{ field: 'code', title: '编号', span: 12, itemRender: { name: '$input' } }, { field: 'code', title: '编号', span: 12, itemRender: { name: '$input' } },
{ field: 'name', title: '名称', span: 12, itemRender: { name: '$input' } }, { field: 'name', title: '名称', span: 12, itemRender: { name: '$input' } },
{ title: '分类', span: 12, slots: { default: 'sort_id' } }, { title: '分类', span: 12, slots: { default: 'sort_id' } },
{ field: 'spec', title: '规格型号', span: 12, itemRender: { name: '$input' } },
{ field: 'size', title: '尺寸', span: 12, itemRender: { name: '$input' } }, { field: 'size', title: '尺寸', span: 12, itemRender: { name: '$input' } },
{ {
@ -247,11 +249,11 @@ export default {
textField: "name", textField: "name",
listdataFieldName: 'MesEnumValue', listdataFieldName: 'MesEnumValue',
actionParams: { actionParams: {
search_rules_enum: [ search_rules: [
{ {
column: "sys_name", column: "code",
mode: "=", mode: "=",
value: "color" value: "SYS001"
} }
] ]
}, },
@ -261,6 +263,24 @@ export default {
} }
}, },
{ field: 'spec', title: '规格型号', span: 12, itemRender: { name: '$input' } },
]
},
{
title: '右侧',
span: 4,
children: [
{ field: 'image', span: 12, itemRender: { name: 'MkFormUploader' } },
]
},
{
title: '其他',
span: 20,
children: [
{ {
title: '花面', span: 12, title: '花面', span: 12,
field: 'face', field: 'face',
@ -337,7 +357,7 @@ export default {
}, },
{ field: 'theoretical_load', title: '理论装车量', span: 12, itemRender: { name: '$input' } }, { field: 'theoretical_load', title: '理论装车量', span: 8, itemRender: { name: '$input' } },
{ {
title: '土质', span: 12, title: '土质', span: 12,
@ -378,6 +398,11 @@ export default {
} }
} }
}, },
]
},
] ]
@ -644,6 +669,7 @@ export default {
return null; return null;
} }
this.attributes = this.attributes || [];
this.attributes.forEach(item => { this.attributes.forEach(item => {
let v = this.getAttributeValue(item.id); let v = this.getAttributeValue(item.id);

View File

@ -146,7 +146,16 @@ export default {
{ field: 'code', title: '编码' } { field: 'code', title: '编码' }
], ],
listdataFieldName: 'MesWarehouse', listdataFieldName: 'MesWarehouse',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list` dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`,
onDataChanged: ({ data }) => {
console.log(data)
this.pageOptions.formOptions.data.warehouse_pos_detail = {};
this.pageOptions.formOptions.data.warehouse_pos_id = null;
this.pageOptions.formOptions.items[1].itemRender.props.params.actionParams.search_rules[0].value = data.id.toString();
this.pageOptions.formOptions.items[1].itemRender.props.params = JSON.parse(JSON.stringify(this.pageOptions.formOptions.items[1].itemRender.props.params));
this.$forceUpdate();
}
} }
} }
} }
@ -169,6 +178,17 @@ export default {
{ field: 'warehouse_location_name', title: '名称' }, { field: 'warehouse_location_name', title: '名称' },
{ field: 'code', title: '编码' } { field: 'code', title: '编码' }
], ],
isClickToLoad:true,
actionParams: {
search_rules: [
{
column: "warehouse_id",
mode: "=",
value: "0"
}
]
},
listdataFieldName: 'WarehouseLocation', listdataFieldName: 'WarehouseLocation',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list` dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`
} }
@ -199,7 +219,7 @@ export default {
{ field: 'stock', dataRule:{type:"number"}, title: '库存数量', span: 12, itemRender: { name: '$input',props:{type:'number'} } }, { field: 'stock', dataRule: { type: "number" }, title: '库存数量', span: 12, itemRender: { name: '$input', props: { type: 'number' } } },
] ]
}, },
@ -240,11 +260,11 @@ export default {
let detailDataFieldName = this.pageOptions.detailDataFieldName; let detailDataFieldName = this.pageOptions.detailDataFieldName;
let rules = [ let rules = [
{field:"create_time",dataRule:"timestamp"}, { field: "create_time", dataRule: "timestamp" },
{field:"update_time",dataRule:"timestamp"}, { field: "update_time", dataRule: "timestamp" },
]; ];
rules = []; // rules = []; //
this.$mk.formatInitFormData({data: a.data[detailDataFieldName] , rules:[...this.pageOptions.formOptions.items,...rules] }); // this.$mk.formatInitFormData({ data: a.data[detailDataFieldName], rules: [...this.pageOptions.formOptions.items, ...rules] }); //
this.pageOptions.formOptions.data = a.data[detailDataFieldName]; this.pageOptions.formOptions.data = a.data[detailDataFieldName];

View File

@ -3,8 +3,7 @@
<basic-page-list :desc="desc" :options="pageOptions"> <basic-page-list :desc="desc" :options="pageOptions">
<template v-slot:column1="{ row }"> <template v-slot:column1="{ row }">
<a-button class="in" type="primary" @click="stockIn(row.id)">入库</a-button> <a-button class="in" type="primary" @click="positionAdd(row.id)">增加仓位</a-button>
<a-button class="out" @click="stockOut(row.id)">出库</a-button>
</template> </template>
</basic-page-list> </basic-page-list>
@ -121,6 +120,7 @@ export default {
{ field: 'product_detail.size', sortable: true, title: '尺寸', width: 100 }, // { field: 'product_detail.size', sortable: true, title: '尺寸', width: 100 }, //
{ field: 'product_detail.color', sortable: true, title: '颜色', width: 100 }, // { field: 'product_detail.color', sortable: true, title: '颜色', width: 100 }, //
{ field: 'stock', sortable: true, title: '库存数量', width: 100 }, // { field: 'stock', sortable: true, title: '库存数量', width: 100 }, //
{ slots: { default: 'column1' }, sortable: true, title: '操作', width: 160,fixed:"right" }, //
@ -137,16 +137,22 @@ export default {
this.pageOptions = pageData; this.pageOptions = pageData;
}, },
//
stockOut(id) {
console.log("stockOut:"+id)
this.$router.push('/MesStock/MesStockOut/'+id) //
},
// positionAdd(id) {
stockIn(id) { this.$mk.dialog.open({
console.log("stockIn:"+id) page: () => import("./Position/PositionAdd"),
this.$router.push('/MesStock/MesStockIn/'+id) // title: "增加仓位",
pageOptions: {
},
width: 800,
height: 600,
dataId: id,
callback: ({ success }) => {
if (success) {
this.$refs.xGrid.commitProxy('query')
}
}
});
}, },

View File

@ -183,7 +183,7 @@ export default {
// id // id
getDataId() { getDataId() {
let dataId = this.dataId; let dataId = this.dataId;
if (this.$route.params.id) { if (this.$route && this.$route.params && this.$route.params.id) {
dataId = this.$route.params.id; dataId = this.$route.params.id;
} }
if (!dataId) { if (!dataId) {
@ -200,11 +200,7 @@ export default {
// //
back() { back() {
this.$closePage({ this.$emit("callback", {});
closeRoute: "/MesStock/MesStockIn"
});
//
this.$openPage('/MesStock/MesStockPositionList')
}, },
@ -238,10 +234,7 @@ export default {
if (a.code == "200") { if (a.code == "200") {
this.$mk.success("保存成功"); this.$mk.success("保存成功");
setTimeout(() => {
this.back(); this.back();
}, 500);
} else { } else {
this.$mk.error(a.msg || a.message); this.$mk.error(a.msg || a.message);

View File

@ -183,7 +183,7 @@ export default {
// id // id
getDataId() { getDataId() {
let dataId = this.dataId; let dataId = this.dataId;
if (this.$route.params.id) { if (this.$route && this.$route.params && this.$route.params.id) {
dataId = this.$route.params.id; dataId = this.$route.params.id;
} }
if (!dataId) { if (!dataId) {
@ -200,11 +200,8 @@ export default {
// //
back() { back() {
this.$closePage({
closeRoute: "/MesStock/MesStockOut" this.$emit("callback", {});
});
//
this.$openPage('/MesStock/MesStockPositionList')
}, },

View File

@ -0,0 +1,315 @@
<template>
<div class="page-body">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
<div class="footerbar">
<a-button type="primary" @click="ok">确定</a-button>
<a-button @click="cancel">取消</a-button>
</div>
</div>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
export default {
components: {},
props: {
pageMode: {
type: String,
default: "edit"
},
dataId: {
}
},
data() {
//let _this = this;
//
var pageData = {
//
currentConfigName: "",
// ID
currentBeid: 0,
uploadDefaultImg: null,
detailDataFieldName: "",
actions: {
save: `${BASE_URL.BASE_URL}/MesStock/v1/mes/stock/position/create`
},
keyName: 'id',
//
isEdit: false,
//
formOptions: {
data: {
},
//
titleWidth: 100,
//
titleAlign: 'right',
//
rules: {
warehouse_detail: [
{ required: true, message: '请选择仓库' }
],
warehouse_pos_detail: [
{ required: true, message: '请选择仓位' }
],
},
//
items: [
{
title: '仓库', span: 12,
field: 'warehouse_detail',
dataRule: {
fromField: "id",
saveField: "warehouse_id"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "object",
valueField: "id",
textField: "warehouse_title",
columns: [
{ field: 'warehouse_title', title: '名称' },
{ field: 'code', title: '编码' }
],
listdataFieldName: 'MesWarehouse',
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/mes/warehouse/list`,
onDataChanged: ({ data }) => {
console.log(data)
this.formOptions.data.warehouse_pos_detail = {};
this.formOptions.data.warehouse_pos_id = null;
this.formOptions.items[1].itemRender.props.params.actionParams.search_rules[0].value = data.id.toString();
this.formOptions.items[1].itemRender.props.params = JSON.parse(JSON.stringify(this.formOptions.items[1].itemRender.props.params));
this.$forceUpdate();
}
}
}
}
},
{
title: '仓位', span: 12,
field: 'warehouse_pos_detail',
dataRule: {
fromField: "id",
saveField: "warehouse_pos_id"
},
itemRender: {
name: 'MkFormDataSelector', props: {
params: {
dataType: "object",
valueField: "id",
textField: "warehouse_location_name",
columns: [
{ field: 'warehouse_location_name', title: '名称' },
{ field: 'code', title: '编码' }
],
listdataFieldName: 'WarehouseLocation',
isClickToLoad:true,
actionParams: {
search_rules: [
{
column: "warehouse_id",
mode: "=",
value: "0"
}
]
},
dataUrl: `${BASE_URL.BASE_URL}/MesWarehouse/v1/warehouse/location/list`
}
}
}
},
]
},
//
addModeItems: [
],
};
//
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
return pageData;
},
computed: {
desc() {
return this.$t('editPageDesc')
}
},
created() {
},
//
methods: {
// id
getDataId() {
let dataId = this.dataId;
if (this.$route && this.$route.params && this.$route.params.id) {
dataId = this.$route.params.id;
}
if (!dataId) {
dataId = 0;
}
return dataId;
},
getDataId_BigInt() {
let dataId = this.getDataId();
return this.$mk.toBigInt(dataId);
},
//
back() {
this.$emit("callback", {});
},
//
ok() {
let save = () => {
let postdata = Object.assign({}, this.formOptions.data);
//
this.$mk.formatFormData({ data: postdata, rules: this.formOptions.items });
postdata.stock_id = this.getDataId_BigInt();
//
this.$mk.post({
url: this.actions.save,
loading: "保存中...",
data: postdata,
useBigInt: true,
}).then((a) => { //
if (a.code == "200") {
this.$mk.success("保存成功");
this.back();
} else {
this.$mk.error(a.msg || a.message);
}
});
};
//
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { //
save(); //
}).catch(count => { //
this.$mk.error(`存在${count}项错误,请检查`);
});
},
//
cancel() {
this.back();
},
},
//
watch: {
}
};
</script>
<style scoped lang="less">
.page-body {
padding: 30px;
background: @base-bg-color;
}
.formtabs .ant-tabs-tabpane {
/* background: white; */
padding: 12px;
}
.gridPanel {
height: calc(100vh - 600px);
}
.footerbar {
padding-left: 10px;
}
.imagePanel {
cursor: pointer;
padding: 10px;
width: 100px;
img {
width: 80px;
height: 80px;
}
}
.oplinks2 svg {
width: 18px;
height: 18px;
}
.oplinks2 i {
margin-left: 5px;
}
</style>

View File

@ -50,7 +50,7 @@ export default {
addPageUrl: "/MesStock/MesStockPositionAdd", addPageUrl: "/MesStock/MesStockPositionAdd",
editPageUrl: "/MesStock/MesStockPositionUpdate/", editPageUrl: "/MesStock/MesStockPositionUpdate/",
disabledAdd:true,
// //
actions: { // Api actions: { // Api
// =============================== Start =============================== // =============================== Start ===============================
@ -150,14 +150,48 @@ export default {
// //
stockOut(id) { stockOut(id) {
console.log("stockOut:"+id) //console.log("stockOut:"+id)
this.$router.push('/MesStock/MesStockOut/'+id) // //this.$router.push('/MesStock/MesStockOut/'+id) //
this.$mk.dialog.open({
page: () => import("../OutIn/OutEdit"),
title: "出库",
pageOptions: {
},
width: 800,
height: 600,
dataId: id,
callback: ({ success }) => {
if (success) {
this.$refs.xGrid.commitProxy('query')
}
}
});
}, },
// //
stockIn(id) { stockIn(id) {
console.log("stockIn:"+id) //console.log("stockIn:"+id)
this.$router.push('/MesStock/MesStockIn/'+id) // //this.$router.push('/MesStock/MesStockIn/'+id) //
this.$mk.dialog.open({
page: () => import("../OutIn/InEdit"),
title: "入库",
pageOptions: {
},
width: 800,
height: 600,
dataId: id,
callback: ({ success }) => {
if (success) {
this.$refs.xGrid.commitProxy('query')
}
}
});
}, },
}, },