Renxy пре 2 година
родитељ
комит
56bbe0742c

+ 13 - 19
src/pages/Detail/FlowModal.js

@@ -461,29 +461,18 @@ function FlowModal(props) {
         onCancel={onClose}
         footer={false}
         width="98%"
+        bodyStyle={{ maxHeight: '660px' }}
       >
         <Row gutter={8}>
           <Col span={14}>
             <Flow meta={{ type: 'view' }} flowDetail={graphData} onSelectNode={handleSelectNode} />
           </Col>
           <Col span={10}>
-            <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
-              <div style={{ fontSize: '16px' }}>清单列表</div>
-              {isOut && (
-                <Button
-                  type="primary"
-                  style={{ float: 'right', marginBottom: '10px' }}
-                  onClick={() => setVersionVisible(true)}
-                >
-                  新建清单
-                </Button>
-              )}
-            </div>
-
+            <div style={{ fontSize: '16px', marginBottom: '10px' }}>清单列表</div>
             <div style={{ display: 'flex' }}>
               <Select
                 defaultValue={selectType}
-                style={{ width: '30%' }}
+                style={{ width: '20%' }}
                 onChange={value => {
                   setSelectType(value);
                   setInputValue('');
@@ -498,19 +487,24 @@ function FlowModal(props) {
                 value={inputValue}
                 onChange={e => setInputValue(e.target.value)}
               />
-              <Button type="primary" style={{ marginLeft: '10px' }}>
-                搜索
-              </Button>
+              {isOut && (
+                <Button
+                  type="primary"
+                  style={{ marginLeft: '20%' }}
+                  onClick={() => setVersionVisible(true)}
+                >
+                  新建清单
+                </Button>
+              )}
             </div>
             <div style={{ width: '100%', marginTop: '10px' }}>
               <Table
-                style={{ maxHeight: '80%' }}
                 columns={columns}
                 dataSource={showData} //data
                 loading={nodeLoading}
                 bordered={false}
                 pagination={{ position: ['none', 'none'], pageSize: 999, onChange }}
-                scroll={{ y: 65 * pageSize }}
+                scroll={{ y: '460px' }}
                 // childrenColumnName="none"
                 // expandable={{
                 //   expandedRowRender: record => (

+ 15 - 1
src/pages/Detail/Index.js

@@ -20,7 +20,12 @@ import CommitAuditModal from './CommitAuditModal';
 import CommentContent from '@/components/CommentContent';
 import MergeModal from './MergeModal';
 import { GetTokenFromUrl, getToken } from '@/utils/utils';
-import { queryDelPurchaseExcel, queryDetail, queryDingInstanceExecute } from '@/services/boom';
+import {
+  queryDelPurchaseExcel,
+  queryDelSheetRecord,
+  queryDetail,
+  queryDingInstanceExecute,
+} from '@/services/boom';
 import HistoryDrawer from './HistoryDrawer';
 import AuditFlow from './AuditFlow';
 import { getCurrentUser } from '@/utils/authority';
@@ -322,6 +327,14 @@ function Detail(props) {
     });
   };
 
+  const onDelSheet = async id => {
+    const params = {
+      excel_id: version.id,
+      sheet_id: id,
+    };
+    await queryDelSheetRecord(params);
+  };
+
   const onAudit = ({ audit_comment }) => {
     const flowNode = flow.currentNode;
     dispatch({
@@ -1120,6 +1133,7 @@ function Detail(props) {
               templateId={templateId}
               getUser={getUser}
               onUpdate={onUpdate}
+              onDelSheet={onDelSheet}
             />
           )}
         </div>

+ 6 - 3
src/pages/Detail/LuckySheet.js

@@ -62,7 +62,7 @@ class LuckySheet extends React.Component {
     return uuid.join('');
   }
   renderSheet(currentData) {
-    const { onClickCell, version, getUser, onUpdate, templateId } = this.props;
+    const { onClickCell, version, getUser, onUpdate, templateId, onDelSheet } = this.props;
     const data = currentData || this.props.data;
     if (!this.luckysheet) {
       clearTimeout(this.renderTimer);
@@ -99,6 +99,9 @@ class LuckySheet extends React.Component {
             this.luckysheet.setCellFormat(0, 0, 'bg', '#fff');
           }, 100);
         },
+        sheetDeleteAfter: sheet => {
+          onDelSheet && onDelSheet(sheet?.sheet.id);
+        },
       },
     };
     if (version) {
@@ -109,8 +112,8 @@ class LuckySheet extends React.Component {
         templateId: templateId,
         // flowId: version.flow_id,
         loadUrl: `/api/v1/purchase/record/sheet?gridKey=${version.id}&JWT-TOKEN=${token}`,
-        updateUrl: `ws://${location.host}/api/v1/ws?id=${version.id}&sid=${templateId}&JWT-TOKEN=${token}`,
-        // updateUrl: `ws://120.55.44.4:8896/api/v1/ws?id=${version.id}&sid=${templateId}&JWT-TOKEN=${token}`,
+        // updateUrl: `ws://${location.host}/api/v1/ws?id=${version.id}&sid=${templateId}&JWT-TOKEN=${token}`,
+        updateUrl: `ws://120.55.44.4:8896/api/v1/ws?id=${version.id}&sid=${templateId}&JWT-TOKEN=${token}`,
         authorityUrl: `/api/v1/purchase/bom/user/excel/col?depId=${localStorage.depId}&JWT-TOKEN=${token}`,
         getUser,
         // workbookCreateBefore(luckysheet) {

+ 10 - 6
src/pages/Detail/models/detail.js

@@ -81,7 +81,7 @@ export default {
     auditExcel: [],
     dingInstanceD: [],
     typeOptions: [],
-    classifyList:[],
+    classifyList: [],
   },
 
   effects: {
@@ -565,13 +565,15 @@ export default {
         });
       }
     },
-    *queryClassify ({ payload, callback }, { call, put }) {
+    *queryClassify({ payload, callback }, { call, put }) {
       const data = yield call(queryClassify, payload);
       if (data) {
-         yield put({
+        yield put({
           type: 'save',
           payload: {
-            typeOptions: data?.map(item=>{return {...item, label:item.name, value:item.id}}),
+            typeOptions: data?.map(item => {
+              return { ...item, label: item.name, value: item.id };
+            }),
           },
         });
       }
@@ -579,10 +581,12 @@ export default {
     *queryBindClassify({ payload, callback }, { call, put }) {
       const data = yield call(queryBindClassify, payload);
       if (data) {
-         yield put({
+        yield put({
           type: 'save',
           payload: {
-            classifyList: data?.map(item=>{return {...item, label:item.name, value:item.id}}),
+            classifyList: data?.map(item => {
+              return { ...item, label: item.name, value: item.id };
+            }),
           },
         });
       }

+ 29 - 26
src/pages/List/ClassifyModal.js

@@ -1,54 +1,53 @@
-import { List, Modal, Select, Table } from "antd";
-import TreeSelect from "rc-tree-select";
-import React, { useEffect, useMemo } from "react";
+import { Button, List, Modal, Select, Table } from 'antd';
+import TreeSelect from 'rc-tree-select';
+import React, { useEffect, useMemo } from 'react';
 
-const ClassifyModal = ({ data, visible,userList, onClose, handleChange }) => {
-  const {classify =[], project_id} = data
+const ClassifyModal = ({ data, visible, userList, onClose, handleChange }) => {
+  const { classify = [], project_id } = data;
   const list = useMemo(() => {
     return userList.map(item => {
-      return {label:item.CName, value:item.ID}
-    })
-  }, [userList])
+      return { label: item.CName, value: item.ID };
+    });
+  }, [userList]);
 
   const onChange = (e, item) => {
-    console.log(e, item)
+    console.log(e, item);
     const idx = classify.findIndex(cur => cur.classify_id == item.classify_id);
     if (idx > -1) {
       const curClassifyItem = { ...classify[idx], uid: e.join(',') };
       classify[idx] = curClassifyItem;
-      handleChange({project_id, classify})
+      handleChange({ project_id, classify });
     }
-  }
+  };
 
   const columns = [
     {
       title: '分类名称',
       width: '50%',
-      render: item =>  item.name,
+      render: item => item.name,
     },
     {
       title: '选择操作人',
       width: '50%',
       render: item => {
-        return ( 
+        return (
           <Select
             mode="multiple"
             allowClear
             style={{ width: '100%' }}
             placeholder="选择操作人"
-            defaultValue={item.uid ? item.uid.split(",").map(item=>Number(item)) : []}
-            onChange={(e) =>  onChange(e,item) }
+            defaultValue={item.uid ? item.uid.split(',').map(item => Number(item)) : []}
+            onChange={e => onChange(e, item)}
             options={list}
           />
-        )
-      }
-    }
-  ]
-  
+        );
+      },
+    },
+  ];
 
-  return ( 
+  return (
     <Modal
-      width='60%'
+      width="60%"
       // confirmLoading={loading}
       maskClosable={false}
       destroyOnClose
@@ -56,6 +55,11 @@ const ClassifyModal = ({ data, visible,userList, onClose, handleChange }) => {
       visible={visible}
       onCancel={onClose}
       onOk={onClose}
+      footer={[
+        <Button key="submit" type="primary" onClick={onClose}>
+          确定
+        </Button>,
+      ]}
     >
       <Table
         columns={columns}
@@ -64,7 +68,6 @@ const ClassifyModal = ({ data, visible,userList, onClose, handleChange }) => {
         scroll={{ y: 500 }}
       />
     </Modal>
-  )
-
-}
-export default ClassifyModal;
+  );
+};
+export default ClassifyModal;

+ 10 - 3
src/services/boom.js

@@ -13,6 +13,14 @@ import { stringify } from 'qs';
 export async function queryRecord(params) {
   return request(`/purchase/record?${stringify(params)}`);
 }
+//删除excel中单个sheet页
+export async function queryDelSheetRecord(params) {
+  const response = await request(`/purchase/bom/del-purchase-excel-sheet?${stringify(params)}`);
+  if (response.code == 200) {
+    message.success('删除成功');
+  }
+}
+
 // 查询全部工作流
 export async function queryFlowList(params) {
   return request(`/purchase/bom/flows?${stringify(params)}`);
@@ -398,7 +406,7 @@ export async function queryUserListByRoleID(params) {
 
 //新增工作流时调用接口 给项目绑定默认分类列表
 //purchase/bom/default-bind-classify?project_id=1
-export async function queryDefaultBindClassify (params) {
+export async function queryDefaultBindClassify(params) {
   let res = await request(`/purchase/bom/default-bind-classify?${stringify(params)}`, {
     method: 'GET',
   });
@@ -413,7 +421,7 @@ export async function queryClassify() {
   return res.data;
 }
 
-export async function queryBindClassify (params) {
+export async function queryBindClassify(params) {
   let res = await request(`/purchase/bom/get-bind-classify?${stringify(params)}`, {
     method: 'GET',
   });
@@ -433,4 +441,3 @@ export async function queryDelPurchaseExcel(params) {
   });
   return res;
 }
-