From 3aedad63dd01f1fc5154cb520af32edab967d6e0 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周一, 12 5月 2025 09:15:26 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo
---
PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Controllers/WorkPlanQueryDrawer.tsx | 646 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 646 insertions(+), 0 deletions(-)
diff --git a/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Controllers/WorkPlanQueryDrawer.tsx b/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Controllers/WorkPlanQueryDrawer.tsx
new file mode 100644
index 0000000..99cc7c7
--- /dev/null
+++ b/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Controllers/WorkPlanQueryDrawer.tsx
@@ -0,0 +1,646 @@
+import {
+ ref,
+ onMounted,
+ reactive,
+ computed,
+ Ref,
+ watch,
+ SetupContext,
+ h,
+} from 'vue'
+import { injectModel } from '@/libs/Provider/Provider'
+import { WorkPlanDrawer } from '../Models/WorkPlanDrawer'
+import { ElMessage } from 'element-plus'
+import isEqual from 'lodash/isEqual'
+import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox'
+import { cloneDeep } from 'lodash'
+
+export const useWorkPlanQueryDrawer = (props: any, ctx?: any) => {
+ const workPlanDrawer = injectModel<WorkPlanDrawer>('WorkPlanDrawer')
+ /**
+ * 鐢ㄦ潵瀵规瘮鐨勫垵濮嬪寲鏁版嵁
+ */
+ 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 datePickerRange = (attrs) => {
+ return (
+ <el-date-picker
+ type="daterange"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ {...attrs}
+ ></el-date-picker>
+ )
+ }
+
+ const dateTimePickerRange = (attrs) => {
+ return (
+ <el-date-picker
+ type="datetimerange"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ {...attrs}
+ ></el-date-picker>
+ )
+ }
+
+ const visible = computed({
+ get() {
+ return props.modelValue
+ },
+ set(val) {
+ ctx.emit('update:modelValue', val)
+ },
+ })
+ /**
+ * 楂樼骇鏌ヨ鐨刦orm瀛楁
+ */
+ const formItems = reactive([
+ {
+ label: '浠诲姟缂栫爜',
+ prop: 'taskCode',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヤ换鍔$紪鐮�',
+ },
+ {
+ label: '璁″垝鐘舵��',
+ prop: 'workPlanStatus',
+ el: 'select',
+ clearable:true,
+ option: [],
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヨ鍒掔姸鎬�',
+ },
+ {
+ label: '鍙枡鐘舵��',
+ prop: 'callMaterialStatus',
+ el: 'select',
+ clearable:true,
+ option: [],
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ彨鏂欑姸鎬�',
+ },
+ {
+ label: '鍘熸枡鏍囪瘑',
+ prop: 'dataIdentifier',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ師鏂欐爣璇�',
+ },
+ {
+ label: '鍘熸枡鍨嬪彿',
+ prop: 'materialMode',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ師鏂欏瀷鍙�',
+ },
+ {
+ label: '闀垮害(mm)',
+ prop: 'length',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 0.01,
+ precision: 2,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ラ暱搴�(mm)',
+ },
+ {
+ label: '鎵撶爜鍐呭',
+ prop: 'markingContent',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ墦鐮佸唴瀹�',
+ },
+ {
+ label: '鎵撶爜浣嶇疆',
+ prop: 'markingPosition',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 0.01,
+ precision: 2,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ墦鐮佷綅缃�',
+ },
+ {
+ label: '鍒囧壊浣嶇疆',
+ prop: 'cuttingPosition',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 0.01,
+ precision: 2,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ垏鍓蹭綅缃�',
+ },
+ {
+ label: '绠℃鏁伴噺',
+ prop: 'quantity',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 1,
+ precision: 0,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ョ娈垫暟閲�',
+ },
+ {
+ label: '娉曞叞鍘氬害(mm)',
+ prop: 'flangeThickness',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 0.01,
+ precision: 2,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ硶鍏板帤搴�(mm)',
+ },
+ {
+ label: '娉曞叞鐩村緞(mm)',
+ prop: 'flangeInnerDiameter',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 0.01,
+ precision: 2,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ硶鍏扮洿寰�(mm)',
+ },
+ {
+ label: '娉曞叞鍏О鍘嬪姏',
+ prop: 'weldingHeatInput',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ硶鍏板叕绉板帇鍔�',
+ },
+ {
+ label: '娉曞叞鍐茬爜鍐呭',
+ prop: 'pipeAllowableStress',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ硶鍏板啿鐮佸唴瀹�',
+ },
+ {
+ label: '濂楃闀垮害(mm)',
+ prop: 'pipeDiameter',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 0.01,
+ precision: 2,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ绠¢暱搴�(mm)',
+ },
+ {
+ label: '濂楃鐩村緞(mm)',
+ prop: 'pipeWallThickness',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 0.01,
+ precision: 2,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ绠$洿寰�(mm)',
+ },
+ {
+ label: '宸ュ巶浠g爜',
+ prop: 'factoryCode',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ伐鍘備唬鐮�',
+ },
+ {
+ label: '浜у搧浠g爜',
+ prop: 'productCode',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヤ骇鍝佷唬鐮�',
+ },
+ {
+ label: '宸ヤ綅浠g爜',
+ prop: 'workstationCode',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ伐浣嶄唬鐮�',
+ },
+ {
+ label: '璁惧浠g爜',
+ prop: 'equipmentCode',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヨ澶囦唬鐮�',
+ },
+ {
+ label: '宸ヤ欢鍚嶇О',
+ prop: 'workpieceName',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ伐浠跺悕绉�',
+ },
+ {
+ label: '宸ュ簭鍚嶇О',
+ prop: 'processName',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ伐搴忓悕绉�',
+ },
+ {
+ label: '绠′欢缂栫爜',
+ prop: 'pipeFittingCode',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ョ浠剁紪鐮�',
+ },
+ {
+ label: '椤哄簭鍙�',
+ prop: 'preSerialNumber',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ラ『搴忓彿',
+ },
+ {
+ label: '绠℃缂栫爜',
+ prop: 'pipeSpecCode',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ョ娈电紪鐮�',
+ },
+ {
+ label: '绠℃鍚嶇О',
+ prop: 'pipeSectionName',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ョ娈靛悕绉�',
+ },
+ {
+ label: '澶栧緞(mm)',
+ prop: 'outerDiameter',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 0.01,
+ precision: 2,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ寰�(mm)',
+ },
+ {
+ label: '澹佸帤(mm)',
+ prop: 'thickness',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(inputNumber, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ step: 0.01,
+ precision: 2,
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ鍘�(mm)',
+ },
+ {
+ label: '鏉愯川',
+ prop: 'material',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ潗璐�',
+ },
+ {
+ label: '宸ヨ壓娴佸悜缂栧彿',
+ prop: 'processRouteNumber',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ伐鑹烘祦鍚戠紪鍙�',
+ },
+ {
+ label: '璁″垝寮�濮嬫椂闂�',
+ prop: 'plannedStartTime',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(dateTimePickerRange, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヨ鍒掑紑濮嬫椂闂�',
+ },
+ {
+ label: '璁″垝瀹屾垚鏃堕棿',
+ prop: 'plannedEndTime',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(dateTimePickerRange, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヨ鍒掑畬鎴愭椂闂�',
+ },
+ {
+ label: '鐝粍淇℃伅',
+ prop: 'teamInfo',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ョ彮缁勪俊鎭�',
+ },
+ {
+ label: '鏃堕棿鎴�',
+ prop: 'timestamp',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ユ椂闂存埑',
+ },
+ {
+ label: '鍒涘缓鏃堕棿',
+ prop: 'creationTime',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(dateTimePickerRange, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ垱寤烘椂闂�',
+ },
+ {
+ label: '淇敼鏃堕棿',
+ prop: 'lastModificationTime',
+ el: (props: any, { attrs }: SetupContext) => {
+ return h(dateTimePickerRange, {
+ ...props,
+ clearable: true,
+ ...attrs,
+ })
+ },
+ width: '100%',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヤ慨鏀规椂闂�',
+ },
+ {
+ label: '鍒涘缓浜�',
+ prop: 'creatorName',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ垱寤轰汉',
+ },
+ {
+ label: '淇敼浜�',
+ prop: 'lastModifierName',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ヤ慨鏀逛汉',
+ },
+ {
+ label: '澶囨敞',
+ prop: 'remark',
+ el: 'input',
+ //disabled: disabled,
+ placeholder: '璇疯緭鍏ュ娉�',
+ },
+ ])
+ /**
+ * 鏍¢獙鏄惁鏈夋暟鎹彉鍖�
+ */
+ const checkIsEqualObject = () => {
+ const data = {
+ formData: formData.value,
+ }
+ const check = isEqual(initiateData.value, data)
+ return check
+ }
+ const commonGetFormData=()=>{
+ const data = {
+ taskCode: formData.value.taskCode || '',
+workPlanStatus: formData.value.workPlanStatus || '',
+callMaterialStatus: formData.value.callMaterialStatus || '',
+dataIdentifier: formData.value.dataIdentifier || '',
+materialMode: formData.value.materialMode || '',
+length: formData.value.length || '',
+markingContent: formData.value.markingContent || '',
+markingPosition: formData.value.markingPosition || '',
+cuttingPosition: formData.value.cuttingPosition || '',
+quantity: formData.value.quantity || '',
+flangeThickness: formData.value.flangeThickness || '',
+flangeInnerDiameter: formData.value.flangeInnerDiameter || '',
+weldingHeatInput: formData.value.weldingHeatInput || '',
+pipeAllowableStress: formData.value.pipeAllowableStress || '',
+pipeDiameter: formData.value.pipeDiameter || '',
+pipeWallThickness: formData.value.pipeWallThickness || '',
+factoryCode: formData.value.factoryCode || '',
+productCode: formData.value.productCode || '',
+workstationCode: formData.value.workstationCode || '',
+equipmentCode: formData.value.equipmentCode || '',
+workpieceName: formData.value.workpieceName || '',
+processName: formData.value.processName || '',
+pipeFittingCode: formData.value.pipeFittingCode || '',
+preSerialNumber: formData.value.preSerialNumber || '',
+pipeSpecCode: formData.value.pipeSpecCode || '',
+pipeSectionName: formData.value.pipeSectionName || '',
+outerDiameter: formData.value.outerDiameter || '',
+thickness: formData.value.thickness || '',
+material: formData.value.material || '',
+processRouteNumber: formData.value.processRouteNumber || '',
+plannedStartTime: formData.value.plannedStartTime || '',
+plannedEndTime: formData.value.plannedEndTime || '',
+teamInfo: formData.value.teamInfo || '',
+timestamp: formData.value.timestamp || '',
+creationTime: formData.value.creationTime || '',
+lastModificationTime: formData.value.lastModificationTime || '',
+creatorName: formData.value.creatorName || '',
+lastModifierName: formData.value.lastModifierName || '',
+remark: formData.value.remark || '',
+ }
+ return data;
+ }
+ const onClose = (done: () => void) => {
+ if (visible.value) {
+ visible.value = false
+ const data =commonGetFormData();
+ ctx.emit('close', data)
+ }
+ }
+ /**
+ * 纭鏌ヨ
+ */
+ const onConfirmQuery = async () => {
+ const data =commonGetFormData();
+ ctx.emit('confirmQuery', data)
+ }
+ /**
+ * 閲嶇疆鏌ヨ
+ */
+ const onReset = async () => {
+ formData.value = {}
+ formData.value.taskCode = ''
+formData.value.workPlanStatus = ''
+formData.value.callMaterialStatus = ''
+formData.value.dataIdentifier = ''
+formData.value.materialMode = ''
+formData.value.length = ''
+formData.value.markingContent = ''
+formData.value.markingPosition = ''
+formData.value.cuttingPosition = ''
+formData.value.quantity = ''
+formData.value.flangeThickness = ''
+formData.value.flangeInnerDiameter = ''
+formData.value.weldingHeatInput = ''
+formData.value.pipeAllowableStress = ''
+formData.value.pipeDiameter = ''
+formData.value.pipeWallThickness = ''
+formData.value.factoryCode = ''
+formData.value.productCode = ''
+formData.value.workstationCode = ''
+formData.value.equipmentCode = ''
+formData.value.workpieceName = ''
+formData.value.processName = ''
+formData.value.pipeFittingCode = ''
+formData.value.preSerialNumber = ''
+formData.value.pipeSpecCode = ''
+formData.value.pipeSectionName = ''
+formData.value.outerDiameter = ''
+formData.value.thickness = ''
+formData.value.material = ''
+formData.value.processRouteNumber = ''
+formData.value.plannedStartTime = ''
+formData.value.plannedEndTime = ''
+formData.value.teamInfo = ''
+formData.value.timestamp = ''
+formData.value.deletionTime = ''
+formData.value.operationRemark = ''
+formData.value.deleteRemark = ''
+formData.value.remark = ''
+formData.value.extraField1 = ''
+formData.value.extraField2 = ''
+formData.value.extraField3 = ''
+ //鍚戠埗缁勪欢鍙戦�佽嚜瀹氫箟浜嬩欢
+ ctx.emit('restQuery');
+ }
+
+ 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 workPlanStatusEnumEnum = await workPlanDrawer.getWmsEnumData({
+ EnumName: 'WorkPlanStatusEnum',
+})
+updateFormItemOptions('workPlanStatus', workPlanStatusEnumEnum)
+const callMaterialStatusEnumEnum = await workPlanDrawer.getWmsEnumData({
+ EnumName: 'CallMaterialStatusEnum',
+})
+updateFormItemOptions('callMaterialStatus', callMaterialStatusEnumEnum)
+
+ }
+ commonQueryEnumForFrom()
+ /**
+ * 寮圭獥鎵撳紑鑾峰彇璇︽儏
+ */
+ const onOpen = async () => {
+ disabled.value = false
+ updateCheckData()
+ }
+
+ watch(() => current.value, onOpen)
+
+ return {
+ formItems,
+ formData,
+ visible,
+ formRef,
+ onOpen,
+ onClose,
+ onConfirmQuery,
+ onReset,
+ }
+}
--
Gitblit v1.9.3