Commit 4c0477b6 authored by 皮倩雯's avatar 皮倩雯

修改数据字典模块

parents bf89e623 2d8a8a4e
Pipeline #31991 skipped with stages
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
......@@ -21,22 +21,26 @@ const EditForm = props => {
otherForm.resetFields();
}, [info]);
useEffect(() => {
if (nodeType === 1 || nodeType === 2) {
let arr = Object.keys(form.getFieldsValue());
let obj = {};
arr.map(i => {
obj[i] = info[i];
});
form.setFieldsValue({ ...obj, shortName: info.menuShortName });
}
if (nodeType === 3 || nodeType === 4) {
let arr = Object.keys(otherForm.getFieldsValue());
let obj = {};
arr.map(i => {
obj[i] = info[i];
});
otherForm.setFieldsValue({ ...obj, shortName: info.menuShortName });
if(JSON.stringify(info)!='{}' ){
let data =info.data
if (nodeType === 1 || nodeType === 2) {
let arr = Object.keys(form.getFieldsValue());
let obj = {};
arr.map(i => {
obj[i] = data[i];
});
form.setFieldsValue({ ...obj, shortName: data.menuShortName });
}
if (nodeType === 3 || nodeType === 4) {
let arr = Object.keys(otherForm.getFieldsValue());
let obj = {};
arr.map(i => {
obj[i] = data[i];
});
otherForm.setFieldsValue({ ...obj, shortName: data.menuShortName });
}
}
}, [info]);
const submit = () => {
......@@ -214,7 +218,7 @@ const EditForm = props => {
<Input />
</Item>
<CheckList
info={info}
info={info.data?info.data:{}}
nodeType={nodeType}
valueCallback={valueCallback}
/>
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, Radio, Checkbox, notification, Tooltip } from 'antd';
import {
getField, loadTableFields, LoadEventFields, LoadEventType, UpdateFields
} from '@/services/platform/bs'
import styles from './index.less'
import ChangeAdd from './changeAdd'
import { PlusSquareOutlined } from '@ant-design/icons';
import { shape } from 'prop-types';
const AddModal = props => {
const { callBackSubmit = () => { }, isType, itemData, isVisible, formObj1 } = props;
const [loading, setLoading] = useState(false);
const [fieldName, setFieldName] = useState([]); // 弹窗
const [eventList, setEventList] = useState([]); // 事件
const [filed, setFiled] = useState({}); // 事件
const [verification, setVerification] = useState([]);
const [Shape, setShape] = useState('文本')
const [characteristics, setCharacteristics] = useState(['文本', '数值', '唯一值文本', '多行文本', '编码', '地址', '本人部门', '本人姓名', '本人ID', '选择器', '搜索选择器', '值选择器', '值复选器', '业务选择器', '可编辑值选择器', '平铺值选择器', '站点选择器', '人员选择器', '人员选择器新', '城市选择器', '台账选择器', '附件', '可预览附件', '图片', '可预览图片', '录音', '视频', '日期时间', '日期', '日期月份', '日期年份', '日期周', '时分秒', '设备选择', '坐标控件', '区域控件', '路径控件', '智能抄表', '二维码识别', '设备二维码', '位置坐标'])
const [visible, setVisible] = useState(false); // 弹窗
const [isShow, setIsShow] = useState(false); // 弹窗
const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({ rule: [], numerical: '' });
const [characterValue, setCharacterValue] = useState('')
const [pramData, setPramData] = useState({ Unit: '', ExceptionEvent: '', Group: '', RowSpan: 0, ColSpan: 0, ReadOnly: false, EditableLater: false, ExceptionValue: '', Preset: '', picture: false, must: false, coordinates: false })
const [checkedList, setCheckedList] = useState([]);//选中的复选框内容
const { TextArea } = Input;
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
console.log('obj', obj);
let data = [{ Unit: pramData.Unit || '', StoreType: "nvarchar(255)", Group: pramData.Group || '', Shape, ExceptionEvent: pramData.ExceptionEvent || '', RowSpan: pramData.RowSpan || 0, ColSpan: pramData.ColSpan || 0, ReadOnly: pramData.ReadOnly || false, EditableLater: pramData.EditableLater || false, ExceptionValue: pramData.ExceptionValue || '', Preset: pramData.Preset || '', ID: Number(itemData.ID), Name: obj.Name, Alias: obj.Alias, SyncEvent: obj.SyncEvent, ValidationRule: obj.ValidationRule, ExceptionEventFields: characterValue }]
switch (Shape) {
case '编码':
data[0].Config = `${obj.code}.${obj.prefix ? obj.prefix : ''}`;
break
case '坐标控件':
pramData.coordinates ? data[0].Config = '当前坐标' : data[0].Config = '';
break
case '图片': case '可预览图片':
data[0].Preset = pramData.picture ? '拍照相册' : '';
data[0].ValidationRule = pramData.must ? 'required' : ''
break
default:
data[0].Config = obj.Config;
}
UpdateFields(data).then(res => {
setLoading(false);
if (res.msg === "Ok" || res.msg === "") {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '修改成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}
});
};
useEffect(() => {
if (isType != '') {
let req1 = getField({ fieldID: itemData.ID })
let req2 = loadTableFields({ tableName: formObj1.tableName })
let req3 = LoadEventType({})
Promise.all([req1, req2, req3]).then(res => {
res[1].msg === 'Ok' && setFieldName(res[1].data.root)
res[2].msg === 'Ok' && setEventList(res[2].data.root)
if (res[0].msg === 'Ok') {
form.setFieldsValue({ ...res[0].data.root })
if (res[0].data.root.ExceptionEventFields === '') {
setCharacterValue('')
setIsShow(false)
} else {
setIsShow(true)
setCharacterValue(res[0].data.root.ExceptionEventFields)
}
setShape(res[0].data.root.Shape)
let coordinates = false, picture = false, must = false
switch (res[0].data.root.Shape) {
case '坐标控件':
res[0].data.root.Config === "当前坐标" ? coordinates = true : coordinates = false
break
case '图片': case '可预览图片':
res[0].data.root.Preset === "拍照相册" ? picture = true : picture = false;
res[0].data.root.ValidationRule === "required" ? must = true : must = false
break
case '编码':
let code = res[0].data.root.Config.split(".")
form.setFieldsValue({ code: code[0] || '', prefix: code[1] === "undefined" ? '' : code[1] });
break
}
setPramData({ ...res[0].data.root, coordinates, must, picture })
}
})
}
}, [isVisible]);
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 17,
},
};
const handleChange = (value) => {
form.setFieldsValue({ schemename: value });
}
const onOK = prop => {
setVisible(false);
if (type === 'rule') {
form.setFieldsValue({ ValidationRule: prop });
} else {
setCheckedList(prop.checkedList)
setCharacterValue(prop.str)
}
};
const add = (type) => {
let obj = form.getFieldsValue();
let data = { ...formObj }
if (obj.ValidationRule) {
let arr = obj.ValidationRule.split(",")
arr.map(item => {
switch (item) {
case 'required':
data.rule.push(item);
break;
case 'emphasis':
data.rule.push(item);
break;
case 'sensitive':
data.rule.push(item);
break;
default:
data.numerical = item
}
})
} else {
data = { rule: [], numerical: '' }
}
setType(type);
setFormObj(data)
setVisible(true);
}
const handleEvent = (value, e) => {
let data = { ...pramData }
data.ExceptionEvent = e.name
if (e.tablename) {
getFieldData(e.tablename)
setPramData(data)
} else {
setIsShow(false)
setFiled({})
setCharacterValue('')
}
}
const getFieldData = (value) => {
LoadEventFields({ eventTableName: value, distinctFields: '' }).then(res => {
if (res.msg === 'Ok') {
setFiled(formateArrDataA(res.data.root, 'group'))
setIsShow(true)
}
})
}
const formateArrDataA = (initialArr, name) => {
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
}
//先获取一下这个数组中有多少个"name"
let nameArr = []
for (let i in initialArr) {
if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
nameArr.push(initialArr[i][`${name}`])
}
}
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in initialArr) {
if (initialArr[j][`${name}`] == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(initialArr[j])
}
}
}
for (let key in tempObj) {
let arr = []
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.fieldName)
})
}
return tempObj
}
const handleCharacteristics = (value) => {
let data = { ...pramData }
setShape(value)
data.must = false
data.coordinates = false
data.picture = false
data.Preset = ''
setPramData(data)
form.setFieldsValue({ ValidationRule: '' });
if (value.indexOf("日期") != -1 || value === "时分秒") {
form.setFieldsValue({ Config: undefined });
}
}
const onCharacterValue = (e) => {
setCharacterValue(e.target.value)
}
const onChangeReady = (e, str) => {
let data = { ...pramData }
switch (str) {
case 'ReadOnly':
data.ReadOnly = e.target.checked;
break;
case 'EditableLater':
data.EditableLater = e.target.checked
break;
case 'must':
data.must = e.target.checked
break;
case 'picture':
data.picture = e.target.checked
break;
case 'coordinates':
data.coordinates = e.target.checked
break;
}
setPramData(data)
}
const handleInput = (e, str) => {
let data = { ...pramData }
switch (str) {
case 'Unit':
data.Unit = e.target.value;
break;
case 'RowSpan':
data.RowSpan = e.target.value;
break;
case 'Preset':
data.Preset = e.target.value;
break;
case 'ExceptionValue':
data.ExceptionValue = e.target.value;
break;
default:
break
}
setPramData(data)
}
const handleSeparator = (value) => {
let data = { ...pramData }
switch (value) {
case '6':
data.Preset = '是'
form.setFieldsValue({ Config: '是,否' });
break;
case '7':
data.Preset = '否'
form.setFieldsValue({ Config: '是,否' });
break;
case '8':
data.Preset = '否'
form.setFieldsValue({ Config: '否,是' });
break;
}
setPramData(data)
}
return (
<>
<Modal
title='修改'
bodyStyle={{ width: '100%', minHeight: '100px' }}
width="700px"
destroyOnClose
maskClosable={false}
centered ={true}
cancelText="取消"
okText="确认"
{...props}
visible={isVisible}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
{isVisible && (
<Form form={form} {...layout} >
<Item
label="字段名"
name="Name"
rules={[{ required: true, message: '请输入表名' }]}
>
<Input placeholder="请输入别名" disabled/>
</Item>
<Item
label="别名"
name="Alias"
>
<Input placeholder="请输入别名" allowClear />
</Item>
<Item
name="ReadOnly"
label="属性"
>
<div>
<Checkbox checked={pramData.ReadOnly} onChange={(e) => onChangeReady(e, 'ReadOnly')}>只读</Checkbox>
<Checkbox checked={pramData.EditableLater} onChange={(e) => onChangeReady(e, 'EditableLater')}>允许补正(事后修改)</Checkbox>
</div>
</Item>
<Item
label="同步"
name="SyncEvent"
>
<Radio.Group>
<Radio value={0} style={{ marginRight: '0.5rem' }}>不同步</Radio>
<Radio value={1} style={{ marginRight: '0.5rem' }}>工单 → 事件</Radio>
<Radio value={2} >事件(上报时) → 工单</Radio>
</Radio.Group>
</Item>
<Item
label="形态"
>
<div className={styles.listEvent}>
<Select style={{ width: '42%' }} value={Shape} onChange={handleCharacteristics}>
{characteristics.length ? characteristics.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option>; }) : ''}
</Select>
<div className={styles.unit}>单位:<Input style={{ width: '5rem' }} placeholder="" allowClear value={pramData.Unit} onChange={(e) => handleInput(e, 'Unit')} /></div>
<div className={styles.unit}>宽:<Input style={{ width: '4rem' }} placeholder="" allowClear value={pramData.RowSpan} onChange={(e) => handleInput(e, 'RowSpan')} /></div>
</div>
</Item>
{(() => {
switch (Shape) {
case '编码':
return <>
<Item
label="前缀"
name="prefix"
>
<Input style={{ width: '95%' }} placeholder="" allowClear />
</Item>
<Item
label="编码方式"
name="code"
>
<Radio.Group>
<Radio value='年份编码' style={{ marginRight: '0.5rem' }}>XJ-2019-000001(前缀-年份-六位编码)</Radio>
<Radio value='年月编码' style={{ marginRight: '0.5rem' }}>XJ-201909-000001(前缀-年份月份-六位编码)</Radio>
<Radio value='一般编码' defaultChecked >XJ00000001(前缀 八位编码)</Radio>
</Radio.Group>
</Item>
</>
case '值选择器': case '值复选器': case '可编辑值选择器': case '平铺值选择器':
return <> <Item
label="可选值"
name="Config"
>
<TextArea allowClear />
</Item>
<Item
colon={false}
label=" "
> <div style={{ display: 'flex', alignItems: 'center' }}>
<span style={{ marginRight: '0.4rem' }}>以英文逗号为分隔符填写,或其他分隔符粘贴:</span>
<Select onChange={handleSeparator} style={{ width: '30%' }}>
<Select.Option value='0'>以,分隔(英文逗号)</Select.Option>
<Select.Option value='1'>以/分隔(正斜杠)</Select.Option>
<Select.Option value='2'>以\\分隔(反斜杠)</Select.Option>
<Select.Option value='3'>以、分隔(中文顿号)</Select.Option>
<Select.Option value='4'>以;分隔(英文分号)</Select.Option>
<Select.Option value='5'>以;分隔(中文分号)</Select.Option>
<Select.Option value='6'>(是)/否</Select.Option>
<Select.Option value='7'>是/(否)</Select.Option>
<Select.Option value='8'>(否)/是</Select.Option>
</Select>
</div>
</Item>
</>
case '图片': case '可预览图片':
return <Item
name="ReadOnly"
label="选项"
>
<div>
<Checkbox checked={pramData.picture} onChange={(e) => onChangeReady(e, 'picture')}>允许从相册选取</Checkbox>
<Checkbox checked={pramData.must} onChange={(e) => onChangeReady(e, 'must')}>必填字段</Checkbox>
</div>
</Item>
case '日期时间': case '日期': case '日期月份': case '日期年份': case '日期周': case '时分秒':
return <Item
label="选项"
name="Config"
>
<Radio.Group style={{ marginTop: '0.3rem' }}>
<Radio value='默认为空' defaultChecked style={{ width: '18rem', marginBottom: '0.5rem' }}>默认为空</Radio>
<Radio value='' >默认为当前时间</Radio>
<Radio value='不可选择' style={{ width: '18rem' }}>锁定为当前时间(通过用户点击刷新)</Radio>
<Radio value='不超过当前时间' >不超过当前时间</Radio>
</Radio.Group>
</Item>
case '坐标控件':
return <Item
label="选项"
name="Config"
>
<div>
<Checkbox value='当前坐标' style={{ marginRight: '0.2rem' }} checked={pramData.coordinates} onChange={(e) => onChangeReady(e, 'coordinates')}></Checkbox>锁定为当前位置坐标
</div>
</Item>
default:
return <Item
label="配置"
name="Config"
>
<TextArea allowClear />
</Item>
}
}
)()}
{Shape === '图片' || Shape === '可预览图片' ? '' :
<Item
label="预设值"
>
<div className={styles.listEvent}>
<Input style={{ width: '40%', height: '1.8rem' }} value={pramData.Preset} onChange={(e) => handleInput(e, 'Preset')} placeholder="" allowClear />
<Item
style={{ marginLeft: '1rem' }}
label="验证"
name="ValidationRule"
style={{ margin: '0 0 0 1rem' }}
>
<Input style={{ width: '95%' }} placeholder="" allowClear />
</Item>
<Tooltip title="选择验证规则">
<PlusSquareOutlined
onClick={() => add('rule')}
style={{ fontSize: '24px', color: '#1890FF', display: 'flex', alignItems: 'center' }}
/>
</Tooltip>
</div>
</Item>
}
<Item
label="异常值"
>
<div className={styles.listEvent}>
<Input style={{ width: '40%', height: '1.8rem' }} value={pramData.ExceptionValue} onChange={(e) => handleInput(e, 'ExceptionValue')} placeholder="" allowClear />
<Item
style={{ marginLeft: '1rem' }}
label="触发事件"
name="ExceptionEvent"
style={{ margin: '0 0 0 1rem' }}
>
<Select style={{ width: '12rem' }} onChange={handleEvent}>
{eventList.length ? eventList.map((item, index) => { return <Select.Option key={index} tablename={item.TableName} name={item.Name} value={item.ID}>{item.Name}</Select.Option>; }) : ''}
</Select>
</Item>
</div>
</Item>
<Item
label="字段集"
>
<div className={styles.listEvent}>
<Input style={{ width: '93%' }} placeholder="" disabled={!isShow} onChange={onCharacterValue} allowClear value={characterValue} />
<Tooltip title={!isShow ? '' : '字符集选择'}>
<PlusSquareOutlined
onClick={() => !isShow ? '' : add('characteristics')}
style={{ fontSize: '24px', color: !isShow ? 'gray' : '#1890FF', cursor: !isShow ? 'no-drop' : 'pointer', display: 'flex', alignItems: 'center', marginLeft: '0.5rem' }}
/>
</Tooltip>
</div>
</Item>
</Form>
)}
</Modal>
<ChangeAdd
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onOK}
newCheckedList={checkedList}
isType={type}
filed={filed}
characterValue={characterValue}
formObj={formObj} />
</>
);
};
export default AddModal;
import React, { useState, useEffect } from 'react';
import {
Form,
Modal,
Space,
Table,
Button,
Popconfirm,
Spin,
notification,
} from 'antd';
import { reloadTableFields, removeFields } from '@/services/platform/bs';
import FieldEditor from './fieldEditor';
const AddModal = props => {
const [tableData, setTableData] = useState([]);
const { callBackSubmit = () => {}, type, formObj, visible } = props;
const [loading, setLoading] = useState(false);
const [treeLoading, setTreeLoading] = useState(true);
const [form] = Form.useForm();
const [flag, setFlag] = useState(0); // 弹窗类型
const [isVisible, setIsVisible] = useState(false); // 弹窗
const [isType, setIsType] = useState(''); // 弹窗类型
const [itemData, setItemData] = useState({});
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
}
});
};
const columns = [
{
title: '字段名',
dataIndex: 'name',
key: 'name',
width: 150,
render: text => <a>{text}</a>,
},
{
title: '别名',
dataIndex: 'alias',
key: 'alias',
align: 'center',
},
{
title: '字段类型',
dataIndex: 'storeType',
key: 'storeType',
align: 'center',
},
{
title: '形态',
dataIndex: 'shape',
key: 'shape',
align: 'center',
},
{
title: '配置',
dataIndex: 'config',
key: 'config',
align: 'center',
},
{
title: '只读',
dataIndex: 'readOnly',
key: 'readOnly',
align: 'center',
},
{
title: '同步',
dataIndex: 'syncEvent',
key: 'syncEvent',
align: 'center',
},
{
title: '操作',
width: 250,
ellipsis: true,
align: 'center',
render: (text, record) => (
<Space>
<Button
type="primary"
size="small"
onClick={() => {
editor(record);
}}
>
编辑
</Button>
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该字段?"
okText="确认"
cancelText="取消"
onConfirm={() => {
deleteChart(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div>
</Space>
),
},
];
const editor = record => {
setIsType('edit');
setIsVisible(true);
setItemData(record);
};
const Submit = prop => {
setIsVisible(false);
setFlag(flag + 1);
};
useEffect(() => {
if (type !== '') {
setTreeLoading(true);
reloadTableFields({
tableName: formObj.tableName,
}).then(res => {
setTreeLoading(false);
if (res.msg === 'Ok') {
setTableData(res.data.root);
}
});
}
}, [visible, flag]);
// 删除表字段
const deleteChart = record => {
removeFields({ fieldIDs: record.ID }).then(res => {
if (res.msg === 'Ok' || res.msg === '') {
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
setFlag(flag + 1);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
};
return (
<>
<Modal
title="字段配置"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '50px', left: '50px' }}
width="60%"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender
getContainer={false}
>
{visible && (
<Spin tip="loading..." spinning={treeLoading}>
<Table
columns={columns}
dataSource={tableData}
// pagination={{ pageSize: 10 }}
scroll={{ x: 'max-content', y: '35rem' }}
size="small"
rowKey={(record, index) => `complete${record.tableID}${index}`}
pagination={false}
/>
</Spin>
)}
</Modal>
<FieldEditor
isVisible={isVisible}
isType={isType}
itemData={itemData}
formObj1={formObj}
onCancel={() => setIsVisible(false)}
callBackSubmit={Submit}
/>
</>
);
};
export default AddModal;
......@@ -50,9 +50,9 @@
padding: 0.5rem;
}
.cardContent{
height: 25rem;
height:35rem;
overflow-y: scroll;
width: 19.5rem;
width: 22rem;
}
.cardItemData{
padding: 1rem;
......@@ -77,6 +77,9 @@
font-weight: 600;
background: #FAFAFA;
}
td{
width: 12rem;
}
}
tbody{
tr:hover{
......@@ -85,3 +88,9 @@
}
}
}
.defaultTile{
background-color:transparent ;
}
.activeTile{
background-color:#dfe8f6 ;
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Modal, Card, Table, Button, Tree, Input, notification } from 'antd';
import React, { useState, useEffect, useRef } from 'react';
import { Modal, Spin, Table, Button, Divider, Input, notification } from 'antd';
import classnames from 'classnames'
import { LoadFieldsByGroup, LoadGroup } from '@/services/platform/bs'
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons';
import Sortable from 'sortablejs';
import styles from './index.less'
import { pick } from 'lodash';
import {
ChangeOrder
} from '@/services/platform/bs'
import { DataRegion } from 'bizcharts/lib/components/Annotation';
import { Number } from 'core-js';
let list = {}
const AddModal = props => {
let ref = useRef();
const { callBackSubmit = () => { }, type, formObj, visible } = props;
const [loading, setLoading] = useState(false);
const [treeLoading, setTreeLoading] = useState(true)
const [isModalVisible, setIsModalVisible] = useState(false)
const [data, setData] = useState([])
const [allData, setAllData] = useState({})
const [leftData, setLeftData] = useState([])
const [flag, setFlag] = useState(0); // 弹窗类型
const [pickIndex, setPickIndex] = useState('')
const [selectData, setSelectData] = useState('')
const [createName, setCreateName] = useState('')
// 提交
const onSubmit = () => {
setLoading(true);
let arr = []
data.map((item) => {
if (item.children && item.children.length) {
item.children.map(childrenItem => {
arr.push({ groupName: item.title, ID: childrenItem.key })
})
}
leftData.map((item) => {
allData[item].map(allItem => {
arr.push({ groupName: item, ID: Number(allItem.ID) })
})
})
ChangeOrder(arr).then(res => {
setLoading(false);
......@@ -63,33 +65,67 @@ const AddModal = props => {
res.data.root.map(item => {
arr.push(item.text)
})
LoadFieldsByGroup({ tableName: formObj.tableName, groupName: arr.join(",") }).then(respone => {
if (respone.msg === 'Ok') {
let data = handlerDatas(respone.data.root)
let arr = []
data.map((item, index) => {
arr.push({ title: item.Group, key: index, top: true })
arr[index].children = []
item.children.map(propTtem => {
arr[index].children.push({ title: propTtem.Name, key: propTtem.ID, top: false })
})
})
setData(arr)
let data = formateArrDataA(respone.data.root, 'Group')
list = data
setLeftData(arr || [])
setSelectData(arr[0] || {})
setAllData(data)
draftSort()
}
})
}
}
)
}
}, [visible, flag]);
const add = () => {
setCreateName('')
setIsModalVisible(true)
}
const formateArrDataA = (initialArr, name) => {
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
}
//先获取一下这个数组中有多少个"name"
let nameArr = []
for (let i in initialArr) {
if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
nameArr.push(initialArr[i][`${name}`])
}
}
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in initialArr) {
if (initialArr[j][`${name}`] == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(initialArr[j])
}
}
}
for (let key in tempObj) {
let arr = []
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item)
})
}
return tempObj
}
const handlerDatas = (arr) => {
let obj = {};
arr.forEach((item, index) => {
......@@ -104,7 +140,71 @@ const AddModal = props => {
});
return Object.values(obj); // 最终输出
}
//拖拽初始化及逻辑
const draftSort = () => {
let el = document.getElementById('doctor-drag-items');
if (el) {
let sortable = Sortable.create(el, {
animation: 100, //动画参数
group: {
name: 'shared',
pull: true,// To clone: set pull to 'clone'
put: false // 不允许拖拽进这个列表
},
onEnd: function (evt) { //拖拽完毕之后发生,只需关注该事件
let maxLegth = 0
let leftNewest = []
let flagData = ''
setLeftData(data => {
maxLegth = 225 + data.length * 45;
leftNewest = data
return data
})
setSelectData(data => {
flagData = data
return data
})
if (evt.originalEvent.clientX < 983 && evt.originalEvent.clientY > 225 && evt.originalEvent.clientY < maxLegth) {
let index = Math.ceil((evt.originalEvent.clientY - 225) / 40)
let name = evt.from.children[0].getAttribute('group')
setAllData((data) => {
let obj = { ...data }
if (obj[name][evt.oldIndex]) {
obj[leftNewest[index - 1]].push(obj[name][evt.oldIndex])
}
obj[flagData].splice(evt.oldIndex, 1)
return obj
})
}
else {
let arr = [];
let len = evt.from.children.length;
for (let i = 0; i < len; i++) {
let child = evt.from.children[i]
arr.push({ ID: child.getAttribute('drag-id'), Name: child.getAttribute('drag-name'), Shape: child.getAttribute('drag-shape'), Group: child.getAttribute('group') })
}
setAllData((data) => {
let obj = { ...data }
obj[flagData] = arr
return obj
})
}
},
animation: 1000,
direction: 'vertical',
forceFallback: true,
});
}
}
//完成拖拽
const onDrop = (info) => {
const dropKey = info.node.props.eventKey;
......@@ -175,28 +275,40 @@ const AddModal = props => {
* @param {Array} selectedKeys 选中的key 数组存放,单多选
* @param {Node} e 被选择中的node信息,可以拿到 数据源, 层级关系等...
*/
//完成选择
const onSelect = (selectedKeys, e) => {
if (e.node.top) {
const index = data.findIndex(item => item.key === e.node.key)
setPickIndex(index)
}
else {
setPickIndex('')
}
// //完成选择
// const onSelect = (selectedKeys, e) => {
// if (e.node.top) {
// const index = data.findIndex(item => item.key === e.node.key)
// setPickIndex(index)
// }
// else {
// setPickIndex('')
// }
}
// }
const del = () => {
if (pickIndex !== '') {
let arr = [...data]
arr.splice(pickIndex, 1)
setData(arr)
let arr = [...leftData]
let newArr = { ...allData }
let index = arr.findIndex(item => { return pickIndex == item })
arr.splice(index, 1)
if(newArr["(未分组)"]){
newArr["(未分组)"]=newArr["(未分组)"].concat(newArr[pickIndex])
}
delete newArr[pickIndex]
setLeftData(arr)
setAllData(newArr)
}
}
const handleOk = () => {
let arr = [...data]
createName !== '' && arr.push({ title: createName, key: arr.length, top: true, children: [] })
setData(arr)
let arr = [...leftData]
let newArr = { ...allData }
if (createName !== '') {
arr.push(createName)
newArr[createName] = []
}
setLeftData(arr)
setAllData(newArr)
setIsModalVisible(false)
}
const handleCancel = () => {
......@@ -205,13 +317,18 @@ const AddModal = props => {
const change = (e) => {
setCreateName(e.target.value)
}
const pickData = (e, item) => {
e.stopPropagation();
setSelectData(item);
setPickIndex(item)
}
return (
<>
<Modal
title='字段配置'
bodyStyle={{ width: '100%', minHeight: '100px' }}
bodyStyle={{ width: '100%', minHeight: '100px', height: '40rem' }}
style={{ top: '50px', left: '50px' }}
width='30%'
width='42%'
destroyOnClose
maskClosable={false}
cancelText="取消"
......@@ -223,8 +340,10 @@ const AddModal = props => {
getContainer={false}
>
{visible && (
<div style={{ display: 'flex' }} className={styles.cardList}>
<Card bordered={true} extra={<div style={{ display: 'flex' }}><Button onClick={add} style={{ display: 'flex', alignItems: 'center', marginRight: '1rem' }}>添加分组<PlusOutlined /></Button><Button danger onClick={del} style={{ display: 'flex', alignItems: 'center' }}>删除分组<DeleteOutlined /></Button> </div>} style={{ width: '100%' }}>
<Spin tip="loading..." spinning={treeLoading}>
<div className={styles.cardList}>
{/* <Card bordered={true} extra={<div style={{ display: 'flex' }}><Button onClick={add} style={{ display: 'flex', alignItems: 'center', marginRight: '1rem' }}>添加分组<PlusOutlined /></Button><Button danger onClick={del} style={{ display: 'flex', alignItems: 'center' }}>删除分组<DeleteOutlined /></Button> </div>} style={{ width: '100%' }}>
<Tree
draggable //是否可以拖拽
blockNode //是否节点占据一行
......@@ -233,12 +352,64 @@ const AddModal = props => {
onDrop={onDrop} //拖拽结束后触发的回调函数
onSelect={onSelect} // 选中某一级的回调函数
/>
</Card>
</Card> */}
<div style={{ display: 'flex', width: '96.4%', justifyContent: 'flex-end' }}><Button onClick={add} style={{ display: 'flex', alignItems: 'center', marginRight: '1rem' }}>添加分组<PlusOutlined /></Button><Button danger onClick={del} style={{ display: 'flex', alignItems: 'center' }}>删除分组<DeleteOutlined /></Button> </div>
<div className={styles.listCard}>
<div className={styles.cardItem} style={{ borderRight: '1px solid #99bbe8' }}>
<div className={styles.doctorTable}>
<table>
<thead>
<tr>
<td>组名称</td>
</tr>
</thead>
<tbody id='doctor-drag-items1'>
{leftData && leftData.length > 0 ?
leftData.map((item, index) => {
return <tr className={classnames({
[styles.defaultTile]: true,
[styles.activeTile]: pickIndex==item,
})} onClick={e => pickData(e, item)} drag-id={item} key={index} style={{ cursor: 'pointer' }}>
<td><span title={item}>{item}</span></td>
</tr>
})
: <tr><td colSpan='12' style={{ textAlign: 'center' }}>暂无数据</td></tr>
}
</tbody>
</table>
</div>
</div>
<div className={styles.cardItem}>
<div className={styles.cardContent}>
<div className={styles.doctorTable}>
<table>
<thead>
<tr>
<td>字段名</td>
<td>形态</td>
</tr>
</thead>
<tbody id='doctor-drag-items'>
{allData[selectData] && allData[selectData].length > 0 ?
allData[selectData].map((item, index) => {
return <tr drag-id={item.ID} drag-name={item.Name} drag-shape={item.Shape} key={index} group={item.Group} style={{ cursor: 'move' }}>
<td><span title={item.Name}>{item.Name}</span></td>
<td><span title={item.Shape}>{item.Shape}</span></td>
</tr>
})
: <tr><td colSpan='12' style={{ textAlign: 'center' }}>暂无数据</td></tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
)}
</Spin>)}
</Modal>
<Modal title="添加分组" style={{ top: '200px', left: '50px' }} visible={isModalVisible} onOk={handleOk} onCancel={handleCancel}>
<Input
......
......@@ -20,7 +20,6 @@ import styles from './index.less'
import Editor from './components/Field/editor'
import AddTablelList from './components/Field/addTable'
import AffiliateAdd from './components/Field/affiliateAdd'
import FieldsConfig from './components/Field/fieldsConfig'
import LoadGroup from './components/Field/loadGroup'
import { useHistory } from 'react-router-dom';
const { Search } = Input;
......@@ -140,6 +139,7 @@ const TableManager = () => {
Object.keys(groupData).map((item, index) => {
newArr.push({ type: item, key: index })
})
console.log('groupData',groupData);
setAllData(groupData)
setGroupArr(newArr)
}
......@@ -302,7 +302,7 @@ const TableManager = () => {
{
title: '类型', dataIndex: 'type', key: 'type',
render: text => {
return (<div style={{ color: '#3764a0' }}>{text}({allData[text].length}个)</div>)
return (<div style={{ color: '#3764a0' }}>{text}({allData&&allData[text]?allData[text].length:0}个)</div>)
}
},
......@@ -311,7 +311,6 @@ const TableManager = () => {
return (
<Spin tip="loading..." spinning={treeLoading}>
<PageContainer>
<div className={styles.tablemanager_container}>
<div className={styles.operate_bar}>
<div className={styles.fast_search}>
......@@ -331,7 +330,7 @@ const TableManager = () => {
<Button type="primary" style={{ marginLeft: "10px" }} onClick={AffiliateAddTable}>附加</Button>
</div>
<div className={styles.table_container}>
<div style={{ width: '100vm', height: 'calc(100vh - 150px) ', background: '#ffffff' }}>
{/* <Table
columns={columns}
dataSource={tableData}
......@@ -353,6 +352,7 @@ const TableManager = () => {
className="components-table-demo-nested"
columns={columns}
expandable={{ expandedRowRender }}
showHeader={false}
dataSource={groupArr}
size="small"
style={{ height: '8rem' }}
......@@ -393,15 +393,7 @@ const TableManager = () => {
formObj={formObj}
/>
)}
{visible && type === 'config' && (
<FieldsConfig
visible={visible}
type={type}
formObj={formObj}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
/>
)}
{visible && type === 'sort' && (
<LoadGroup
visible={visible}
......
.tablemanager_container {
display: flex;
flex-direction: column;
width: 100vm;
.operate_bar {
width: 100%;
height: 60px;
......@@ -25,7 +26,3 @@
}
}
.table_container{
width: 100%;
height: calc(100% - 100px);
}
\ No newline at end of file
......@@ -19,10 +19,16 @@ const AddModal = props => {
const [checkAll, setCheckAll] = useState([]);
const [selectData, setSelectData] = useState([])
let objArr = []
const onChangeList = (list, index) => {
const onChangeList = (list, index,title) => {
const checkedListArr = [...checkedList]
checkedListArr[index] = list
setCheckedList(checkedListArr);
const indeterminateArr = [...indeterminate]
const checkAllArr = [...checkAll]
indeterminateArr[index] = !!list.length && list.length < filed[title].length
checkAllArr[index] = list.length === filed[title].length
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr);
};
const onCheckAllChange = e => {
......@@ -61,14 +67,21 @@ const AddModal = props => {
else if (isType === 'characteristics') {
let arr = Object.keys(filed)
setTitle(arr)
console.log('arr', arr);
let checkArr = []
let indeterminateArr = []
let checkAllArr = []
arr.map((item, index) => {
indeterminateArr.push(true)
checkAllArr.push(false)
checkArr[index] = []
newCheckedList.map(checkItem => {
if (filed[item].includes(checkItem)) {
checkArr[index].push(checkItem)
}
})
indeterminateArr.push(!!checkArr[index].length && checkArr[index].length < filed[item].length)
checkAllArr.push(checkArr[index].length === filed[item].length)
})
setCheckedList(newCheckedList)
setCheckedList(checkArr)
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr)
let newArr = characterValue.length? characterValue.split(","):[]
......@@ -158,7 +171,7 @@ const AddModal = props => {
{title.map((item, index) => {
return <div className={styles.cardItemData} key={index}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', color: '#15428b', borderTopColor: '#99bbe8' }}>{item} <Checkbox indeterminate={indeterminate[index]} onChange={onCheckAllChange} index={index} checkvalue={filed[item]} checked={checkAll[index]}> </Checkbox></Divider>
<CheckboxGroup options={filed[item]} value={checkedList[index]} onChange={(e) => onChangeList(e, index)} /></div>
<CheckboxGroup options={filed[item]} value={checkedList[index]} onChange={(e) => onChangeList(e, index,item)} /></div>
})}
</div>
</div>
......
......@@ -33,7 +33,6 @@ const AddModal = props => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
console.log('obj', obj);
let data = [{ Unit: pramData.Unit || '', StoreType: "nvarchar(255)", Group: pramData.Group || '', Shape, ExceptionEvent: pramData.ExceptionEvent || '', RowSpan: pramData.RowSpan || 0, ColSpan: pramData.ColSpan || 0, ReadOnly: pramData.ReadOnly || false, EditableLater: pramData.EditableLater || false, ExceptionValue: pramData.ExceptionValue || '', Preset: pramData.Preset || '', ID: Number(itemData.ID), Name: obj.Name, Alias: obj.Alias, SyncEvent: obj.SyncEvent, ValidationRule: obj.ValidationRule, ExceptionEventFields: characterValue }]
switch (Shape) {
......@@ -87,10 +86,12 @@ const AddModal = props => {
form.setFieldsValue({ ...res[0].data.root })
if (res[0].data.root.ExceptionEventFields === '') {
setCharacterValue('')
setCheckedList([])
setIsShow(false)
} else {
setIsShow(true)
setCharacterValue(res[0].data.root.ExceptionEventFields)
setCheckedList(res[0].data.root.ExceptionEventFields.split(','))
}
setShape(res[0].data.root.Shape)
let coordinates = false, picture = false, must = false
......@@ -109,6 +110,9 @@ const AddModal = props => {
}
setPramData({ ...res[0].data.root, coordinates, must, picture })
let index = res[2].data.root.find(item => { return item.Name == res[0].data.root.ExceptionEvent })
console.log('index',index);
getFieldData(index.TableName)
}
})
}
......@@ -178,6 +182,7 @@ const AddModal = props => {
setIsShow(false)
setFiled({})
setCharacterValue('')
setCheckedList([])
}
}
const getFieldData = (value) => {
......@@ -312,7 +317,7 @@ const AddModal = props => {
width="700px"
destroyOnClose
maskClosable={false}
centered ={true}
centered={true}
cancelText="取消"
okText="确认"
{...props}
......@@ -329,7 +334,7 @@ const AddModal = props => {
name="Name"
rules={[{ required: true, message: '请输入表名' }]}
>
<Input placeholder="请输入别名" disabled/>
<Input placeholder="请输入别名" disabled />
</Item>
<Item
label="别名"
......
......@@ -16,105 +16,15 @@ import { useHistory } from 'react-router-dom';
import styles from './index.less'
const AddModal = props => {
const history = useHistory();
const [allData, setAllData] = useState([]);
const [tableData, setTableData] = useState([]);
const { callBackSubmit = () => { }, type, visible } = props;
const [loading, setLoading] = useState(false);
const [treeLoading, setTreeLoading] = useState(false);
const [formObj, setFormObj] = useState('');
const [form] = Form.useForm();
const [flag, setFlag] = useState(0); // 弹窗类型
const [isVisible, setIsVisible] = useState(false); // 弹窗
const [isType, setIsType] = useState(''); // 弹窗类型
const [itemData, setItemData] = useState({});
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
}
});
};
const columns = [
{
title: '字段名',
dataIndex: 'name',
key: 'name',
width: 150,
render: text => <a>{text}</a>,
},
{
title: '别名',
dataIndex: 'alias',
key: 'alias',
align: 'center',
},
{
title: '字段类型',
dataIndex: 'storeType',
key: 'storeType',
align: 'center',
},
{
title: '形态',
dataIndex: 'shape',
key: 'shape',
align: 'center',
},
{
title: '配置',
dataIndex: 'config',
key: 'config',
align: 'center',
},
{
title: '只读',
dataIndex: 'readOnly',
key: 'readOnly',
align: 'center',
},
{
title: '同步',
dataIndex: 'syncEvent',
key: 'syncEvent',
align: 'center',
},
{
title: '操作',
width: 250,
ellipsis: true,
align: 'center',
render: (text, record) => (
<Space>
<Button
type="primary"
size="small"
onClick={() => {
editor(record);
}}
>
编辑
</Button>
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该字段?"
okText="确认"
cancelText="取消"
onConfirm={() => {
deleteChart(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div>
</Space>
),
},
];
const editor = record => {
setIsType('edit');
setIsVisible(true);
......@@ -124,6 +34,106 @@ const AddModal = props => {
setIsVisible(false);
setFlag(flag + 1);
};
const expandedRowRender = (item) => {
const columns = [
{
title: '字段名',
dataIndex: 'name',
key: 'name',
width: 150,
render: text => <a>{text}</a>,
},
{
title: '别名',
dataIndex: 'alias',
key: 'alias',
align: 'center',
width: 200,
},
{
title: '字段类型',
dataIndex: 'storeType',
key: 'storeType',
align: 'center',
width: 200,
},
{
title: '形态',
dataIndex: 'shape',
key: 'shape',
align: 'center',
width: 200,
},
{
title: '配置',
dataIndex: 'config',
key: 'config',
align: 'center',
width: 200,
},
{
title: '只读',
dataIndex: 'readOnly',
key: 'readOnly',
align: 'center',
width: 200,
},
{
title: '同步',
dataIndex: 'syncEvent',
key: 'syncEvent',
align: 'center',
width: 200,
},
{
title: '操作',
width: 250,
ellipsis: true,
align: 'center',
render: (text, record) => (
<Space>
<Button
type="primary"
size="small"
onClick={() => {
editor(record);
}}
>
编辑
</Button>
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该字段?"
okText="确认"
cancelText="取消"
onConfirm={() => {
deleteChart(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div>
</Space>
),
},
];
return <Table columns={columns} dataSource={allData[item.type]} pagination={false} />;
};
const columns = [
{
title: '类型', dataIndex: 'type', key: 'type',
render: text => {
return (<div style={{ color: '#3764a0' }}>{text}(共{allData[text].length}条)</div>)
}
},
];
useEffect(() => {
if (props.match.params.id) {
setFormObj(props.match.params.id)
......@@ -133,9 +143,13 @@ const AddModal = props => {
}).then(res => {
setTreeLoading(false);
if (res.msg === 'Ok') {
setTableData(res.data.root);
console.log(formateArrDataA(res.data.root,'groupName'));
let arr =formateArrDataA(res.data.root,'group')
let newArr = []
Object.keys(arr).map((item, index) => {
newArr.push({ type: item, key: index,id:index })
})
setAllData(arr);
setTableData(newArr);
}
});
}
......@@ -167,11 +181,12 @@ const AddModal = props => {
}
}
}
for (let key in tempObj) {
for (let keys in tempObj) {
let arr = []
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.fieldName)
tempObj[keys].map((item,index) => {
tempObj[keys] = arr;
item.key = index
arr.push(item)
})
}
return tempObj
......@@ -206,10 +221,12 @@ const AddModal = props => {
<Table
columns={columns}
dataSource={tableData}
expandable={{ expandedRowRender }}
showHeader={false}
// pagination={{ pageSize: 10 }}
scroll={{ x: 'max-content', y: '45rem' }}
scroll={{ y: '45rem' }}
size="small"
rowKey={(record, index) => `complete${record.tableID}${index}`}
rowKey='id'
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
......
......@@ -7,10 +7,11 @@ import {
Button,
Select,
Popconfirm,
message
message,
Tooltip
} from 'antd';
import { PlusCircleOutlined } from '@ant-design/icons';
import { PlusCircleOutlined, EditTwoTone, DeleteOutlined, FundViewOutlined } from '@ant-design/icons';
import { useHistory } from 'react-router-dom';
const { Search } = Input;
const { Option } = Select;
import EditModal from './components/EditModal'
......@@ -18,7 +19,7 @@ import VisibleRoleModal from './components/RolseSelect/VisibleRoleModal'
import { GetMessageConfigList, TestPush, DeleteMessageConfig, GetMsgTypeList, DeleteIISAgentConfig } from '@/services/platform/messagemanage'
import styles from './ProjectManage.less'
const ProjectManage = () => {
const history = useHistory();
const [visibleParams, setvisibleParams] = useState({
addVisible: false, // 新增弹窗
delVisible: false, // 删除弹窗
......@@ -72,24 +73,16 @@ const ProjectManage = () => {
ellipsis: true,
render: (text, record) => (
<Space>
<Button
type="primary"
size="small"
onClick={() => {
<Tooltip title="测试">
<FundViewOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={() => {
TestDesc(record);
}}
>
测试
</Button>
<Button
type="primary"
size="small"
onClick={() => {
}} />
</Tooltip>
<Tooltip title="编辑">
<EditTwoTone style={{ fontSize: '16px', color: '#e86060' }} onClick={() => {
changeDesc(record);
}}
>
编辑
</Button>
}}></EditTwoTone>
</Tooltip>
{
record.name != "通用报警"
......@@ -104,9 +97,8 @@ const ProjectManage = () => {
DeleteProject(record)
}}
>
<Button size="small" danger>
删除
</Button>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }}></DeleteOutlined>
</Popconfirm>
</div>)
}
......@@ -120,28 +112,27 @@ const ProjectManage = () => {
GetMessageList({ pageSize: 10, pageIndex: 0, search: value })
}
const changeDesc = (record) => {
setCurrentTempalte(record)
handleShowModal("editVisible", true)
history.push({ pathname: `/platformCenter/schemeDetail`, state: { template: record } })
// handleShowModal("editVisible", true)
}
const TestDesc = (record) => {
console.log(record)
if(record.ThemeName)
TestPush({
theme:record.ThemeName,
msgType:record.MsgType,
tousers:record.PushGroup,
pushPath:record.item.AgentConfig.Url,
msgTypeId:record.ID
}).then(
res =>{
if(res.code === 0){
message.success("测试推送成功")
}else{
message.error(res.msg)
if (record.ThemeName)
TestPush({
theme: record.ThemeName,
msgType: record.MsgType,
tousers: record.PushGroup,
pushPath: record.item.AgentConfig ? record.item.AgentConfig.Url : '',
msgTypeId: record.ID
}).then(
res => {
if (res.code === 0) {
message.success("测试推送成功")
} else {
message.error(res.msg)
}
}
}
)
)
}
const DeleteProject = (record) => {
let agen = record.item.AgentConfig
......@@ -158,21 +149,21 @@ const ProjectManage = () => {
res3 => {
if (res3.code === 0) {
message.success("删除方案成功")
setFlag(flag +1)
setFlag(flag + 1)
}
}
)
}
}
)
}else{
} else {
DeleteMessageConfig({
id:config.ID
id: config.ID
}).then(
res3 =>{
if(res3.code === 0){
res3 => {
if (res3.code === 0) {
message.success("删除方案成功")
setFlag(flag +1)
setFlag(flag + 1)
}
}
)
......@@ -189,16 +180,18 @@ const ProjectManage = () => {
setvisibleParams({ ...visibleParams, [key]: value });
};
const editModal = () => {
handleShowModal("editVisbile",false)
handleShowModal("editVisbile", false)
setFlag(flag + 1)
}
const bddModal = () => {
handleShowModal("addVisbile",false)
handleShowModal("addVisbile", false)
setFlag(flag + 1)
}
const onAddClick = () => {
setCurrentTempalte({})
handleShowModal("addVisible", true)
// handleShowModal("addVisible", true)
history.push({ pathname: `/platformCenter/schemeDetail`, state: { template: {} } })
}
const onTypeChange = (value) => {
if (value == "全部") {
......@@ -237,6 +230,7 @@ const ProjectManage = () => {
res => {
let mesList = []
if (res.code === 0) {
console.log('res.data.MessageConfigModels', res.data.MessageConfigModels);
res.data.MessageConfigModels.map((item) => {
mesList.push({
name: item.MessageConfig.MsgType,
......@@ -248,7 +242,7 @@ const ProjectManage = () => {
item: item
})
})
console.log('mesList',mesList);
console.log('mesList', mesList);
setDataList(mesList)
}
}
......@@ -297,7 +291,7 @@ const ProjectManage = () => {
</div>
<div className={styles.list_view}>
<Table columns={columns} dataSource={dataList} pagination={{ pageSize: '10' }} rowKey='ID'/>
<Table columns={columns} dataSource={dataList} pagination={{ pageSize: '10' }} rowKey='ID' />
</div>
<EditModal
visible={visibleParams.editVisible}
......
......@@ -20,8 +20,8 @@
align-items: center;
.title {
margin-left: 5px;
margin-right: 5px;
margin-left: 18px;
margin-right: 10px;
}
}
......@@ -34,8 +34,8 @@
align-items: center;
.title {
margin-left: 20px;
margin-right: 5px;
margin-left: 25px;
margin-right: 10px;
}
}
}
......
......@@ -105,12 +105,13 @@ const EditModal = props => {
console.log(form.getFieldValue())
let fv = form.getFieldValue()
if (template.ThemeName) {
console.log('fv.wx_template',fv.wx_template);
console.log('fv.push_mode.toString()',fv.push_mode.toString());
let a = {
ID: template.ID,
ThemeName: template.ThemeName,
MsgType: fv.name,
PublicTemplateID: fv.wx_template,
PublicTemplateID: fv.wx_template.toString(),
PublicConfig: template.PublicConfig,
PublicPath: fv.h5_path,
MsgTemplateName: template.MsgTemplateName,
......@@ -157,6 +158,7 @@ const EditModal = props => {
)
} else {
console.log('fv.push_mode.toString()',fv.push_mode.toString());
let b = {
ThemeName: "定时推送",
MsgType: fv.name,
......@@ -209,7 +211,6 @@ const EditModal = props => {
}
const onTypeChange = (value) => {
console.log(value)
setCurrentTrench({
isAPPShow: value.indexOf("平台弹框") > -1 ? true : false,
isWXShow: value.indexOf("公众号推送") > -1 ? true : false,
......
......@@ -6,6 +6,7 @@ import DayOfWeekSelect from './DayOfWeekSelect'
import styles from './VisibleIISAgentConfig.less'
import moment from 'moment'
import { tr } from 'voca';
import {EditOutlined } from '@ant-design/icons';
const { Item } = Form;
......@@ -25,7 +26,6 @@ const VisibleIISAgentConfig = props => {
const [form] = Form.useForm();
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
const { agentConfig, value, onIISAgentSubmit } = props
useEffect(() => {
if (agentConfig) {
form.setFieldsValue({
......@@ -53,11 +53,13 @@ const VisibleIISAgentConfig = props => {
}
form.setFieldsValue({
name: value
})
setSelectRole(props.value)
if(value){
form.setFieldsValue({
name: value
})
setSelectRole(props.value)
}
}, [props])
......@@ -163,8 +165,7 @@ const VisibleIISAgentConfig = props => {
return (
<div className={styles.agent_container}>
<Input value={selectRole} disabled={true} />
<div className={styles.select_btn} onClick={handleClick}>推送计划</div>
<div className={styles.select_btn} onClick={handleClick}><EditOutlined style={{fontSize:'18px'}}/></div>
<SiteModal
{...props}
title="编辑定时任务"
......@@ -174,6 +175,7 @@ const VisibleIISAgentConfig = props => {
destroyOnClose
cancelText="取消"
okText="确认"
forceRender
visible={previewVisible}
onOk={() => handleOk()}
confirmLoading={loading}
......
.agent_container {
display: flex;
flex-direction: row;
width: 80%;
.select_btn {
display: inline-block;
color: #2f54eb;
cursor: pointer;
border-bottom: 1px solid #2f54eb;
width: 80px;
margin-left: 20px;
text-align: center;
padding: 0 0.8rem;
color: rgba(22,133,255,1);
}
.select_result {}
......
......@@ -24,7 +24,7 @@ const VisibleRoleModal = props => {
const [dataTree, setDataTree] = useState([])
const [dataLeafs, setDataLeafs] = useState([])
const [selectValues, setSelectValues] = useState([])
const { onSubmit, title, operate,initValues } = props
const { onSubmit, title, operate, initValues, selectValue } = props
const GetRoleGroupList = () => {
......@@ -50,11 +50,11 @@ const VisibleRoleModal = props => {
// for (const id of initValues) {
// if(id == roleItem.roleID){
// leafNode.checked = true
// }
// }
return leafNode
})
})
})
......@@ -66,6 +66,7 @@ const VisibleRoleModal = props => {
useEffect(() => {
setSelectRole(props.value)
selectValue && setSelectRole(selectValue)
GetRoleGroupList()
}, [])
......@@ -110,7 +111,7 @@ const VisibleRoleModal = props => {
<SiteModal
{...props}
title={title ? `选择${title}` : "关联角色"}
title={title && Object.prototype.toString.call(title) !== '[object Object]' ? `选择${title}` : "关联角色"}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 200, borderRadius: '20px' }}
width="800px"
......@@ -124,7 +125,7 @@ const VisibleRoleModal = props => {
>
<div className={styles.list_card}>
<ListCard {...props} onChange2={onChange2} data={dataTree} dataLeafs={dataLeafs} initValues={initValues}/>
<ListCard {...props} onChange2={onChange2} data={dataTree} dataLeafs={dataLeafs} initValues={initValues} />
</div>
</SiteModal>
</div>
......@@ -147,7 +148,7 @@ const checkChildrenByCondition = (
const ListCard = props => {
const { onChange, onChange2, data, dataLeafs,initValues } = props
const { onChange, onChange2, data, dataLeafs, initValues } = props
const [changedItem, setChangedItem] = useState({ item: {} });
const [valueList, setValueList] = useState([]);
......@@ -219,7 +220,7 @@ const ListCard = props => {
}
useEffect(() => {
initValues&&setValueList(initValues)
initValues && setValueList(initValues)
}, [])
return (
<div>
......
.role_container {
display: flex;
flex-direction: row;
width: 80%;
.select_btn {
display: inline-block;
color: #2f54eb;
cursor: pointer;
border-bottom: 1px solid #2f54eb;
width: 80px;
margin-left: 20px;
text-align: center;
padding: 0 0.8rem;
color: rgba(22,133,255,1);
}
}
.list_card{
......
......@@ -72,11 +72,8 @@ const TemplateManage = () => {
setOption([]);
GetThirdpartyTemplates(obj).then(res => {
if (res.msg==="Ok") {
console.log(res.data);
setOption(res.data);
console.log(2)
} else {
console.log(1);
notification.error({
message: '提示',
duration: 15,
......
import React, { useState, useEffect, useRef } from 'react'
import SiteModal from '@/components/Modal/SiteModa';
import { Form, Input, notification, Select, Checkbox, message, Button, Card, Switch as Switchs } from 'antd'
import BaseForm from '@/components/BaseForm/index';
import { Switch } from 'react-router';
import { iteratee } from 'lodash';
import styles from './schemeDetail.less';
import v from 'voca';
import { UsergroupDeleteOutlined } from '@ant-design/icons';
import VisibleRoleModal from '../messageManage/projectManage/components/RolseSelect/VisibleRoleModal'
import VisibleIISAgentConfig from '../messageManage/projectManage/components/IISAgentConfig/VisibleIISAgentConfig'
import { GetMessageTemplate } from '@/services/platform/messagemanage'
import moment from 'moment'
import { UpdateMessageConfig, InsertMessageConfig, AddIISAgentConfig } from '@/services/platform/messagemanage'
import { useHistory } from 'react-router-dom';
const { Item } = Form;
const EditModal = props => {
const history = useHistory();
const [form] = Form.useForm();
const [loading, setLoading] = useState(false);
const [plan,setPlan]= useState('');
const [isStart, setIsStart] = useState(false);
const [IISConfig, setIISConfig] = useState(null)
const [isUse, setIsUse] = useState("0")
const [btnType, setBtnType] = useState("定时推送")
const { template, confirmModal } = props.location.state
const [currentTrench, setCurrentTrench] = useState({
isMessageShow: false,
isAPPShow: false,
isWEBShow: false,
isWXShow: false
})
const [APP_ITEMS, setAPP_ITEMS] = useState([])
const [WEB_ITEMS, setWEB_ITEMS] = useState([])
const [WX_ITEMS, setWX_ITEMS] = useState([])
const [MES_ITEMS, setMES_ITEMS] = useState([])
const [listType, setListType] = useState([{ title: '定时推送', desc: '用于周期性简报的定时推送,如智能巡检、运行周报。' }, { title: '监控报警', desc: '设备硬件故障,阈值超限,状态突变,采集超时等异常情况报警。' }, { title: '工单办理', desc: '在工单系统中,针对特定人员的通知,包括工作办理、审核、会签、回退等操作。' }, { title: '平台公告', desc: '由运维人员向所有用户或特定用户发送的事务公告,如系统升级、维护。' }])
useEffect(() => {
GetMessageTemplate().then(
res => {
if (res.code === 0) {
let arr1 = []
let arr2 = []
let arr3 = []
let arr4 = []
res.data.map((item, index) => {
if (item.Type === "公众号") {
arr1.push(item)
}
if (item.Type === "短信") {
arr2.push(item)
}
if (item.Type === "APP") {
arr3.push(item)
}
if (item.Type === "WEB") {
arr4.push(item)
}
})
setAPP_ITEMS(arr3)
setMES_ITEMS(arr2)
console.log('arr1', arr1);
setWX_ITEMS(arr1)
setWEB_ITEMS(arr4)
}
}
)
}, [])
useEffect(() => {
if (template.ThemeName) {
form.setFieldsValue({
name: template.MsgType,
isStart: template.IsStarted === "0" ? "关闭" : "开启",
to_person: template.PushGroup,
push_mode: template.PushMode === null ? '' : template.PushMode.split(","),
app_template: template.AppTemplateID,
app_path: template.AppFunctionPath,
wx_template: template.PublicTemplateID ? parseInt(template.PublicTemplateID) : '',
h5_path: template.PublicPath,
miniprogram_path: template.MiniAppRoute,
web_template: template.WebTemplateID,
web_path: template.WebFunctionPath,
message_template: template.MsgTemplateID,
})
setPlan(template.MsgType)
setBtnType(template.type)
setIsUse(template.IsStarted)
setCurrentTrench({
isAPPShow: template.PushMode && template.PushMode.split(",").indexOf("平台弹框") > -1 ? true : false,
isWXShow: template.PushMode && template.PushMode.split(",").indexOf("公众号推送") > -1 ? true : false,
isWEBShow: template.PushMode && template.PushMode.split(",").indexOf("平台弹框") > -1 ? true : false,
isMessageShow: template.PushMode && template.PushMode.split(",").indexOf("短信推送") > -1 ? true : false,
})
}
else {
setBtnType('定时推送')
}
}, [props])
const onNameChange = (e) => {
setPlan(e.target.value)
}
const onSubmit = () => {
let fv = form.getFieldValue()
console.log('fv',fv);
let push_mode = ((currentTrench.isAPPShow || currentTrench.isWEBShow) ? '平台弹框' : '') + (currentTrench.isWXShow ? ',公众号推送' : '') + (currentTrench.isMessageShow ? ',短信推送' : '')
if (template.ThemeName) {
let a = {
ID: template.ID,
ThemeName: template.ThemeName,
MsgType: fv.name,
PublicTemplateID: fv.wx_template.toString(),
PublicConfig: template.PublicConfig,
PublicPath: fv.h5_path,
MsgTemplateName: template.MsgTemplateName,
MsgTemplateCode: template.MsgTemplateCode,
MsgConfig: template.MsgConfig,
MiniAppRoute: fv.miniprogram_path,
AppFunctionPath: fv.app_path,
AppConfig: template.AppConfig,
WebFunctionPath: fv.web_path,
WebConfig: template.WebConfig,
IsDelete: template.IsDelete,
InputTime: moment().format("YYYY-MM-DD HH:mm:ss"),
Pusher: template.Pusher,
PushMode: push_mode,
PushPath: template.PushPath,
IsStarted: isUse,
MsgTemplateID: fv.message_template,
AppTemplateID: fv.app_template,
WebTemplateID: fv.web_template,
PushGroup: fv.to_person ? fv.to_person.toString() : ''
}
UpdateMessageConfig(a).then(
res => {
if (res.code === 0) {
if (IISConfig) {
AddIISAgentConfig(IISConfig).then(
res => {
if (res.code === 0) {
message.success("保存成功")
}
}
)
} else {
message.success("保存成功")
}
}
else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
}
)
} else {
let b = {
ThemeName: "定时推送",
MsgType: fv.name,
PublicTemplateID: fv.wx_template?fv.wx_template.toString():null,
PublicConfig: template.PublicConfig,
PublicPath: fv.h5_path,
MsgTemplateName: template.MsgTemplateName,
MsgTemplateCode: template.MsgTemplateCode,
MsgConfig: template.MsgConfig,
MiniAppRoute: fv.miniprogram_path,
AppFunctionPath: fv.app_path,
AppConfig: template.AppConfig,
WebFunctionPath: fv.web_path,
WebConfig: template.WebConfig,
IsDelete: template.IsDelete,
InputTime: moment().format("YYYY-MM-DD HH:mm:ss"),
Pusher: template.Pusher,
PushMode: push_mode,
PushPath: template.PushPath,
IsStarted: isUse,
MsgTemplateID: fv.message_template,
AppTemplateID: fv.app_template,
WebTemplateID: fv.web_template,
PushGroup: fv.to_person ? fv.to_person.toString() : ''
}
console.log(b)
InsertMessageConfig(b).then(
res => {
if (res.code === 0) {
if (IISConfig) {
AddIISAgentConfig(IISConfig).then(
res => {
if (res.code === 0) {
message.success("保存成功")
}
else{
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
}
)
} else {
message.success("保存成功")
}
}
else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
}
)
}
}
const onIISAgentSubmit = (value) => {
setIISConfig(value)
}
const onPushSubmit = (value) => {
console.log(value, "onPushSubmit")
}
const layout = {
layout: 'horizontal',
labelCol: {
span: 2,
},
wrapperCol: {
span: 24,
},
};
const onChange = (value) => {
setIsUse(value?'1':'0')
}
const back = () => {
history.push('/platformCenter/notify')
}
const tailLayout = {
wrapperCol: { offset: 21, span: 24 },
};
const onTypeChange = (value, type) => {
let data = { ...currentTrench }
data[type] = value
setCurrentTrench(data)
}
return (
<div className={styles.editModal_container}>
<Form form={form} {...layout} onFinish={onSubmit}>
<div className={styles.content}>
<Card title="方案" style={{ width: '100%' }}>
<Item
label="方案名称"
name="name"
rules={[
{
required: true,
message: '请输入方案名称',
},
]}
>
<Input style={{ width: '25rem' }} placeholder="请输入方案名称" disabled={template.ThemeName ? true : false} onChange={onNameChange} />
</Item>
<Item
label="方案类型"
>
<div className={styles.cardList}>
{listType.map(item => {
return <div key={item.title} className={styles.cardListItem}><Button type={item.title === btnType ? 'primary' : 'default'} style={{ cursor: 'not-allowed', marginRight: '1rem' }} >{item.title}</Button> <span>{item.desc}</span></div>
})}
</div>
</Item>
</Card>
{btnType === '定时推送' && (<Card title="推送信息" style={{ width: '100%', marginTop: '1rem' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Item
label="推送组"
name="to_person"
labelCol={{ span: 5 }}
style={{ paddingTop: '1.6rem', width: '35rem' }}
>
<VisibleRoleModal
style={{ display: 'flex', width: '35rem', alignItems: 'center' }}
onSubmit={onPushSubmit}
selectValue={template && template.PushGroup ? template.PushGroup : []}
title={<UsergroupDeleteOutlined style={{ fontSize: '18px' }} />} />
</Item>
<div style={{ display: 'flex', width: '30rem', margin: '0 2rem', alignItems: 'center' }}>
推送计划: <VisibleIISAgentConfig agentConfig={template.item && template.item.AgentConfig} value={plan} onIISAgentSubmit={onIISAgentSubmit} />
</div>
<span>
是否启用:<Switchs checked={isUse === '0' ? false : true} onChange={onChange} />
</span>
</div>
</Card>)}
<div className={styles.push_trench}>
{
<div className={styles.trench_card}>
<div className={styles.card_title}>
<div className={styles.lable}>APP</div>
<Switchs onChange={e => onTypeChange(e, 'isAPPShow')} checked={currentTrench.isAPPShow} />
</div>
<div className={styles.card_body}>
<Item
label="模板"
name="app_template"
labelCol={{ span: 4 }}
>
<Select style={{ width: '97%' }} disabled={!currentTrench.isAPPShow} >
{
APP_ITEMS.map((item, idx) => {
return (
<Select.Option value={item.Id} key={idx}>{item.LikeName}</Select.Option>
)
})
}
</Select>
</Item>
<Item
label="功能路径"
name="app_path"
labelCol={{ span: 4 }}
>
<Input style={{ width: '97%' }} disabled={!currentTrench.isAPPShow} placeholder="请输入功能路径" />
</Item>
</div>
</div>
}
{
<div className={styles.trench_card}>
<div className={styles.card_title}>
<div className={styles.lable}>微信</div>
<Switchs onChange={e => onTypeChange(e, 'isWXShow')} checked={currentTrench.isWXShow} />
</div>
<div className={styles.card_body}>
<Item
label="模板"
name="wx_template"
labelCol={{ span: 4 }}
>
<Select style={{ width: '97%' }} disabled={!currentTrench.isWXShow} >
{
WX_ITEMS.map((item, idx) => {
return (
<Select.Option value={item.Id} key={idx}>{item.LikeName}</Select.Option>
)
})
}
</Select>
</Item>
<Item
label="H5路由"
name="h5_path"
labelCol={{ span: 4 }}
>
<Input style={{ width: '97%' }} disabled={!currentTrench.isWXShow} placeholder="请输入功能路径" />
</Item>
<Item
label="小程序路由"
name="miniprogram_path"
labelCol={{ span: 4 }}
>
<Input style={{ width: '97%' }} disabled={!currentTrench.isWXShow} placeholder="请输入功能路径" />
</Item>
</div>
</div>
}
{
<div className={styles.trench_card}>
<div className={styles.card_title}>
<div className={styles.lable}>WEB</div>
<Switchs onChange={e => onTypeChange(e, 'isWEBShow')} checked={currentTrench.isWEBShow} />
</div>
<div className={styles.card_body}>
<Item
label="模板"
name="web_template"
labelCol={{ span: 4 }}
>
<Select style={{ width: '97%' }} disabled={!currentTrench.isWEBShow}>
{
WEB_ITEMS.map((item, idx) => {
return (
<Select.Option value={item.Id} key={idx}>{item.LikeName}</Select.Option>
)
})
}
</Select>
</Item>
<Item
label="功能路径"
name="web_path"
labelCol={{ span: 4 }}
>
<Input style={{ width: '97%' }} disabled={!currentTrench.isWEBShow} placeholder="请输入功能路径" />
</Item>
</div>
</div>
}
{
<div className={styles.trench_card}>
<div className={styles.card_title}>
<div className={styles.lable}>短信推送</div>
<Switchs onChange={e => onTypeChange(e, 'isMessageShow')} checked={currentTrench.isMessageShow} />
</div>
<div className={styles.card_body}>
<Item
label="模板"
name="message_template"
labelCol={{ span: 4 }}
>
<Select style={{ width: '97%' }} disabled={!currentTrench.isMessageShow} >
{
MES_ITEMS.map((item, idx) => {
return (
<Select.Option value={item.Id} key={idx}>{item.LikeName}</Select.Option>
)
})
}
</Select>
</Item>
</div>
</div>
}
</div>
</div>
<Item {...tailLayout} style={{ marginTop: '1rem' }}>
<Button htmlType="button" onClick={back} style={{ marginRight: '2rem' }}>
返回
</Button>
<Button type="primary" htmlType="submit">
确定
</Button>
</Item>
</Form>
<div>
</div>
</div>
)
}
export default EditModal;
\ No newline at end of file
.editModal_container{
width: 100%;
overflow-y: hidden;
height: calc(100% - 20px);
display: flex;
flex-direction: column;
button[ant-click-animating-without-extra-node]:after {
border: 0 none;
opacity: 0;
animation:none 0 ease 0 1 normal;
}
.content{
height: calc(100vh - 140px);
overflow-y: scroll;
}
.cardList{
display: flex;
flex-wrap: wrap;
.cardListItem{
width: 50%;
margin-bottom: 1rem;
}
}
.ant-card-bordered {
border-right: none;
}
.push_trench{
width: 100%;
height: fit-content;
display: flex;
flex-direction:row;
flex-wrap: wrap;
justify-content: space-between;
.trench_card{
margin-top: 1rem;
width: 49.2%;
border-width: 1px;
border-color: #EEEEEE;
border-style: solid;
border-radius: 5px;
display: flex;
flex-direction: column;
align-items: center;
background-color: #ffffff;
.card_title{
border-bottom-style: solid;
border-bottom-width: 1px;
border-bottom-color:#F6F7F9;
height:50px;
width: 100%;
display: flex;
flex-direction: row;
justify-content:space-between;
padding: 0 1.6rem;
align-items: center;
.lable{
font-size: large;
margin-left: 10px;
}
}
.card_body{
margin-top: 10px;
width: 100%;
padding: 10px;
height: 18rem;
display: flex;
flex-direction: column;
justify-content: center;
}
}
}
}
\ No newline at end of file
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Form, Modal, Space, Divider, Radio, Checkbox } from 'antd';
import {
} from '@/services/platform/bs'
import styles from './index.less'
import styles from './standingBook.less'
import Sortable from 'sortablejs';
const CheckboxGroup = Checkbox.Group;
const AddModal = props => {
const { callBackSubmit = () => { }, isType, formObj, visible, filed, characterValue, newCheckedList } = props;
const { callBackSubmit = () => { }, isType, pickItem, visible, filed, characterValue, newCheckedList } = props;
const [loading, setLoading] = useState(false);
const [value, setValue] = useState('');
const [checkValue, setCheckValue] = useState([]);
......@@ -19,10 +17,16 @@ const AddModal = props => {
const [checkAll, setCheckAll] = useState([]);
const [selectData, setSelectData] = useState([])
let objArr = []
const onChangeList = (list, index) => {
const onChangeList = (list, index, title) => {
const checkedListArr = [...checkedList]
checkedListArr[index] = list
setCheckedList(checkedListArr);
const indeterminateArr = [...indeterminate]
const checkAllArr = [...checkAll]
indeterminateArr[index] = !!list.length && list.length < filed[title].length
checkAllArr[index] = list.length === filed[title].length
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr);
};
const onCheckAllChange = e => {
......@@ -50,47 +54,37 @@ const AddModal = props => {
}
const onSubmit = () => {
isType === 'rule' ? callBackSubmit(`${value === '无' || value === '' ? '' : value + ','}${checkValue.join(',')}`) : callBackSubmit({ checkedList, str: selectData.join(",") });
isType === 'rule' ? callBackSubmit(`${value === '无' || value === '' ? '' : value + ','}${checkValue.join(',')}`) : callBackSubmit({ checkedList, str: selectData.join(","), pickItem });
};
useEffect(() => {
if (isType != '' && isType === 'rule') {
setValue(formObj.numerical)
setCheckValue(formObj.rule)
}
else if (isType === 'characteristics') {
if (isType != '') {
let arr = Object.keys(filed)
setTitle(arr)
console.log('arr', arr);
let checkArr = []
let indeterminateArr = []
let checkAllArr = []
arr.map((item, index) => {
indeterminateArr.push(true)
checkAllArr.push(false)
checkArr[index] = []
newCheckedList.map(checkItem => {
if (filed[item].includes(checkItem)) {
checkArr[index].push(checkItem)
}
})
indeterminateArr.push(!!checkArr[index].length && checkArr[index].length < filed[item].length)
checkAllArr.push(checkArr[index].length === filed[item].length)
})
setCheckedList(newCheckedList)
setCheckedList(checkArr)
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr)
let newArr = characterValue.length? characterValue.split(","):[]
let newArr = characterValue.length ? characterValue.split(",") : []
setSelectData(newArr)
draftSort()
}
}, [visible]);
//单选框变化时触发的事件
const handleChange = (e) => {
setValue(e.target.value)
if (e.target.value === '无') {
setCheckValue([])
}
}
//复选框变化时触发的事件
const onChange = (e) => {
setCheckValue(e)
if (e.length && value == '无') {
setValue('')
}
}
//拖拽初始化及逻辑
const draftSort = () => {
let el = document.getElementById('doctor-drag-items');
......@@ -114,10 +108,10 @@ const AddModal = props => {
<Modal
title={isType === 'rule' ? '选择验证规则' : '字段集选择'}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '160px' }}
style={{ top: '10px' }}
width="700px"
destroyOnClose
centered ={true}
centered={true}
maskClosable={false}
cancelText="取消"
okText="确认"
......@@ -127,30 +121,8 @@ const AddModal = props => {
forceRender={true}
getContainer={false}
>
{visible && isType === 'rule' && (
<>
<Radio.Group onChange={handleChange} value={value}>
<Space direction="vertical">
<Radio value='无'>无(清空选中)</Radio>
<Radio value='number'>数值(number)</Radio>
<Radio value='digits'>整数(digits)</Radio>
<Radio value='email'>邮箱(email)</Radio>
<Radio value='identity'>身份证号(identity)</Radio>
<Radio value='mobile'>手机号(mobile)</Radio>
<Radio value='bankAccount'>银行卡号(bankAccount)</Radio>
<Radio value='timeControl'>时间控制(timeControl)</Radio>
</Space>
</Radio.Group>
<Checkbox.Group style={{ width: '100%', marginTop: '1rem' }} onChange={onChange} value={checkValue}>
<Space direction="vertical">
<Checkbox value="required">必填(required)</Checkbox>
<Checkbox value="emphasis">强调(emphasis)</Checkbox>
<Checkbox value="sensitive">敏感(sensitive)</Checkbox>
</Space>
</Checkbox.Group>
</>
)}
{visible && isType === 'characteristics' && (
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem} style={{ borderRight: '1px solid #99bbe8' }}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}>待选字段列表</Divider>
......@@ -158,7 +130,7 @@ const AddModal = props => {
{title.map((item, index) => {
return <div className={styles.cardItemData} key={index}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', color: '#15428b', borderTopColor: '#99bbe8' }}>{item} <Checkbox indeterminate={indeterminate[index]} onChange={onCheckAllChange} index={index} checkvalue={filed[item]} checked={checkAll[index]}> </Checkbox></Divider>
<CheckboxGroup options={filed[item]} value={checkedList[index]} onChange={(e) => onChangeList(e, index)} /></div>
<CheckboxGroup options={filed[item]} value={checkedList[index]} onChange={(e) => onChangeList(e, index, item)} /></div>
})}
</div>
</div>
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, Tooltip, Button, notification, Image, Menu, Dropdown } from 'antd';
import {
PlusOutlined,
InfoCircleOutlined,
DownOutlined
} from '@ant-design/icons';
import {
LoadEventFields
} from '@/services/platform/bs'
import add from '@/assets/images/thumbnail/add.jpg';
import editor from '@/assets/images/thumbnail/editor.jpg';
import hand from '@/assets/images/thumbnail/hand.png';
import search from '@/assets/images/thumbnail/search.jpg';
import taizhang from '@/assets/images/thumbnail/taizhang.jpg';
import web from '@/assets/images/thumbnail/web.jpg';
import {
GetCM_Ledger_LoadLedgerTable, GetCMLedger_QueryLedgers, GetCMLedger_OperateLedger
} from '@/services/standingBook/api';
import styles from './standingBook.less';
import ChangeAdd from './changeAdd'
import { orderBy } from 'lodash';
const { Option } = Select;
const { TextArea } = Input;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, tableData, maxLength } = props;
const [standingTable, setStandingTable] = useState([]);
const [inputValue, setInputVaule] = useState({ Fields: '', EditFields: '', AddFields: '', MobileFields: '', SearchFields: '', WebFields: '' });
const [isVisible, setIsVisible] = useState(false); // 弹窗
const [loading, setLoading] = useState(false);
const [pickItem, setPickItem] = useState('')
const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [types, setTypes] = useState(''); // 弹窗类型
const [Order, setOrder] = useState(''); // 弹窗类型
const [checkedList, setCheckedList] = useState([])
const [Type,setType] = useState('')
const [characterValue, setCharacterValue] = useState('')
const [standingType, setStandingType] = useState(['台账', '反馈', '设备']);
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
let data = type == 'add' ? { ...obj, ...inputValue, Order: maxLength } : { ...obj, Order, ID: formObj.ID }
GetCMLedger_OperateLedger(data)
.then(res => {
setLoading(false);
if (res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: type == 'add' ? '新增成功' : '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(err => {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
setLoading(false);
});
}
});
};
const onFinish = value => { };
useEffect(() => {
getTableData()
if (type === 'edit') {
GetCMLedger_QueryLedgers({ ledgerId: formObj.ID }).then(res => {
res.data.root && form.setFieldsValue({ ...res.data.root });
setInputVaule({ ...res.data.root })
setOrder(res.data.root.Order)
setType(res.data.root.Type)
changTable(res.data.root.TableName)
})
}
else if (type === 'add') {
setInputVaule({ Fields: '', EditFields: '', AddFields: '', MobileFields: '', SearchFields: '', WebFields: '' })
setFiled({})
form.resetFields();
form.setFieldsValue({ AccountType: '台账' });
}
}, [visible]);
const layout = {
layout: 'horizontal',
labelCol: {
span: 5,
},
wrapperCol: {
span: 19,
},
};
const getTableData = () => {
setType('')
GetCM_Ledger_LoadLedgerTable().then(res => {
if (res.msg === 'Ok') {
setStandingTable(res.data.root)
}
})
}
const changTable = (value) => {
LoadEventFields({ eventTableName: value, distinctFields: '' }).then(res => {
if (res.data.root && res.data.root.length) {
setFiled(formateArrDataA(res.data.root, 'group'))
}
})
}
const formateArrDataA = (initialArr, name) => {
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
}
//先获取一下这个数组中有多少个"name"
let nameArr = []
for (let i in initialArr) {
if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
nameArr.push(initialArr[i][`${name}`])
}
}
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in initialArr) {
if (initialArr[j][`${name}`] == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(initialArr[j])
}
}
}
for (let key in tempObj) {
let arr = []
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.fieldName)
})
}
return tempObj
}
const onOK = prop => {
setIsVisible(false)
let inputText = { ...inputValue }
inputText[prop.pickItem] = prop.str
setCheckedList(prop.checkedList)
setInputVaule(inputText)
}
const pickFiled = (fileds) => {
setTypes('add')
setCharacterValue(inputValue[fileds])
setCheckedList(inputValue[fileds].split(','))
setPickItem(fileds)
setIsVisible(true)
}
const changeText = (e, type) => {
let inputText = { ...inputValue }
inputText[type] = e.target.value
setInputVaule(inputText)
}
const inputType = (e) => {
setType(e.target.value)
form.setFieldsValue({ Type:e.target.value })
}
return (
<Modal
title={`${type === 'add' ? '台账配置' : '台账编辑'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '80px' }}
width="700px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
{visible && (
<div className={styles.formData}>
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="分组"
name="Type"
rules={[{ required: true, message: '请选择分组' }]}
>
<div>
<Input
className="ue-editable-select-input"
onChange={inputType}
value = {Type}
>
</Input>
<Dropdown
placement='bottomRight'
style={{width:'20rem'}}
overlay={<Menu>
{tableData.length ? tableData.map((item, index) => { return <Menu.Item onClick={()=>{setType(item); form.setFieldsValue({ Type:item})}} style={{width:'26.6rem'}} key={index}>{item}</Menu.Item> }) : ''}
</Menu>} >
<div className={styles.linkDrowp} onClick={e => e.preventDefault()}>
<DownOutlined style={{fontSize:'12px',color:'rgba(0, 0, 0, 0.25)'}} />
</div>
</Dropdown>
{/* {tableData.length ? tableData.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''} */}
</div>
</Item>
<Item
label="台账类型"
name="AccountType"
>
<Select
placeholder="选择台账类型"
>
{standingType.length ? standingType.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''}
</Select>
</Item>
<Item
label="台账名称"
name="Name"
rules={[{ required: true, message: '请输入台账名称' }]}
>
<Input placeholder="台账名称不可重复" allowClear />
</Item>
<Item
label="台账表"
name="TableName"
rules={[{ required: true, message: '请选择台账表' }]}
>
<Select
placeholder=""
optionFilterProp="children"
onChange={changTable}
>
{standingTable.length ? standingTable.map((item, index) => { return <Option key={index} value={item.value}>{item.text}</Option> }) : ''}
</Select>
</Item>
<Item
label={<div className={styles.formData_label}>
<Tooltip title={<Image
width={200}
src={taizhang}
/>}><InfoCircleOutlined style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }} /></Tooltip><span>台账字段</span> </div>}
name="Fields"
>
<div className={styles.filed_listItem} >
<TextArea placeholder="前端详情查看字段" onChange={(e) => changeText(e, 'Fields')} value={inputValue.Fields} allowClear />
<Button type="dashed" onClick={() => pickFiled('Fields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
<Item
label={<div className={styles.formData_label}> <Tooltip title={<Image
width={200}
src={search}
/>}><InfoCircleOutlined style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }} /></Tooltip><span>检索字段</span> </div>}
name="SearchFields"
>
<div className={styles.filed_listItem} >
<TextArea placeholder="前端列表检索字段" onChange={(e) => changeText(e, 'SearchFields')} value={inputValue.SearchFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('SearchFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
<Item
label={<div className={styles.formData_label}> <Tooltip title={<Image
width={200}
src={add}
/>}><InfoCircleOutlined style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }} /></Tooltip><span>添加字段</span> </div>}
name="AddFields"
>
<div className={styles.filed_listItem} >
<TextArea placeholder="前端数据添加字段" onChange={(e) => changeText(e, 'AddFields')} value={inputValue.AddFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('AddFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
<Item
label={<div className={styles.formData_label}>
<Tooltip
title={<Image
width={200}
src={editor}
/>}><InfoCircleOutlined style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }} /></Tooltip><span>编辑字段</span> </div>}
name="EditFields"
>
<div className={styles.filed_listItem} >
<TextArea placeholder="前端可编辑字段" onChange={(e) => changeText(e, 'EditFields')} value={inputValue.EditFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('EditFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
<Item
label={<div className={styles.formData_label}>
<Tooltip title={<Image
width={200}
src={web}
/>}><InfoCircleOutlined style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }} /></Tooltip><span>前端字段</span> </div>}
name="WebFields"
>
<div className={styles.filed_listItem} >
<TextArea placeholder="前端列表展示字段" onChange={(e) => changeText(e, 'WebFields')} value={inputValue.WebFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('WebFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
<Item
label={<div className={styles.formData_label}>
<Tooltip title={<Image
width={100}
src={hand}
/>}><InfoCircleOutlined style={{ color: '#1890FF', padding: '0.2rem 0.2rem 0 0' }} /></Tooltip><span>手持字段</span> </div>}
name="MobileFields"
>
<div className={styles.filed_listItem} >
<TextArea placeholder="手持展示字段" onChange={(e) => changeText(e, 'MobileFields')} value={inputValue.MobileFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('MobileFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
<Item
label='接口配置'
name="Interface"
>
<div className={styles.filed_listItem} >
<TextArea placeholder="服务项目dll库" allowClear />
</div>
</Item>
</Form>
<ChangeAdd
visible={isVisible}
onCancel={() => setIsVisible(false)}
callBackSubmit={onOK}
newCheckedList={checkedList}
isType={types}
filed={filed}
pickItem={pickItem}
characterValue={characterValue}
formObj={formObj} />
</div>
)
}
</Modal >
);
};
export default AddModal;
import React, { useState, useEffect } from 'react';
import {
Form,
Card,
Space,
Table,
Popconfirm,
Spin,
Tooltip,
notification,
} from 'antd';
import {
DoubleLeftOutlined,
DoubleRightOutlined,
PlusSquareFilled,
RightOutlined,
EditTwoTone,
DeleteOutlined
} from '@ant-design/icons';
import classnames from 'classnames';
import PageContainer from '@/components/BasePageContainer';
import { GetCM_Ledger_LoadLedgers, CM_Ledger_RmoveLedger } from '@/services/standingBook/api';
import AddModal from './editorModal'
import styles from './standingBook.less';
const standingBook = props => {
const [allData, setAllData] = useState([]);
const [tableData, setTableData] = useState([]);
const [treeLoading, setTreeLoading] = useState(false);
const [maxLength, setMaxLength] = useState(0);
const [treeVisible, setTreeVisible] = useState(true); // 左边列表是否可见
const [formObj, setFormObj] = useState('');
const [flag, setFlag] = useState(0); // 弹窗类型
const [isVisible, setIsVisible] = useState(false); // 弹窗
const [isType, setIsType] = useState(''); // 弹窗类型
const [pickItem, setPickItem] = useState('');
const { Item } = Form;
const editor = record => {
setFormObj(record);
setIsType('edit');
setIsVisible(true);
};
const Submit = prop => {
setIsVisible(false);
setFlag(flag + 1);
};
const columns = [
{
title: '台账类型',
dataIndex: 'AccountType',
key: 'AccountType',
width: 100,
},
{
title: '台账名称',
dataIndex: 'name',
key: 'name',
align: 'center',
width: 200,
},
{
title: '台账表名',
dataIndex: 'tableName',
key: 'tableName',
align: 'center',
width: 300,
},
{
title: '台账字段',
dataIndex: 'fields',
key: 'fields',
align: 'center',
width: 100,
},
{
title: '检索字段',
dataIndex: 'searchFields',
key: 'searchFields',
align: 'center',
width: 100,
},
{
title: '添加字段',
dataIndex: 'addFields',
key: 'addFields',
align: 'center',
width: 100,
},
{
title: '编辑字段',
dataIndex: 'editFields',
key: 'editFields',
align: 'center',
width: 100,
},
{
title: '前端字段',
dataIndex: 'webFields',
key: 'webFields',
align: 'center',
width: 100,
},
{
title: '手持字段',
dataIndex: 'mobileFields',
key: 'mobileFields',
align: 'center',
width: 100,
},
{
title: '操作',
ellipsis: true,
align: 'center',
render: (text, record) => (
<Space>
<Tooltip title="编辑此表">
<EditTwoTone
onClick={() => editor(record)}
style={{ fontSize: '16px' }}
/>
</Tooltip>
<Tooltip title="删除此表">
<Popconfirm
placement="bottomRight"
title={
<p>
是否删除此表
</p>
}
// title={`确认删除用户${currentUser}`}
okText="确认"
cancelText="取消"
onConfirm={() => deleteChart(record)}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
</Space>
),
},
];
useEffect(() => {
setTreeLoading(true);
GetCM_Ledger_LoadLedgers().then(res => {
setTreeLoading(false);
if (res.msg === 'Ok' && res.data.root) {
setMaxLength(res.data.root.length + 1)
let arr = formateArrDataA(res.data.root, 'type')
let newArr = []
Object.keys(arr).map((item, index) => {
newArr.push(item)
})
setAllData(arr);
setPickItem(newArr[0])
console.log(newArr, 'newArr');
setTableData(newArr);
}
});
}, [flag]);
const formateArrDataA = (initialArr, name) => {
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
}
//先获取一下这个数组中有多少个"name"
let nameArr = []
for (let i in initialArr) {
if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
nameArr.push(initialArr[i][`${name}`])
}
}
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in initialArr) {
if (initialArr[j][`${name}`] == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(initialArr[j])
}
}
}
for (let keys in tempObj) {
let arr = []
tempObj[keys].map((item, index) => {
tempObj[keys] = arr;
item.key = index
arr.push(item)
})
}
return tempObj
}
// 删除表字段
const deleteChart = record => {
CM_Ledger_RmoveLedger({ ledgerId: record.ID }).then(res => {
if (res.msg === 'Ok' || res.msg === '') {
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
setFlag(flag + 1);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
};
//显示弹框
const showPopup = () => {
setIsVisible(true)
setIsType('add')
}
const onSubmit = () => {
setIsVisible(false);
setFlag(flag + 1)
};
return (
<PageContainer className={styles.userManageContainer}>
<div className={styles.contentContainers}>
<Spin spinning={treeLoading} tip="loading...">
<Card
className={classnames({
[styles.orgContainer]: true,
[styles.orgContainerHide]: !treeVisible,
})}
>
{treeVisible ? <>
<div>
<span
style={{
fontSize: '15px ',
fontWeight: 'bold',
color: '#333E51',
paddingLeft: '14px'
}}
>
台账列表
</span>
<Tooltip title="添加台账表">
<PlusSquareFilled
style={{
color: '#1890FF',
fontSize: '25px',
verticalAlign: 'middle',
float: 'right',
paddingRight: '14px'
}}
onClick={e => showPopup()}
/>
</Tooltip>
<hr style={{ width: '100%', color: '#eeecec' }} />
{
tableData.length && (tableData.map((item, index) => {
return <div className={classnames({
[styles.listItem]: true,
[styles.pickItem]: item === pickItem,
})} onClick={e => setPickItem(item)} key={index}>{item}({allData[item] ? allData[item].length : ''}条) {item === pickItem ? <RightOutlined /> : ''} </div>
})
)}
</div></> : ''}
<div className={styles.switcher}>
{treeVisible && (
<Tooltip title="隐藏台账列表">
<DoubleLeftOutlined onClick={() => setTreeVisible(false)} />
</Tooltip>
)}
{!treeVisible && (
<Tooltip title="显示台账列表">
<DoubleRightOutlined onClick={() => setTreeVisible(true)} />
</Tooltip>
)}
</div>
</Card>
</Spin>
<div
className={classnames({
[styles.userContainer]: true,
[styles.userContainerHide]: !treeVisible,
})}
>
<Table
size="small"
rowKey='ID'
bordered
onRow={record => {
return {
onDoubleClick: event => {event.stopPropagation(); editor(record)}, //双击
};
}}
columns={columns}
dataSource={allData[pickItem]}
// loading={tableLoading}
scroll={{ x: 'max-content', y: 'calc(100vh - 150px)' }}
// scroll={{ x: 'max-content' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
showSizeChanger: true,
}}
/>
</div>
<AddModal visible={isVisible} type={isType} formObj={formObj} maxLength={maxLength} callBackSubmit={onSubmit} onCancel={() => setIsVisible(false)} tableData={tableData} />
</div>
</PageContainer>
);
};
export default standingBook;
.redText{
color: red;
cursor: pointer;
}
.ant-layout{
overflow: auto;
.ant-layout-content{
margin:12px !important;
}
}
.ant-btn > .anticon + span, .ant-btn > span + .anticon {
margin-left: 8px;
vertical-align: middle;
}
.siteTitle{
font-size: 16px;
margin: 0 0 6px 0;
user-select: none;
padding: 3px;
border-bottom: 1px solid #ccc;
}
.userManageContainer{
.ant-card-body{
padding-left: 0;
padding-right: 0;
}
.listItem{
display: flex;
justify-content: space-between;
font-size: 14px;
font-weight: 400;
color: #414E65;
cursor: pointer;
line-height: 28px;
align-items: center;
padding: 8px 14px;
}
.pickItem{
background-color: #F5F6F9;
}
.ant-form-item {
vertical-align: top;
}
.ant-form-item-label > label {
align-items:middle;
}
.ant-modal-body{
padding-bottom:0px;
padding-right:40px;
padding-left:40px;
.ant-form{
width: 90%;
}
}
.anticon svg {
margin-top: -3px;
}
.ant-popover-message {
position: relative;
padding: 0px 0 0px;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
}
.ant-tree-treenode{
width: 100% !important;
.ant-tree-node-content-wrapper{
display: inline-block;
width: 100%;
}
.iconWraper1{
float: right;
span{
display: none;
}
}
}
.ant-tree-treenode:hover{
.iconWraper1>span{
margin-left: 12px;
font-size: 18px;
display: inline-block;
}
}
.ant-radio-group {
margin: 0px !important;
}
.contentContainers{
display: flex;
width: 100%;
position: relative;
.ant-table.ant-table-bordered > .ant-table-container {
min-width: calc(100vw - 582px);
height: calc(100vh - 120px);
overflow-x: hidden;
border: none;
}
.orgContainer{
height: calc(100vh - 74px);
width: 340px;
left: 0;
top: 0;
overflow-x: hidden;
margin-right: 10px;
position: relative;
transition-property:width,left;
transition-duration: 0.5s;
white-space: nowrap;
.ant-tree{
padding-top: 6px;
.ant-tree-switcher{
line-height: 1;
margin-right: 0px !important;
color:#1890FF;
.ant-tree-switcher-line-icon{
margin-left: 5px;
}
}
}
.switcher{
display: block;
position: absolute;
font-size: 18px;
color: #1890FF!important;
top: 50%;
right: 2px;
transform: translate(0%,-50%);
z-index: 1;
}
}
.orgContainerHide{
// transform: translateX(-230px);
left: 0px;
top: 0;
width: 26px;
}
.ant-popover-message-title {
padding-left: 20px;
}
.userContainer{
height: calc(100vh - 74px) !important;
z-index: 999;
min-width: 800px;
background: white;
width: 100%;
position: relative;
transition: width 0.5s;
.title{
margin: 16px 0 10px 16px;
display: inline-block;
width: 270px;
cursor: pointer;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding: 8px;
padding-right: 20px;
}
.ant-btn{
margin: 0px 10px;
.ant-btn-primary{
background: #50aefc;
}
}
.ant-input-search-button{
margin-left: 0px !important;
}
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-table-cell{
text-align:center;
overflow: hidden;
// text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-body{
height:calc(100vh - 210px);
border-right: white;
overflow: auto !important;
}
.clickRowStyle{
background: #cfe7fd;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
}
}
}
.ant-modal-root{
.ant-tree-switcher{
line-height: 1;
color:#1890FF;
margin-right: 0px !important;
}
.ant-checkbox-group .ant-checkbox-group-item {
margin-right: 0px !important;
min-width: 270px !important;
}
.ant-tree-list-holder{
overflow: auto;
overflow-x:hidden;
height: 40vh;
}
.ant-tabs-content-holder{
overflow: auto;
height: 50vh;
}
}
.ant-modal-content{
border-radius: 5px;
}
.ant-modal-header{
border-radius: 5px 5px 0 0;
padding: 28px 40px;
}
.ant-modal-close{
top:14px;
right:20px;
}
.ant-modal-footer{
border:none;
padding: 28px 40px;
}
.ant-modal-footer .ant-btn + .ant-btn:not(.ant-dropdown-trigger) {
margin-bottom: 0;
margin-left: 15px;
}
// .ant-form-horizontal .ant-form-item-control {
// margin-left: 10px;
// }
.linkDrowp{
position: absolute;
top: 0;
left: 94.6%;
width: 1rem;
height: 100%;
display: flex;
align-items: center;
}
.title{
display: flex;
align-items: center;
width: 100%;
}
.tip{
display: none;
}
.fs{
font-size: 18px;
margin-left: 10px;
}
.title:hover{
.tip{
display: flex;
align-items: center;
justify-content: flex-end;
width: 100%;
}
}
.titleText{
width: 12rem;
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
}
.ant-popover-inner {
border-radius: 10px;
background-color: rgba(255, 255, 255, 0.788);
}
.ant-popover-inner-content {
padding: 10px 10px;
}
.ant-popover-message > .anticon {
top: 7.0005px
}
.listCard{
display: flex;
.cardItem{
padding: 0.5rem;
}
.cardContent{
height: 30rem;
overflow-y: scroll;
width: 19.5rem;
}
.cardItemData{
padding: 1rem;
border: 1px solid #b5b8c8;
margin-bottom: 1rem;
}
}
.sortable-ghost {
border-bottom: 2px dashed #1890ff;
}
.doctorTable {
margin-bottom: 16px;
table {
width: 100%;
td {
padding: 6px;
border: 1px solid #e8e8e8;
}
thead {
tr {
font-weight: 600;
background: #FAFAFA;
}
}
tbody{
tr:hover{
background-color:#ededed ;
}
}
}
}
.formData{
height: 38rem;
overflow-y: scroll;
.ant-form-item-label > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before{
display: none;
}
.formData_label{
display: flex;
align-items: center;
}
.filed_listItem{
display: flex;
height: 3.6rem;
.ant-btn-icon-only {
width: 32px;
height: 32px;
/* padding: 2.4px 0; */
font-size: 16px;
border-radius: 2px;
vertical-align: -1px;
display: flex;
align-items: center;
justify-content: center;
}
}
}
......@@ -38,15 +38,17 @@ import { USER_MODE } from '@/utils/constants';
import BaseFrameContainer from '@/components/BaseFrameContainer';
import JumpContainer from '@/components/JumpContainer';
import HostManager from '@/pages/platformCenter/hostmanager';
import MessageManager from '@/pages/platformCenter/messageManage';
import MessageManager from '@/pages/platformCenter/messageManage'
import SchemeDetail from '@/pages/platformCenter/schemeDetail/schemeDetail'
import SchemeConfig from '@/pages/platformCenter/schemeConfig/schemeConfig';
import DimensionsConfig from '@/pages/platformCenter/dimensionsConfig/dimensionsConfig';
import TaskScheduling from '@/pages/artificial/taskScheduling/taskScheduling';
import PoliciesIssued from '@/pages/artificial/policiesIssued/policiesIssued';
import TableManager from '@/pages/platformCenter/bsmanager/tablemanager';
import FiledConfig from '@/pages/platformCenter/filedConfig/filedConfig';
import AuthControl from '@/pages/authcontrol';
import TableManager from '@/pages/platformCenter/bsmanager/tablemanager'
import StandingBook from '@/pages/platformCenter/standingBook/standingBook'
import FiledConfig from '@/pages/platformCenter/filedConfig/filedConfig'
// import ColConen from '@/components/Colophon/colContent';
const iconStyle = { verticalAlign: '0.125em' };
......@@ -242,6 +244,12 @@ export default {
name: '消息平台',
component: MessageManager,
},
{
path: '/platformCenter/SchemeDetail',
name: '模板编辑',
component: SchemeDetail,
hideMenu: true,
},
{
path: '/platformCenter/emq',
name: '宿主管理',
......@@ -267,6 +275,11 @@ export default {
component: FiledConfig,
hideMenu: true,
},
{
path: '/platformCenter/bsmanger/standingBook',
name: '台账管理',
component: StandingBook,
},
// {
// path: '/platformCenter/bsmanger/standbookmanager',
// name: '台账配置',
......
import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
// 加载台账
export const GetCM_Ledger_LoadLedgers = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCM_Ledger_LoadLedgers`, query);
// 加载台账表
export const GetCM_Ledger_LoadLedgerTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCM_Ledger_LoadLedgerTable`, query);
// 查看对应台账
export const GetCMLedger_QueryLedgers = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCMLedger_QueryLedgers`, query);
// 编辑或新增台账
export const GetCMLedger_OperateLedger = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCMLedger_OperateLedger`, data);
// 删除台账
export const CM_Ledger_RmoveLedger = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Ledger_RmoveLedger`, query);
\ No newline at end of file
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