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
width: '150px', style={{
whiteSpace: 'nowrap', /* 不换行 */ width: '150px',
overflow: 'hidden', /* 超出部分隐藏 */ whiteSpace: 'nowrap' /* 不换行 */,
textOverflow: 'ellipsis' /* 显示省略号 */ overflow: 'hidden' /* 超出部分隐藏 */,
}}> textOverflow: 'ellipsis' /* 显示省略号 */,
{text} }}
</div> >
</Tooltip> {text}
</div>
</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,103 +125,127 @@ const ApkUpload = props => { ...@@ -81,103 +125,127 @@ const ApkUpload = props => {
return; return;
} }
setLoadding(true); setLoadding(true);
postAppVersionInfo(formData).then(res=> { postAppVersionInfo(formData)
if(res.code === 0){ .then(res => {
message.success('新版本提交成功!'); if (res.code === 0) {
getRecords(); message.success('新版本提交成功!');
form.resetFields() getRecords();
}else{ form.resetFields();
message.error(res.msg) } else {
} message.error(res.msg);
}).catch(err=>{ }
console.log(err, '提交失败') })
}); .catch(err => {
console.log(err, '提交失败');
});
setLoadding(false); setLoadding(false);
}; };
return ( return (
<div style={{ <div
display: 'flex', style={{
width: '100%' display: 'flex',
}}> width: '100%',
<Form
style={{
width: '50%'
}}
{...layout}
initialValues={{
DownUrl: '',
ApkName: '水务掌天下'
}} }}
form={form} className={styles.apkUpload}
name="control-hooks"
onFinish={valus => console.log(valus, '表单完成信息')}
> >
<Form.Item name="ApkName" label="应用名称" rules={[{ required: true }]}> <Form
<Input placeholder="请输入应用名称" /> style={{
</Form.Item> width: '50%',
<Form.Item name="Ver" label="发布版本号" rules={[{ required: true }]}> }}
<Input placeholder="请输入发布版本号" /> {...layout}
</Form.Item> initialValues={{
<Form.Item name="UploadLog" label="发版说明" rules={[{ required: true }]}> DownUrl: '',
<TextArea rows={6} placeholder="请输入发版说明" /> ApkName: '水务掌天下',
</Form.Item> }}
<Form.Item name="DownUrl" style={{ display: 'none' }} /> form={form}
<Form.Item name="control-hooks"
name="UploadFile" onFinish={valus => console.log(valus, '表单完成信息')}
label="上传APK"
rules={[{ required: true }]}
valuePropName="fileList"
getValueFromEvent={normFile}
> >
<Upload <Form.Item name="ApkName" label="应用名称" rules={[{ required: true }]}>
maxCount={1} <Input placeholder="请输入应用名称" />
onChange={baseFile => { </Form.Item>
const file = baseFile.file; <Form.Item label="发版版本号">
let sourcePath = ''; <Space>
if (file.status === 'done' && file.response.code === 0) { <Form.Item name="Ver" noStyle rules={[{ required: true, message: '请输入版本号' }]}>
sourcePath = `/PandaOMS/OMS/FileCenter/DownLoadFiles?filepath=${file.response.data}`; <Input placeholder="请输入发版版本号" />
message.success('上传成功!'); </Form.Item>
} else if (file.status === 'done' && file.response.code !== 0) { <Tooltip title="上传apk自动获取">
message.error('上传失败:' + file.response.msg); <QuestionCircleOutlined />
} </Tooltip>
form.setFieldsValue({ </Space>
DownUrl: sourcePath, </Form.Item>
}); <Form.Item name="UploadLog" label="发版日志" rules={[{ required: true }]}>
console.log(file, '上传图片'); <TextArea
}} rows={6}
name="file" placeholder="请输入发版日志,例:
a 更新日志:
action={`${window.origin}/PandaOMS/OMS/FileCenter/UploadApk`} 1.修复bugXXXX
accept=".apk" 2.新增功能XXXX"
> />
<Button icon={<UploadOutlined />}>上传APK</Button> </Form.Item>
</Upload> <Form.Item name="DownUrl" style={{ display: 'none' }} />
</Form.Item> <Form.Item
<Form.Item {...tailLayout}> name="UploadFile"
<Button label="上传APK"
loading={loadding} rules={[{ required: true }]}
type="primary" valuePropName="fileList"
onClick={() => { getValueFromEvent={normFile}
console.log(form.getFieldsValue(), '表单完成信息');
postAPPUploadInfo();
}}
> >
提交 <Upload
</Button> maxCount={1}
</Form.Item> onChange={async baseFile => {
</Form> const file = baseFile.file;
<Table let sourcePath = '';
style={{ if (file.status === 'done' && file.response.code === 0) {
width: '50%' sourcePath = `/PandaOMS/OMS/FileCenter/DownLoadFiles?filepath=${
}} file.response.data
columns={columns} }`;
pagination={{ getVerionInfo(file.response.data);
pageSize: 10 message.success('上传成功!');
}} } else if (file.status === 'done' && file.response.code !== 0) {
dataSource={dataSource} message.error('上传失败:' + file.response.msg);
/> }
form.setFieldsValue({
DownUrl: sourcePath,
});
console.log(file, '上传图片');
}}
name="file"
a
action={`${window.origin}/PandaOMS/OMS/FileCenter/UploadApk`}
accept=".apk"
>
<Button icon={<UploadOutlined />}>上传APK</Button>
</Upload>
</Form.Item>
<Form.Item {...tailLayout}>
<Button
loading={loadding}
type="primary"
onClick={() => {
console.log(form.getFieldsValue(), '表单完成信息');
postAPPUploadInfo();
}}
>
提交
</Button>
</Form.Item>
</Form>
<Table
bordered={true}
style={{
width: '50%',
}}
columns={columns}
pagination={{
pageSize: 10,
}}
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