Commit 5d612bb5 authored by 田涛's avatar 田涛

电力设备新增模板导出和导入功能

parent 08129ab7
......@@ -236,7 +236,8 @@ export const FasSerUrl = {
getRegionAreaRpnUrl: completePrefix(fireBaseURI, 'api/risksource/queryRiskAreaRpn'), // 获取厂区下所有区域rpn值
getFireStationInfoUrl: completePrefix(fireBaseURI, 'api/firestation/createAndSaveImg'),// 维护消防小室/消防泡沫间信息
riskSourceRpniUpdateUrl: completePrefix(fireBaseURI, 'api/risksource/updateRiskSourceRpni'), //fmea修改时更新风险点rpni值
downloadTemplate: completePrefix(fireBaseURI, 'api/impEquip/downTemplate'), // 电力设备模板导出
uploadImpEquipmentList: completePrefix(fireBaseURI, 'api/impEquip/uploadList'), // 电力设备导入
getVideoTreeUrl: completePrefix(fireBaseURI, 'api/impEquip/videos'), //获取设备视频树
getImpEquipDetailUrl: completePrefix(fireBaseURI, 'api/impEquip/detail/{id}'), //预案获取重点设备信息
startTestPrecontrolUrl: completePrefix(fireBaseURI, 'api/risksource/data/fireqeuiment/soe'),
......
import amosRequest, { singleFetch } from 'amos-processor/lib/fetch/amosRequest';
import { utils, Store } from 'amos-tool';
import { AmosFetch } from 'amos-processor/lib/fetch';
import { message } from 'amos-framework';
import formatUrl from 'amos-processor/lib/utils/urlFormat';
import SysConsts from 'amos-processor/lib/config/consts';
import payload from './payload';
......@@ -160,4 +159,39 @@ export const downLoadZIP = ({ url, data, fileName, method = 'POST' }) => {
});
};
/**
* 文件下载
* @param {*} param
*/
export const fileDownload = ({ url, data, fileName, method = 'GET' }) => {
return AmosFetch[method.toLocaleLowerCase()](url,
{
params: {
headers: {
'Accept': 'application/json, */*',
...compleHeaders()
},
...method.toLocaleLowerCase() !== 'get' ? {
body: JSON.stringify(data || {})
} : {}
}
}
).then((response) => {
if (response.ok) {
response.blob().then((blob) => {
const a = window.document.createElement('a');
const downUrl = window.URL.createObjectURL(blob);// 获取 blob 本地文件连接 (blob 为纯二进制对象,不能够直接保存到磁盘上)
const filename = (fileName && fileName.split('.')) || response.headers.get('Content-Disposition').split('filename=')[1].split('.');
a.href = downUrl;
a.download = `${decodeURI(filename[0])}.${filename[1]}`;
a.click();
window.URL.revokeObjectURL(downUrl);
});
return { state: 1 };
} else {
throw new Error('');
}
});
};
export { amosRequest, singleFetch, convertDatalist, buildPageable, formatUrl };
/* eslint-disable no-magic-numbers */
import classnames from 'classnames';
import { trim } from 'amos-tool';
/**
* form表单布局样式设置方法
* @param {number} width 单项form(文本和控件)所占百分比1-100
* @param {number} label 单项form文本宽度(宽度设置的单位为rem)
* @param {*} other 单项form其他样式名称
* @example
* <FormItem className={itemLayout('100', '7')} label={<span>调度名称</span>} field="jobname">
* <Input value={form.jobname} />
* </FormItem>
*/
export const formLayout = (width, label, other) => {
return classnames(
`eb-com-form-item-${width}`,
`eb-com-form-item-label-${label}`,
other
);
};
/**
* form标签每一项的布局
* @param {number} width 宽度 一般为百分比
* @param {*} label form表单文字label的宽度单位是em 一般设置为文字的个数
* @param {*} marginRight form表单左侧的margin宽度 百分比
* @param {*} display
*/
export const formItemLayout = (width, label, marginRight, display) => {
return {
style: {
width: `${width}%`,
label: `${label}%`,
marginRight: `${marginRight || 0}%`,
display: display ? display : 'inline-block'
},
labelWidth: label === '100' ? '100%' : `${label}rem`,
filled: label !== '100'
};
};
/**
* 执行字符串表达式
* @param {*} fn
*/
const evil = (fn) => {
let Fn = Function; // 一个变量指向Function,防止有些前端编译工具报错
return new Fn(`return ${fn}`)();
};
/**
* 常用form表单校对象
*/
export const formRules = {
longTextLength: 1000,
textLength: 255,
secondLength: 500,
hundredLength: 100,
required: (msg) => ({ required: true, message: msg || '必填项' }),
name: (length = 32) => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
if (trim(value).length > length) {
callback(new Error(`字符长度不能大于${length}`));
}
}
callback();
} };
},
equipLength: (length = 32, tip) => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
if (trim(value).length !== length) {
callback(new Error(tip || `长度必须等于${length}位`));
}
}
callback();
} };
},
numEvilScope: (min, max, tip) => {
return { validator: (rules, value, callback) => {
if (value !== undefined && value !== null && trim(String(value))) {
const _value = Number(trim(String(value)));
try {
if (min && evil(`${_value}${min}`) || (max && evil(`${_value}${max}`))) {
callback(new Error(tip));
}
} catch (e) {
callback(new Error(tip));
}
}
callback();
} };
},
numScope: (min, max, tip) => {
return { validator: (rules, value, callback) => {
if (value !== undefined && value !== null && trim(String(value))) {
if ((min && Number(trim(String(value))) <= min) || (max && Number(trim(String(value))) > max)) {
callback(new Error(tip));
}
}
callback();
} };
},
phone: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
const reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入正确的手机号`));
}
}
callback();
} };
},
tel: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
const reg = /^((0\d{2,3})-)(\d{7,8})((\d{3,}))?$/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入正确的固定电话`));
}
}
callback();
} };
},
phoneAndtel: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
// const reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
// const reg1 = /^((0\d{2,3})-)(\d{7,8})((\d{3,}))?$/;
const reg = /^(^1[3|4|5|6|7|8|9][0-9]\d{4,8}$)|(^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$)$/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入正确的手机号或固定电话`));
}
}
callback();
} };
},
serviceTel: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
const reg = /(^(400)-(\d{3})-(\d{4})(.)(\d{1,4})$)|(^(400)-(\d{3})-(\d{4}$))/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入正确的客服电话`));
}
}
callback();
} };
},
email: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
const reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入正确格式的邮箱地址`));
}
}
callback();
} };
},
website: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
const reg = /^((https|http|ftp|rtsp|mms){0,1}(:\/\/){0,1})www\.(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入正确格式的网址`));
}
}
callback();
} };
},
longitude: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
const reg = /^(\-|\+)?(((\d|[1-9]\d|1[0-7]\d|0{1,3})\.\d{0,6})|(\d|[1-9]\d|1[0-7]\d|0{1,3})|180\.0{0,6}|180)$/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入正确格式精度`));
}
}
callback();
} };
},
latitude: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
const reg = /^(\-|\+)?([0-8]?\d{1}\.\d{0,6}|90\.0{0,6}|[0-8]?\d{1}|90)$/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入正确格式精度`));
}
}
callback();
} };
},
clockScope: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
const reg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入大于0的数`));
}
}
callback();
} };
},
positiveInteger: () => {
return { validator: (rules, value, callback) => {
if (value && trim(value)) {
const reg = /^[1-9]\d*$/;
if (!reg.test(trim(value))) {
callback(new Error(`请输入正整数`));
}
}
callback();
} };
}
};
/**
* 过滤对象中字符串的前后空格
* @param {*} form
*/
export const trimFormData = (form) => {
for (let key in form) {
if ((typeof form[key] === 'string') && form[key].constructor === String) {
form[key] = trim(form[key]);
}
}
return form;
};
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Form } from 'amos-framework';
import Modal from './index';
import { formRules, formLayout } from './FormUtils';
const FormItem = Form.Item;
/**
* 导入文件
*
* @class ImportFile
* @extends {Component}
*/
class ImportFile extends Component {
static propTypes = {
onDownload: PropTypes.func
};
constructor(props) {
super(props);
this.state = {
form: {},
visible: false,
rules: {
file: [formRules.required()]
},
title: ''
};
}
onOpen = (title, save) => {
this.setState({ visible: true, title });
this.save = save;
}
onSave = () => {
this.form.validate((valid,dataValues) => {
if (valid) {
const formData = new window.FormData();
formData.append('file', dataValues.file);
this.save && this.save(formData).then(d => {
this.onCancel();
});
}
});
}
onCancel = () => {
this.setState({
form: {},
visible: false
});
}
onFileChange = (varName, value) => {
const { form } = this.state;
form[varName] = value;
this.setState({ form });
}
render() {
const { visible, form, title, rules } = this.state;
return (
<Modal
modalClass=""
width={450}
visible={visible}
onCancel={this.onCancel}
onOk={this.onSave}
okText="保存"
title={`${title}` || '导入文件'}
>
<div>
<Form className="eb-form-tablelist-filter-content" rules={rules} ref={form => this.form = form} model={form}>
<FormItem className={formLayout('100', '100')} label={<span>选择文件</span>} field="file">
<input
ref={node => this.fileInput = node}
type="file"
name="avatar"
accept=".xls,.xlsx"
onChange={(e) => this.onFileChange('file', e.target.files[0])}
/>
</FormItem>
</Form>
</div>
</Modal>
);
}
}
export default ImportFile;
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Modal, Button } from 'amos-framework';
import './modal.scss';
/**
* 公共的配置弹框
*
* @class CommonModal
* @extends {DefaultNode}
*/
class CommonModal extends Component {
static propTypes = {
width: PropTypes.number,
children: PropTypes.node,
title: PropTypes.any,
onCancel: PropTypes.func,
modalClass: PropTypes.string,
visible: PropTypes.bool,
footer: PropTypes.any,
noOverflow: PropTypes.bool,
onOk: PropTypes.func,
floorNode: PropTypes.any,
okText: PropTypes.string,
cancelText: PropTypes.string
};
static defaultProps = {
width: 720,
children: <div />,
onCancel(){},
onOk(){},
okText: '确定',
cancelText: '取消'
};
constructor(props) {
super(props);
}
handleOK = (e) => {
// 阻止弹框中回车提交表单问题
e && e.preventDefault();
this.props.onOk(e);
}
render() {
const { title, visible, noOverflow, okText, cancelText, modalClass, onCancel, width, children, footer, floorNode, ...other } = this.props;
return (
<Modal
{...other}
header={title}
width={width}
visible={visible}
dragable
className={`eb-modal ${noOverflow ? 'no-overflow' : ''} ${modalClass || ''}`}
onCancel={onCancel}
onOk={this.handleOK}
outterClosable={false}
content={visible ? children : <div />}
footer={!footer ?
<div>
{
floorNode
}
<Button className="eb-modal-save" onClick={this.handleOK}>{okText || '确定'}</Button>
<Button className="eb-modal-cancel" onClick={onCancel}>{cancelText || '确定'}</Button>
</div> : footer
}
/>
);
}
}
export default CommonModal;
//系统前缀名
$frame-main-bg: white; //系统主背景色
$frame-slave-bg: rgba(243, 243, 243, 1); //系统次级背景色
$frame-main-bordercolor:rgba(228, 228, 228, 1); //系统次级背景色
$frame-second-bordercolor: rgba(46, 83, 146, 1); //系统次级背景色
$frame-third-bordercolor: rgba(201, 201, 201, 1); //系统次级背景色
$frame-first-fontsize: 20px; //系统一级文本大小
$frame-second-fontsize: 15px; //系统二级文本大小
$frame-third-fontsize: 13px; //系统三级文本大小
$frame-fourth-fontsize: 12px; //系统四级文本大小
$frame-first-color: rgba(63, 63, 63, 1);//系统一级文本颜色
$frame-second-color: rgba(206, 206, 206, 1);//系统二级文本颜色
$frame-third-color: white;//系统三级文本颜色
$frame-fourth-color: rgba(51, 51, 51, 1);//系统四级文本颜色
$frame-main-color: rgba(52, 95, 166, 1);//系统主色
$frame-select-color: rgba(230, 247, 255, 1);//系统选中色
$frame-select-first-color: rgba(21, 146, 230, 1);//系统选中色
$frame-disabled-color: rgba(227, 227, 227, 1);//系统中禁用色
$from-disabled-color: #f4f4f4;//系统中rom表单控件禁用色
//系统特殊演示变量
//状态色
$special-state-color-error: red; //错误
$special-state-color-pass: rgba(13, 204, 57, 1); //通过
$special-state-color-unknown: rgba(255, 153, 0, 1); //未知
//对话框
$modal-header-bg: linear-gradient(360deg, rgba(246, 246, 246, 1) 0%, rgba(238, 238, 238, 1) 100%); //对话框顶部标题栏背景色
$modal-footer-bg: rgba(242, 242, 242, 1); //对话框底部背景色
$modal-colse-bg: linear-gradient(360deg, rgba(235, 4, 4, 1) 0%, rgba(255, 0, 87, 1) 100%); //对话框删除按钮色
//流程
$flow-bg: rgba(223, 223, 223, 1); //流程底色
@import './index.scss';
@import './scrollbar.scss';
.eb-modal {
.amos-modal-container {
border-radius: 6px;
box-shadow: 0 0 6 rgba(0, 0, 0, 0.16);
}
&.no-overflow {
overflow: inherit;
.amos-modal-container {
overflow: inherit;
}
.amos-modal-container .amos-modal-content {
overflow: inherit;
}
}
.amos-modal-header {
display: flex;
width: 100%;
height: 30px;
align-items: center;
padding: 0 0 0 18px;
background: $modal-header-bg;
border-radius: 6px 6px 0 0;
.amos-modal-title {
font-size: 14px;
color: $frame-fourth-color;
}
}
.amos-modal-close {
display: flex;
width: 30px;
height: 30px;
padding: 0;
background: $modal-colse-bg;
align-items: center;
justify-content: center;
.amos-modal-close-x {
width: auto;
height: auto;
line-height: inherit;
color: $frame-third-color;
&::after {
display: block;
width: 20px;
height: 20px;
background-image: url('../../../../assets/tip/closeWhite.png');
background-size: 100%;
content: '';
}
}
}
.amos-modal-content {
@include default-scroll;
max-height: 60vh;
min-height: 100px;
padding: 10px 0;
}
.amos-modal-footer {
display: flex;
width: 100%;
height: 60px;
padding: 0;
background: $modal-footer-bg;
border: 1px solid $frame-main-bordercolor;
align-items: center;
justify-content: flex-end;
border-radius: 0 0 6px 6px;
.amos-btn {
height: 32px;
padding: 0 20px;
font-size: $frame-second-fontsize;
border: 0;
border-radius: 6px;
&.eb-modal-save {
color: $frame-third-color;
background: $frame-main-color;
}
&.eb-modal-cancel {
margin-right: 35px;
margin-left: 32px;
color: rgba(153, 153, 153, 1);
background: $frame-main-bg;
border: 1px solid $frame-main-bordercolor;
}
&:last-child {
margin-right: 35px;
margin-left: 32px;
}
}
}
}
/**
* 公共滑动条样式
*/
@import '~amos-framework/lib/styles/mixins/scrollbar.scss';
$scrollOutColor: rgba(#dedede, 0.3);
$scrollInnerColor: rgba(rgb(20, 20, 20), 0.1);
@mixin default-scroll {
overflow: auto;
&:hover {
&::-webkit-scrollbar {
width: 8px;
height: 8px;
background-color: whitesmoke;
}
&::-webkit-scrollbar-track {
// padding: 1px;
background-color: whitesmoke;
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
// border: 1px solid #e4e4e4;
// border-top: 0;
// border-right: 0;
// // border-left: 0;
// border-radius: 0;
}
&::-webkit-scrollbar-thumb {
background-color: #eaeaea;
border: 1px solid #cecece;
// border: 1px solid #e4e4e4;
// border-top: 0;
// border-right: 0;
// border-bottom: 0;
// border-radius: 0;
// background-clip: padding-box;
}
}
&::-webkit-scrollbar {
width: 8px;
height: 8px;
background-color: transparent;
}
&::-webkit-scrollbar-track {
background: transparent;
border: 0;
}
&::-webkit-scrollbar-thumb {
background: transparent;
border: 0;
}
}
.mod-com-scrollbar {
// @include pretty-scrollbar(5px, 8px, $scrollOutColor, $scrollInnerColor);
@include default-scroll;
}
import React from 'react';
import { Modal, Button } from 'amos-framework';
import { Message } from 'amos-antd';
import classnames from 'classnames';
import './tip.scss';
const ghost = Modal.ghost;
/**
* 提示确认框
* @param {string} message 提示语
*/
const confirmTip = (message, img) => {
return new Promise((resolve, reject) => {
const dialog = ghost.show({
title: '提示',
className: classnames('mods-com-tip-modal'),
width: 330,
content: (
<div className="mods-com-tip-modal-content">
<div className="mods-com-tip-modal-img"><img src={img} alt="" /></div>
<div className="mods-com-tip-modal-msg">{message}</div>
</div>
),
footer: (
<div>
<Button className="mods-com-tip-modal-cancel" onClick={() => dialog.hide()}>
取消
</Button>
<Button
className="mods-com-tip-modal-ok" onClick={() =>{
resolve();
dialog.hide();
}}>
确定
</Button>
<a className="mods-com-tip-modal-close" onClick={() => dialog.hide()} />
</div>
)
});
});
};
const confirmCheckTip = (message, checkTip, img) => {
return new Promise((resolve, reject) => {
Modal.confirm({
title: '提示',
className: classnames('eb-tip-modal'),
width: 275,
content: (
<div className="eb-tip-modal-content">
<div className="eb-tip-modal-img"><img src={img} alt="" /></div>
<div className="eb-tip-modal-msg">{message}</div>
<div className="eb-tip-check-input"><input type="checkbox" id="confirmCheckTip" />{checkTip}</div>
</div>
),
onOk: () => {
resolve(document.getElementById('confirmCheckTip').checked);
},
onCancel() {}
});
});
};
Message.config({
top: 100
// duration: 1000
});
export default {
confirm: confirmTip,
check: confirmCheckTip,
error: Message.error,
success: Message.success,
warning: Message.warning
};
//系统前缀名
$frame-main-bg: white; //系统主背景色
$frame-slave-bg: rgba(243, 243, 243, 1); //系统次级背景色
$frame-main-bordercolor:rgba(228, 228, 228, 1); //系统次级背景色
$frame-second-bordercolor: rgba(46, 83, 146, 1); //系统次级背景色
$frame-third-bordercolor: rgba(201, 201, 201, 1); //系统次级背景色
$frame-first-fontsize: 20px; //系统一级文本大小
$frame-second-fontsize: 15px; //系统二级文本大小
$frame-third-fontsize: 13px; //系统三级文本大小
$frame-fourth-fontsize: 12px; //系统四级文本大小
$frame-first-color: rgba(63, 63, 63, 1);//系统一级文本颜色
$frame-second-color: rgba(206, 206, 206, 1);//系统二级文本颜色
$frame-third-color: white;//系统三级文本颜色
$frame-fourth-color: rgba(51, 51, 51, 1);//系统四级文本颜色
$frame-main-color: rgba(52, 95, 166, 1);//系统主色
$frame-select-color: rgba(230, 247, 255, 1);//系统选中色
$frame-select-first-color: rgba(21, 146, 230, 1);//系统选中色
$frame-disabled-color: rgba(227, 227, 227, 1);//系统中禁用色
$from-disabled-color: #f4f4f4;//系统中rom表单控件禁用色
//系统特殊演示变量
//状态色
$special-state-color-error: red; //错误
$special-state-color-pass: rgba(13, 204, 57, 1); //通过
$special-state-color-unknown: rgba(255, 153, 0, 1); //未知
//对话框
$modal-header-bg: linear-gradient(360deg, rgba(246, 246, 246, 1) 0%, rgba(238, 238, 238, 1) 100%); //对话框顶部标题栏背景色
$modal-footer-bg: rgba(242, 242, 242, 1); //对话框底部背景色
$modal-colse-bg: linear-gradient(360deg, rgba(235, 4, 4, 1) 0%, rgba(255, 0, 87, 1) 100%); //对话框删除按钮色
//流程
$flow-bg: rgba(223, 223, 223, 1); //流程底色
@import './index.scss';
.ant-message {
.ant-message-notice {
.ant-message-notice-content {
padding: 0;
background: transparent;
border-radius: 0;
box-shadow: none;
.ant-message-custom-content {
max-width: 500px;
min-width: 260px;
min-height: 40px;
padding: 15px 30px;
font-size: $frame-second-fontsize;
line-height: 26px;
color: white;
text-align: left;
border: 0;
border-radius: 6px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
> i {
display: none;
}
&.ant-message-success {
background: $special-state-color-pass;
}
&.ant-message-error {
background: $special-state-color-error;
}
&.ant-message-warning {
background: $special-state-color-unknown;
}
}
}
}
}
.eb-tip-modal {
.amos-modal-container {
border-radius: 6px;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.16);
.eb-tip-modal-content {
padding: 2px 0 16px;
color: $frame-fourth-color;
.eb-tip-modal-img {
display: flex;
width: 100%;
height: 118px;
align-items: center;
justify-content: center;
> img {
height: 100%;
}
}
.eb-tip-modal-msg {
padding: 0 15px;
margin-top: 15px;
font-size: 15px;
text-align: center;
white-space: pre-line;
}
.eb-tip-check-input {
position: relative;
top: 2px;
padding-top: 5px;
font-size: $frame-second-fontsize;
text-align: center;
> input {
position: relative;
top: 2px;
}
}
}
.amos-modal-content {
padding: 0;
> div {
.amos-modal-confirm-body {
> i {
display: none;
}
.amos-modal-confirm-title {
display: flex;
width: 100%;
height: 30px;
padding: 0 0 0 18px;
font-size: $frame-second-fontsize;
font-weight: normal;
color: $frame-fourth-color;
align-items: center;
background: $modal-header-bg;
border-bottom: $frame-main-bordercolor;
}
}
.amos-modal-confirm-content {
padding: 0;
margin: 0;
}
}
}
.amos-modal-confirm-btns {
display: flex;
width: 100%;
height: 60px;
margin: 0;
background: $modal-footer-bg;
border-top: 1px solid $frame-main-bordercolor;
align-items: center;
justify-content: flex-end;
.amos-btn {
height: 32px;
padding: 0 20px;
font-size: $frame-second-fontsize;
border: 0;
border-radius: 6px;
&:last-child {
margin-right: 35px;
margin-left: 32px;
color: $frame-third-color;
background: $frame-main-color;
}
&:first-child {
position: absolute;
top: 0;
right: 0;
display: flex;
width: 30px;
height: 30px;
padding: 0;
font-size: 12px;
color: transparent;
background: red;
border-radius: 0 6px 0 0;
align-items: center;
justify-content: center;
&::after {
position: absolute;
display: block;
width: 20px;
height: 20px;
background-image: url('../../../../assets/tip/closeWhite.png');
background-size: 100%;
content: '';
}
}
}
}
}
}
.mods-com-tip-modal {
.amos-modal-container {
border-radius: 6px;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.16);
.amos-modal-content {
position: relative;
padding: 0;
.amos-modal-ghost-title {
display: block;
width: 100%;
height: 30px;
padding-left: 23px;
font-size: 15px;
font-weight: normal;
line-height: 30px;
color: #333;
background-image: linear-gradient(180deg, #f6f6f6 0%, #eee 100%);
border-bottom: solid 1px #eaeaea;
}
.amos-modal-ghost-content {
padding: 0;
margin: 0;
}
.mods-com-tip-modal-img {
display: flex;
height: 120px;
align-items: center;
img {
max-height: 100%;
object-fit: contain;
}
}
.mods-com-tip-modal-content {
display: flex;
align-items: center;
flex-direction: column;
padding: 10px 20px 15px;
font-size: 14px;
line-height: 21px;
color: #3d3d3d;
.mods-com-tip-modal-msg {
margin-top: 10px;
}
}
.amos-modal-ghost-btns {
display: flex;
align-items: center;
justify-content: flex-end;
width: 100%;
height: 60px;
padding: 0;
margin: 0;
background-color: #f2f2f2;
border: solid 1px #eaeaea;
.amos-btn {
height: 32px;
padding: 0 20px;
font-size: $frame-second-fontsize;
border: 0;
border-radius: 6px;
&.mods-com-tip-modal-ok {
margin-right: 22px;
margin-left: 32px;
color: $frame-third-color;
background: $frame-main-color;
}
&.mods-com-tip-modal-cancel {
color: #999;
background: white;
border: solid 1px #deddde;
}
}
}
.mods-com-tip-modal-close {
position: absolute;
top: 0;
right: 0;
display: inline-block;
width: 30px;
height: 30px;
background: red;
background-image: url('../../../../assets/tip/closeWhite.png');
background-position: center;
background-size: 80%;
border-radius: 0 5px 0 0;
}
}
}
}
......@@ -9,6 +9,9 @@ import { pathMapping } from './../../../../routes/customRoutes';
import EquipmentModel from './EquipmentModel';
import BizIcon from './../../../common/icon/BizIcon';
import { FasSerUrl } from '../../../../consts/urlConsts';
import ImportFile from '../../../bizview/common/biz/ImportFile';
import { commonPost, fileDownload } from '../../../../utils/request';
import Tip from '../../../bizview/common/tip';
const matchEquipmentPath = pathMapping.matchEquipment;
const ls = _amosTool.Store.lsTool;
......@@ -223,6 +226,22 @@ class Equipment extends Component {
});
}
import = () => {
this.importFile.onOpen('批量导入分类', (file) => {
commonPost(FasSerUrl.uploadImpEquipmentList, file)
.then(d => {
console.log(d);
Tip.success('导入成功');
this.importFile.onCancel();
this.state.reload();
}).catch(Tip.error);
});
}
export = () => {
return fileDownload({ url: FasSerUrl.downloadTemplate, method: 'GET' });
}
delete() {
let { selectedRowKeys } = this.state;
if (selectedRowKeys === undefined || selectedRowKeys.length <= 0) {
......@@ -344,11 +363,14 @@ class Equipment extends Component {
<div className='important-equipment-tools'>
<span>搜索:</span>
<Input value={name} onChange={e => this.onChange('name', e.target.value)} placeholder="按编号,名称搜索" />
<Button icon={<BizIcon icon="tianjia" />} transparent onClick={() => this.add()} />
<Button icon={<BizIcon icon="xiugai" />} transparent onClick={() => this.edit()} />
<Button icon={<BizIcon icon="shanchu" />} transparent onClick={() => this.delete()} />
<Button icon={<BizIcon icon="tianjia" title="添加" />} transparent onClick={() => this.add()} />
<Button icon={<BizIcon icon="xiugai" title="修改" />} transparent onClick={() => this.edit()} />
<Button icon={<BizIcon icon="daoru" title="导入" />} transparent onClick={() => this.import()} />
<Button icon={<BizIcon icon="daochu" title="导出模板" />} transparent onClick={() => this.export()} />
<Button icon={<BizIcon icon="shanchu" title="删除" />} transparent onClick={() => this.delete()} />
</div>
</div>
<ImportFile ref={node => this.importFile = node} />
<Modal
className='match-equipment-bind'
header="添加重点设备"
......
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