Commit 072ee41e authored by 涂伟's avatar 涂伟
parents 283bf7be 727ab1b2
Pipeline #93810 passed with stages
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 debounce from 'lodash/debounce';
import RoalChoose from './RoalChoose';
......@@ -13,11 +13,13 @@ const ConfgUndertake = (props, ref) => {
const [chooseUser, setChooseUser] = useState(); // 当前编辑角色或者机构的默认承办人
const [showUnderTaker, setShowUnderTaker] = useState(false); // 是否显示选择默认承办人弹窗
const [roleList, setRoleList] = useState([]);
const [IsDynamicDefaultUser, setIsDynamicDefaultUser] = useState(0)
const delayedNodeChange = useRef(debounce(list => nodeChage('roleList', list), 500)).current;
useImperativeHandle(ref, () => ({
getParmar,
}));
useEffect(() => {
setIsDynamicDefaultUser(editMsg.IsDynamicDefaultUser || 0)
setRoleList(editMsg.roleList);
}, [editMsg]);
const getParmar = () => ({ roleList });
......@@ -55,6 +57,11 @@ const ConfgUndertake = (props, ref) => {
nodeChage('roleList', list);
setShowUnderTaker(false);
};
const onChangeDefaultUser = e => {
setIsDynamicDefaultUser(e ? 1 : 0)
nodeChage('IsDynamicDefaultUser', e ? 1 : 0);
};
// 定义表格
const columns = [
{
......@@ -192,6 +199,17 @@ const ConfgUndertake = (props, ref) => {
})}
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
roleList={roleList}
visible={showRoal}
......
import React, { useEffect, useMemo, useState } from 'react';
import styles from './index.less';
import { Form, Table , Input, message, Button, Upload, Tooltip } from 'antd';
import { getAppUploadRecords, postAppVersionInfo } from '@/services/mobileConfig/api';
import { UploadOutlined } from '@ant-design/icons';
import { Form, Table, Input, message, Button, Upload, Tooltip, Space, Tag } from 'antd';
import {
getAppUploadRecords,
postAppVersionInfo,
getApkVerionInfo,
} from '@/services/mobileConfig/api';
import { UploadOutlined, QuestionCircleOutlined, DownloadOutlined } from '@ant-design/icons';
import { request } from '@wisdom-utils/utils/es';
const ApkUpload = props => {
const [loadding, setLoadding] = useState(false);
......@@ -23,7 +27,25 @@ const ApkUpload = props => {
{
title: '版本号',
dataIndex: 'Ver',
width: 200,
key: 'Ver',
render: (text, record, index) => {
if (index === 0)
return (
<>
{text}
<Tag
color="blue"
style={{
marginLeft: '10px',
}}
>
当前版本
</Tag>
</>
);
return <>{text}</>;
},
},
{
title: '上传时间',
......@@ -34,31 +56,35 @@ const ApkUpload = props => {
title: '发版日志',
dataIndex: 'UploadLog',
key: 'UploadLog',
render: (text, recore, index) =>
<Tooltip title= {text}>
<div style={{
width: '150px',
whiteSpace: 'nowrap', /* 不换行 */
overflow: 'hidden', /* 超出部分隐藏 */
textOverflow: 'ellipsis' /* 显示省略号 */
}}>
{text}
</div>
</Tooltip>
render: (text, record, index) => (
<Tooltip title={text}>
<div
style={{
width: '150px',
whiteSpace: 'nowrap' /* 不换行 */,
overflow: 'hidden' /* 超出部分隐藏 */,
textOverflow: 'ellipsis' /* 显示省略号 */,
}}
>
{text}
</div>
</Tooltip>
),
},
{
title: '下载',
key: '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();
useEffect(()=>{
useEffect(() => {
getRecords();
//getAppUploadRecords().then(x=> console.log(x, '上传记录'))
}, [])
}, []);
const normFile = e => {
if (Array.isArray(e)) {
return e;
......@@ -66,12 +92,30 @@ const ApkUpload = props => {
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 res = await getAppUploadRecords();
if(res.code === 0){
if (res.code === 0) {
setDataSource(res.data || []);
}
}
};
const postAPPUploadInfo = async () => {
await form.validateFields();
......@@ -81,103 +125,127 @@ const ApkUpload = props => {
return;
}
setLoadding(true);
postAppVersionInfo(formData).then(res=> {
if(res.code === 0){
message.success('新版本提交成功!');
getRecords();
form.resetFields()
}else{
message.error(res.msg)
}
}).catch(err=>{
console.log(err, '提交失败')
});
postAppVersionInfo(formData)
.then(res => {
if (res.code === 0) {
message.success('新版本提交成功!');
getRecords();
form.resetFields();
} else {
message.error(res.msg);
}
})
.catch(err => {
console.log(err, '提交失败');
});
setLoadding(false);
};
return (
<div style={{
display: 'flex',
width: '100%'
}}>
<Form
style={{
width: '50%'
}}
{...layout}
initialValues={{
DownUrl: '',
ApkName: '水务掌天下'
<div
style={{
display: 'flex',
width: '100%',
}}
form={form}
name="control-hooks"
onFinish={valus => console.log(valus, '表单完成信息')}
className={styles.apkUpload}
>
<Form.Item name="ApkName" label="应用名称" rules={[{ required: true }]}>
<Input placeholder="请输入应用名称" />
</Form.Item>
<Form.Item name="Ver" label="发布版本号" rules={[{ required: true }]}>
<Input placeholder="请输入发布版本号" />
</Form.Item>
<Form.Item name="UploadLog" label="发版说明" rules={[{ required: true }]}>
<TextArea rows={6} placeholder="请输入发版说明" />
</Form.Item>
<Form.Item name="DownUrl" style={{ display: 'none' }} />
<Form.Item
name="UploadFile"
label="上传APK"
rules={[{ required: true }]}
valuePropName="fileList"
getValueFromEvent={normFile}
<Form
style={{
width: '50%',
}}
{...layout}
initialValues={{
DownUrl: '',
ApkName: '水务掌天下',
}}
form={form}
name="control-hooks"
onFinish={valus => console.log(valus, '表单完成信息')}
>
<Upload
maxCount={1}
onChange={baseFile => {
const file = baseFile.file;
let sourcePath = '';
if (file.status === 'done' && file.response.code === 0) {
sourcePath = `/PandaOMS/OMS/FileCenter/DownLoadFiles?filepath=${file.response.data}`;
message.success('上传成功!');
} else if (file.status === 'done' && file.response.code !== 0) {
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();
}}
<Form.Item name="ApkName" label="应用名称" rules={[{ required: true }]}>
<Input placeholder="请输入应用名称" />
</Form.Item>
<Form.Item label="发版版本号">
<Space>
<Form.Item name="Ver" noStyle rules={[{ required: true, message: '请输入版本号' }]}>
<Input placeholder="请输入发版版本号" />
</Form.Item>
<Tooltip title="上传apk自动获取">
<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 name="DownUrl" style={{ display: 'none' }} />
<Form.Item
name="UploadFile"
label="上传APK"
rules={[{ required: true }]}
valuePropName="fileList"
getValueFromEvent={normFile}
>
提交
</Button>
</Form.Item>
</Form>
<Table
style={{
width: '50%'
}}
columns={columns}
pagination={{
pageSize: 10
}}
dataSource={dataSource}
/>
<Upload
maxCount={1}
onChange={async baseFile => {
const file = baseFile.file;
let sourcePath = '';
if (file.status === 'done' && file.response.code === 0) {
sourcePath = `/PandaOMS/OMS/FileCenter/DownLoadFiles?filepath=${
file.response.data
}`;
getVerionInfo(file.response.data);
message.success('上传成功!');
} else if (file.status === 'done' && file.response.code !== 0) {
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>
);
};
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
export const postAppVersionInfo = parmas => post(`${PUBLISH_SERVICE}/Mobile/PostAppVersionInfo`, 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