From db2c3d7fe3d1e89b49b9628f408ba883dc75dc51 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期四, 03 七月 2025 17:11:43 +0800
Subject: [PATCH] no message
---
zy-asrs-admin/src/components/orderOut/orderOutMergePreview/stockOut.vue | 660 ++++++++++++++++++++++++++++++------------------------------
1 files changed, 330 insertions(+), 330 deletions(-)
diff --git a/zy-asrs-admin/src/components/orderOut/orderOutMergePreview/stockOut.vue b/zy-asrs-admin/src/components/orderOut/orderOutMergePreview/stockOut.vue
index 480d07f..a03f3da 100644
--- a/zy-asrs-admin/src/components/orderOut/orderOutMergePreview/stockOut.vue
+++ b/zy-asrs-admin/src/components/orderOut/orderOutMergePreview/stockOut.vue
@@ -1,330 +1,330 @@
-<script setup>
-import { ref, watch, reactive } from 'vue';
-import { useRouter } from "vue-router";
-import { get, post, postBlob } from '@/utils/request.js'
-import { message, Modal } from 'ant-design-vue';
-import { logout } from '@/config.js';
-import { formatMessage } from '@/utils/localeUtils.js';
-import useTableSearch from '@/utils/tableUtils.jsx';
-
-const router = useRouter();
-
-const TABLE_KEY = 'table-order-out-preview';
-
-const emit = defineEmits(['closeParent', 'reload'])
-
-const {
- getColumnSearchProps,
-} = useTableSearch();
-
-let currentOrder = ref(null);
-let searchInput = ref(null);
-let tableData = ref([]);
-const operationPortList = ref([])
-const globalOperationPort = ref(null)
-const open = ref(false);
-const showWidth = ref("60%")
-const records = ref([])
-const waveId = ref(null)
-const loading = ref(false)
-let tableDataValue = []
-let tableDataColSpan = []
-
-const customColSpanProps = (index) => {
- let count = tableDataColSpan[index];
- if (count == null) {
- count = 0;
- }
- return {
- rowSpan: count,
- };
-}
-
-let columns = [
- {
- title: formatMessage('db.man_order_detl.matnr', '鍟嗗搧缂栧彿'),
- dataIndex: 'matnr',
- width: 140,
- ellipsis: true,
- ...getColumnSearchProps('matnr'),
- customCell: (_, index) => {
- return customColSpanProps(index)
- },
- },
- {
- title: formatMessage('db.man_order_detl.batch', '鎵瑰彿'),
- dataIndex: 'batch',
- width: 140,
- ellipsis: true,
- ...getColumnSearchProps('batch'),
- customCell: (_, index) => {
- return customColSpanProps(index)
- },
- },
-];
-
-const state = reactive({
- selectedRowKeys: [],
-});
-const onSelectChange = selectedRowKeys => {
- // console.log('selectedRowKeys changed: ', selectedRowKeys);
- state.selectedRowKeys = selectedRowKeys;
-};
-
-const fieldList = [];
-getColumns();
-//鍔犺浇鎵╁睍瀛楁
-async function getColumns() {
- let fieldResp = await post('/api/matField/list', {
- unique: 1,
- })
- let fieldResult = fieldResp.data;
- let tmp = columns;
- if (fieldResult.code == 200) {
- let data = fieldResult.data;
-
- data.forEach((item) => {
- tmp.push({
- title: formatMessage(item.language, item.describe),
- name: item.name,
- dataIndex: item.name,
- key: item.name,
- width: 140,
- editable: true,
- customCell: (_, index) => {
- return customColSpanProps(index)
- },
- })
-
- fieldList.push(item.name);
- })
-
- tmp.push({
- title: formatMessage('db.man_order_detl.anfme', '鏁伴噺'),
- dataIndex: 'anfme',
- width: 140,
- ellipsis: true,
- fixed: 'right',
- })
-
- tmp.push({
- title: formatMessage('db.man_order_detl.locNo', '鍑哄簱搴撲綅'),
- dataIndex: 'locNo',
- width: 140,
- ellipsis: true,
- fixed: 'right',
- })
-
- tmp.push({
- title: formatMessage('db.man_order_detl.operationPort', '浣滀笟鍙�'),
- dataIndex: 'operationPort',
- width: 140,
- ellipsis: true,
- fixed: 'right',
- })
-
- columns = tmp;
- } else if (result.code === 401) {
- message.error(result.msg);
- logout()
- } else {
- message.error(result.msg);
- }
-}
-
-async function getOperationPort() {
- let resp = await post('/api/operationPort/list', {})
- let result = resp.data;
- if (result.code == 200) {
- let data = result.data;
- let tmp = []
- data.forEach((item) => {
- tmp.push({
- label: item.flag,
- value: item.id
- })
- })
- operationPortList.value = tmp;
- } else if (result.code === 401) {
- message.error(result.msg);
- logout()
- } else {
- message.error(result.msg);
- }
-}
-
-watch(open, (newVal, oldVal) => {
- if (newVal) {
- handleOrderMergePreview()
- }
-})
-
-const handleOk = () => {
- let requestParam = {
- waveId: waveId.value,
- list: tableData.value
- };
-
- post('/api/out/orderOut/merge/wave', requestParam).then((resp) => {
- let result = resp.data;
- if (result.code == 200) {
- message.success(formatMessage('page.add.success', '鍑哄簱鎴愬姛'));
- open.value = false;
- emit('closeParent', true)
- emit('reload', true)
- } else {
- message.error(result.msg);
- }
- })
-}
-
-const handleOrderMergePreview = async () => {
- let data = records.value;
- if (data.length == 0) {
- message.error(formatMessage("page.orderOut.mergeOrderOut.checkedError", "璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�"));
- return;
- }
-
- loading.value = true;
-
- await getOperationPort();
- tableData.value = []
- tableDataValue = []
-
- let defaultOperationPort = "";
- if (operationPortList.value.length > 0) {
- defaultOperationPort = operationPortList.value[0].value;
- globalOperationPort.value = defaultOperationPort;
- }
-
- post('/api/out/orderOut/merge/loc/preview', data).then((resp) => {
- let result = resp.data;
- if (result.code == 200) {
- let tmp = result.data;
- tableDataValue = tmp;
-
- let tableDataTmp = []
- let idx = 0;
- let colSpan = []
- tmp.forEach((item) => {
- let count = item.locs.length;
-
- if (item.locs.length == 0) {
- let dataTmp = JSON.parse(JSON.stringify(item));
-
- dataTmp.locId = null;
- dataTmp.locNo = null;
- dataTmp.locDetlId = null;
- dataTmp.anfme = item.anfme;
- dataTmp.key = idx;
- dataTmp.operationPort = defaultOperationPort;
-
- tableDataTmp.push(dataTmp);
- count++;
- } else {
- let isused = item.anfme;
- console.log(isused);
-
- for (let i = 0; i < item.locs.length; i++) {
- if (isused == 0) {
- break;
- }
- const val = item.locs[i];
- let dataTmp = JSON.parse(JSON.stringify(item));
- let anfme = isused - val.anfme > 0 ? val.anfme : isused;
- isused -= anfme;
-
- dataTmp.locId = val.locId;
- dataTmp.locNo = val.locNo;
- dataTmp.locDetlId = val.locDetlId;
- dataTmp.anfme = anfme;
- dataTmp.key = idx;
- dataTmp.operationPort = defaultOperationPort;
-
- tableDataTmp.push(dataTmp);
- }
-
- console.log(tableDataTmp);
-
-
- if (isused > 0) {
- let dataTmp = JSON.parse(JSON.stringify(item));
- dataTmp.locId = null;
- dataTmp.locNo = null;
- dataTmp.locDetlId = null;
- dataTmp.anfme = isused;
- dataTmp.key = idx;
- dataTmp.operationPort = defaultOperationPort;
-
- tableDataTmp.push(dataTmp);
- count++;
- }
- }
-
- colSpan[idx] = count;
- idx += count;
- })
-
- tableDataColSpan = colSpan;
- tableData.value = tableDataTmp;
-
- loading.value = false;
- } else {
- message.error(result.msg);
- }
- })
-}
-
-const handleGlobalOperationPortChange = () => {
- if (tableData.value.length > 0) {
- tableData.value.forEach((item) => {
- item.operationPort = globalOperationPort.value;
- })
- }
-}
-
-defineExpose({
- open,
- showWidth,
- records,
- waveId,
-})
-</script>
-
-<script>
-export default {
- name: '棰勮鍚堝苟璁㈠崟鍑哄簱'
-}
-</script>
-
-<template>
- <div>
- <a-modal v-model:open="open" :width="showWidth"
- :title="formatMessage('page.orderOutPreview.preview', '棰勮鍚堝苟璁㈠崟鍑哄簱')" @ok="handleOk">
- <div>
- <span>浣滀笟鍙o細</span>
- <a-select v-model:value="globalOperationPort" :options="operationPortList"
- @change="handleGlobalOperationPortChange"></a-select>
- </div>
- <a-table :data-source="tableData" :loading="loading" :defaultExpandAllRows="false" :key="TABLE_KEY"
- rowKey="index" :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns">
- <template #bodyCell="{ column, text, record, index }">
- <template v-if="column.dataIndex === 'locNo'">
- <div v-if="record.locId != null && record.anfme > 0">
- <a-tag color="green">{{ record.locNo }}</a-tag>
- </div>
- <div v-else>
- <a-tag color="red">搴撳瓨涓嶈冻</a-tag>
- </div>
- </template>
-
- <template v-if="column.dataIndex === 'operationPort'">
- <a-select v-model:value="record.operationPort" :options="operationPortList"></a-select>
- </template>
- </template>
- </a-table>
- </a-modal>
- </div>
-</template>
-
-<style></style>
+<script setup>
+import { ref, watch, reactive } from 'vue';
+import { useRouter } from "vue-router";
+import { get, post, postBlob } from '@/utils/request.js'
+import { message, Modal } from 'ant-design-vue';
+import { logout } from '@/config.js';
+import { formatMessage } from '@/utils/localeUtils.js';
+import useTableSearch from '@/utils/tableUtils.jsx';
+
+const router = useRouter();
+
+const TABLE_KEY = 'table-order-out-preview';
+
+const emit = defineEmits(['closeParent', 'reload'])
+
+const {
+ getColumnSearchProps,
+} = useTableSearch();
+
+let currentOrder = ref(null);
+let searchInput = ref(null);
+let tableData = ref([]);
+const operationPortList = ref([])
+const globalOperationPort = ref(null)
+const open = ref(false);
+const showWidth = ref("60%")
+const records = ref([])
+const waveId = ref(null)
+const loading = ref(false)
+let tableDataValue = []
+let tableDataColSpan = []
+
+const customColSpanProps = (index) => {
+ let count = tableDataColSpan[index];
+ if (count == null) {
+ count = 0;
+ }
+ return {
+ rowSpan: count,
+ };
+}
+
+let columns = [
+ {
+ title: formatMessage('db.man_order_detl.matnr', '鍟嗗搧缂栧彿'),
+ dataIndex: 'matnr',
+ width: 140,
+ ellipsis: true,
+ ...getColumnSearchProps('matnr'),
+ customCell: (_, index) => {
+ return customColSpanProps(index)
+ },
+ },
+ {
+ title: formatMessage('db.man_order_detl.batch', '鎵瑰彿'),
+ dataIndex: 'batch',
+ width: 140,
+ ellipsis: true,
+ ...getColumnSearchProps('batch'),
+ customCell: (_, index) => {
+ return customColSpanProps(index)
+ },
+ },
+];
+
+const state = reactive({
+ selectedRowKeys: [],
+});
+const onSelectChange = selectedRowKeys => {
+ // console.log('selectedRowKeys changed: ', selectedRowKeys);
+ state.selectedRowKeys = selectedRowKeys;
+};
+
+const fieldList = [];
+getColumns();
+//鍔犺浇鎵╁睍瀛楁
+async function getColumns() {
+ let fieldResp = await post('/api/matField/list', {
+ unique: 1,
+ })
+ let fieldResult = fieldResp.data;
+ let tmp = columns;
+ if (fieldResult.code == 200) {
+ let data = fieldResult.data;
+
+ data.forEach((item) => {
+ tmp.push({
+ title: formatMessage(item.language, item.describe),
+ name: item.name,
+ dataIndex: item.name,
+ key: item.name,
+ width: 140,
+ editable: true,
+ customCell: (_, index) => {
+ return customColSpanProps(index)
+ },
+ })
+
+ fieldList.push(item.name);
+ })
+
+ tmp.push({
+ title: formatMessage('db.man_order_detl.anfme', '鏁伴噺'),
+ dataIndex: 'anfme',
+ width: 140,
+ ellipsis: true,
+ fixed: 'right',
+ })
+
+ tmp.push({
+ title: formatMessage('db.man_order_detl.locNo', '鍑哄簱搴撲綅'),
+ dataIndex: 'locNo',
+ width: 140,
+ ellipsis: true,
+ fixed: 'right',
+ })
+
+ tmp.push({
+ title: formatMessage('db.man_order_detl.operationPort', '浣滀笟鍙�'),
+ dataIndex: 'operationPort',
+ width: 140,
+ ellipsis: true,
+ fixed: 'right',
+ })
+
+ columns = tmp;
+ } else if (result.code === 401) {
+ message.error(result.msg);
+ logout()
+ } else {
+ message.error(result.msg);
+ }
+}
+
+async function getOperationPort() {
+ let resp = await post('/api/operationPort/list', {})
+ let result = resp.data;
+ if (result.code == 200) {
+ let data = result.data;
+ let tmp = []
+ data.forEach((item) => {
+ tmp.push({
+ label: item.flag,
+ value: item.id
+ })
+ })
+ operationPortList.value = tmp;
+ } else if (result.code === 401) {
+ message.error(result.msg);
+ logout()
+ } else {
+ message.error(result.msg);
+ }
+}
+
+watch(open, (newVal, oldVal) => {
+ if (newVal) {
+ handleOrderMergePreview()
+ }
+})
+
+const handleOk = () => {
+ let requestParam = {
+ waveId: waveId.value,
+ list: tableData.value
+ };
+
+ post('/api/out/orderOut/merge/wave', requestParam).then((resp) => {
+ let result = resp.data;
+ if (result.code == 200) {
+ message.success(formatMessage('page.add.success', '鍑哄簱鎴愬姛'));
+ open.value = false;
+ emit('closeParent', true)
+ emit('reload', true)
+ } else {
+ message.error(result.msg);
+ }
+ })
+}
+
+const handleOrderMergePreview = async () => {
+ let data = records.value;
+ if (data.length == 0) {
+ message.error(formatMessage("page.orderOut.mergeOrderOut.checkedError", "璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�"));
+ return;
+ }
+
+ loading.value = true;
+
+ await getOperationPort();
+ tableData.value = []
+ tableDataValue = []
+
+ let defaultOperationPort = "";
+ if (operationPortList.value.length > 0) {
+ defaultOperationPort = operationPortList.value[0].value;
+ globalOperationPort.value = defaultOperationPort;
+ }
+
+ post('/api/out/orderOut/merge/loc/preview', data).then((resp) => {
+ let result = resp.data;
+ if (result.code == 200) {
+ let tmp = result.data;
+ tableDataValue = tmp;
+
+ let tableDataTmp = []
+ let idx = 0;
+ let colSpan = []
+ tmp.forEach((item) => {
+ let count = item.locs.length;
+
+ if (item.locs.length == 0) {
+ let dataTmp = JSON.parse(JSON.stringify(item));
+
+ dataTmp.locId = null;
+ dataTmp.locNo = null;
+ dataTmp.locDetlId = null;
+ dataTmp.anfme = item.anfme;
+ dataTmp.key = idx;
+ dataTmp.operationPort = defaultOperationPort;
+
+ tableDataTmp.push(dataTmp);
+ count++;
+ } else {
+ let isused = item.anfme;
+ console.log(isused);
+
+ for (let i = 0; i < item.locs.length; i++) {
+ if (isused == 0) {
+ break;
+ }
+ const val = item.locs[i];
+ let dataTmp = JSON.parse(JSON.stringify(item));
+ let anfme = isused - val.anfme > 0 ? val.anfme : isused;
+ isused -= anfme;
+
+ dataTmp.locId = val.locId;
+ dataTmp.locNo = val.locNo;
+ dataTmp.locDetlId = val.locDetlId;
+ dataTmp.anfme = anfme;
+ dataTmp.key = idx;
+ dataTmp.operationPort = defaultOperationPort;
+
+ tableDataTmp.push(dataTmp);
+ }
+
+ console.log(tableDataTmp);
+
+
+ if (isused > 0) {
+ let dataTmp = JSON.parse(JSON.stringify(item));
+ dataTmp.locId = null;
+ dataTmp.locNo = null;
+ dataTmp.locDetlId = null;
+ dataTmp.anfme = isused;
+ dataTmp.key = idx;
+ dataTmp.operationPort = defaultOperationPort;
+
+ tableDataTmp.push(dataTmp);
+ count++;
+ }
+ }
+
+ colSpan[idx] = count;
+ idx += count;
+ })
+
+ tableDataColSpan = colSpan;
+ tableData.value = tableDataTmp;
+
+ loading.value = false;
+ } else {
+ message.error(result.msg);
+ }
+ })
+}
+
+const handleGlobalOperationPortChange = () => {
+ if (tableData.value.length > 0) {
+ tableData.value.forEach((item) => {
+ item.operationPort = globalOperationPort.value;
+ })
+ }
+}
+
+defineExpose({
+ open,
+ showWidth,
+ records,
+ waveId,
+})
+</script>
+
+<script>
+export default {
+ name: '棰勮鍚堝苟璁㈠崟鍑哄簱'
+}
+</script>
+
+<template>
+ <div>
+ <a-modal v-model:open="open" :width="showWidth"
+ :title="formatMessage('page.orderOutPreview.preview', '棰勮鍚堝苟璁㈠崟鍑哄簱')" @ok="handleOk">
+ <div>
+ <span>浣滀笟鍙o細</span>
+ <a-select v-model:value="globalOperationPort" :options="operationPortList"
+ @change="handleGlobalOperationPortChange"></a-select>
+ </div>
+ <a-table :data-source="tableData" :loading="loading" :defaultExpandAllRows="false" :key="TABLE_KEY"
+ rowKey="index" :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns">
+ <template #bodyCell="{ column, text, record, index }">
+ <template v-if="column.dataIndex === 'locNo'">
+ <div v-if="record.locId != null && record.anfme > 0">
+ <a-tag color="green">{{ record.locNo }}</a-tag>
+ </div>
+ <div v-else>
+ <a-tag color="red">搴撳瓨涓嶈冻</a-tag>
+ </div>
+ </template>
+
+ <template v-if="column.dataIndex === 'operationPort'">
+ <a-select v-model:value="record.operationPort" :options="operationPortList"></a-select>
+ </template>
+ </template>
+ </a-table>
+ </a-modal>
+ </div>
+</template>
+
+<style></style>
--
Gitblit v1.9.1