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

---
 HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx |  392 +++++++++++++++++--------------------------------------
 1 files changed, 123 insertions(+), 269 deletions(-)

diff --git a/HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx b/HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx
index e75418d..63d362d 100644
--- a/HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx
+++ b/HIAWms/hiawms_web/src/widgets/WmsMaterialContainer/Views/Pages/WmsMaterialContainer/WmsMaterialContainer.tsx
@@ -1,299 +1,153 @@
-import { computed, defineComponent, onMounted, reactive, ref } from 'vue'
+import { defineComponent, onMounted, ref } from 'vue'
 import type { Ref } from 'vue'
-import BaseTable from '@/components/Table/Table'
 import styles from './WmsMaterialContainer.module.scss'
-import { useWmsMaterialContainer } from '../../../Controllers/WmsMaterialContainer'
-import IconButton from '@/components/IconButton/IconButton'
-import WmsMaterialContainerDrawer from '../Dialog/WmsMaterialContainerDrawer/WmsMaterialContainerDrawer'
-import WmsMaterialContainerQueryDrawer from '../Dialog/WmsMaterialContainerQueryDrawer/WmsMaterialContainerQueryDrawer'
-import Search from '@/components/Search/Search'
-import { columns } from './Config'
-import TdButton from '@/components/TdButton/TdButton'
-import { vPermission } from '@/libs/Permission/Permission'
-import { getWmsEnumData } from '@/widgets/WmsMaterialContainer/Models/Service/WmsMaterialContainerDrawer'
 import {
   ElInput,
-  ElSelect,
-  ElOption,
-  ElDatePicker,
   ElForm,
   ElFormItem,
+  ElButton,
+  ElSelect,
+  ElOption,
+  ElMessage,
 } from 'element-plus'
-import { injectModel } from '@/libs/Provider/Provider'
-
-interface RenderTableType {
-  url?: string
-  dataSource: Ref<any[]>
-  isDrag?: boolean
-  isChecked?: boolean
-  isHidePagination?: boolean
-  params?: Record<string, any>
-  autoHeight?: boolean
-}
+import {
+  getPlaceNoForStockList,
+  getMaterialModelList,
+  instock,
+} from '@/widgets/WmsMaterialContainer/Models/Service/WmsMaterialContainer'
+import { Message } from '@element-plus/icons-vue/dist/types'
 
 export default defineComponent({
   name: 'WmsMaterialContainer',
-  directives: {
-    permission: vPermission,
-  },
-  setup(props, ctx) {
-    const {
-      dataSource,
-      contextMenu,
-      dialogConfig,
-      dialogConfigForQuery,
-      tableRef,
-      current,
-      search,
-      sort,
-      headers,
-      onError,
-      onSearch,
-      onRowClick,
-      onConfirmWmsMaterialContainer,
-      onCheck,
-      onAddWmsMaterialContainer,
-      onAdvancedQuery,
-      onExport,
-      openDetail,
-      onSuccess,
-      onBeforeUpload,
-    } = useWmsMaterialContainer(props, ctx)
-
-    //瀹氫箟楂樼骇鏌ヨ寮曠敤
-    const wmsMaterialContainerQueryDrawerRef = ref(null)
-    // 鏂板鐨勬煡璇㈡潯浠�
+  setup() {
+    // 鏌ヨ琛ㄥ崟鏁版嵁
     const queryForm = ref({
-      searchVal: '',
-      str_searchFormInputAttrs: [],
+      materialModel: '',
+      placeNo: '',
+      materialBatch: '',
+      stockNumber: '',
     })
-    //瀹氫箟鏁翠綋妯$硦鏌ヨ鐨勫垪鏁扮粍(娉ㄦ剰锛氬繀椤诲ぇ灏忓啓璺熷悗绔殑瀹炰綋绫诲睘鎬у悕涓�鑷达紝鍚﹀垯浼氬鑷村尮閰嶄笉瀵圭殑闂)
-    const _searchFormInputAttrs = ref(['MaterialId'])
-    const searchFormInputAttrs_Placeholder = ref('璇疯緭鍏ョ墿鏂橧d')
 
-    // 鍔ㄦ�佹灇涓鹃�夐」
-    const enumOptions = reactive({})
+    // 鏁版嵁婧�
+    const modelOptions = ref<Array<{ value: string; label: string }>>([])
+    const placeNoOptions = ref<Array<{ value: string; label: string }>>([])
 
-    // 鑾峰彇鏋氫妇鏁版嵁
-    const fetchEnumData = async () => {
-      try {
-      } catch (error) {
-        console.error('鑾峰彇鏋氫妇鏁版嵁澶辫触:', error)
-      }
-    }
-
-    // 缁勪欢鎸傝浇鏃惰幏鍙栨灇涓炬暟鎹�
     onMounted(() => {
-      fetchEnumData()
+      // 缁勪欢鎸傝浇鍚庤幏鍙栧瀷鍙峰垪琛ㄥ拰搴撲綅鍙峰垪琛�
+      getModelList()
+      getPlaceNoList()
     })
 
-    // 瀹氫箟鍝嶅簲寮忔煡璇㈡暟鎹�
-    const _curHighQueryData = ref({
-      searchVal: '',
-      str_searchFormInputAttrs: [],
-    })
-    // 鏂扮増鐨勬煡璇㈡柟娉曪紙涓婚〉闈腑鐨勬寜閽�愭煡璇€�戯級
-    const handleQueryForMain = async () => {
-      _curHighQueryData.value.searchVal = queryForm.value.searchVal
-      _curHighQueryData.value.str_searchFormInputAttrs =
-        _searchFormInputAttrs.value
-      tableRef.value.getList(_curHighQueryData.value)
-    }
-    // 鏂扮増鐨勬煡璇㈡柟娉曪紙楂樼骇鏌ヨ涓殑鎸夐挳銆愭煡璇€�戯級
-    const handleQuery = async (extraParams = {}) => {
-      let filteredData = commonGetHighQueryForm(extraParams)
-      commonSaveCurHighQueryData(filteredData)
-      tableRef.value.getList(filteredData)
-    }
-    // 鏂扮増鐨勬煡璇㈤噸缃�
-    const resetQuery = () => {
-      queryForm.value.searchVal = ''
-      queryForm.value.str_searchFormInputAttrs = _searchFormInputAttrs.value
-    }
-    //鏂扮増鐨勫鍑烘柟娉�
-    const handleExport = () => {
-      onExport(_curHighQueryData.value)
-    }
-    // 鏂扮増鐨勬煡璇㈠脊鍑烘鍏抽棴鏂规硶
-    const closeQuery = (extraParams = {}) => {
-      let filteredData = commonGetHighQueryForm(extraParams)
-      console.log('closeQuery鏂规硶')
-      console.log(filteredData)
-      commonSaveCurHighQueryData(filteredData)
-    }
-    //淇濆瓨鏌ヨ鍊�
-    const commonSaveCurHighQueryData = (filteredData = {}) => {
-      _curHighQueryData.value = { ..._curHighQueryData.value, ...filteredData }
-      _curHighQueryData.value.searchVal = queryForm.value.searchVal
-      _curHighQueryData.value.str_searchFormInputAttrs =
-        _searchFormInputAttrs.value
-    }
-    //鑾峰彇楂樼骇鏌ヨ寮瑰嚭妗嗙殑鏌ヨ鍊�
-    const commonGetHighQueryForm = (extraParams = {}) => {
-      // 杩囨护鎺� undefined 鐨勫��
-      let filteredData = Object.assign(
-        {},
-        ...Object.entries(extraParams).map(([key, value]) =>
-          value !== undefined ? { [key]: value } : {}
-        )
-      )
-      //缁勫悎妯$硦鏌ヨ
-      filteredData.searchVal = queryForm.value.searchVal
-      filteredData.str_searchFormInputAttrs = _searchFormInputAttrs.value
-      return filteredData
+    // 缁勭洏鎿嶄綔
+    const handlePalletize = () => {
+      console.log('缁勭洏鎿嶄綔', queryForm.value)
+      // 杩欓噷娣诲姞缁勭洏閫昏緫
     }
 
-    /**
-     * @returns 琛ㄦ牸
-     */
-    const RenderBaseTable = (props: RenderTableType) => {
-      const {
-        url,
-        dataSource,
-        isDrag,
-        isChecked,
-        isHidePagination,
-        params,
-        autoHeight,
-      } = props
+    // 缁勭洏鍏ュ簱鎿嶄綔
+    const handlePalletizeStorage = () => {
+      console.log('缁勭洏鍏ュ簱鎿嶄綔', queryForm.value)
+      instock(queryForm.value), resetQueryForm()
+      ElMessage.success({
+        message: '缁勭洏鍏ュ簱鎴愬姛',
+        type: 'success',
+      })
+      // 杩欓噷娣诲姞缁勭洏鍏ュ簱閫昏緫
+    }
 
-      return (
-        <div
-          class={{
-            [styles.wmsMaterialContainerList]: true,
-          }}
-        >
-          <BaseTable
-            ref={tableRef}
-            url={url}
-            sortUrlTpl="/api/v1/HIAWms/wmsMaterialContainer/{id}/adjustsort/{sort}"
-            v-model:dataSource={dataSource.value}
-            columns={columns}
-            contextMenu={contextMenu}
-            params={params}
-            isDrag={isDrag}
-            isChecked={isChecked}
-            autoHeight={autoHeight}
-            onCheck={onCheck}
-            onRowClick={onRowClick}
-            isHidePagination={isHidePagination}
-            pageSize={20}
-            v-slots={{
-              name: ({ row }: any) => {
-                return row?.name ? (
-                  <TdButton
-                    onClick={() => openDetail(row)}
-                    text={<span style="color:#5a84ff">璇︽儏</span>}
-                    icon="scale"
-                    tip={row?.name}
-                    hover
-                  >
-                    {row?.name}
-                  </TdButton>
-                ) : (
-                  '-'
-                )
-              },
-            }}
-          ></BaseTable>
-        </div>
-      )
+    const resetQueryForm = () => {
+      queryForm.value.materialModel = ''
+      queryForm.value.placeNo = ''
+      queryForm.value.materialBatch = ''
+      queryForm.value.stockNumber = ''
+    }
+
+    const getModelList = async () => {
+      const models = await getMaterialModelList()
+      modelOptions.value = models.map((item: string) => ({
+        value: item.materialModel,
+        label: item.materialModelDesc,
+      }))
+    }
+
+    const getPlaceNoList = async () => {
+      const placeNos = await getPlaceNoForStockList(2)
+      console.log('搴撲綅鍙峰垪琛�:', placeNos)
+      placeNoOptions.value = placeNos.map((item: string) => ({
+        value: item.placeNo,
+        label: item.placeNoDesc,
+      }))
     }
 
     return () => {
       return (
         <div class={styles.wmsMaterialContainerContent}>
-          {/* 娣诲姞/缂栬緫 */}
-          <WmsMaterialContainerDrawer
-            v-model={dialogConfig.visible}
-            title={dialogConfig.title}
-            row={current.value}
-            sort={sort.value}
-            onConfirm={onConfirmWmsMaterialContainer}
-          />
-          {/* 楂樼骇鏌ヨ */}
-          <WmsMaterialContainerQueryDrawer
-            ref="wmsMaterialContainerQueryDrawerRef"
-            v-model={dialogConfigForQuery.visible}
-            title={dialogConfigForQuery.title}
-            row={current.value}
-            sort={sort.value}
-            onConfirmQuery={handleQuery}
-            onRestQuery={resetQuery}
-            onClose={closeQuery}
-          />
-
-          <div class={styles.headerContent}>
-            <div class={styles.header}>
-              <IconButton
-                v-permission="wmsMaterialContainer-add"
-                icon="add-p"
-                onClick={onAddWmsMaterialContainer}
-                type="primary"
+          <ElForm label-position="top" class={styles.h5Form}>
+            <ElFormItem label="鍨嬪彿">
+              <ElSelect
+                v-model={queryForm.value.materialModel}
+                placeholder="璇烽�夋嫨鍨嬪彿"
+                clearable
+                class={styles.formInput}
               >
-                娣诲姞
-              </IconButton>
-              <el-divider direction="vertical" />
-
-              <el-divider direction="vertical" />
-              <el-upload
-                v-permission="wmsMaterialContainer-import"
-                name="file"
-                accept=".xlsx,.xls,.csv"
-                show-file-list={false}
-                onError={onError}
-                onSuccess={onSuccess}
-                before-upload={onBeforeUpload}
-                headers={headers.value}
-                action="/api/v1/HIAWms/wmsMaterialContainer/import"
-              >
-                <IconButton icon="in">瀵煎叆</IconButton>
-              </el-upload>
-
-              <IconButton
-                v-permission="wmsMaterialContainer-output"
-                icon="out"
-                onClick={handleExport}
-              >
-                瀵煎嚭
-              </IconButton>
-            </div>
-            <ElFormItem style={{ marginTop: '15px' }}>
-              <ElFormItem label="鍏抽敭瀛�">
-                <ElInput
-                  v-model={queryForm.value.searchVal}
-                  placeholder={searchFormInputAttrs_Placeholder.value}
-                  clearable
-                  class={styles.formItem}
-                />
-              </ElFormItem>
-              <IconButton
-                type="primary"
-                icon="search"
-                onClick={handleQueryForMain}
-              >
-                鏌ヨ
-              </IconButton>
-              {/* <IconButton style="" icon="refresh" onClick={resetQuery}> 
-                閲嶇疆 
-              </IconButton> */}
-              <IconButton
-                v-permission="wmsMaterialContainer-add"
-                icon="search"
-                onClick={onAdvancedQuery}
-                type="primary"
-              >
-                楂樼骇鏌ヨ
-              </IconButton>
+                {modelOptions.value.map((item) => (
+                  <ElOption
+                    key={item.value}
+                    label={item.label}
+                    value={item.value}
+                  />
+                ))}
+              </ElSelect>
             </ElFormItem>
-          </div>
-
-          <RenderBaseTable
-            url="/api/v1/HIAWms/wmsMaterialContainer/page"
-            dataSource={dataSource}
-            isChecked={true}
-            isDrag={true}
-          />
+            <ElFormItem label="搴撲綅鍙�">
+              <ElSelect
+                v-model={queryForm.value.placeNo}
+                placeholder="璇烽�夋嫨搴撲綅鍙�"
+                clearable
+                class={styles.formInput}
+              >
+                {placeNoOptions.value.map((item) => (
+                  <ElOption
+                    key={item.value}
+                    label={item.label}
+                    value={item.value}
+                  />
+                ))}
+              </ElSelect>
+            </ElFormItem>
+            <ElFormItem label="鎵规鍙�">
+              <ElInput
+                v-model={queryForm.value.materialBatch}
+                placeholder="璇疯緭鍏ユ壒娆″彿"
+                clearable
+                class={styles.formInput}
+              />
+            </ElFormItem>
+            <ElFormItem label="鏁伴噺">
+              <ElInput
+                v-model={queryForm.value.stockNumber}
+                placeholder="璇疯緭鍏ユ暟閲�"
+                clearable
+                class={styles.formInput}
+              />
+            </ElFormItem>
+            <div class={styles.buttonGroup}>
+              {/* <ElButton
+                type="primary"
+                onClick={handlePalletize}
+                class={styles.actionButton}
+              >
+                缁勭洏
+              </ElButton> */}
+              <ElButton
+                type="success"
+                onClick={handlePalletizeStorage}
+                class={styles.actionButton}
+              >
+                缁勭洏鍏ュ簱
+              </ElButton>
+            </div>
+          </ElForm>
         </div>
       )
     }

--
Gitblit v1.9.3