| | |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Select, Radio, Tooltip, Input, notification } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { queryPrintSql } from '@/utils/option.js' |
| | | import MkPrintTemps from '@/menu/components/share/actioncomponent/actionform/mkPrintTemps' |
| | | import './index.scss' |
| | | |
| | | const sysTempsIds = ['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'] |
| | |
| | | state = { |
| | | wxTemps: [], |
| | | selectTemp: null, |
| | | miniTemps: [], |
| | | printTemps: [] |
| | | miniTemps: [] |
| | | } |
| | | |
| | | componentDidMount() { |
| | |
| | | wxTemps = JSON.parse(wxTemps) |
| | | |
| | | this.resetTemps(wxTemps) |
| | | } |
| | | |
| | | this.checkPrintTemp() |
| | | } |
| | | |
| | | checkPrintTemp = () => { |
| | | if (!window.GLOB.printTemps) { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: Utils.formatOptions(queryPrintSql), |
| | | obj_name: 'data', |
| | | arr_field: 'PN,ID,Images' |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 云端数据验证 |
| | | |
| | | Api.getCloudConfig(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | let temps = (res.data || []).map(temp => { |
| | | return { |
| | | value: temp.ID, |
| | | text: temp.PN |
| | | } |
| | | }) |
| | | |
| | | window.GLOB.printTemps = temps |
| | | |
| | | this.setState({printTemps: temps}) |
| | | }) |
| | | } else { |
| | | this.setState({printTemps: window.GLOB.printTemps || []}) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | render() { |
| | | const { unionFields, verify, notes, card, appType } = this.props |
| | | const { wxTemps, selectTemp, printTemps } = this.state |
| | | const { wxTemps, selectTemp } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | </Col> : null} |
| | | {verify.printEnable === 'true' ? <Col span={8}> |
| | | <Form.Item label="打印模板" required> |
| | | <Select value={verify.printTempId} onSelect={this.onPrintIdChange}> |
| | | {printTemps.map(option => |
| | | <Select.Option key={option.value} value={option.value}> |
| | | {option.text} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | <MkPrintTemps value={verify.printTempId} onChange={this.onPrintIdChange}/> |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}></Col> |