Commit 072ee41e authored by 涂伟's avatar 涂伟
parents 283bf7be 727ab1b2
Pipeline #93810 passed with stages
import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle } from 'react'; import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
import { Space, Button, Divider, Table, Tooltip, message } from 'antd'; import { Space, Button, Divider, Table, Tooltip, message, Switch } from 'antd';
import { DeleteOutlined, EditTwoTone, PlusOutlined } from '@ant-design/icons'; import { DeleteOutlined, EditTwoTone, PlusOutlined } from '@ant-design/icons';
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce';
import RoalChoose from './RoalChoose'; import RoalChoose from './RoalChoose';
...@@ -13,11 +13,13 @@ const ConfgUndertake = (props, ref) => { ...@@ -13,11 +13,13 @@ const ConfgUndertake = (props, ref) => {
const [chooseUser, setChooseUser] = useState(); // 当前编辑角色或者机构的默认承办人 const [chooseUser, setChooseUser] = useState(); // 当前编辑角色或者机构的默认承办人
const [showUnderTaker, setShowUnderTaker] = useState(false); // 是否显示选择默认承办人弹窗 const [showUnderTaker, setShowUnderTaker] = useState(false); // 是否显示选择默认承办人弹窗
const [roleList, setRoleList] = useState([]); const [roleList, setRoleList] = useState([]);
const [IsDynamicDefaultUser, setIsDynamicDefaultUser] = useState(0)
const delayedNodeChange = useRef(debounce(list => nodeChage('roleList', list), 500)).current; const delayedNodeChange = useRef(debounce(list => nodeChage('roleList', list), 500)).current;
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
getParmar, getParmar,
})); }));
useEffect(() => { useEffect(() => {
setIsDynamicDefaultUser(editMsg.IsDynamicDefaultUser || 0)
setRoleList(editMsg.roleList); setRoleList(editMsg.roleList);
}, [editMsg]); }, [editMsg]);
const getParmar = () => ({ roleList }); const getParmar = () => ({ roleList });
...@@ -55,6 +57,11 @@ const ConfgUndertake = (props, ref) => { ...@@ -55,6 +57,11 @@ const ConfgUndertake = (props, ref) => {
nodeChage('roleList', list); nodeChage('roleList', list);
setShowUnderTaker(false); setShowUnderTaker(false);
}; };
const onChangeDefaultUser = e => {
setIsDynamicDefaultUser(e ? 1 : 0)
nodeChage('IsDynamicDefaultUser', e ? 1 : 0);
};
// 定义表格 // 定义表格
const columns = [ const columns = [
{ {
...@@ -192,6 +199,17 @@ const ConfgUndertake = (props, ref) => { ...@@ -192,6 +199,17 @@ const ConfgUndertake = (props, ref) => {
})} })}
pagination={false} pagination={false}
/> />
<div style={{ display: 'flex', justifyContent: 'right', marginTop: 14, marginBottom: '12px' }}>
是否动态承办人
<Switch
style={{ marginLeft: '5px' }}
checked={IsDynamicDefaultUser !== 0}
onChange={onChangeDefaultUser}
/>
</div>
<div className={styles.titleBox} style={{ color: '#BCBCBC', fontSize: 14, paddingLeft: 20 }}>
开启动态承办人后当前角色里所有人都是承办人
</div>
<RoalChoose <RoalChoose
roleList={roleList} roleList={roleList}
visible={showRoal} visible={showRoal}
......
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Form, Table , Input, message, Button, Upload, Tooltip } from 'antd'; import { Form, Table, Input, message, Button, Upload, Tooltip, Space, Tag } from 'antd';
import { getAppUploadRecords, postAppVersionInfo } from '@/services/mobileConfig/api'; import {
import { UploadOutlined } from '@ant-design/icons'; getAppUploadRecords,
postAppVersionInfo,
getApkVerionInfo,
} from '@/services/mobileConfig/api';
import { UploadOutlined, QuestionCircleOutlined, DownloadOutlined } from '@ant-design/icons';
import { request } from '@wisdom-utils/utils/es'; import { request } from '@wisdom-utils/utils/es';
const ApkUpload = props => { const ApkUpload = props => {
const [loadding, setLoadding] = useState(false); const [loadding, setLoadding] = useState(false);
...@@ -23,7 +27,25 @@ const ApkUpload = props => { ...@@ -23,7 +27,25 @@ const ApkUpload = props => {
{ {
title: '版本号', title: '版本号',
dataIndex: 'Ver', dataIndex: 'Ver',
width: 200,
key: 'Ver', key: 'Ver',
render: (text, record, index) => {
if (index === 0)
return (
<>
{text}
<Tag
color="blue"
style={{
marginLeft: '10px',
}}
>
当前版本
</Tag>
</>
);
return <>{text}</>;
},
}, },
{ {
title: '上传时间', title: '上传时间',
...@@ -34,31 +56,35 @@ const ApkUpload = props => { ...@@ -34,31 +56,35 @@ const ApkUpload = props => {
title: '发版日志', title: '发版日志',
dataIndex: 'UploadLog', dataIndex: 'UploadLog',
key: 'UploadLog', key: 'UploadLog',
render: (text, recore, index) => render: (text, record, index) => (
<Tooltip title= {text}> <Tooltip title={text}>
<div style={{ <div
style={{
width: '150px', width: '150px',
whiteSpace: 'nowrap', /* 不换行 */ whiteSpace: 'nowrap' /* 不换行 */,
overflow: 'hidden', /* 超出部分隐藏 */ overflow: 'hidden' /* 超出部分隐藏 */,
textOverflow: 'ellipsis' /* 显示省略号 */ textOverflow: 'ellipsis' /* 显示省略号 */,
}}> }}
>
{text} {text}
</div> </div>
</Tooltip> </Tooltip>
),
}, },
{ {
title: '下载', title: '下载',
key: 'DownUrl', key: 'DownUrl',
dataIndex: 'DownUrl', dataIndex: 'DownUrl',
render: (text, record, index) => <UploadOutlined onClick={()=> window.open(`${window.origin}${text}`, '_self') }/> render: (text, record, index) => {
return <DownloadOutlined onClick={() => window.open(`${window.origin}${text}`, '_self')} />;
},
}, },
]; ];
const [form] = Form.useForm(); const [form] = Form.useForm();
useEffect(()=>{ useEffect(() => {
getRecords(); getRecords();
//getAppUploadRecords().then(x=> console.log(x, '上传记录')) }, []);
}, [])
const normFile = e => { const normFile = e => {
if (Array.isArray(e)) { if (Array.isArray(e)) {
return e; return e;
...@@ -66,12 +92,30 @@ const ApkUpload = props => { ...@@ -66,12 +92,30 @@ const ApkUpload = props => {
return e?.fileList; return e?.fileList;
}; };
const getVerionInfo = filePath => {
getApkVerionInfo({
apkPath: filePath,
})
.then(res => {
if (res.code === 0) {
if (res.data) {
form.setFieldsValue({
Ver: 'V' + res.data?.versionName,
});
}
}
})
.catch(err => {
console.log(err);
});
};
const getRecords = async () => { const getRecords = async () => {
const res = await getAppUploadRecords(); const res = await getAppUploadRecords();
if(res.code === 0){ if (res.code === 0) {
setDataSource(res.data || []); setDataSource(res.data || []);
} }
} };
const postAPPUploadInfo = async () => { const postAPPUploadInfo = async () => {
await form.validateFields(); await form.validateFields();
...@@ -81,32 +125,37 @@ const ApkUpload = props => { ...@@ -81,32 +125,37 @@ const ApkUpload = props => {
return; return;
} }
setLoadding(true); setLoadding(true);
postAppVersionInfo(formData).then(res=> { postAppVersionInfo(formData)
if(res.code === 0){ .then(res => {
if (res.code === 0) {
message.success('新版本提交成功!'); message.success('新版本提交成功!');
getRecords(); getRecords();
form.resetFields() form.resetFields();
}else{ } else {
message.error(res.msg) message.error(res.msg);
} }
}).catch(err=>{ })
console.log(err, '提交失败') .catch(err => {
console.log(err, '提交失败');
}); });
setLoadding(false); setLoadding(false);
}; };
return ( return (
<div style={{ <div
style={{
display: 'flex', display: 'flex',
width: '100%' width: '100%',
}}> }}
className={styles.apkUpload}
>
<Form <Form
style={{ style={{
width: '50%' width: '50%',
}} }}
{...layout} {...layout}
initialValues={{ initialValues={{
DownUrl: '', DownUrl: '',
ApkName: '水务掌天下' ApkName: '水务掌天下',
}} }}
form={form} form={form}
name="control-hooks" name="control-hooks"
...@@ -115,11 +164,24 @@ const ApkUpload = props => { ...@@ -115,11 +164,24 @@ const ApkUpload = props => {
<Form.Item name="ApkName" label="应用名称" rules={[{ required: true }]}> <Form.Item name="ApkName" label="应用名称" rules={[{ required: true }]}>
<Input placeholder="请输入应用名称" /> <Input placeholder="请输入应用名称" />
</Form.Item> </Form.Item>
<Form.Item name="Ver" label="发布版本号" rules={[{ required: true }]}> <Form.Item label="发版版本号">
<Input placeholder="请输入发布版本号" /> <Space>
<Form.Item name="Ver" noStyle rules={[{ required: true, message: '请输入版本号' }]}>
<Input placeholder="请输入发版版本号" />
</Form.Item> </Form.Item>
<Form.Item name="UploadLog" label="发版说明" rules={[{ required: true }]}> <Tooltip title="上传apk自动获取">
<TextArea rows={6} placeholder="请输入发版说明" /> <QuestionCircleOutlined />
</Tooltip>
</Space>
</Form.Item>
<Form.Item name="UploadLog" label="发版日志" rules={[{ required: true }]}>
<TextArea
rows={6}
placeholder="请输入发版日志,例:
更新日志:
1.修复bugXXXX
2.新增功能XXXX"
/>
</Form.Item> </Form.Item>
<Form.Item name="DownUrl" style={{ display: 'none' }} /> <Form.Item name="DownUrl" style={{ display: 'none' }} />
<Form.Item <Form.Item
...@@ -131,11 +193,14 @@ const ApkUpload = props => { ...@@ -131,11 +193,14 @@ const ApkUpload = props => {
> >
<Upload <Upload
maxCount={1} maxCount={1}
onChange={baseFile => { onChange={async baseFile => {
const file = baseFile.file; const file = baseFile.file;
let sourcePath = ''; let sourcePath = '';
if (file.status === 'done' && file.response.code === 0) { if (file.status === 'done' && file.response.code === 0) {
sourcePath = `/PandaOMS/OMS/FileCenter/DownLoadFiles?filepath=${file.response.data}`; sourcePath = `/PandaOMS/OMS/FileCenter/DownLoadFiles?filepath=${
file.response.data
}`;
getVerionInfo(file.response.data);
message.success('上传成功!'); message.success('上传成功!');
} else if (file.status === 'done' && file.response.code !== 0) { } else if (file.status === 'done' && file.response.code !== 0) {
message.error('上传失败:' + file.response.msg); message.error('上传失败:' + file.response.msg);
...@@ -167,17 +232,20 @@ const ApkUpload = props => { ...@@ -167,17 +232,20 @@ const ApkUpload = props => {
</Form.Item> </Form.Item>
</Form> </Form>
<Table <Table
bordered={true}
style={{ style={{
width: '50%' width: '50%',
}} }}
columns={columns} columns={columns}
pagination={{ pagination={{
pageSize: 10 pageSize: 10,
}} }}
dataSource={dataSource} dataSource={dataSource}
rowClassName={(record, index) => {
if (index === 0) return 'newVer-row';
}}
/> />
</div> </div>
); );
}; };
export default ApkUpload; export default ApkUpload;
.apkUpload{
:global{
.newVer-row{
background-color: #e6f7ff; /* 淡蓝色背景 */
font-weight: bold; /* 粗体字体 */
color: #1890ff; /* Ant Design主色 */
}
}
}
...@@ -124,3 +124,5 @@ export const upgradeCardVersion = parmas => post(`${PUBLISH_SERVICE}/WebSite/App ...@@ -124,3 +124,5 @@ export const upgradeCardVersion = parmas => post(`${PUBLISH_SERVICE}/WebSite/App
export const postAppVersionInfo = parmas => post(`${PUBLISH_SERVICE}/Mobile/PostAppVersionInfo`, parmas); export const postAppVersionInfo = parmas => post(`${PUBLISH_SERVICE}/Mobile/PostAppVersionInfo`, parmas);
export const getAppUploadRecords = parmas => get(`${PUBLISH_SERVICE}/Mobile/GetAppUploadRecords`, parmas); export const getAppUploadRecords = parmas => get(`${PUBLISH_SERVICE}/Mobile/GetAppUploadRecords`, parmas);
export const getApkVerionInfo = parmas => get(`${PUBLISH_SERVICE}/FileCenter/GetApkVerionInfo`, parmas);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment