fangmingyue 2 年之前
父節點
當前提交
667ea4b95d
共有 1 個文件被更改,包括 20 次插入3 次删除
  1. 20
    3
      src/pages/check/index.jsx

+ 20
- 3
src/pages/check/index.jsx 查看文件

3
 import { useNavigate, Link } from 'react-router-dom';
3
 import { useNavigate, Link } from 'react-router-dom';
4
 import { queryTable } from "@/utils/request";
4
 import { queryTable } from "@/utils/request";
5
 import { ProTable } from "@ant-design/pro-components";
5
 import { ProTable } from "@ant-design/pro-components";
6
-import { Button, message, Popconfirm } from "antd";
6
+import { Button, message, Popconfirm, Input, Modal } from "antd";
7
 import { getTaCheck, deleteTaCheck, putTaCheck, calcScoreTaCheck } from '@/service/tacheck';
7
 import { getTaCheck, deleteTaCheck, putTaCheck, calcScoreTaCheck } from '@/service/tacheck';
8
 
8
 
9
 const queryList = queryTable(getTaCheck);
9
 const queryList = queryTable(getTaCheck);
13
   const navigate = useNavigate();
13
   const navigate = useNavigate();
14
   const actionRef = React.useRef();
14
   const actionRef = React.useRef();
15
   const [messageApi, contextHolder] = message.useMessage();
15
   const [messageApi, contextHolder] = message.useMessage();
16
+  const [open, setOpen] = React.useState(false);
17
+  const [check, setCheck] = React.useState({});
16
 
18
 
17
   const onDelete = (item) => {
19
   const onDelete = (item) => {
18
     deleteTaCheck(item.checkId).then(() => {
20
     deleteTaCheck(item.checkId).then(() => {
21
   }
23
   }
22
 
24
 
23
   const onUpdateStatus = (item) => {
25
   const onUpdateStatus = (item) => {
24
-    putTaCheck(item.checkId, {...item, status: Math.abs(item.status - 1)}).then(() => {
26
+    putTaCheck(item.checkId, { ...item, status: Math.abs(item.status - 1) }).then(() => {
25
       actionRef.current.reload();
27
       actionRef.current.reload();
26
     })
28
     })
27
   }
29
   }
40
     });
42
     });
41
   }
43
   }
42
 
44
 
45
+  const onOpen = (record) => {
46
+    setCheck(record);
47
+    setOpen(true)
48
+  }
49
+
43
   const columns = [
50
   const columns = [
44
     {
51
     {
45
       title: "测评名称",
52
       title: "测评名称",
81
       title: "调查问卷得分",
88
       title: "调查问卷得分",
82
       dataIndex: "surveyScore",
89
       dataIndex: "surveyScore",
83
       hideInSearch: true,
90
       hideInSearch: true,
84
-      render: (_, row) => {        
91
+      render: (_, row) => {
85
         const origin = row.surveyScore || 0;
92
         const origin = row.surveyScore || 0;
86
         const percent = row.surveyScorePercent || 0;
93
         const percent = row.surveyScorePercent || 0;
87
         const score = Number(origin * percent).toFixed(2);
94
         const score = Number(origin * percent).toFixed(2);
109
       valueType: "option",
116
       valueType: "option",
110
       width: 240,
117
       width: 240,
111
       render: (_, record) => [
118
       render: (_, record) => [
119
+        console.log('record', record),
112
         // <Button
120
         // <Button
113
         //   key={1}
121
         //   key={1}
114
         //   style={{ padding: 0 }}
122
         //   style={{ padding: 0 }}
143
             计算分数
151
             计算分数
144
           </Button>
152
           </Button>
145
         </Popconfirm>,
153
         </Popconfirm>,
154
+        <Button type="link" key={5} onClick={() => { onOpen(record) }}>复制</Button>,
146
       ],
155
       ],
147
     },
156
     },
148
   ]
157
   ]
150
   return (
159
   return (
151
     <Page>
160
     <Page>
152
       {contextHolder}
161
       {contextHolder}
162
+      <Modal
163
+        title="复制"
164
+        open={open}
165
+        onCancel={() => setOpen(false)}
166
+      >
167
+        测评名称:
168
+        <Input placeholder="请输入" value={check.title + '-复制'} />
169
+      </Modal>
153
       <ProTable
170
       <ProTable
154
         actionRef={actionRef}
171
         actionRef={actionRef}
155
         rowKey="checkId"
172
         rowKey="checkId"