From c635d78b479510ebe2556a420948effcd30a0731 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期六, 21 十二月 2024 18:40:43 +0800 Subject: [PATCH] 新建德森项目分支 --- zy-asrs-admin/src/views/loc/stockAdjust/index.vue | 760 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 380 insertions(+), 380 deletions(-) diff --git a/zy-asrs-admin/src/views/loc/stockAdjust/index.vue b/zy-asrs-admin/src/views/loc/stockAdjust/index.vue index ed774d1..6dadaae 100644 --- a/zy-asrs-admin/src/views/loc/stockAdjust/index.vue +++ b/zy-asrs-admin/src/views/loc/stockAdjust/index.vue @@ -1,380 +1,380 @@ -<script setup> -import { ref, reactive } from 'vue'; -import { useRouter } from "vue-router"; -import { get, post, postForm } 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'; -import MatQueryView from '@/components/mat/matQuery/index.vue' - -const router = useRouter(); - -const TABLE_KEY = 'table-locDetl'; -const matQueryChild = ref(null) -const searchInput = ref(null) - -let tableData = ref([]); -getColumns(); - -const { - getColumnSearchProps, - handleResizeColumn, -} = useTableSearch(); - -const state = reactive({ - selectedRowKeys: [], - loading: false, - columns: [], -}); -const onSelectChange = selectedRowKeys => { - // console.log('selectedRowKeys changed: ', selectedRowKeys); - state.selectedRowKeys = selectedRowKeys; -}; - -state.columns = [ - { - title: formatMessage('db.man_loc_detl.qty', '瀹為檯鏁伴噺'), - dataIndex: 'qty', - width: 140, - ellipsis: true, - }, - { - title: formatMessage('db.man_loc_detl.anfme', '搴撳瓨鏁伴噺'), - dataIndex: 'anfme', - width: 140, - ellipsis: true, - }, - { - title: formatMessage('db.man_loc_detl.matnr', '鍟嗗搧缂栧彿'), - dataIndex: 'matnr', - width: 140, - ellipsis: true, - ...getColumnSearchProps('matnr'), - }, - { - title: formatMessage('db.man_loc_detl.batch', '鎵瑰彿'), - dataIndex: 'batch', - width: 140, - ellipsis: true, - ...getColumnSearchProps('batch'), - }, -]; - -let columnsOther = [ - { - title: formatMessage('db.man_loc_detl.loc_id', '搴撲綅'), - dataIndex: 'locId$', - width: 140, - ellipsis: true, - ...getColumnSearchProps('locId$'), - }, - { - title: formatMessage('db.man_loc_detl.loc_no', '搴撲綅鍙�'), - dataIndex: 'locNo', - width: 140, - ellipsis: true, - ...getColumnSearchProps('locNo'), - }, - // { - // title: formatMessage('db.man_loc_detl.mat_id', '鍟嗗搧'), - // dataIndex: 'matId$', - // width: 140, - // ellipsis: true, - // ...getColumnSearchProps('matId$'), - // }, - { - title: formatMessage('db.man_loc_detl.order_no', '璁㈠崟鍙�'), - dataIndex: 'orderNo', - width: 140, - ellipsis: true, - ...getColumnSearchProps('orderNo'), - }, - { - title: formatMessage('db.man_loc_detl.anfme', '鏁伴噺'), - dataIndex: 'anfme', - width: 140, - ellipsis: true, - ...getColumnSearchProps('anfme'), - }, - { - title: formatMessage('db.man_loc_detl.freeze', '鏄惁鍐荤粨'), - dataIndex: 'freeze$', - width: 140, - ellipsis: true, - ...getColumnSearchProps('freeze$'), - }, - { - title: formatMessage('db.man_loc_detl.status', '鐘舵��'), - dataIndex: 'status$', - width: 140, - ellipsis: true, - ...getColumnSearchProps('status$'), - }, - // { - // title: formatMessage('db.man_loc_detl.create_time', '娣诲姞鏃堕棿'), - // dataIndex: 'createTime$', - // width: 140, - // ellipsis: true, - // ...getColumnSearchProps('createTime$'), - // }, - // { - // title: formatMessage('db.man_loc_detl.create_by', '娣诲姞浜哄憳'), - // dataIndex: 'createBy$', - // width: 140, - // ellipsis: true, - // ...getColumnSearchProps('createBy$'), - // }, - { - title: formatMessage('db.man_loc_detl.update_time', '淇敼鏃堕棿'), - dataIndex: 'updateTime$', - width: 140, - ellipsis: true, - ...getColumnSearchProps('updateTime$'), - }, - { - title: formatMessage('db.man_loc_detl.update_by', '淇敼浜哄憳'), - dataIndex: 'updateBy$', - width: 140, - ellipsis: true, - ...getColumnSearchProps('updateBy$'), - }, - { - title: formatMessage('db.man_loc_detl.memo', '澶囨敞'), - dataIndex: 'memo', - width: 140, - ellipsis: true, - ...getColumnSearchProps('memo'), - }, -] - -let fieldList = []; -//鍔犺浇鎵╁睍瀛楁 -async function getColumns() { - let fieldResp = await post('/api/matField/list', { - unique: 1 - }) - let fieldResult = fieldResp.data; - let tmp = state.columns; - if (fieldResult.code == 200) { - let data = fieldResult.data; - data.forEach((item) => { - let filed = { - title: formatMessage(item.language, item.describe), - name: item.name, - dataIndex: item.name, - key: item.name, - width: 140, - editable: true, - ...getColumnSearchProps(item.name), - } - tmp.push(filed) - fieldList.push(filed) - }) - - tmp = tmp.concat(columnsOther) - - tmp.push({ - title: formatMessage('common.operation', '鎿嶄綔'), - name: 'oper', - dataIndex: 'oper', - key: 'oper', - width: 140, - fixed: 'right', - }) - - state.columns = tmp; - } else if (result.code === 401) { - message.error(result.msg); - logout() - } else { - message.error(result.msg); - } -} - -const openSelect = () => { - if (loc.value == null) { - message.error(formatMessage('page.stockAdjust.locDetlListNull', '璇锋绱㈠簱浣�')); - return; - } - - if (loc.value.locSts$ != 'F') { - message.error(formatMessage('page.stockAdjust.locDetlListNull', '褰撳墠搴撲綅鐘舵�佷笉鍙皟鏁�')); - return; - } - - matQueryChild.value.open = true; -} - -const handleMatQueryOk = (result) => { - let tmp = []; - - if (tableData.value != undefined) { - tmp = [...tableData.value] - } - - for (let i = 0; i < result.length; i++) { - let item = result[i] - item.anfme = 0; - item.qty = 0; - item.matId = item.id; - item.id = null; - - fieldList.forEach((filed) => { - item[filed.key] = '' - }) - - tmp.push(item) - } - - tableData.value = tmp; -} - -const handleDel = (record) => { - let data = tableData.value; - let tmp = [] - - for (let i = 0; i < data.length; i++) { - let item = data[i] - if (item.id == record.id) { - continue - } - tmp.push(item) - } - tableData.value = tmp -} - -const loc = ref(null) -const onSearch = () => { - if (searchInput.value == '' || searchInput.value == null) { - message.error(formatMessage('page.stockAdjust.input.loc', '璇峰厛杈撳叆搴撲綅鍙�')); - return; - } - - postForm('/api/loc/search/locNo', { - locNo: searchInput.value, - }).then(resp => { - let result = resp.data; - if (result.code == 200) { - loc.value = result.data.loc; - - let detls = []; - result.data.locDetls.forEach((item) => { - item.qty = item.anfme; - detls.push(item) - }) - tableData.value = detls; - } else { - message.error(result.msg); - loc.value = null; - tableData.value = null; - } - }) -} - -const submitAdj = () => { - Modal.confirm({ - title: formatMessage('page.stockAdjust.adjust', '璋冩暣搴撳瓨'), - content: formatMessage('page.stockAdjust.confirm', '纭畾璋冩暣搴撳瓨鍚楋紵'), - maskClosable: true, - onOk: async () => { - confirmAdj() - }, - }); - -} - -const confirmAdj = () => { - if (loc.value == null) { - message.error(formatMessage('page.stockAdjust.locDetlListNull', '璇锋绱㈠簱浣�')); - return; - } - - if (loc.value.locSts$ != 'F') { - message.error(formatMessage('page.stockAdjust.locDetlListNull', '褰撳墠搴撲綅鐘舵�佷笉鍙皟鏁�')); - return; - } - - let tmpData = tableData.value; - if (tmpData.length == 0) { - message.error(formatMessage('page.stockAdjust.locDetlListNull', '搴撳瓨淇℃伅涓嶈兘涓虹┖')); - return; - } - - post('/api/loc/adjust', { - locNo: loc.value.locNo, - detls: tmpData - }).then(resp => { - let result = resp.data; - if (result.code == 200) { - message.success(formatMessage('page.stockAdjust.success', '搴撳瓨璋冩暣鎴愬姛')); - - loc.value = null; - tableData.value = null; - searchInput.value = null; - } else { - message.error(result.msg); - } - }) -} - -</script> - -<script> -export default { - name: '搴撳瓨璋冩暣' -} -</script> - -<template> - <div> - <div style="margin-bottom: 20px;display: flex;align-items: center;"> - <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '璇疯緭鍏�')" - style="width: 200px;" @search="onSearch" /> - <div v-if="loc" style="margin-left: 20px;font-size: 18px;"> - 褰撳墠妫�绱㈠簱浣�: {{ loc.locNo }} ,搴撲綅鐘舵��: {{ loc.locSts$ }}.{{ loc.locStsId$ }} - </div> - </div> - <div class="table-header"> - <div> - <a-button @click="openSelect">鏂板搴撳瓨</a-button> - <a-button style="margin-left: 5px;" type="primary" @click="submitAdj">璋冩暣搴撳瓨</a-button> - </div> - </div> - <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" - :data-source="tableData" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" - :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="state.columns" - @resizeColumn="handleResizeColumn"> - <template #bodyCell="{ column, text, record }"> - <template v-if="column.dataIndex === 'oper'"> - <div style="display: flex;justify-content: space-evenly;"> - <a-button type="link" danger @click="handleDel(record)">{{ formatMessage('page.delete', '鍒犻櫎') - }}</a-button> - </div> - </template> - - <template v-if="column.dataIndex === 'qty'"> - <div> - <a-input-number v-model:value="record[column.dataIndex]" :min="1" /> - </div> - </template> - - <template v-if="column.dataIndex === 'batch'"> - <div> - <a-input v-model:value="record[column.dataIndex]" /> - </div> - </template> - - <template v-if="column.editable"> - <div> - <a-input v-model:value="record[column.dataIndex]" /> - </div> - </template> - </template> - </a-table> - - <MatQueryView ref="matQueryChild" @handle-ok="handleMatQueryOk" /> - </div> -</template> - -<style></style> +<script setup> +import { ref, reactive } from 'vue'; +import { useRouter } from "vue-router"; +import { get, post, postForm } 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'; +import MatQueryView from '@/components/mat/matQuery/index.vue' + +const router = useRouter(); + +const TABLE_KEY = 'table-locDetl'; +const matQueryChild = ref(null) +const searchInput = ref(null) + +let tableData = ref([]); +getColumns(); + +const { + getColumnSearchProps, + handleResizeColumn, +} = useTableSearch(); + +const state = reactive({ + selectedRowKeys: [], + loading: false, + columns: [], +}); +const onSelectChange = selectedRowKeys => { + // console.log('selectedRowKeys changed: ', selectedRowKeys); + state.selectedRowKeys = selectedRowKeys; +}; + +state.columns = [ + { + title: formatMessage('db.man_loc_detl.qty', '瀹為檯鏁伴噺'), + dataIndex: 'qty', + width: 140, + ellipsis: true, + }, + { + title: formatMessage('db.man_loc_detl.anfme', '搴撳瓨鏁伴噺'), + dataIndex: 'anfme', + width: 140, + ellipsis: true, + }, + { + title: formatMessage('db.man_loc_detl.matnr', '鍟嗗搧缂栧彿'), + dataIndex: 'matnr', + width: 140, + ellipsis: true, + ...getColumnSearchProps('matnr'), + }, + { + title: formatMessage('db.man_loc_detl.batch', '鎵瑰彿'), + dataIndex: 'batch', + width: 140, + ellipsis: true, + ...getColumnSearchProps('batch'), + }, +]; + +let columnsOther = [ + { + title: formatMessage('db.man_loc_detl.loc_id', '搴撲綅'), + dataIndex: 'locId$', + width: 140, + ellipsis: true, + ...getColumnSearchProps('locId$'), + }, + { + title: formatMessage('db.man_loc_detl.loc_no', '搴撲綅鍙�'), + dataIndex: 'locNo', + width: 140, + ellipsis: true, + ...getColumnSearchProps('locNo'), + }, + // { + // title: formatMessage('db.man_loc_detl.mat_id', '鍟嗗搧'), + // dataIndex: 'matId$', + // width: 140, + // ellipsis: true, + // ...getColumnSearchProps('matId$'), + // }, + { + title: formatMessage('db.man_loc_detl.order_no', '璁㈠崟鍙�'), + dataIndex: 'orderNo', + width: 140, + ellipsis: true, + ...getColumnSearchProps('orderNo'), + }, + { + title: formatMessage('db.man_loc_detl.anfme', '鏁伴噺'), + dataIndex: 'anfme', + width: 140, + ellipsis: true, + ...getColumnSearchProps('anfme'), + }, + { + title: formatMessage('db.man_loc_detl.freeze', '鏄惁鍐荤粨'), + dataIndex: 'freeze$', + width: 140, + ellipsis: true, + ...getColumnSearchProps('freeze$'), + }, + { + title: formatMessage('db.man_loc_detl.status', '鐘舵��'), + dataIndex: 'status$', + width: 140, + ellipsis: true, + ...getColumnSearchProps('status$'), + }, + // { + // title: formatMessage('db.man_loc_detl.create_time', '娣诲姞鏃堕棿'), + // dataIndex: 'createTime$', + // width: 140, + // ellipsis: true, + // ...getColumnSearchProps('createTime$'), + // }, + // { + // title: formatMessage('db.man_loc_detl.create_by', '娣诲姞浜哄憳'), + // dataIndex: 'createBy$', + // width: 140, + // ellipsis: true, + // ...getColumnSearchProps('createBy$'), + // }, + { + title: formatMessage('db.man_loc_detl.update_time', '淇敼鏃堕棿'), + dataIndex: 'updateTime$', + width: 140, + ellipsis: true, + ...getColumnSearchProps('updateTime$'), + }, + { + title: formatMessage('db.man_loc_detl.update_by', '淇敼浜哄憳'), + dataIndex: 'updateBy$', + width: 140, + ellipsis: true, + ...getColumnSearchProps('updateBy$'), + }, + { + title: formatMessage('db.man_loc_detl.memo', '澶囨敞'), + dataIndex: 'memo', + width: 140, + ellipsis: true, + ...getColumnSearchProps('memo'), + }, +] + +let fieldList = []; +//鍔犺浇鎵╁睍瀛楁 +async function getColumns() { + let fieldResp = await post('/api/matField/list', { + unique: 1 + }) + let fieldResult = fieldResp.data; + let tmp = state.columns; + if (fieldResult.code == 200) { + let data = fieldResult.data; + data.forEach((item) => { + let filed = { + title: formatMessage(item.language, item.describe), + name: item.name, + dataIndex: item.name, + key: item.name, + width: 140, + editable: true, + ...getColumnSearchProps(item.name), + } + tmp.push(filed) + fieldList.push(filed) + }) + + tmp = tmp.concat(columnsOther) + + tmp.push({ + title: formatMessage('common.operation', '鎿嶄綔'), + name: 'oper', + dataIndex: 'oper', + key: 'oper', + width: 140, + fixed: 'right', + }) + + state.columns = tmp; + } else if (result.code === 401) { + message.error(result.msg); + logout() + } else { + message.error(result.msg); + } +} + +const openSelect = () => { + if (loc.value == null) { + message.error(formatMessage('page.stockAdjust.locDetlListNull', '璇锋绱㈠簱浣�')); + return; + } + + if (loc.value.locSts$ != 'F') { + message.error(formatMessage('page.stockAdjust.locDetlListNull', '褰撳墠搴撲綅鐘舵�佷笉鍙皟鏁�')); + return; + } + + matQueryChild.value.open = true; +} + +const handleMatQueryOk = (result) => { + let tmp = []; + + if (tableData.value != undefined) { + tmp = [...tableData.value] + } + + for (let i = 0; i < result.length; i++) { + let item = result[i] + item.anfme = 0; + item.qty = 0; + item.matId = item.id; + item.id = null; + + fieldList.forEach((filed) => { + item[filed.key] = '' + }) + + tmp.push(item) + } + + tableData.value = tmp; +} + +const handleDel = (record) => { + let data = tableData.value; + let tmp = [] + + for (let i = 0; i < data.length; i++) { + let item = data[i] + if (item.id == record.id) { + continue + } + tmp.push(item) + } + tableData.value = tmp +} + +const loc = ref(null) +const onSearch = () => { + if (searchInput.value == '' || searchInput.value == null) { + message.error(formatMessage('page.stockAdjust.input.loc', '璇峰厛杈撳叆搴撲綅鍙�')); + return; + } + + postForm('/api/loc/search/locNo', { + locNo: searchInput.value, + }).then(resp => { + let result = resp.data; + if (result.code == 200) { + loc.value = result.data.loc; + + let detls = []; + result.data.locDetls.forEach((item) => { + item.qty = item.anfme; + detls.push(item) + }) + tableData.value = detls; + } else { + message.error(result.msg); + loc.value = null; + tableData.value = null; + } + }) +} + +const submitAdj = () => { + Modal.confirm({ + title: formatMessage('page.stockAdjust.adjust', '璋冩暣搴撳瓨'), + content: formatMessage('page.stockAdjust.confirm', '纭畾璋冩暣搴撳瓨鍚楋紵'), + maskClosable: true, + onOk: async () => { + confirmAdj() + }, + }); + +} + +const confirmAdj = () => { + if (loc.value == null) { + message.error(formatMessage('page.stockAdjust.locDetlListNull', '璇锋绱㈠簱浣�')); + return; + } + + if (loc.value.locSts$ != 'F') { + message.error(formatMessage('page.stockAdjust.locDetlListNull', '褰撳墠搴撲綅鐘舵�佷笉鍙皟鏁�')); + return; + } + + let tmpData = tableData.value; + if (tmpData.length == 0) { + message.error(formatMessage('page.stockAdjust.locDetlListNull', '搴撳瓨淇℃伅涓嶈兘涓虹┖')); + return; + } + + post('/api/loc/adjust', { + locNo: loc.value.locNo, + detls: tmpData + }).then(resp => { + let result = resp.data; + if (result.code == 200) { + message.success(formatMessage('page.stockAdjust.success', '搴撳瓨璋冩暣鎴愬姛')); + + loc.value = null; + tableData.value = null; + searchInput.value = null; + } else { + message.error(result.msg); + } + }) +} + +</script> + +<script> +export default { + name: '搴撳瓨璋冩暣' +} +</script> + +<template> + <div> + <div style="margin-bottom: 20px;display: flex;align-items: center;"> + <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '璇疯緭鍏�')" + style="width: 200px;" @search="onSearch" /> + <div v-if="loc" style="margin-left: 20px;font-size: 18px;"> + 褰撳墠妫�绱㈠簱浣�: {{ loc.locNo }} ,搴撲綅鐘舵��: {{ loc.locSts$ }}.{{ loc.locStsId$ }} + </div> + </div> + <div class="table-header"> + <div> + <a-button @click="openSelect">鏂板搴撳瓨</a-button> + <a-button style="margin-left: 5px;" type="primary" @click="submitAdj">璋冩暣搴撳瓨</a-button> + </div> + </div> + <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" + :data-source="tableData" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" + :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="state.columns" + @resizeColumn="handleResizeColumn"> + <template #bodyCell="{ column, text, record }"> + <template v-if="column.dataIndex === 'oper'"> + <div style="display: flex;justify-content: space-evenly;"> + <a-button type="link" danger @click="handleDel(record)">{{ formatMessage('page.delete', '鍒犻櫎') + }}</a-button> + </div> + </template> + + <template v-if="column.dataIndex === 'qty'"> + <div> + <a-input-number v-model:value="record[column.dataIndex]" :min="1" /> + </div> + </template> + + <template v-if="column.dataIndex === 'batch'"> + <div> + <a-input v-model:value="record[column.dataIndex]" /> + </div> + </template> + + <template v-if="column.editable"> + <div> + <a-input v-model:value="record[column.dataIndex]" /> + </div> + </template> + </template> + </a-table> + + <MatQueryView ref="matQueryChild" @handle-ok="handleMatQueryOk" /> + </div> +</template> + +<style></style> -- Gitblit v1.9.1