From f73d8786777c7ebcf53a93bf46c2268892a28502 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 07 5月 2025 09:14:40 +0800
Subject: [PATCH] 调整项目位置
---
HIAWms/web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecordDrawer.tsx | 553 +++++++++++++++++++++++++++---------------------------
1 files changed, 278 insertions(+), 275 deletions(-)
diff --git a/HIAWms/web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecordDrawer.tsx b/HIAWms/web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecordDrawer.tsx
index 4e6176f..275c9ad 100644
--- a/HIAWms/web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecordDrawer.tsx
+++ b/HIAWms/web/src/widgets/WmsInOutStockRecord/Controllers/WmsInOutStockRecordDrawer.tsx
@@ -1,275 +1,278 @@
-import {
- ref,
- onMounted,
- reactive,
- computed,
- Ref,
- watch,
- SetupContext,
- h,
-} from 'vue'
-import { injectModel } from '@/libs/Provider/Provider'
-import { WmsInOutStockRecordDrawer } from '../Models/WmsInOutStockRecordDrawer'
-import { ElMessage } from 'element-plus'
-import isEqual from 'lodash/isEqual'
-import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox'
-import { cloneDeep } from 'lodash'
-
-export const useWmsInOutStockRecordDrawer = (props: any, ctx?: any) => {
- const wmsInOutStockRecordDrawer = injectModel<WmsInOutStockRecordDrawer>('wmsInOutStockRecordDrawer')
- /**
- * 鐢ㄦ潵瀵规瘮鐨勫垵濮嬪寲鏁版嵁
- */
- const initiateData: Ref<Record<string, any>> = ref({})
- const formData = ref<Record<string, any>>({})
- // ref
- const formRef = ref()
-
- const disabled = ref(false)
-
- const current = computed(() => {
- return props.row || null
- })
-
- const inputNumber = (attrs) => {
- return (
- <el-input-number
- min="1"
- step="1"
- precision="0"
- {...attrs}
- ></el-input-number>
- )
- }
-
- const visible = computed({
- get() {
- return props.modelValue
- },
- set(val) {
- ctx.emit('update:modelValue', val)
- },
- })
- /**
- * 娣诲姞鐨刦orm瀛楁
- */
- const formItems = reactive([
- {
- label: '鍗曟嵁缂栧彿',
- prop: 'orderNo',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ュ崟鎹紪鍙�',
- rules: [{required: true, message: '鍗曟嵁缂栧彿涓嶈兘涓虹┖', trigger: 'blur' }],
- },
- {
- label: '鐗╂枡鍚嶇О',
- prop: 'materialName',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ョ墿鏂欏悕绉�',
- },
- {
- label: '鐗╂枡浠跺彿',
- prop: 'materialNo',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ョ墿鏂欎欢鍙�',
- rules: [{required: true, message: '鐗╂枡浠跺彿涓嶈兘涓虹┖', trigger: 'blur' }],
- },
- {
- label: '鎿嶄綔绫诲瀷',
- prop: 'stockType',
- el: 'select',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ユ搷浣滅被鍨�',
- rules: [{required: true, message: '鎿嶄綔绫诲瀷涓嶈兘涓虹┖', trigger: 'blur' }],
- },
- {
- label: '瀹瑰櫒缂栧彿',
- prop: 'containerNo',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ュ鍣ㄧ紪鍙�',
- },
- {
- label: '鏈哄瀷',
- prop: 'materialModel',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ユ満鍨�',
- },
- {
- label: '鎿嶄綔鏃堕棿',
- prop: 'operateTime',
- type: 'datetimerange',
- el: 'date-picker',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ユ搷浣滄椂闂�',
- },
- {
- label: '澶囨敞',
- prop: 'remark',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ュ娉�',
- },
- {
- label: '鐗╂枡ID',
- prop: 'materialId',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ョ墿鏂橧D',
- rules: [{required: true, message: '鐗╂枡ID涓嶈兘涓虹┖', trigger: 'blur' }],
- },
- {
- label: '浠诲姟鍙�',
- prop: 'taskNo',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ヤ换鍔″彿',
- rules: [{required: true, message: '浠诲姟鍙蜂笉鑳戒负绌�', trigger: 'blur' }],
- },
- {
- label: '璧峰搴撲綅',
- prop: 'sourcePlace',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ヨ捣濮嬪簱浣�',
- },
- {
- label: '鐩爣搴撲綅',
- prop: 'toPlace',
- el: 'input',
- //disabled: disabled,
- placeholder: '璇疯緭鍏ョ洰鏍囧簱浣�',
- },
- ])
- /**
- * 鏍¢獙鏄惁鏈夋暟鎹彉鍖�
- */
- const checkIsEqualObject = () => {
- const data = {
- formData: formData.value,
- }
- const check = isEqual(initiateData.value, data)
- return check
- }
-
- const onClose = (done: () => void) => {
- if (visible.value) {
- if (checkIsEqualObject()) {
- visible.value = false
- done && done()
- } else {
- ConfirmBox('鏄惁淇濆瓨璁剧疆锛�')
- .then(() => {
- onConfirm()
- })
- .catch(() => {
- visible.value = false
- done && done()
- })
- }
- }
- }
- /**
- * 淇濆瓨
- */
- const onConfirm = async () => {
- await formRef.value?.validate()
- const data = {
- orderNo: formData.value.orderNo,
-materialName: formData.value.materialName,
-materialNo: formData.value.materialNo,
-stockType: formData.value.stockType,
-containerNo: formData.value.containerNo,
-materialModel: formData.value.materialModel,
-operateTime: formData.value.operateTime,
-remark: formData.value.remark,
-materialId: formData.value.materialId,
-taskNo: formData.value.taskNo,
-sourcePlace: formData.value.sourcePlace,
-toPlace: formData.value.toPlace,
- }
- if (!current.value) {
- await wmsInOutStockRecordDrawer.addWmsInOutStockRecord(data)
- } else {
- const id = current.value.id
- await wmsInOutStockRecordDrawer.updateWmsInOutStockRecord(id, data)
- }
- ElMessage.success('淇濆瓨鎴愬姛')
- ctx.emit('confirm')
- }
-
- const updateCheckData = () => {
- initiateData.value = {
- formData: {
- ...formData.value,
- },
- }
- }
- const updateFormItemOptions = (propName: string, enumData: any[]) => {
- const item = formItems.find((item) => item.prop === propName)
- if (item && enumData) {
- item.options = enumData.map((item) => ({
- label: item.description,
- value: item.value,
- }))
- }
- }
- /**
- * 閫氱敤鏌ヨ鏋氫妇
- */
- const commonQueryEnumForFrom = async () => {
- const stockTypeEnumEnum = await wmsInOutStockRecordDrawer.getWmsEnumData({
- EnumName: 'StockTypeEnum',
-})
-updateFormItemOptions('stockType', stockTypeEnumEnum)
-
- }
- commonQueryEnumForFrom()
- /**
- * 寮圭獥鎵撳紑鑾峰彇璇︽儏
- */
- const onOpen = async () => {
- if (current.value) {
- const res = await wmsInOutStockRecordDrawer.getWmsInOutStockRecordDetail(current.value)
-
- formData.value = {
- orderNo: res.orderNo,
-materialName: res.materialName,
-materialNo: res.materialNo,
-stockType: res.stockType,
-containerNo: res.containerNo,
-materialModel: res.materialModel,
-operateTime: res.operateTime,
-remark: res.remark,
-materialId: res.materialId,
-taskNo: res.taskNo,
-sourcePlace: res.sourcePlace,
-toPlace: res.toPlace,
- id: res.id,
- }
- disabled.value = true
- updateCheckData()
- } else {
- formData.value = {}
-
- disabled.value = false
- updateCheckData()
- }
- }
-
- watch(() => current.value, onOpen)
-
- return {
- formItems,
- formData,
- visible,
- formRef,
- onOpen,
- onClose,
- onConfirm,
- }
-}
+import {
+ ref,
+ onMounted,
+ reactive,
+ computed,
+ Ref,
+ watch,
+ SetupContext,
+ h,
+} from 'vue'
+import { injectModel } from '@/libs/Provider/Provider'
+import { WmsInOutStockRecordDrawer } from '../Models/WmsInOutStockRecordDrawer'
+import { ElMessage } from 'element-plus'
+import isEqual from 'lodash/isEqual'
+import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox'
+import { cloneDeep } from 'lodash'
+
+export const useWmsInOutStockRecordDrawer = (props: any, ctx?: any) => {
+ const wmsInOutStockRecordDrawer = injectModel<WmsInOutStockRecordDrawer>(
+ 'wmsInOutStockRecordDrawer'
+ )
+ /**
+ * 鐢ㄦ潵瀵规瘮鐨勫垵濮嬪寲鏁版嵁
+ */
+ const initiateData: Ref<Record<string, any>> = ref({})
+ const formData = ref<Record<string, any>>({})
+ // ref
+ const formRef = ref()
+
+ const disabled = ref(false)
+
+ const current = computed(() => {
+ return props.row || null
+ })
+
+ const inputNumber = (attrs) => {
+ return (
+ <el-input-number
+ min="1"
+ step="1"
+ precision="0"
+ {...attrs}
+ ></el-input-number>
+ )
+ }
+
+ const visible = computed({
+ get() {
+ return props.modelValue
+ },
+ set(val) {
+ ctx.emit('update:modelValue', val)
+ },
+ })
+ /**
+ * 娣诲姞鐨刦orm瀛楁
+ */
+ const formItems = reactive([
+ {
+ label: '鍗曟嵁缂栧彿',
+ prop: 'orderNo',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ崟鎹紪鍙�',
+ rules: [{ required: true, message: '鍗曟嵁缂栧彿涓嶈兘涓虹┖', trigger: 'blur' }],
+ },
+ {
+ label: '鐗╂枡鍚嶇О',
+ prop: 'materialName',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ョ墿鏂欏悕绉�',
+ },
+ {
+ label: '鐗╂枡浠跺彿',
+ prop: 'materialNo',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ョ墿鏂欎欢鍙�',
+ rules: [{ required: true, message: '鐗╂枡浠跺彿涓嶈兘涓虹┖', trigger: 'blur' }],
+ },
+ {
+ label: '鎿嶄綔绫诲瀷',
+ prop: 'stockType',
+ el: 'select',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ搷浣滅被鍨�',
+ rules: [{ required: true, message: '鎿嶄綔绫诲瀷涓嶈兘涓虹┖', trigger: 'blur' }],
+ },
+ {
+ label: '瀹瑰櫒缂栧彿',
+ prop: 'containerNo',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ鍣ㄧ紪鍙�',
+ },
+ {
+ label: '鏈哄瀷',
+ prop: 'materialModel',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ満鍨�',
+ },
+ {
+ label: '鎿嶄綔鏃堕棿',
+ prop: 'operateTime',
+ type: 'datetimerange',
+ el: 'date-picker',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ搷浣滄椂闂�',
+ },
+ {
+ label: '澶囨敞',
+ prop: 'remark',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ娉�',
+ },
+ {
+ label: '鐗╂枡ID',
+ prop: 'materialId',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ョ墿鏂橧D',
+ rules: [{ required: true, message: '鐗╂枡ID涓嶈兘涓虹┖', trigger: 'blur' }],
+ },
+ {
+ label: '浠诲姟鍙�',
+ prop: 'taskNo',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヤ换鍔″彿',
+ rules: [{ required: true, message: '浠诲姟鍙蜂笉鑳戒负绌�', trigger: 'blur' }],
+ },
+ {
+ label: '璧峰搴撲綅',
+ prop: 'sourcePlace',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヨ捣濮嬪簱浣�',
+ },
+ {
+ label: '鐩爣搴撲綅',
+ prop: 'toPlace',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ョ洰鏍囧簱浣�',
+ },
+ ])
+ /**
+ * 鏍¢獙鏄惁鏈夋暟鎹彉鍖�
+ */
+ const checkIsEqualObject = () => {
+ const data = {
+ formData: formData.value,
+ }
+ const check = isEqual(initiateData.value, data)
+ return check
+ }
+
+ const onClose = (done: () => void) => {
+ if (visible.value) {
+ if (checkIsEqualObject()) {
+ visible.value = false
+ done && done()
+ } else {
+ ConfirmBox('鏄惁淇濆瓨璁剧疆锛�')
+ .then(() => {
+ onConfirm()
+ })
+ .catch(() => {
+ visible.value = false
+ done && done()
+ })
+ }
+ }
+ }
+ /**
+ * 淇濆瓨
+ */
+ const onConfirm = async () => {
+ await formRef.value?.validate()
+ const data = {
+ orderNo: formData.value.orderNo,
+ materialName: formData.value.materialName,
+ materialNo: formData.value.materialNo,
+ stockType: formData.value.stockType,
+ containerNo: formData.value.containerNo,
+ materialModel: formData.value.materialModel,
+ operateTime: formData.value.operateTime,
+ remark: formData.value.remark,
+ materialId: formData.value.materialId,
+ taskNo: formData.value.taskNo,
+ sourcePlace: formData.value.sourcePlace,
+ toPlace: formData.value.toPlace,
+ }
+ if (!current.value) {
+ await wmsInOutStockRecordDrawer.addWmsInOutStockRecord(data)
+ } else {
+ const id = current.value.id
+ await wmsInOutStockRecordDrawer.updateWmsInOutStockRecord(id, data)
+ }
+ ElMessage.success('淇濆瓨鎴愬姛')
+ ctx.emit('confirm')
+ }
+
+ const updateCheckData = () => {
+ initiateData.value = {
+ formData: {
+ ...formData.value,
+ },
+ }
+ }
+ const updateFormItemOptions = (propName: string, enumData: any[]) => {
+ const item = formItems.find((item) => item.prop === propName)
+ if (item && enumData) {
+ item.options = enumData.map((item) => ({
+ label: item.description,
+ value: item.value,
+ }))
+ }
+ }
+ /**
+ * 閫氱敤鏌ヨ鏋氫妇
+ */
+ const commonQueryEnumForFrom = async () => {
+ const stockTypeEnumEnum = await wmsInOutStockRecordDrawer.getWmsEnumData({
+ EnumName: 'StockTypeEnum',
+ })
+ updateFormItemOptions('stockType', stockTypeEnumEnum)
+ }
+ commonQueryEnumForFrom()
+ /**
+ * 寮圭獥鎵撳紑鑾峰彇璇︽儏
+ */
+ const onOpen = async () => {
+ if (current.value) {
+ const res = await wmsInOutStockRecordDrawer.getWmsInOutStockRecordDetail(
+ current.value
+ )
+
+ formData.value = {
+ orderNo: res.orderNo,
+ materialName: res.materialName,
+ materialNo: res.materialNo,
+ stockType: res.stockType,
+ containerNo: res.containerNo,
+ materialModel: res.materialModel,
+ operateTime: res.operateTime,
+ remark: res.remark,
+ materialId: res.materialId,
+ taskNo: res.taskNo,
+ sourcePlace: res.sourcePlace,
+ toPlace: res.toPlace,
+ id: res.id,
+ }
+ disabled.value = true
+ updateCheckData()
+ } else {
+ formData.value = {}
+
+ disabled.value = false
+ updateCheckData()
+ }
+ }
+
+ watch(() => current.value, onOpen)
+
+ return {
+ formItems,
+ formData,
+ visible,
+ formRef,
+ onOpen,
+ onClose,
+ onConfirm,
+ }
+}
--
Gitblit v1.9.3