File was renamed from src/api/w4k.js |
| | |
| | | import axios from 'axios' |
| | | import jsSHA from 'jssha' |
| | | |
| | | class W4kApi { |
| | | class DirectApi { |
| | | /** |
| | | * @description 鉴权挑战 |
| | | * @param {Object} param 查询及提交参数 |
| | | */ |
| | | login (ip, username = 'admin', password) { |
| | | w4kLogin (ip, username = 'admin', password) { |
| | | return new Promise((resolve, reject) => { |
| | | let challurl = ip + '/api/auth/login/challenge?username=' + username |
| | | challurl = '/trans/redirect?rd=' + challurl + '&method=get' |
| | |
| | | }) |
| | | } |
| | | |
| | | queryUsers (ip) { |
| | | w4kQueryUsers (ip) { |
| | | let url = ip + '/api/persons/query' |
| | | url = '/trans/redirect?rd=' + url + '&method=post' |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | addUsers (ip, data) { |
| | | w4kAddUsers (ip, data) { |
| | | return new Promise((resolve, reject) => { |
| | | let delurl = ip + '/api/persons/item/' + data.id |
| | | delurl = '/trans/redirect?rd=' + delurl + '&method=DELETE' |
| | |
| | | } |
| | | } |
| | | |
| | | export default new W4kApi() |
| | | export default new DirectApi() |
| | |
| | | axios.defaults.withCredentials = false |
| | | |
| | | axios.interceptors.request.use((config) => { |
| | | if (config.url.includes('LoginAndRedirect') || config.url.includes('getjsonresult') || config.url.includes('wxNativePay')) { |
| | | if (/LoginAndRedirect|getjsonresult|wxNativePay|postek/ig.test(config.url)) { |
| | | config.data = qs.stringify(config.data) |
| | | } else if (/\/doupload|\/dopreload|\/upload/.test(config.url)) { |
| | | config.headers = { 'Content-Type': 'multipart/form-data' } |
| | |
| | | }) |
| | | } |
| | | |
| | | postekPrint (data) { |
| | | return axios({ |
| | | url: 'http://127.0.0.1:888/postek/print', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // /** |
| | | // * @description 文件上传 |
| | | // */ |
| | |
| | | document.title = GLOB.platTitle || '' |
| | | |
| | | if (config.filter === 'true' || (/^20\d{2}-\d{2}-\d{2}$/.test(config.filter) && new Date(config.filter).getTime() + 86400000 >= new Date().getTime())) { |
| | | let html = document.getElementsByTagName('html')[0] |
| | | |
| | | if (html) { |
| | | html.style.filter = 'grayscale(100%)' |
| | | } |
| | | GLOB.filter = true |
| | | } |
| | | |
| | | if (process.env.NODE_ENV === 'production') { // 用于校验是否存在开发权限 |
| | |
| | | if (item.key === 'field' || item.key === 'linkurl' || item.key === 'bgImage' || item.key === 'posterField') { |
| | | item.options = [] |
| | | config.columns.forEach(col => { |
| | | let label = col.label |
| | | if (label.toLowerCase() !== col.field.toLowerCase()) { |
| | | label = col.field + ' ' + col.label |
| | | } |
| | | let label = `${col.field}(${col.label})` |
| | | if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) { |
| | | item.options.push({ |
| | | value: col.field, |
| | |
| | | if (item.key === 'field') { |
| | | item.options = [] |
| | | config.columns.forEach(col => { |
| | | let label = col.label |
| | | if (label.toLowerCase() !== col.field.toLowerCase()) { |
| | | label = col.field + ' ' + col.label |
| | | } |
| | | let label = `${col.field}(${col.label})` |
| | | |
| | | if (/^(Int|Decimal)/ig.test(col.datatype) && (value === 'number' || value === 'slider')) { |
| | | item.options.push({ |
| | |
| | | options = ['border', 'margin'] |
| | | } else if (element.eleType === 'text') { |
| | | options[0] = 'font2' |
| | | options.push('display') |
| | | } else if (element.eleType === 'slider') { |
| | | options = ['padding', 'margin'] |
| | | } else if (element.eleType === 'splitline') { |
| | |
| | | let _elements = elements.map(cell => { |
| | | if (cell.uuid === res.uuid) { |
| | | res.style = cell.style || {} |
| | | |
| | | if (res.eleType !== 'text') { |
| | | delete res.style.display |
| | | } |
| | | |
| | | if (res.eleType === 'splitline' && (cell.eleType !== 'splitline' || cell.focus)) { |
| | | res.style.paddingTop = '5px' |
| | | res.style.paddingBottom = '5px' |
| | |
| | | index = i |
| | | } |
| | | |
| | | let label = item.label || '' |
| | | if (item.field && item.field.toLowerCase() !== label.toLowerCase()) { |
| | | label = label + ' (' + item.field + ')' |
| | | } |
| | | let label = `${item.field || ''}(${item.label})` |
| | | |
| | | if (['text', 'number', 'textarea', 'color'].includes(item.type) && _item.field !== item.field) { |
| | | _inputfields.push({ |
| | |
| | | index = i |
| | | } |
| | | |
| | | let label = item.label || '' |
| | | if (item.field && item.field.toLowerCase() !== label.toLowerCase()) { |
| | | label = label + ' (' + item.field + ')' |
| | | } |
| | | let label = `${item.field || ''}(${item.label})` |
| | | |
| | | if (['text', 'number', 'textarea', 'color'].includes(item.type) && _item.field !== item.field) { |
| | | _inputfields.push({ |
| | |
| | | index = i |
| | | } |
| | | |
| | | let label = item.label || '' |
| | | if (item.field && item.field.toLowerCase() !== label.toLowerCase()) { |
| | | label = label + ' (' + item.field + ')' |
| | | } |
| | | let label = `${item.field || ''}(${item.label})` |
| | | |
| | | if (['text', 'number', 'textarea', 'color'].includes(item.type) && _item.field !== item.field) { |
| | | _inputfields.push({ |
| | |
| | | initVal: card.controlField || '', |
| | | required: true, |
| | | allowClear: true, |
| | | options: columns |
| | | options: columns.map(item => ({ |
| | | value: item.field, |
| | | text: `${item.label}(${item.field})` |
| | | })) |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | initVal: card.controlField || '', |
| | | required: true, |
| | | allowClear: true, |
| | | options: columns |
| | | options: columns.map(item => ({ |
| | | value: item.field, |
| | | text: `${item.label}(${item.field})` |
| | | })) |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | _columns.unshift({field: '$Index', label: '序号'}) |
| | | |
| | | let options = _columns.map(col => { |
| | | let label = col.label |
| | | if (col.label.toLowerCase() !== col.field.toLowerCase()) { |
| | | label += `(${col.field})` |
| | | } |
| | | let label = `${col.field}(${col.label})` |
| | | return { |
| | | value: col.field, |
| | | label: label, |
| | |
| | | value: 'dynamic', |
| | | label: '动态值', |
| | | children: _columns.map(cell => { |
| | | let _label = cell.label |
| | | if (cell.label.toLowerCase() !== cell.field.toLowerCase()) { |
| | | _label += `(${cell.field})` |
| | | } |
| | | let _label = `${cell.field}(${cell.label})` |
| | | return { |
| | | value: cell.field, |
| | | label: _label |
| | |
| | | |
| | | editColumn = (column) => { |
| | | let fields = fromJS(this.props.fields).toJS().map(item => { |
| | | if (item.label.toLowerCase() !== item.field.toLowerCase()) { |
| | | item.text = item.label + '(' + item.field + ')' |
| | | } |
| | | item.text = `${item.field}(${item.label})` |
| | | return item |
| | | }) |
| | | |
| | |
| | | |
| | | editColumn = (column) => { |
| | | let fields = fromJS(this.props.fields).toJS().map(item => { |
| | | if (item.label.toLowerCase() !== item.field.toLowerCase()) { |
| | | item.text = item.label + '(' + item.field + ')' |
| | | } |
| | | item.text = `${item.field}(${item.label})` |
| | | return item |
| | | }) |
| | | |
| | |
| | | |
| | | editColumn = (column) => { |
| | | let fields = fromJS(this.props.fields).toJS().map(item => { |
| | | if (item.label.toLowerCase() !== item.field.toLowerCase()) { |
| | | item.text = item.label + '(' + item.field + ')' |
| | | } |
| | | item.text = `${item.field}(${item.label})` |
| | | return item |
| | | }) |
| | | |
| | |
| | | index = i |
| | | } |
| | | |
| | | let label = item.label || '' |
| | | if (item.field && item.field.toLowerCase() !== label.toLowerCase()) { |
| | | label = label + ' (' + item.field + ')' |
| | | } |
| | | let label = `${item.field || ''}(${item.label})` |
| | | |
| | | if (['text', 'number', 'textarea', 'color'].includes(item.type) && card.field !== item.field) { |
| | | _inputfields.push({ |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | | {options.includes('display') ? <Panel header="显示" key="display"> |
| | | <Col span={24}> |
| | | <Form.Item |
| | | colon={false} |
| | | label={<SwapOutlined title="浮动"/>} |
| | | labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } |
| | | > |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} defaultValue={card.display || 'block'} onChange={(e) => this.changeNormalStyle(e.target.value, 'display')}> |
| | | <Radio value="block">块级元素</Radio> |
| | | <Radio value="inline-block">行内块元素</Radio> |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | </Panel> : null} |
| | | </Collapse> : null} |
| | | </Form> |
| | | <div style={{textAlign: 'right'}}> |
| | |
| | | index = i |
| | | } |
| | | |
| | | let label = item.label || '' |
| | | if (item.field && item.field.toLowerCase() !== label.toLowerCase()) { |
| | | label = label + ' (' + item.field + ')' |
| | | } |
| | | let label = `${item.field || ''}(${item.label})` |
| | | |
| | | if (['text', 'number', 'textarea', 'color'].includes(item.type) && card.field !== item.field) { |
| | | _inputfields.push({ |
| | |
| | | |
| | | import NApi from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api/w4k.js' |
| | | import Api from '@/api/direct.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | |
| | |
| | | // let ip = 'http://localhost:3001' |
| | | let ip = selectIp.face_ip |
| | | |
| | | Api.login(ip, selectIp.face_uname, selectIp.face_pwd).then(result => { |
| | | Api.w4kLogin(ip, selectIp.face_uname, selectIp.face_pwd).then(result => { |
| | | if (result.errors) { |
| | | this.execPreError(result) |
| | | return |
| | |
| | | |
| | | document.cookie = 'sessionID=' + result.session_id |
| | | |
| | | Api.queryUsers(ip).then(res => { |
| | | Api.w4kQueryUsers(ip).then(res => { |
| | | if (res.errors) { |
| | | this.execPreError(res) |
| | | return |
| | |
| | | data.id_number = CryptoJS.enc.Base64.stringify(encrypted.ciphertext) |
| | | } |
| | | |
| | | Api.addUsers(ip, data).then(res => { |
| | | Api.w4kAddUsers(ip, data).then(res => { |
| | | if (res.errors) { |
| | | this.execPreError(res, data) |
| | | return |
| | |
| | | } |
| | | } |
| | | |
| | | // execRfidPrint = () => { |
| | | // let type = 'HF' |
| | | // let printparamsJsonArray = [] |
| | | |
| | | // let mm = 12 |
| | | // if (type === 'HF') { |
| | | // printparamsJsonArray.push({PTK_OpenUSBPort: 255}); // 打开打印机USB端口 |
| | | // printparamsJsonArray.push({PTK_ClearBuffer: ''}); // 清空缓存 |
| | | // printparamsJsonArray.push({PTK_SetDarkness: 10}); // 设置打印黑度 取值范围 0-20 |
| | | // printparamsJsonArray.push({PTK_SetPrintSpeed: 4}); // 设置打印速度 |
| | | // printparamsJsonArray.push({PTK_SetDirection: 'B'}); // 设置打印方向 |
| | | // printparamsJsonArray.push({PTK_SetLabelHeight: 25*mm + ","+ 10*mm +","+ 0 +","+ false}); // 设置标签高度、间隙及偏移 |
| | | // printparamsJsonArray.push({PTK_SetLabelWidth: 60*mm}); // 设置标签宽度 |
| | | // printparamsJsonArray.push({PTK_SetRFID: 0+","+0+","+0+","+0+","+0}); // UHF RFID打印设置 |
| | | // printparamsJsonArray.push({PTK_RWRFIDLabel: 1+","+0+","+0+","+4+","+1+',EEBA99192945C746'}); |
| | | // printparamsJsonArray.push({PTK_DrawText_TrueType: "50,10,36,0,微软雅黑,1,700,0,0,0,北京明科有限公司"}); |
| | | // // printparamsJsonArray.push({PTK_DrawText_TrueType: x+","+y+","+FHeight+","+FWidth+","+FType+","+Fspin+","+FWeight+","+FItalic+","+FUnline+","+FStrikeOut+","+data}); |
| | | // // printparamsJsonArray.push({PTK_EncodeRFIDPC:'mkA040'}); |
| | | // printparamsJsonArray.push({PTK_PrintLabel:1+","+1}); |
| | | // printparamsJsonArray.push({PTK_CloseUSBPort: ""}); // 关闭USB通讯端口 |
| | | // } |
| | | |
| | | // let data = { |
| | | // reqParam: '1', |
| | | // printparams: JSON.stringify(printparamsJsonArray) |
| | | // // printparams: JSON.stringify([{PTK_OpenUSBPort: 255},{PTK_ErrorReport_USBInterrupt: 'status:'},{PTK_GetPrinterDPI: 'DPI:'},{PTK_CloseUSBPort: ''}]) |
| | | // // printparams: JSON.stringify([{PTK_OpenUSBPort: 255},{PTK_RFIDCalibrate: ''},{PTK_CloseUSBPort: ''}]) |
| | | // } |
| | | |
| | | // Api.postekPrint(data).then(result => { |
| | | |
| | | // }) |
| | | // } |
| | | |
| | | execPrint = (list, template, formdata) => { |
| | | const { btn } = this.props |
| | | let _errors = [] |
| | | |
| | | // if (btn) { |
| | | // this.execRfidPrint() |
| | | // return |
| | | // } |
| | | |
| | | let defaultPrinter = btn.verify.defaultPrinter || 'lackprinter' |
| | | let printers = {} |
| | | if (btn.verify.printerTypeList && btn.verify.printerTypeList.length > 0) { |
| | |
| | | index = i |
| | | } |
| | | |
| | | let label = item.label || '' |
| | | if (item.field && item.field.toLowerCase() !== label.toLowerCase()) { |
| | | label = label + ' (' + item.field + ')' |
| | | } |
| | | let label = `${item.field || ''}(${item.label})` |
| | | |
| | | if (['text', 'number', 'textarea', 'color'].includes(item.type) && card.field !== item.field) { |
| | | _inputfields.push({ |
| | |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col span={8}> |
| | | <Form.Item label={'打印模式'}> |
| | | <Form.Item label="打印模式"> |
| | | {getFieldDecorator('printMode', { |
| | | initialValue: printMode || 'normal' |
| | | })( |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={8}> |
| | | <Form.Item label={'链接类型'}> |
| | | <Form.Item label="链接类型"> |
| | | {getFieldDecorator('linkType', { |
| | | initialValue: linkType || 'system' |
| | | })( |
| | |
| | | .g2-tooltip { |
| | | display: none; |
| | | } |
| | | .mk-action-space { |
| | | display: none; |
| | | } |
| | | } |
| | | |
| | | .print-page { |
| | |
| | | padding: 2px 8px!important; |
| | | line-height: 1.5; |
| | | } |
| | | .ant-table-placeholder { |
| | | display: none; |
| | | } |
| | | .ant-empty { |
| | | display: none; |
| | | } |
| | | .mk-action-space { |
| | | display: none; |
| | | } |
| | | } |
| | | .print-page.auto:last-child { |
| | | height: auto!important; |
| | |
| | | // if (!res || !res.ip) return |
| | | // sessionStorage.setItem('ipAddress', res.ip) |
| | | // }) |
| | | if (window.GLOB.filter) { |
| | | let view = document.getElementById('mk-login-view') |
| | | |
| | | if (view) { |
| | | view.style.filter = 'grayscale(100%)' |
| | | } |
| | | } |
| | | |
| | | if (sessionStorage.getItem('loginError')) { |
| | | try { |
| | | let res = JSON.parse(sessionStorage.getItem('loginError')) |
| | |
| | | const { lineColor, bgImage, loginlogo, copyRight, webSite, ICP, loginWays, touristLogin } = this.state |
| | | |
| | | return ( |
| | | <div className="login-container" style={bgImage ? {backgroundImage: 'url(' + bgImage + ')'} : {}}> |
| | | <div className="login-container" id="mk-login-view" style={bgImage ? {backgroundImage: 'url(' + bgImage + ')'} : {}}> |
| | | <div className="logo" style={lineColor ? {borderColor: lineColor} : {}}> |
| | | {loginlogo ? <img src={loginlogo} alt=""/> : null} |
| | | {this.state.platName ? <p className="plat-name">{this.state.platName}</p> : null} |
| | |
| | | MenuID: '1588493493409k9guqp067d31lu7blsv', |
| | | MenuNo: 's_job_stepM', |
| | | MenuName: '计划任务', |
| | | }, { |
| | | src: '', |
| | | systems: ['production', 'local', 'SSO', 'cloud'], |
| | | PageParam: {OpenType: 'newtab', Template: 'BaseTable'}, |
| | | type: 'BaseTable', |
| | | MenuID: '1670296054432ab9d5c0pf76o93315ag', |
| | | MenuNo: 's_sys_job_history_M', |
| | | MenuName: '代理作业记录', |
| | | }] |
| | | }] |