shaogen1995 пре 4 месеци
родитељ
комит
8da6a1ba10

+ 1 - 1
src/pages/A_workbench/A2business/index.tsx

@@ -202,7 +202,7 @@ function A2business() {
         <h1>我的申请</h1>
 
         {rrArr.map(item => (
-          <div className='A2rrRow'>
+          <div className='A2rrRow' key={item.name}>
             <div>{item.name}</div>
             <div>{item.num}</div>
             <div className='A2rrRowShow'>

+ 1 - 1
src/pages/B_enterTibet/B3_4page/B3edit/main.tsx

@@ -279,7 +279,7 @@ function B3editMain({ pageSta }: Props) {
           </Button>
         ) : null}
 
-        {btnFlagFu2(topInfo)['导出'] ? EXbtnFu() : null}
+        {EXbtnFu()}
 
         {btnFlagFu2(topInfo)['删除'] ? (
           <MyPopconfirm

+ 4 - 0
src/pages/B_enterTibet/B3_4page/type.d.ts

@@ -62,4 +62,8 @@ export type FourTableType = {
   relatedOrderNum: string
   // 入库库房
   storageId: number | null
+
+  // ---------------出库有的
+  // 是否需要归还
+  isReturn: 0 | 1
 }

+ 2 - 2
src/pages/D_storeManage/D4impStor/D4edit/index.tsx

@@ -416,7 +416,7 @@ function D4edit() {
           </Button>
         ) : null}
 
-        {btnFlagFu2(topInfo)['导出'] ? EXbtnFu() : null}
+        {EXbtnFu()}
 
         {btnFlagFu2(topInfo)['删除'] ? (
           <MyPopconfirm
@@ -451,7 +451,7 @@ function D4edit() {
     if (res.code === 0) {
       const arrRes: any = ruTransformDataFu(res.data || [])
 
-      arrRes.sort(() => Math.random() - 0.5)
+      // arrRes.sort(() => Math.random() - 0.5)
 
       const oldGoods = [...topInfo.goods]
 

+ 5 - 5
src/pages/D_storeManage/D4impStor/index.tsx

@@ -18,7 +18,7 @@ import { FourTableType } from '@/pages/B_enterTibet/B3_4page/type'
 import ExportJsonExcel from 'js-export-excel'
 const { RangePicker } = DatePicker
 
-const baseFormData: TypeD4Form = {
+export const D3baseFormData: TypeD4Form = {
   pageSize: 10,
   pageNum: 1,
   num: '',
@@ -42,9 +42,9 @@ function D4impStor() {
 
   const { list } = useSelector((state: RootState) => state.D2storSet.tableInfo)
 
-  const [formData, setFormData] = useState(baseFormData)
-  const formDataRef = useRef(baseFormData)
-  const formDataOldRef = useRef(baseFormData)
+  const [formData, setFormData] = useState(D3baseFormData)
+  const formDataRef = useRef(D3baseFormData)
+  const formDataOldRef = useRef(D3baseFormData)
 
   useEffect(() => {
     formDataRef.current = formData
@@ -98,7 +98,7 @@ function D4impStor() {
 
   // 点击重置
   const resetSelectFu = useCallback(() => {
-    setFormData(baseFormData)
+    setFormData(D3baseFormData)
     setTimeout(() => {
       setTimeKey(Date.now())
     }, 50)

+ 135 - 48
src/pages/D_storeManage/D6putsStor/index.tsx

@@ -4,31 +4,33 @@ import { Button, DatePicker, Input, Select } from 'antd'
 import { B3_4inputKeyArr, D3InputKeyType } from '@/pages/B_enterTibet/B3_4page'
 import dayjs from 'dayjs'
 import MyTable from '@/components/MyTable'
-import { D6tableC } from '@/utils/tableData'
+import { D6tableC, statusObj } from '@/utils/tableData'
 import MyPopconfirm from '@/components/MyPopconfirm'
-import history from '@/utils/history'
-import { TypeD4Form } from '../D4impStor/type'
+import history, { btnFlagFu } from '@/utils/history'
+import { selectObj } from '@/utils/select'
+import { D3baseFormData } from '../D4impStor'
+import { useDispatch, useSelector } from 'react-redux'
+import { D2_APIgetList } from '@/store/action/D2storSet'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { FourTableType } from '@/pages/B_enterTibet/B3_4page/type'
+import ExportJsonExcel from 'js-export-excel'
+import { D6_APIdel, D6_APIgetList } from '@/store/action/D6putsStor'
 const { RangePicker } = DatePicker
 
-const baseFormData: TypeD4Form = {
-  pageSize: 10,
-  pageNum: 1,
-  num: '',
-  name: '',
-  deptName: '',
-  userName: '',
-  startTime: '',
-  endTime: '',
-  status: null,
-  userType: null,
-  storageInId: null
-}
+function D6putsStor() {
+  const dispatch = useDispatch()
 
-// 没有接入后端 待完善
+  // 获取入库库房下拉框 - 库房设置列表
+  useEffect(() => {
+    dispatch(D2_APIgetList({ pageNum: 1, pageSize: 99999 }))
+  }, [dispatch])
 
-function D6putsStor() {
-  const [formData, setFormData] = useState(baseFormData)
-  const formDataRef = useRef(baseFormData)
+  const { list } = useSelector((state: RootState) => state.D2storSet.tableInfo)
+
+  const [formData, setFormData] = useState(D3baseFormData)
+  const formDataRef = useRef(D3baseFormData)
+  const formDataOldRef = useRef(D3baseFormData)
 
   useEffect(() => {
     formDataRef.current = formData
@@ -61,8 +63,9 @@ function D6putsStor() {
 
   // 封装发送请求的函数
   const getListFu = useCallback(() => {
-    console.log('发送请求', formDataRef.current)
-  }, [])
+    formDataOldRef.current = { ...formDataRef.current }
+    dispatch(D6_APIgetList(formDataRef.current))
+  }, [dispatch])
 
   useEffect(() => {
     getListFu()
@@ -81,7 +84,7 @@ function D6putsStor() {
 
   // 点击重置
   const resetSelectFu = useCallback(() => {
-    setFormData(baseFormData)
+    setFormData(D3baseFormData)
     setTimeout(() => {
       setTimeKey(Date.now())
     }, 50)
@@ -101,34 +104,50 @@ function D6putsStor() {
   // 点击删除
   const delTableFu = useCallback(
     async (id: number) => {
-      getListFu()
+      const res = await D6_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功')
+        getListFu()
+      }
     },
     [getListFu]
   )
 
   // 点击操作按钮
-  const tableBtnFu = useCallback((key: string, id: number) => {
+  const tableBtnFu = useCallback((id: number, key: string) => {
     history.push(`/putsStor_edit/${key}/${id}`)
   }, [])
 
   const tableLastBtn = useMemo(() => {
-    //   看状态和账号角色显示按钮 待完善
     return [
       {
         title: '操作',
-        render: (item: any) => {
-          return (
+        render: (item: FourTableType) => {
+          let obj = btnFlagFu(item)
+          return !Object.values(obj).some(Boolean) ? (
+            '-'
+          ) : (
             <>
-              <Button size='small' type='text' onClick={() => tableBtnFu('2', item.id)}>
-                编辑
-              </Button>
-              <Button size='small' type='text' onClick={() => tableBtnFu('3', item.id)}>
-                审批
-              </Button>
-              <Button size='small' type='text' onClick={() => tableBtnFu('4', item.id)}>
-                查看
-              </Button>
-              <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+              {obj['编辑'] ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '2')}>
+                  编辑
+                </Button>
+              ) : null}
+
+              {obj['审批'] ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '3')}>
+                  审批
+                </Button>
+              ) : null}
+              {obj['查看'] ? (
+                <Button size='small' type='text' onClick={() => tableBtnFu(item.id, '4')}>
+                  查看
+                </Button>
+              ) : null}
+
+              {obj['删除'] ? (
+                <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+              ) : null}
             </>
           )
         }
@@ -136,6 +155,67 @@ function D6putsStor() {
     ]
   }, [delTableFu, tableBtnFu])
 
+  // 从仓库拿数据
+  const tableInfo = useSelector((state: RootState) => state.D6putsStor.tableInfo)
+
+  // 点击导出
+  const deriveFu = useCallback(async () => {
+    const name = '藏品出库' + dayjs(new Date()).format('YYYY-MM-DD HH:mm')
+
+    const res = await D6_APIgetList(
+      {
+        ...formDataOldRef.current,
+        pageNum: 1,
+        pageSize: 99999
+      },
+      true
+    )
+
+    if (res.code === 0) {
+      if (res.data.records.length <= 0) return MessageFu.warning('当前搜索条件没有数据!')
+
+      const option = {
+        fileName: name,
+        datas: [
+          {
+            sheetData: res.data.records.map((v: FourTableType) => ({
+              ...v,
+              status: statusObj[v.status as 1],
+              isReturn: v.isReturn === 1 ? '是' : '否'
+            })),
+            sheetName: name,
+            sheetFilter: [
+              'num',
+              'name',
+              'storageName',
+              'isReturn',
+              'returnDate',
+              'deptName',
+              'creatorName',
+              'createTime',
+              'status'
+            ],
+            sheetHeader: [
+              '业务单号',
+              '申请名称',
+              '入库库房',
+              '是否需要归还',
+              '预计归还日期',
+              '发起部门',
+              '发送人',
+              '发起日期',
+              '申请状态'
+            ],
+            columnWidths: [10, 10, 10, 10, 10, 10, 10, 10, 10]
+          }
+        ]
+      }
+
+      const toExcel = new ExportJsonExcel(option) //new
+      toExcel.saveExcel() //保存
+    }
+  }, [])
+
   return (
     <div className={styles.D6putsStor}>
       <div className='pageTitle'>出库</div>
@@ -155,7 +235,10 @@ function D6putsStor() {
           ))}
         </div>
         <div className='D4toprr'>
-          <Button type='primary'>批量导出</Button>&emsp;
+          <Button type='primary' onClick={deriveFu}>
+            批量导出
+          </Button>
+          &emsp;
           <Button type='primary' onClick={() => history.push('/putsStor_edit/1/null')}>
             新增
           </Button>
@@ -176,21 +259,23 @@ function D6putsStor() {
           <div>
             <span>申请状态:</span>
             <Select
-              placeholder='请选择'
+              allowClear={true}
+              placeholder='全部'
               style={{ width: 150 }}
               value={formData.status}
               onChange={e => setFormData({ ...formData, status: e })}
-              options={[{ value: '', label: '全部' }]}
+              options={selectObj['申请状态'].filter(v => v.label !== '待盘点')}
             />
           </div>
 
           <div>
             <span>选择角色:</span>
             <Select
+              allowClear={true}
               style={{ width: 150 }}
-              placeholder='请选择'
-              options={[]}
-              fieldNames={{ value: 'id', label: 'roleName' }}
+              placeholder='全部'
+              options={selectObj['角色']}
+              // fieldNames={{ value: 'id', label: 'roleName' }}
               value={formData.userType}
               onChange={e => setFormData({ ...formData, userType: e })}
             />
@@ -200,11 +285,13 @@ function D6putsStor() {
             <span>出库库房:</span>
             {/* 拿库房设置的列表 */}
             <Select
-              placeholder='请选择'
+              allowClear={true}
+              placeholder='全部'
               style={{ width: 150 }}
               value={formData.storageInId}
               onChange={e => setFormData({ ...formData, storageInId: e })}
-              options={[{ value: '', label: '全部' }]}
+              fieldNames={{ value: 'id', label: 'name' }}
+              options={list}
             />
           </div>
         </div>
@@ -219,12 +306,12 @@ function D6putsStor() {
       {/* 表格 */}
       <MyTable
         yHeight={610}
-        list={[{ id: 66 }]}
+        list={tableInfo.list}
         columnsTemp={D6tableC}
         lastBtn={tableLastBtn}
         pageNum={formData.pageNum}
         pageSize={formData.pageSize}
-        total={0}
+        total={tableInfo.total}
         onChange={(pageNum, pageSize) => paginationChange(pageNum, pageSize)}
       />
     </div>

+ 4 - 0
src/pages/X_stock/X2lookText/index.module.scss

@@ -15,6 +15,10 @@
       max-height: 580px;
       min-height: 200px;
       overflow-y: auto;
+      .media-wrap {
+        margin: 10px auto;
+        text-align: center;
+      }
     }
     .YtBtn {
       margin-top: 20px;

+ 77 - 0
src/store/action/D6putsStor.ts

@@ -0,0 +1,77 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+/**
+ * 出库 - 获取分页列表
+ */
+export const D6_APIgetList = (data: any, exportFlag?: boolean): any => {
+  if (exportFlag) return http.post('cms/orderOut/page', data)
+  else {
+    return async (dispatch: AppDispatch) => {
+      const res = await http.post('cms/orderOut/page', data)
+      if (res.code === 0) {
+        const obj = {
+          list: res.data.records,
+          total: res.data.total
+        }
+
+        dispatch({ type: 'D6/getList', payload: obj })
+      }
+    }
+  }
+}
+
+/**
+ * 出库-删除
+ */
+export const D6_APIdel = (id: number) => {
+  return http.get(`cms/orderOut/remove/${id}`)
+}
+
+/**
+ * 出库-创建订单
+ */
+export const D6_APIcreate = () => {
+  return http.get('cms/orderOut/create')
+}
+
+/**
+ * 出库-获取详情
+ */
+export const D6_APIgetInfo = (id: number) => {
+  return http.get(`cms/orderOut/detail/${id}`)
+}
+
+/**
+ * 出库-存草稿
+ */
+export const D6_APIsaveDraft = (data: any) => {
+  return http.post('cms/orderOut/saveDraft', data)
+}
+
+/**
+ * 出库-创建
+ */
+export const D6_APIsaveCreate = (data: any) => {
+  return http.post('cms/orderOut/saveCreate', data)
+}
+
+/**
+ * 出库-编辑保存
+ */
+export const D6_APIsaveApply = (data: any) => {
+  return http.post('cms/orderOut/saveApply', data)
+}
+
+/**
+ * 出库-审批
+ */
+export const D6_APIsaveAudit = (data: any) => {
+  return http.post('cms/orderOut/audit', data)
+}
+
+/**
+ * 出库-撤回订单
+ */
+export const D6_APIrevocation = (id: number) => {
+  return http.get(`cms/orderOut/revocation/${id}`)
+}

+ 28 - 0
src/store/reducer/D6putsStor.ts

@@ -0,0 +1,28 @@
+import { FourTableType } from '@/pages/B_enterTibet/B3_4page/type'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as FourTableType[],
+    total: 0
+  }
+}
+
+// 定义 action 类型
+type Props = {
+  type: 'D6/getList'
+  payload: { list: FourTableType[]; total: number }
+}
+
+// reducer
+export default function userReducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'D6/getList':
+      return { ...state, tableInfo: action.payload }
+
+    default:
+      return state
+  }
+}

+ 2 - 0
src/store/reducer/index.ts

@@ -7,6 +7,7 @@ import FourAll from './FourAll'
 import C2files from './C2files'
 import D2storSet from './D2storSet'
 import D4impStor from './D4impStor'
+import D6putsStor from './D6putsStor'
 import Z1dict from './Z1dict'
 import Z2numRule from './Z2numRule'
 import Z3flowSet from './Z3flowSet'
@@ -22,6 +23,7 @@ const rootReducer = combineReducers({
   C2files,
   D2storSet,
   D4impStor,
+  D6putsStor,
   Z1dict,
   Z2numRule,
   Z3flowSet,

+ 5 - 8
src/utils/history.ts

@@ -182,7 +182,6 @@ export type btnFlagTxtType2 =
   | '审批'
   | '编辑'
   | '重新提交'
-  | '导出'
   | '删除'
   | '盘点'
 export const btnFlagFu2 = (item: FourTableType) => {
@@ -196,7 +195,6 @@ export const btnFlagFu2 = (item: FourTableType) => {
     审批: false,
     编辑: false,
     重新提交: false,
-    导出: false,
     删除: false,
     盘点: false
   }
@@ -229,11 +227,11 @@ export const btnFlagFu2 = (item: FourTableType) => {
       // 我是申请人
       if (creatorId === myId) flagObj['编辑'] = flagObj['重新提交'] = true
     },
-    4: () => {
-      //已完成
-      // 我是申请人
-      if (creatorId === myId) flagObj['导出'] = true
-    },
+    // 4: () => {
+    //   //已完成
+    //   // 我是申请人
+    //   // if (creatorId === myId) flagObj['导出'] = true
+    // },
     5: () => {
       //待盘点
       // 我是申请人
@@ -252,7 +250,6 @@ export const btnFlagFu2 = (item: FourTableType) => {
     审批: true,
     编辑: true,
     重新提交: true,
-    导出: true,
     删除: true,
     盘点: true
   }

+ 2 - 2
src/utils/http.ts

@@ -8,8 +8,8 @@ import { domShowFu } from './domShow'
 const envFlag = process.env.NODE_ENV === 'development'
 
 // 待完善
-// const baseUrlTemp = 'https://sit-yiwubwg.4dage.com' // 测试环境
-const baseUrlTemp = 'http://192.168.20.61:8096' // 线下环境
+const baseUrlTemp = 'https://sit-yiwubwg.4dage.com' // 测试环境
+// const baseUrlTemp = 'http://192.168.20.61:8096' // 线下环境
 
 const baseFlag = baseUrlTemp.includes('https://')
 

+ 9 - 10
src/utils/tableData.ts

@@ -147,17 +147,16 @@ export const D4tableC = [
   ['txtChange', '申请状态', 'status', statusObj]
 ]
 
-// 待完善
 export const D6tableC = [
-  ['txt', '申请编号', 'regionName'],
-  ['txt', '业务名称', 'layer1'],
-  ['txt', '出库库房', 'layer2'],
-  ['txt', '是否需要归还', 'layer2'],
-  ['txt', '预计归还日期', 'layer2'],
-  ['txt', '发起部门', 'layer3'],
-  ['txt', '发起人', 'layer3'],
-  ['txt', '发起日期', 'layer3'],
-  ['txt', '申请状态', 'layer3']
+  ['txt', '业务单号', 'num'],
+  ['txt', '申请名称', 'name'],
+  ['txt', '出库库房', 'storageName'],
+  ['txtChange', '是否需要归还', 'isReturn', { 1: '是', 0: '否' }],
+  ['txt', '预计归还日期', 'returnDate'],
+  ['txt', '发起部门', 'deptName'],
+  ['txt', '发送人', 'creatorName'],
+  ['txt', '发起日期', 'createTime'],
+  ['txtChange', '申请状态', 'status', statusObj]
 ]
 
 export const D4goodsTableC = [