From 9eaf758e97367dbc2eca2bdbdc92ab39e08be9d0 Mon Sep 17 00:00:00 2001
From: zs <zhousong@weben-smart.com>
Date: 周四, 15 5月 2025 13:12:17 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo

---
 HIAWms/hiawms_web/src/widgets/HIAWms/Views/Pages/WmsMaterialType/WmsMaterialType.tsx |  376 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 376 insertions(+), 0 deletions(-)

diff --git a/HIAWms/hiawms_web/src/widgets/HIAWms/Views/Pages/WmsMaterialType/WmsMaterialType.tsx b/HIAWms/hiawms_web/src/widgets/HIAWms/Views/Pages/WmsMaterialType/WmsMaterialType.tsx
new file mode 100644
index 0000000..900bc2e
--- /dev/null
+++ b/HIAWms/hiawms_web/src/widgets/HIAWms/Views/Pages/WmsMaterialType/WmsMaterialType.tsx
@@ -0,0 +1,376 @@
+import { computed, defineComponent, onMounted, reactive, ref } from 'vue' 
+import type { Ref } from 'vue' 
+import BaseTable from '@/components/Table/Table' 
+import styles from './WmsMaterialType.module.scss' 
+import { useWmsMaterialType } from '../../../Controllers/WmsMaterialType' 
+import IconButton from '@/components/IconButton/IconButton' 
+import WmsMaterialTypeDrawer from '../Dialog/WmsMaterialTypeDrawer/WmsMaterialTypeDrawer' 
+import WmsMaterialTypeQueryDrawer from '../Dialog/WmsMaterialTypeQueryDrawer/WmsMaterialTypeQueryDrawer' 
+import Search from '@/components/Search/Search' 
+import { columns } from './Config' 
+import TdButton from '@/components/TdButton/TdButton' 
+import { vPermission } from '@/libs/Permission/Permission' 
+import dayjs from 'dayjs' 
+import { 
+  getWmsEnumData 
+} from '@/widgets/WmsMaterialType/Models/Service/WmsMaterialTypeDrawer' 
+import { 
+  ElInput, 
+  ElSelect, 
+  ElOption, 
+  ElDatePicker, 
+  ElForm, 
+  ElFormItem, 
+} from 'element-plus' 
+import { injectModel } from '@/libs/Provider/Provider' 
+// 寮曞叆鍏叡閫夐」閰嶇疆  
+import {   
+  FILTER_MODE_OPTIONS_STRING 
+} from '@/components/DyFormForHighQuery/DyFormForHighQueryOptions';  
+ 
+interface RenderTableType { 
+  url?: string 
+  dataSource: Ref<any[]> 
+  isDrag?: boolean 
+  isChecked?: boolean 
+  isHidePagination?: boolean 
+  params?: Record<string, any> 
+  autoHeight?: boolean 
+} 
+ 
+export default defineComponent({ 
+  name: 'WmsMaterialType', 
+  directives: { 
+    permission: vPermission, 
+  }, 
+  setup(props, ctx) { 
+    const { 
+      dataSource, 
+      contextMenu, 
+      dialogConfig, 
+      dialogConfigForQuery, 
+      tableRef, 
+      current, 
+      search, 
+      sort, 
+      headers, 
+      onError, 
+      onSearch, 
+      onRowClick, 
+      onConfirmWmsMaterialType, 
+      onCheck, 
+      onAddWmsMaterialType, 
+      onAdvancedQuery, 
+      onExport, 
+      openDetail, 
+      onSuccess, 
+      onBeforeUpload, 
+    } = useWmsMaterialType(props, ctx) 
+ 
+    //瀹氫箟楂樼骇鏌ヨ寮曠敤 
+   const wmsMaterialTypeQueryDrawerRef=ref(null); 
+    // 鏂板鐨勬煡璇㈡潯浠� 
+    const queryForm = ref({ 
+      searchVal: '', 
+      str_searchFormInputAttrs:[], 
+      searchVal_FilterMode:'' 
+    }) 
+    //瀹氫箟鏁翠綋妯$硦鏌ヨ鐨勫垪鏁扮粍(娉ㄦ剰锛氬繀椤诲ぇ灏忓啓璺熷悗绔殑瀹炰綋绫诲睘鎬у悕涓�鑷达紝鍚﹀垯浼氬鑷村尮閰嶄笉瀵圭殑闂) 
+    const _searchFormInputAttrs = ref([ 
+     'MaterialTypeCode', 'MaterialTypeDesc', 
+    ]); 
+    const searchFormInputAttrs_Placeholder = ref('璇疯緭鍏ョ墿鏂欑被鍨嬬紪鍙�/鐗╂枡绫诲瀷鍚嶇О'); 
+     
+ 
+    // 鍔ㄦ�佹灇涓鹃�夐」 
+    const enumOptions = reactive({ 
+       
+    }) 
+ 
+    // 鑾峰彇鏋氫妇鏁版嵁 
+    const fetchEnumData = async () => { 
+      try { 
+         
+      } catch (error) { 
+        console.error('鑾峰彇鏋氫妇鏁版嵁澶辫触:', error) 
+      } 
+    } 
+ 
+    // 瀹氫箟鍝嶅簲寮忔煡璇㈡暟鎹�  
+    const _curHighQueryData = ref({ searchVal: '',str_searchFormInputAttrs:[],searchVal_FilterMode:'' });   
+    // 缁勪欢鎸傝浇鏃惰幏鍙栨灇涓炬暟鎹�  
+    onMounted(() => {  
+      fetchEnumData()  
+      queryForm.value.searchVal_FilterMode = FILTER_MODE_OPTIONS_STRING[0]?.value || '';  
+      _curHighQueryData.value.searchVal_FilterMode = queryForm.value.searchVal_FilterMode;   
+      _curHighQueryData.value.str_searchFormInputAttrs = _searchFormInputAttrs.value;  
+    })  
+ 
+    // 鏂扮増鐨勬煡璇㈡柟娉曪紙涓婚〉闈腑鐨勬寜閽�愭煡璇€�戯級 
+    const handleQueryForMain = async () => { 
+      _curHighQueryData.value.searchVal = queryForm.value.searchVal; 
+      _curHighQueryData.value.searchVal_FilterMode = queryForm.value.searchVal_FilterMode;  
+      _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.searchVal_FilterMode = FILTER_MODE_OPTIONS_STRING[0]?.value || ''; 
+      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.searchVal_FilterMode = queryForm.value.searchVal_FilterMode  
+      _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.searchVal_FilterMode = queryForm.value.searchVal_FilterMode  
+      filteredData.str_searchFormInputAttrs =_searchFormInputAttrs.value; 
+      return filteredData; 
+    } 
+    
+ 
+    /** 
+     * @returns 琛ㄦ牸 
+     */ 
+    const RenderBaseTable = (props: RenderTableType) => { 
+      const { 
+        url, 
+        dataSource, 
+        isDrag, 
+        isChecked, 
+        isHidePagination, 
+        params, 
+        autoHeight, 
+      } = props 
+ 
+      return ( 
+        <div 
+          class={{ 
+            [styles.wmsMaterialTypeList]: true, 
+          }} 
+        > 
+          <BaseTable 
+            ref={tableRef} 
+            url={url} 
+            sortUrlTpl="/api/v1/HIAWms/wmsMaterialType/{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={{ 
+              creationTime: ({ row }: any) => { 
+ return ( 
+   <div>  
+     {row.creationTime != null 
+     ? dayjs(row.creationTime).format('YYYY-MM-DD HH:mm:ss') 
+      : '-'} 
+   </div>  
+  ) 
+},
+lastModificationTime: ({ row }: any) => { 
+ return ( 
+   <div>  
+     {row.lastModificationTime != null 
+     ? dayjs(row.lastModificationTime).format('YYYY-MM-DD HH:mm:ss') 
+      : '-'} 
+   </div>  
+  ) 
+},
+isDeleted: ({ row }: any) => { 
+ return ( 
+   <div>  
+     {row.isDeleted != null ? (row.isDeleted ? '鏄�' : '鍚�') : '-'} 
+   </div>  
+  ) 
+},
+deletionTime: ({ row }: any) => { 
+ return ( 
+   <div>  
+     {row.deletionTime != null 
+     ? dayjs(row.deletionTime).format('YYYY-MM-DD HH:mm:ss') 
+      : '-'} 
+   </div>  
+  ) 
+},
+isDisabled: ({ row }: any) => { 
+ return ( 
+   <div>  
+     {row.isDisabled != null ? (row.isDisabled ? '鏄�' : '鍚�') : '-'} 
+   </div>  
+  ) 
+}, 
+              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> 
+      ) 
+    } 
+ 
+    return () => { 
+      return ( 
+        <div class={styles.wmsMaterialTypeContent}> 
+          {/* 娣诲姞/缂栬緫 */} 
+          <WmsMaterialTypeDrawer 
+            v-model={dialogConfig.visible} 
+            title={dialogConfig.title} 
+            row={current.value} 
+            sort={sort.value} 
+            onConfirm={onConfirmWmsMaterialType} 
+          /> 
+          {/* 楂樼骇鏌ヨ */} 
+          <WmsMaterialTypeQueryDrawer 
+            ref="wmsMaterialTypeQueryDrawerRef" 
+            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="wmsMaterialType-add" 
+                icon="add-p" 
+                onClick={onAddWmsMaterialType} 
+                type="primary" 
+              > 
+                娣诲姞 
+              </IconButton> 
+              <el-divider direction="vertical" /> 
+ 
+              <el-upload 
+                v-permission="wmsMaterialType-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/wmsMaterialType/import" 
+              > 
+                <IconButton icon="in">瀵煎叆</IconButton> 
+              </el-upload> 
+ 
+              <IconButton 
+                v-permission="wmsMaterialType-output" 
+                icon="out" 
+                onClick={handleExport} 
+              > 
+                瀵煎嚭 
+              </IconButton> 
+            </div> 
+            <ElFormItem style={{ marginTop: '15px' }}> 
+              <ElFormItem label="鍏抽敭瀛�"> 
+                 <el-tooltip 
+                  class="box-item" 
+                  effect="dark" 
+                  content={searchFormInputAttrs_Placeholder.value} 
+                  placement="top-start" 
+                > 
+                <ElInput 
+                  v-model={queryForm.value.searchVal} 
+                  placeholder={searchFormInputAttrs_Placeholder.value} 
+                  clearable 
+                  class={styles.formItem} 
+                /> 
+                </el-tooltip> 
+              </ElFormItem> 
+              <ElFormItem label="" style="width:100px;">  
+                   <ElSelect 
+                                v-model={queryForm.value.searchVal_FilterMode} 
+                                placeholder="璇烽�夋嫨" 
+                                class={styles.formItem} 
+                              > 
+                                {FILTER_MODE_OPTIONS_STRING.map((option) => ( 
+                                  <ElOption 
+                                    key={option.value} 
+                                    label={option.label} 
+                                    value={option.value} 
+                                  /> 
+                                ))} 
+                              </ElSelect> 
+              </ElFormItem>  
+              <IconButton type="primary" icon="search" onClick={handleQueryForMain}> 
+                鏌ヨ 
+              </IconButton> 
+              {/* <IconButton style="" icon="refresh" onClick={resetQuery}> 
+                閲嶇疆 
+              </IconButton> */} 
+              <IconButton 
+                v-permission="wmsMaterialType-add" 
+                icon="search" 
+                onClick={onAdvancedQuery} 
+                type="primary" 
+              > 
+                楂樼骇鏌ヨ 
+              </IconButton> 
+            </ElFormItem> 
+          </div> 
+ 
+          <RenderBaseTable 
+            url="/api/v1/HIAWms/wmsMaterialType/page" 
+            dataSource={dataSource} 
+            isChecked={true} 
+            isDrag={true} 
+          /> 
+        </div> 
+      ) 
+    } 
+  }, 
+}) 

--
Gitblit v1.9.3