diff --git a/src/api/basics/storage/index.ts b/src/api/basics/storage/index.ts index fd235bb..4c3c68f 100644 --- a/src/api/basics/storage/index.ts +++ b/src/api/basics/storage/index.ts @@ -31,3 +31,36 @@ export function deleteStorage(data: any) { data: data, }); } + +/** + * 货位新增 + * */ +export function createStorage(data: any) { + return request({ + url: '/api/api/storage/addStorage', + method: 'post', + data: data, + }); +} + +/** + * 货位编辑 + * */ +export function editStorage(data: any) { + return request({ + url: '/api/api/storage/editStorage', + method: 'post', + data: data, + }); +} + +/** + * 货位删除 + * */ +export function delStorage(data: any) { + return request({ + url: '/api/api/storage/delStorage', + method: 'post', + data: data, + }); +} \ No newline at end of file diff --git a/src/api/label/index.ts b/src/api/label/index.ts index 223680c..d196073 100644 --- a/src/api/label/index.ts +++ b/src/api/label/index.ts @@ -120,4 +120,15 @@ export function checkMaterialPack(data: any) { method: 'post', data: data, }); +} + +/** + * 打印标签 + * */ +export function printStorage(data: any) { + return request({ + url: '/api/api/label/storagePrint', + method: 'post', + data: data, + }); } \ No newline at end of file diff --git a/src/views/basics/flatWarehouse/wareHouseLocation/index.vue b/src/views/basics/flatWarehouse/wareHouseLocation/index.vue index 18e026d..ef28e2e 100644 --- a/src/views/basics/flatWarehouse/wareHouseLocation/index.vue +++ b/src/views/basics/flatWarehouse/wareHouseLocation/index.vue @@ -20,20 +20,20 @@ clearable /> --> - + - + - + @@ -54,6 +54,12 @@
+ + + + + 创建 + +/** + * 新增货位 dialog + */ +function handleAdd() { + selectItem.value = undefined; + dialog.value = { + title: "新增货位", + visible: true, + type: 'add' + }; +} + +/** + * 编辑货位 dialog + */ +function handleUpdate(row: any) { + state.dialog = { + title: "编辑货位", + visible: true, + type: 'edit' + }; + state.selectItem = row; +} + +// 删除确认 +function delConfirm(row: any) { + ElMessageBox.confirm('确认删除?', + '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + distinguishCancelAndClose: true, + type: 'warning', + }).then(() => { + handleDelete(row); + }) + .catch(() => { }); +} + +function dialogOpend() { + formDataRef.value.resetFields(); + state.formData.STORAGENAME = '' + state.formData.DESCRIPTION = '' + if (state.selectItem && state.dialog.type === 'edit') { + state.formData = { + STORAGENAME: state.selectItem.STORAGENAME, + DESCRIPTION: state.selectItem.DESCRIPTION + }; + } +} +// ERP工厂查询 +function ERPFactoryQuery() { + getORG({ orgNo: null }) + .then((res: any) => { + state.ERPFactoryList = res.resultObj + }) + .catch(() => {}) +} +/** + * 取消关闭弹窗 + */ +function cancel() { + state.dialog.visible = false; +} +/** + * 保存 + */ +function submitForm() { + formDataRef.value.validate((isValid: boolean) => { + if (isValid) { + if (state.selectItem) { + // 编辑 + let params = { + ...state.formData, + SITENAME: 'SDK' + }; + editStorage(params).then((res: any) => { + if (res.code === "200") { + proxy.$ElMessage.success("修改成功"); + cancel(); + handleQuery(); + } else { + proxy.$ElMessage.error(res.message); + } + }) + } else { + createStorage(state.formData).then((res: any) => { + if (res.code === "200") { + proxy.$ElMessage.success("新增成功"); + cancel(); + handleQuery(); + } else { + proxy.$ElMessage.error(res.message); + } + }) + } + } + }); +} +/** + * 删除 + * */ +function handleDelete(row: any) { + const params = { + STORAGENAME: row.STORAGENAME, + SITENAME: 'SDK', + }; + delStorage(params).then((res: any) => { + if (res.code === "200") { + proxy.$ElMessage.success("删除成功"); + handleQuery(); + } else { + proxy.$ElMessage.console.error("删除失败"); + } + }); +} + +/** + * 打印机 + */ +function print() { + if (state.PRINTNAME == null || state.PRINTNAME == "") { + ElMessageBox.alert('请选择打印机', { + confirmButtonText: 'OK', + }) + return + } + if (state.multipleSelection.length == 0) { + ElMessageBox.alert('打印清单为空', { + confirmButtonText: 'OK', + }) + return + } + let PRINT = { + LIST: state.multipleSelection, + PRINTNAME: state.PRINTNAME, + USER: ls.get('userId') + } + state.button_print = true; + state.loadings = true; + printStorage(PRINT).then((res: any) => { + console.log('PRINT',res) + }).catch(() => { + state.button_print = false; + state.loadings = false; + }); + state.button_print = false; + state.loadings = false; + ElMessageBox.alert('标签打印成功', { + confirmButtonText: 'OK', + }) +} + +function getPRINTLIST() { + getQueryList({ + queryId: "getPRINTLIST", + version: "00001", + params: { + }, + }).then((res: any) => { + state.PRINTLIST = res.data + }) +} + +const handleSelectionChange = (val: any) => { + state.multipleSelection = val; +} +