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/OrderManagement-main/dialog/orderDialog/index.vue |  201 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 201 insertions(+), 0 deletions(-)

diff --git a/PipeLineLems/pipelinelems_web/src/widgets/OrderManagement-main/dialog/orderDialog/index.vue b/PipeLineLems/pipelinelems_web/src/widgets/OrderManagement-main/dialog/orderDialog/index.vue
new file mode 100644
index 0000000..0718d57
--- /dev/null
+++ b/PipeLineLems/pipelinelems_web/src/widgets/OrderManagement-main/dialog/orderDialog/index.vue
@@ -0,0 +1,201 @@
+<template>
+  <BaseDialog
+    :title="_t(dialogConfig.title)"
+    v-model="visible"
+    width="50%"
+    destroy-on-close
+    @open="onOpen"
+    @close="onClose"
+    @confirm="onConfirm"
+  >
+    <div class="table-body">
+      <div class="table-header">
+        <el-select
+          :placeholder="_t('璇烽�夋嫨')"
+          clearable
+          style="width: 180px"
+          v-if="type === TYPE_MAP.BOM"
+          v-model="importSelected"
+        >
+          <el-option :label="_t('閲嶈')" value="Y"></el-option>
+          <el-option :label="_t('闈為噸瑕�')" value="N"></el-option>
+        </el-select>
+        <el-input
+          :placeholder="_t('鎼滅储')"
+          clearable
+          style="width: 180px; margin: 0 10px"
+          v-model="searchValue"
+        ></el-input>
+        <el-button @click="onSearch" type="info">{{ _t('鏌ヨ') }}</el-button>
+      </div>
+      <div class="table-content">
+        <Table
+          ref="productRef"
+          :dataSource="dataSource"
+          :columns="dialogConfig.columns"
+          :total="dialogConfig.total"
+          :pageSize="MaxResultCount"
+          @page="onPageChange"
+        />
+      </div>
+    </div>
+    <template #custom-btn>
+      <el-button class="update" size="small" type="info" @click="onUpdate">{{
+        _t('鏇存柊')
+      }}</el-button>
+    </template>
+  </BaseDialog>
+</template>
+<script lang="ts" setup>
+import { ref, computed, reactive } from 'vue'
+import Table from '@/components/Table/index.vue'
+import {
+  getBomList,
+  getLotList,
+  getProcessList,
+  updateProcess,
+  updateBom,
+  updateLot,
+} from '../../api/process'
+import { ElMessage } from 'element-plus'
+import { _t } from '../../app'
+import { getEnum } from '../../enum'
+const { TYPE_MAP } = getEnum()
+interface ParamsItem {
+  Filter?: string
+  Sorting?: string
+  SkipCount?: string | number
+  MaxResultCount?: string | number
+  IsDesc?: boolean
+  SerialInputFlag?: string
+}
+
+const MaxResultCount = 20
+const SkipCount = 0
+const searchValue = ref('')
+const importSelected = ref('')
+
+const params: ParamsItem = reactive({
+  MaxResultCount,
+  SkipCount,
+})
+
+const props = defineProps<{
+  modelValue: boolean
+  title: string
+  columns: any[]
+  type: string
+  other: string
+}>()
+
+const emit = defineEmits(['update:modelValue', 'update:dataSource'])
+
+const visible = computed({
+  get() {
+    return props.modelValue
+  },
+  set(v) {
+    emit('update:modelValue', v)
+  },
+})
+
+const dataSource = ref([])
+
+const dialogConfig = computed(() => {
+  return {
+    title: props.title,
+    columns: props.columns,
+    total: 0,
+  }
+})
+
+const getList = async () => {
+  dataSource.value = []
+  const typeMap = {
+    [TYPE_MAP.PROCESS]: getProcessList,
+    [TYPE_MAP.LOT]: getLotList,
+    [TYPE_MAP.BOM]: getBomList,
+  }
+  const otherParamsMap = {
+    [TYPE_MAP.PROCESS]: {
+      OrderNumber: props.other,
+    },
+    [TYPE_MAP.LOT]: {
+      Code: props.other,
+    },
+    [TYPE_MAP.BOM]: {
+      OrderNumber: props.other,
+    },
+  }
+  const otherParams = otherParamsMap[props.type]
+  if (searchValue.value) {
+    params.Filter = searchValue.value
+  } else {
+    delete params.Filter
+  }
+  if (props.type === TYPE_MAP.BOM) {
+    params.SerialInputFlag = importSelected.value
+  }
+  Object.assign(params, otherParams)
+  const fn = typeMap[props.type]
+  const res = await fn(params)
+
+  dataSource.value = res.items
+  dialogConfig.value.total = res.totalCount
+}
+
+const onSearch = () => getList()
+
+const onOpen = () => {
+  searchValue.value = ''
+  getList()
+}
+
+const onClose = () => {
+  visible.value = false
+}
+
+const onConfirm = () => {
+  onClose()
+}
+
+const onUpdate = async () => {
+  const updateFnMap = {
+    [TYPE_MAP.PROCESS]: updateProcess,
+    [TYPE_MAP.LOT]: updateLot,
+    [TYPE_MAP.BOM]: updateBom,
+  }
+  const fn = updateFnMap[props.type]
+  await fn(props.other)
+  ElMessage.success(_t('鏇存柊鎴愬姛'))
+  visible.value = false
+}
+
+const onPageChange = (v: number) => {
+  params.SkipCount = (v - 1) * MaxResultCount
+  getList()
+}
+</script>
+
+<style lang="scss" scoped>
+.table-content {
+  width: 100%;
+  height: 400px;
+}
+
+.table-header {
+  width: 100%;
+  height: 50px;
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+}
+.update {
+  width: 96px;
+  height: 26px;
+}
+.table-body {
+  width: 100%;
+  height: 500px;
+}
+</style>

--
Gitblit v1.9.3