Commit 8a5d3601 authored by 涂伟's avatar 涂伟

fix: '1.表结构升级功能添加2.已附加/未附加显示bug修复3.模板配置交互样式优化'

parent 92f71fbd
This diff was suppressed by a .gitattributes entry.
......@@ -36,6 +36,7 @@ import {
FunnelPlotOutlined,
BranchesOutlined,
ToolOutlined,
QuestionCircleTwoTone,
} from '@ant-design/icons';
import PageContainer from '@/components/BasePageContainer';
......@@ -46,6 +47,8 @@ import {
checkTableType,
regroupTableType,
GetDefaultTableFields,
CheckUpgradeTable,
UpgradeTable,
} from '@/services/tablemanager/tablemanager';
import { useHistory } from 'react-router-dom';
import { Ellipse } from 'bizcharts/lib/g-components';
......@@ -64,6 +67,7 @@ import styles from './index.less';
import formDesign from '@/assets/font/omsfont/formDesign.svg';
import tableDesign from '@/assets/font/omsfont/tableDesign.svg';
import deleteSvg from '@/assets/font/omsfont/delete.svg';
import update from '@/assets/font/omsfont/update.png';
const { Search } = Input;
const { Option } = Select;
const placeholder = '请输入表名';
......@@ -255,7 +259,11 @@ const TableManager = props => {
setSelectTableName('');
setPickIndex(0);
setSelect(groupArr[0].type);
if (!text) {
setShowSearchStyle(false);
} else {
setShowSearchStyle(true);
}
};
const getField = () => {
loadUnattachedTables().then(res => {
......@@ -281,7 +289,7 @@ const TableManager = props => {
item.tableStyle === '大'
? `一行三列/${item.labelStyle ? `${item.labelStyle}布局` : '左右布局'}`
: item.tableStyle;
let fieldCount = Number(item.fieldCount);
let fieldCount = Number(item.fieldCount === '(无)' ? 0 : item.fieldCount);
let extraFieldCount = Number(
item.extraFieldCount === '(无)' ? 0 : item.extraFieldCount,
);
......@@ -413,6 +421,47 @@ const TableManager = props => {
setFieldConfigShow(true);
};
const updateForm = (record, e) => {
e.stopPropagation();
let params = {
tableName: record.tableName,
toTableType:
record.groupName === '事件表' || record.groupName === '工单表'
? '事件工单表'
: record.groupName,
};
CheckUpgradeTable(params).then(res => {
if (res.code === 0) {
return Modal.confirm({
icon: <QuestionCircleTwoTone />,
content: '确定要升级表结构吗?',
okText: '确认',
cancelText: '取消',
onOk: () => {
console.log('确认了666666');
UpgradeTable(params).then(ress => {
if (ress.code === 0) {
message.success('升级成功!');
loadTable(showSearchStyle ? searchValue : '');
} else {
notification.error({
message: '提示',
duration: 3,
description: ress.msg,
});
}
});
},
});
}
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
});
};
const columns = [
{
title: '名称',
......@@ -420,7 +469,22 @@ const TableManager = props => {
key: 'tableName',
width: 400,
render: (text, record) => (
<div onClick={e => fieldsConfig(record, e)}>{searchStyle(text)}</div>
<div
onClick={e => fieldsConfig(record, e)}
style={{ display: 'flex', alignItems: 'center' }}
>
{searchStyle(text)}
{record.IsCanUpgrade ? (
<img
className={styles.btnImg}
alt=""
title="升级表结构"
style={{ marginLeft: '6px' }}
src={update}
onClick={e => updateForm(record, e)}
/>
) : null}
</div>
),
},
{
......
......@@ -572,7 +572,7 @@ const AddModal = props => {
// 改变关联事件类型
const onChangeEvent = (e, i) => {
console.log(e, i, '666');
if (!i) {
if (!i || !e) {
setKeepData(keep);
formAdd.resetFields();
}
......@@ -680,7 +680,7 @@ const AddModal = props => {
return (
<Drawer
title="巡维保计划配置"
title="模板配置"
visible={visible}
destroyOnClose
width="600px"
......@@ -922,29 +922,29 @@ const AddModal = props => {
<Input placeholder="请输入在线任务量" />
</Item>
</Col>
<Col span={24}>
<Item label="是否送审" name="isSubmit" labelCol={{ span: 5 }}>
<Col span={12}>
<Item label="自动派发" name="autoAssign" labelCol={{ span: 10 }}>
<Switch
checkedChildren="是"
unCheckedChildren="否"
checked={visibleChecked}
onChange={change}
checked={visibleChecked1}
onChange={change1}
disabled={autoFlag}
/>
{/* <Radio.Group defaultValue={chee}>
<Radio value="否">否</Radio>
<Radio value="是">是</Radio>
</Radio.Group> */}
</Item>
</Col>
<Col span={24}>
<Item label="自动派发" name="autoAssign" labelCol={{ span: 5 }}>
<Col span={12}>
<Item label="是否送审" name="isSubmit" labelCol={{ span: 10 }}>
<Switch
checkedChildren="是"
unCheckedChildren="否"
checked={visibleChecked1}
onChange={change1}
disabled={autoFlag}
checked={visibleChecked}
onChange={change}
/>
{/* <Radio.Group defaultValue={chee}>
<Radio value="否">否</Radio>
<Radio value="是">是</Radio>
</Radio.Group> */}
</Item>
</Col>
<Col span={24}>
......@@ -970,12 +970,17 @@ const AddModal = props => {
},
]}
>
<TextArea placeholder="例如:and 泵房品牌='熊猫'(SQL表达式)" />
<Input placeholder="例如:and 泵房品牌='熊猫'(SQL表达式)" />
</Item>
</Col>
<Col span={24}>
<Item label="关联事件" name="relationEvent" labelCol={{ span: 5 }}>
<Select placeholder="选择关联事件类型" showSearch onChange={e => onChangeEvent(e)}>
<Select
placeholder="选择关联事件类型"
showSearch
onChange={e => onChangeEvent(e)}
allowClear
>
{eventData
? eventData.map((item, index) => (
<Option key={index} value={item}>
......@@ -987,12 +992,12 @@ const AddModal = props => {
</Item>
</Col>
<Col span={23}>
<span style={{ fontSize: '12px', color: '#bfbcbc', marginLeft: '80px' }}>
<span style={{ fontSize: '12px', color: '#bfbcbc', marginLeft: '114px' }}>
当配置了关联事件后,可配置字段映射规则
</span>
<br />
<span style={{ fontSize: '12px', color: '#bfbcbc', marginLeft: '80px' }}>
配置后,巡维保发起的工单,可以传递该巡维保任务信息
<span style={{ fontSize: '12px', color: '#bfbcbc', marginLeft: '114px' }}>
配置后,设备维保发起的工单,可以传递该维保任务信息
</span>
</Col>
<Col span={4} />
......
......@@ -607,7 +607,7 @@ const AddModal = props => {
// 改变关联事件类型
const onChangeEvent = (e, i) => {
if (!i) {
if (!i || !e) {
setKeepData(keep);
formAdd.resetFields();
}
......@@ -832,7 +832,12 @@ const AddModal = props => {
</Col>
<Col span={23}>
<Item label="关联事件" name="relationEvent" labelCol={{ span: 4 }}>
<Select placeholder="选择关联事件类型" onChange={e => onChangeEvent(e)} showSearch>
<Select
placeholder="选择关联事件类型"
onChange={e => onChangeEvent(e)}
showSearch
allowClear
>
{eventData
? eventData.map((item, index) => (
<Option key={index} value={item}>
......@@ -849,7 +854,7 @@ const AddModal = props => {
</span>
<br />
<span style={{ fontSize: '12px', color: '#bfbcbc', marginLeft: '80px' }}>
配置后,巡检发起的工单,可以传递该巡检任务信息
配置后,管网巡检发起的工单,可以传递该巡检任务信息
</span>
</Col>
<Col span={4} />
......
......@@ -85,3 +85,10 @@ export const GetDefaultTableFields = query =>
export const GetTableGroupMeta = param =>
get(`${PUBLISH_SERVICE}/AccountManage/GetTableGroupMeta`, param);
// 升级表前类型检查
export const CheckUpgradeTable = param =>
get(`${PUBLISH_SERVICE}/CaseManage/CheckUpgradeTable`, param);
// 升级表类型
export const UpgradeTable = param => get(`${PUBLISH_SERVICE}/CaseManage/UpgradeTable`, param);
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