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/in/waitPakin/edit.vue | 470 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 235 insertions(+), 235 deletions(-) diff --git a/zy-asrs-admin/src/views/in/waitPakin/edit.vue b/zy-asrs-admin/src/views/in/waitPakin/edit.vue index e85cc9d..4115c63 100644 --- a/zy-asrs-admin/src/views/in/waitPakin/edit.vue +++ b/zy-asrs-admin/src/views/in/waitPakin/edit.vue @@ -1,235 +1,235 @@ -<script setup> -import { ref, nextTick, watch } from 'vue'; -import { get, post, postBlob, postForm } from '@/utils/request.js' -import { formatMessage } from '@/utils/localeUtils.js'; -import { message } from 'ant-design-vue'; - -const formTable = ref(null); -const submitButton = ref(null); -const isSave = ref(true); -const open = ref(false); -const initFormData = {} -let formData = ref(initFormData); - -let minAnfme = ref(0); -let maxAnfme = ref(999); - -const emit = defineEmits(['tableReload']) - -const handleOk = (e) => { - nextTick(() => { - setTimeout(() => { - submitButton.value.$el.click(); - }, 100); - }); -}; - -const onFinish = values => { - // console.log('Success:', values); - open.value = false; - post(isSave.value ? '/api/waitPakin/save' : '/api/waitPakin/update', formData.value).then((resp) => { - let result = resp.data; - if (result.code === 200) { - message.success(isSave.value ? formatMessage('page.add.success', '鏂板鎴愬姛') : formatMessage('page.update.success', '鏇存柊鎴愬姛')); - emit('tableReload', 'reload') - } else { - message.error(result.msg); - } - nextTick(() => { - formTable.value.resetFields() - }) - }) -}; -const onFinishFailed = errorInfo => { - console.log('Failed:', errorInfo); -}; - -const orderQueryList = ref(null); -orderQuery(null); -function orderQuery(condition) { - postForm('/api/order/query', { - condition: condition - }).then(resp => { - let result = resp.data; - orderQueryList.value = result.data; - }) -} -const orderDetlQueryList = ref(null); -async function orderDetlQuery(orderId) { - let resp = await get('/api/orderDetl/orderId/' + orderId, {}); - let result = resp.data; - return result; -} - -const userQueryList = ref(null); -userQuery(); -function userQuery() { - postForm('/api/user/query', {}).then(resp => { - let result = resp.data; - userQueryList.value = result.data; - }) -} - -const zpalletBarcodeQueryList = ref([]); -zpalletBarcodeQuery(""); -function zpalletBarcodeQuery(condition) { - postForm('/api/zpalletBarcode/query', { - condition: condition - }).then(resp => { - let result = resp.data; - let tmp = [] - result.data.forEach((item) => { - tmp.push({ - value: item.label - }) - }) - zpalletBarcodeQueryList.value = tmp; - }) -} -const zpalletBarcodeSearch = (e) => { - zpalletBarcodeQuery(e) -} - -const handleSearchChange = (e) => { - orderQuery(e); -} - -const handleSelectChange = async (id) => { - orderQueryList.value.forEach((item) => { - if (item.value == id) { - formData.value.orderNo = item.label; - } - }) - - let result = await orderDetlQuery(id); - let tmp = [] - result.data.forEach((item) => { - let count = item.anfme - item.qty - item.workQty - item.waitQty; - tmp.push({ - value: item.id, - label: item.mat$.matnr + '-' + count, - anfme: count - }) - }) - orderDetlQueryList.value = tmp; -} - -const handleDetlSelectChange = (id) => { - orderDetlQueryList.value.forEach((item) => { - if (item.value == id) { - maxAnfme.value = item.anfme; - } - }) -} - -watch(formData, (newVal, oldVal) => { - if (formData.value.orderId != null) { - handleSelectChange(formData.value.orderId); - } -}) - -defineExpose({ - open, - formData, - initFormData, - isSave, -}) - -</script> - -<script> -export default { - name: '缁勬墭閫氱煡妗�-edit' -} -</script> - -<template> - <div> - <a-modal v-model:open="open" - :title="isSave ? formatMessage('page.add', '娣诲姞') : formatMessage('page.edit', '缂栬緫')" @ok="handleOk" - style="width: 600px;"> - <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" - :wrapper-col="{ span: 16 }" style="display: flex;justify-content: space-between;flex-wrap: wrap;" - autocomplete="off" @finish="onFinish" @finishFailed="onFinishFailed"> - <a-form-item :label="formatMessage('db.man_wait_pakin.order_id', '璁㈠崟')" name="orderId" - style="width: 250px;"> - <a-select v-model:value="formData.orderId" :placeholder="formatMessage('common.select', '璇烽�夋嫨')" - style="width: 100%" show-search :options="orderQueryList" optionFilterProp="label" - optionLabelProp="label" @change="handleSelectChange" @search="handleSearchChange"> - </a-select> - </a-form-item> - <a-form-item :label="formatMessage('db.man_wait_pakin.order_no', '璁㈠崟缂栧彿')" name="orderNo" - style="width: 250px;"> - <a-input v-model:value="formData.orderNo" /> - </a-form-item> - <a-form-item :label="formatMessage('db.man_wait_pakin.anfme', '缁勬墭鏁伴噺')" name="anfme" - style="width: 250px;"> - <a-input-number v-model:value="formData.anfme" :min="minAnfme" :max="maxAnfme" - style="width: 100%;" /> - </a-form-item> - <a-form-item :label="formatMessage('db.man_wait_pakin.barcode', '鎵樼洏鐮�')" name="barcode" - style="width: 250px;"> - <a-auto-complete v-model:value="formData.barcode" :options="zpalletBarcodeQueryList" - @search="zpalletBarcodeSearch" /> - </a-form-item> - <a-form-item :label="formatMessage('db.man_wait_pakin.detl_id', '璁㈠崟鏄庣粏')" name="detlId" - style="width: 250px;"> - <a-select v-model:value="formData.detlId" :placeholder="formatMessage('common.select', '璇烽�夋嫨')" - style="width: 100%" show-search :options="orderDetlQueryList" optionFilterProp="label" - optionLabelProp="label" @change="handleDetlSelectChange"> - </a-select> - </a-form-item> - <a-form-item :label="formatMessage('db.man_wait_pakin.io_status', '缁勬墭鐘舵��')" name="status" - style="width: 250px;"> - <a-select v-model:value="formData.ioStatus" :options="[ - { label: '寰呭叆搴�', value: 0 }, - { label: '鍏ュ簱涓�', value: 1 }, - ]"> - </a-select> - </a-form-item> - <a-form-item :label="formatMessage('db.man_wait_pakin.status', '鐘舵��')" name="status" - style="width: 250px;"> - <a-select v-model:value="formData.status" :options="[ - { label: '姝e父', value: 1 }, - { label: '绂佺敤', value: 0 }, - ]"> - </a-select> - </a-form-item> - <!-- <a-form-item :label="formatMessage('db.man_wait_pakin.create_time', '娣诲姞鏃堕棿')" name="createTime" - style="width: 250px;"> - <a-date-picker v-model:value="formData.createTime" show-time format="YYYY-MM-DD HH:mm:ss" - value-format="YYYY-MM-DD HH:mm:ss" /> - </a-form-item> - <a-form-item :label="formatMessage('db.man_wait_pakin.create_by', '娣诲姞浜哄憳')" name="createBy" - style="width: 250px;"> - <a-select v-model:value="formData.createBy" :placeholder="formatMessage('common.select', '璇烽�夋嫨')" - style="width: 100%" show-search :options="userQueryList" optionFilterProp="label" - optionLabelProp="label"> - </a-select> - </a-form-item> - <a-form-item :label="formatMessage('db.man_wait_pakin.update_time', '淇敼鏃堕棿')" name="updateTime" - style="width: 250px;"> - <a-date-picker v-model:value="formData.updateTime" show-time format="YYYY-MM-DD HH:mm:ss" - value-format="YYYY-MM-DD HH:mm:ss" /> - </a-form-item> - <a-form-item :label="formatMessage('db.man_wait_pakin.update_by', '淇敼浜哄憳')" name="updateBy" - style="width: 250px;"> - <a-select v-model:value="formData.updateBy" :placeholder="formatMessage('common.select', '璇烽�夋嫨')" - style="width: 100%" show-search :options="userQueryList" optionFilterProp="label" - optionLabelProp="label"> - </a-select> - </a-form-item> --> - <a-form-item :label="formatMessage('db.man_wait_pakin.memo', '澶囨敞')" name="memo" style="width: 250px;"> - <a-input v-model:value="formData.memo" /> - </a-form-item> - - <a-form-item> - <a-button type="primary" html-type="submit" ref="submitButton" - style="visibility: hidden;">Submit</a-button> - </a-form-item> - </a-form> - </a-modal> - </div> -</template> - -<style></style> +<script setup> +import { ref, nextTick, watch } from 'vue'; +import { get, post, postBlob, postForm } from '@/utils/request.js' +import { formatMessage } from '@/utils/localeUtils.js'; +import { message } from 'ant-design-vue'; + +const formTable = ref(null); +const submitButton = ref(null); +const isSave = ref(true); +const open = ref(false); +const initFormData = {} +let formData = ref(initFormData); + +let minAnfme = ref(0); +let maxAnfme = ref(999); + +const emit = defineEmits(['tableReload']) + +const handleOk = (e) => { + nextTick(() => { + setTimeout(() => { + submitButton.value.$el.click(); + }, 100); + }); +}; + +const onFinish = values => { + // console.log('Success:', values); + open.value = false; + post(isSave.value ? '/api/waitPakin/save' : '/api/waitPakin/update', formData.value).then((resp) => { + let result = resp.data; + if (result.code === 200) { + message.success(isSave.value ? formatMessage('page.add.success', '鏂板鎴愬姛') : formatMessage('page.update.success', '鏇存柊鎴愬姛')); + emit('tableReload', 'reload') + } else { + message.error(result.msg); + } + nextTick(() => { + formTable.value.resetFields() + }) + }) +}; +const onFinishFailed = errorInfo => { + console.log('Failed:', errorInfo); +}; + +const orderQueryList = ref(null); +orderQuery(null); +function orderQuery(condition) { + postForm('/api/order/query', { + condition: condition + }).then(resp => { + let result = resp.data; + orderQueryList.value = result.data; + }) +} +const orderDetlQueryList = ref(null); +async function orderDetlQuery(orderId) { + let resp = await get('/api/orderDetl/orderId/' + orderId, {}); + let result = resp.data; + return result; +} + +const userQueryList = ref(null); +userQuery(); +function userQuery() { + postForm('/api/user/query', {}).then(resp => { + let result = resp.data; + userQueryList.value = result.data; + }) +} + +const zpalletBarcodeQueryList = ref([]); +zpalletBarcodeQuery(""); +function zpalletBarcodeQuery(condition) { + postForm('/api/zpalletBarcode/query', { + condition: condition + }).then(resp => { + let result = resp.data; + let tmp = [] + result.data.forEach((item) => { + tmp.push({ + value: item.label + }) + }) + zpalletBarcodeQueryList.value = tmp; + }) +} +const zpalletBarcodeSearch = (e) => { + zpalletBarcodeQuery(e) +} + +const handleSearchChange = (e) => { + orderQuery(e); +} + +const handleSelectChange = async (id) => { + orderQueryList.value.forEach((item) => { + if (item.value == id) { + formData.value.orderNo = item.label; + } + }) + + let result = await orderDetlQuery(id); + let tmp = [] + result.data.forEach((item) => { + let count = item.anfme - item.qty - item.workQty - item.waitQty; + tmp.push({ + value: item.id, + label: item.mat$.matnr + '-' + count, + anfme: count + }) + }) + orderDetlQueryList.value = tmp; +} + +const handleDetlSelectChange = (id) => { + orderDetlQueryList.value.forEach((item) => { + if (item.value == id) { + maxAnfme.value = item.anfme; + } + }) +} + +watch(formData, (newVal, oldVal) => { + if (formData.value.orderId != null) { + handleSelectChange(formData.value.orderId); + } +}) + +defineExpose({ + open, + formData, + initFormData, + isSave, +}) + +</script> + +<script> +export default { + name: '缁勬墭閫氱煡妗�-edit' +} +</script> + +<template> + <div> + <a-modal v-model:open="open" + :title="isSave ? formatMessage('page.add', '娣诲姞') : formatMessage('page.edit', '缂栬緫')" @ok="handleOk" + style="width: 600px;"> + <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }" + :wrapper-col="{ span: 16 }" style="display: flex;justify-content: space-between;flex-wrap: wrap;" + autocomplete="off" @finish="onFinish" @finishFailed="onFinishFailed"> + <a-form-item :label="formatMessage('db.man_wait_pakin.order_id', '璁㈠崟')" name="orderId" + style="width: 250px;"> + <a-select v-model:value="formData.orderId" :placeholder="formatMessage('common.select', '璇烽�夋嫨')" + style="width: 100%" show-search :options="orderQueryList" optionFilterProp="label" + optionLabelProp="label" @change="handleSelectChange" @search="handleSearchChange"> + </a-select> + </a-form-item> + <a-form-item :label="formatMessage('db.man_wait_pakin.order_no', '璁㈠崟缂栧彿')" name="orderNo" + style="width: 250px;"> + <a-input v-model:value="formData.orderNo" /> + </a-form-item> + <a-form-item :label="formatMessage('db.man_wait_pakin.anfme', '缁勬墭鏁伴噺')" name="anfme" + style="width: 250px;"> + <a-input-number v-model:value="formData.anfme" :min="minAnfme" :max="maxAnfme" + style="width: 100%;" /> + </a-form-item> + <a-form-item :label="formatMessage('db.man_wait_pakin.barcode', '鎵樼洏鐮�')" name="barcode" + style="width: 250px;"> + <a-auto-complete v-model:value="formData.barcode" :options="zpalletBarcodeQueryList" + @search="zpalletBarcodeSearch" /> + </a-form-item> + <a-form-item :label="formatMessage('db.man_wait_pakin.detl_id', '璁㈠崟鏄庣粏')" name="detlId" + style="width: 250px;"> + <a-select v-model:value="formData.detlId" :placeholder="formatMessage('common.select', '璇烽�夋嫨')" + style="width: 100%" show-search :options="orderDetlQueryList" optionFilterProp="label" + optionLabelProp="label" @change="handleDetlSelectChange"> + </a-select> + </a-form-item> + <a-form-item :label="formatMessage('db.man_wait_pakin.io_status', '缁勬墭鐘舵��')" name="status" + style="width: 250px;"> + <a-select v-model:value="formData.ioStatus" :options="[ + { label: '寰呭叆搴�', value: 0 }, + { label: '鍏ュ簱涓�', value: 1 }, + ]"> + </a-select> + </a-form-item> + <a-form-item :label="formatMessage('db.man_wait_pakin.status', '鐘舵��')" name="status" + style="width: 250px;"> + <a-select v-model:value="formData.status" :options="[ + { label: '姝e父', value: 1 }, + { label: '绂佺敤', value: 0 }, + ]"> + </a-select> + </a-form-item> + <!-- <a-form-item :label="formatMessage('db.man_wait_pakin.create_time', '娣诲姞鏃堕棿')" name="createTime" + style="width: 250px;"> + <a-date-picker v-model:value="formData.createTime" show-time format="YYYY-MM-DD HH:mm:ss" + value-format="YYYY-MM-DD HH:mm:ss" /> + </a-form-item> + <a-form-item :label="formatMessage('db.man_wait_pakin.create_by', '娣诲姞浜哄憳')" name="createBy" + style="width: 250px;"> + <a-select v-model:value="formData.createBy" :placeholder="formatMessage('common.select', '璇烽�夋嫨')" + style="width: 100%" show-search :options="userQueryList" optionFilterProp="label" + optionLabelProp="label"> + </a-select> + </a-form-item> + <a-form-item :label="formatMessage('db.man_wait_pakin.update_time', '淇敼鏃堕棿')" name="updateTime" + style="width: 250px;"> + <a-date-picker v-model:value="formData.updateTime" show-time format="YYYY-MM-DD HH:mm:ss" + value-format="YYYY-MM-DD HH:mm:ss" /> + </a-form-item> + <a-form-item :label="formatMessage('db.man_wait_pakin.update_by', '淇敼浜哄憳')" name="updateBy" + style="width: 250px;"> + <a-select v-model:value="formData.updateBy" :placeholder="formatMessage('common.select', '璇烽�夋嫨')" + style="width: 100%" show-search :options="userQueryList" optionFilterProp="label" + optionLabelProp="label"> + </a-select> + </a-form-item> --> + <a-form-item :label="formatMessage('db.man_wait_pakin.memo', '澶囨敞')" name="memo" style="width: 250px;"> + <a-input v-model:value="formData.memo" /> + </a-form-item> + + <a-form-item> + <a-button type="primary" html-type="submit" ref="submitButton" + style="visibility: hidden;">Submit</a-button> + </a-form-item> + </a-form> + </a-modal> + </div> +</template> + +<style></style> -- Gitblit v1.9.1