king
2023-01-17 c39acd25c3e8747be16773a003f519e4ef801640
2023-01-17
18个文件已修改
378 ■■■■ 已修改文件
package-lock.json 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/options.json 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/group/paste/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/tabs/paste/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/tree/antd-tree/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/pastecontroller/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/basetable/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/module/voucher/index.jsx 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/module/voucher/voucherTable/index.jsx 133 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/module/voucher/voucherTable/index.scss 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/excelInbutton/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/exceloutbutton/index.jsx 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/editTable/index.scss 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils.js 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json
@@ -19343,6 +19343,52 @@
      "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
      "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM="
    },
    "sheetjs-style": {
      "version": "0.15.8",
      "resolved": "https://registry.npmjs.org/sheetjs-style/-/sheetjs-style-0.15.8.tgz",
      "integrity": "sha512-/wRiwnq5ck7aO+zLBs+u5JqQK4agUTIGCS0nxgaMjFl6XdlVaaB/RNJcP6S6Efj3+RYbSZuAoyqmSnbzxfT7Kg==",
      "requires": {
        "adler-32": "~1.2.0",
        "cfb": "^1.1.4",
        "codepage": "~1.14.0",
        "commander": "~2.17.1",
        "crc-32": "~1.2.0",
        "exit-on-epipe": "~1.0.1",
        "ssf": "~0.10.3",
        "wmf": "~1.0.1"
      },
      "dependencies": {
        "cfb": {
          "version": "1.2.2",
          "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
          "integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
          "requires": {
            "adler-32": "~1.3.0",
            "crc-32": "~1.2.0"
          },
          "dependencies": {
            "adler-32": {
              "version": "1.3.1",
              "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
              "integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A=="
            }
          }
        },
        "commander": {
          "version": "2.17.1",
          "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
          "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg=="
        },
        "ssf": {
          "version": "0.10.3",
          "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.10.3.tgz",
          "integrity": "sha512-pRuUdW0WwyB2doSqqjWyzwCD6PkfxpHAHdZp39K3dp/Hq7f+xfMwNAWIi16DyrRg4gg9c/RvLYkJTSawTPTm1w==",
          "requires": {
            "frac": "~1.1.2"
          }
        }
      }
    },
    "shell-quote": {
      "version": "1.6.1",
      "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz",
@@ -21720,6 +21766,11 @@
        "string-width": "^1.0.2 || 2 || 3 || 4"
      }
    },
    "wmf": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
      "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw=="
    },
    "wolfy87-eventemitter": {
      "version": "5.2.9",
      "resolved": "https://registry.npmjs.org/wolfy87-eventemitter/-/wolfy87-eventemitter-5.2.9.tgz",
package.json
@@ -95,6 +95,7 @@
    "resolve-url-loader": "3.1.0",
    "sass-loader": "7.2.0",
    "semver": "6.3.0",
    "sheetjs-style": "^0.15.8",
    "spark-md5": "^3.0.1",
    "sql-formatter": "^11.0.2",
    "style-loader": "1.0.0",
public/options.json
@@ -1,12 +1,12 @@
{
  "appId": "201912040924165801464FF1788654BC5AC73",
  "appkey": "20191106103859640976D6E924E464D029CF0",
  "appId": "202108312122504607B107A83F55B40C98CCF",
  "appkey": "20210831212235413F287EC3BF489424496C8",
  "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars",
  "systemType": "",
  "externalDatabase": "",
  "externalDatabase": "qqq",
  "lineColor": "",
  "filter": "false",
  "defaultApp": "mk",
  "defaultApp": "mkindustry",
  "defaultLang": "zh-CN",
  "WXAppID": "",
  "WXminiAppID": "",
@@ -17,6 +17,6 @@
  "transfer": "false",
  "keepPassword": "true",
  "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"],
  "host": "http://qingqiumarket.cn",
  "service": "MKWMS/"
  "host": "http://demo.mk9h.cn",
  "service": "erp_new/"
}
src/menu/components/group/paste/index.jsx
@@ -24,7 +24,7 @@
  pasteSubmit = () => {
    let appType = sessionStorage.getItem('appType')
    let options = ['datacard', 'propcard', 'balcony', 'timeline', 'simpleform', 'stepform', 'tabform', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'chart', 'sandbox']
    let options = ['datacard', 'propcard', 'balcony', 'timeline', 'simpleform', 'stepform', 'tabform', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'sandbox']
    let types = {
      login: '登录',
      navbar: '导航栏',
@@ -37,7 +37,7 @@
    }
    if (appType !== 'mob') {
      options.push('editable', 'antvG6')
      options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart')
    }
    this.pasteFormRef.handleConfirm().then(res => {
src/menu/components/tabs/paste/index.jsx
@@ -60,7 +60,7 @@
  pasteSubmit = () => {
    const { Tab } = this.props
    let appType = sessionStorage.getItem('appType')
    let options = ['tabs', 'group', 'datacard', 'propcard', 'timeline', 'balcony', 'normaltable', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'chart', 'sandbox']
    let options = ['tabs', 'group', 'datacard', 'propcard', 'timeline', 'balcony', 'normaltable', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'sandbox']
    let types = {
      login: '登录',
      navbar: '导航栏',
@@ -70,7 +70,7 @@
    if (appType === 'mob') {
      options.push('menubar')
    } else {
      options.push('editable', 'antvG6')
      options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart')
    }
    this.pasteFormRef.handleConfirm().then(res => {
src/menu/components/tree/antd-tree/index.jsx
@@ -173,7 +173,7 @@
            <NormalForm title="基本设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
              <EditOutlined style={{color: '#1890ff'}} title="编辑"/>
            </NormalForm>
            <CopyComponent type="normaltable" card={card}/>
            <CopyComponent type="tree" card={card}/>
            <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/>
            <ClockComponent config={card} updateConfig={this.updateComponent}/>
            <UserComponent config={card}/>
src/menu/pastecontroller/index.jsx
@@ -59,7 +59,7 @@
  pasteSubmit = () => {
    let appType = sessionStorage.getItem('appType')
    let options = ['tabs', 'timeline', 'datacard', 'propcard', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'iframe', 'sandbox']
    let options = ['tabs', 'timeline', 'datacard', 'propcard', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'scatter', 'iframe', 'sandbox']
    if (appType === 'mob') {
      if (sessionStorage.getItem('editMenuType') !== 'popview') {
@@ -68,7 +68,7 @@
        options.push('menubar')
      }
    } else {
      options.push('editable', 'antvG6')
      options.push('editable', 'antvG6', 'tree', 'dashboard', 'chart')
    }
    this.pasteFormRef.handleConfirm().then(res => {
src/tabviews/basetable/index.jsx
@@ -291,6 +291,8 @@
        })
        return true
      } else {
        item.name = (this.props.MenuName || '')
      }
      // 搜索条件初始化
src/tabviews/custom/components/module/voucher/index.jsx
@@ -20,10 +20,11 @@
    BID: '',
    config: null,
    loading: false,
    data: null,
    data: [],
    disableAdd: false,
    disableSave: false,
    typeOptions: [],
    subjects: [],
    charType: '',
    charInt: '',
    vouDate: null,
@@ -77,7 +78,14 @@
    const { config } = this.state
    if (config.wrap.supBook === MenuID) {
      this.setState({ book: data }, () => {
      let month = data.months
      let vouDate = moment()
      if (month && month < moment().format('YYYY-MM')) {
        vouDate = moment(month, 'YYYY-MM').endOf('month')
      }
      this.setState({ book: data, vouDate }, () => {
        this.loadData()
      })
      return
@@ -118,7 +126,26 @@
        typeOptions: typeOptions,
        charType: typeOptions[0] ? typeOptions[0].voucher_class : '',
        charInt: typeOptions[0] ? typeOptions[0].voucher_char_int : '',
        subjects: res.subjects || [],
      })
      setTimeout(() => {
        this.getVoucher()
      }, 200)
    })
  }
  getVoucher = () => {
    let data = [
      {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 124, creditor: ''},
      {remark: '购入固定资产', subjectscode: '1001', subjectsname: '库存现金', debtor: '', creditor: 124},
      {remark: '转结销售成本', subjectscode: '1001', subjectsname: '库存现金', debtor: -524, creditor: ''},
      {remark: '提现', subjectscode: '1001', subjectsname: '库存现金', debtor: 34, creditor: ''},
    ]
    this.setState({
      data: data
    })
  }
@@ -134,12 +161,8 @@
  }
  changeVoucherDate = () => {
  }
  render() {
    const { config, disableSave, disableAdd, typeOptions, charType, charInt, data } = this.state
    const { config, disableSave, disableAdd, typeOptions, charType, charInt, data, vouDate, subjects } = this.state
    return (
      <div className="menu-voucher-wrap" style={config.style}>
@@ -153,15 +176,15 @@
        {config.wrap.type === 'edit' ? <div className="voucher-body">
          <div className="pre-wrap">
            <div className="voucher-code">
              <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charInt: option.props.charInt})}>
              <Select value={charType} dropdownClassName="mk-vcode-dropdown" onChange={(val, option) => this.setState({charType: val, charInt: option.props.charint})}>
                {typeOptions.map(option =>
                  <Select.Option value={option.voucher_class} charInt={option.voucher_char_int}>{option.voucher_char}</Select.Option>
                  <Select.Option key={option.voucher_char_int} value={option.voucher_class} charint={option.voucher_char_int}>{option.voucher_char}</Select.Option>
                )}
              </Select>
              <Input value={charInt} autoComplete="off" onChange={(e) => this.setState({charInt: e.target.value})}/> 号
            </div>
            <div className="voucher-date">
              日期:<DatePicker onChange={this.changeVoucherDate}/>
              日期:<DatePicker value={vouDate} onChange={(val) => this.setState({vouDate: val})}/>
            </div>
            <div className="voucher-affix">
              附单据 <Input autoComplete="off" /> 张
@@ -169,7 +192,7 @@
              <Button type="link" className="" onClick={this.triggerprint}>备注</Button>
            </div>
          </div>
          <VoucherTable config={config} data={data}/>
          <VoucherTable config={config} subjects={subjects} data={data}/>
        </div> : null}
        {config.wrap.type === 'check' ? <div className="voucher-body">
          <div className="pre-wrap">
src/tabviews/custom/components/module/voucher/voucherTable/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Table, Modal, Input, InputNumber, notification, message, AutoComplete } from 'antd'
import { Table, Modal, Input, InputNumber, notification, message, AutoComplete, Select } from 'antd'
import Api from '@/api'
import Utils from '@/utils/utils.js'
@@ -78,7 +78,7 @@
      if (col.field === 'creditor') {
        MKEmitter.emit('nextLine', col, record)
      } else {
        let cl = {remark: 'subject', subject: 'debtor', debtor: 'creditor'}
        let cl = {remark: 'subjectscode', subjectscode: 'debtor', debtor: 'creditor'}
        MKEmitter.emit('tdFocus', cl[col.uuid] + record.uuid)
      }
    }, 50)
@@ -89,10 +89,19 @@
    if (record.type === 'total') return
    this.setState({editing: true, value: record[col.field]}, () => {
      let node = document.getElementById(col.uuid + record.uuid)
      node && node.select()
    })
    if (col.field === 'subjectscode') {
      this.setState({editing: true}, () => {
        try {
          let node = document.getElementById(col.uuid + record.uuid)
          node.click()
        } catch(e) {}
      })
    } else {
      this.setState({editing: true, value: record[col.field]}, () => {
        let node = document.getElementById(col.uuid + record.uuid)
        node && node.select()
      })
    }
  }
  onBlur = () => {
@@ -100,6 +109,8 @@
    const { value } = this.state
    this.setState({editing: false})
    if (col.field === 'subjectscode') return
    if (value !== record[col.field]) {
      let line = {...record, [col.field]: value}
@@ -118,12 +129,28 @@
    this.setState({value: val})
  }
  complete = (key, option) => {
    this.setState({value: option.props.value})
  complete = (val) => {
    this.setState({value: val}, () => {
      this.onBlur()
    })
  }
  onSelectChange = (val, option) => {
    const { col, record } = this.props
    this.setState({editing: false})
    let line = {...record, ...option.props.extra}
    MKEmitter.emit('changeRecord', col.tableId, line)
    setTimeout(() => {
      MKEmitter.emit('tdFocus', 'debtor' + record.uuid)
    }, 50)
  }
  render() {
    let { col, record, className } = this.props
    let { col, record, subjects, className } = this.props
    const { editing } = this.state
    let children = null
@@ -154,15 +181,27 @@
          children = <div className="content-wrap" onClick={this.focus}>{val}</div>
        }
      }
    } else if (col.field === 'subject') {
    } else if (col.field === 'subjectscode') {
      if (record.type === 'total') {
        colSpan = 0
      } else {
        let val = record.subject || ''
        if (editing) {
          children = <Input.TextArea id={col.uuid + record.uuid} autoSize={false} defaultValue={val} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/>
          children = <Select
            showSearch
            defaultValue={record.subjectscode || ''}
            dropdownClassName="edit-table-dropdown"
            id={col.uuid + record.uuid}
            onBlur={this.onBlur}
            filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
            onSelect={this.onSelectChange}
          >
            {subjects.map((item, i) => (<Select.Option key={i} extra={item} value={item.subjectscode}>{item.subjectscode + ' ' + item.subjectsname}</Select.Option>))}
          </Select>
        } else {
          let val = ''
          if (record.subjectscode) {
            val = (record.subjectscode || '') + ' ' + (record.subjectsname || '')
          }
          children = <div className="content-wrap" onClick={this.focus}>{val}</div>
        }
      }
@@ -217,6 +256,7 @@
class VoucherTable extends Component {
  static propTpyes = {
    config: PropTypes.object,        // 菜单Id
    subjects: PropTypes.array,       // 会计科目
    BID: PropTypes.any,              // 主表ID
    data: PropTypes.any,             // 表格数据
    total: PropTypes.any,            // 总数
@@ -236,17 +276,7 @@
  }
  UNSAFE_componentWillMount () {
    const { config } = this.props
    let data = [
      {remark: '提现', subject: '1001 库存现金', debtor: 124, creditor: ''},
      {remark: '购入固定资产', subject: '1001 库存现金', debtor: '', creditor: 124},
      {remark: '转结销售成本', subject: '1001 库存现金', debtor: -524, creditor: ''},
      {remark: '提现', subject: '1001 库存现金', debtor: 34, creditor: ''},
    ]
    data = this.initData(data)
    data.push(this.getTotalLine(data))
    const { config, subjects, data } = this.props
    let columns = [
      {
@@ -261,12 +291,13 @@
      },
      {
        title: '会计科目',
        dataIndex: 'subject',
        key: 'subject',
        dataIndex: 'subjectscode',
        key: 'subjectscode',
        width: '34%',
        onCell: record => ({
          record,
          col: {uuid: 'subject', field: 'subject', tableId: config.uuid},
          subjects,
          col: {uuid: 'subjectscode', field: 'subjectscode', tableId: config.uuid},
        })
      },
      {
@@ -304,8 +335,7 @@
    ]
    this.setState({
      data: data,
      edData: fromJS(data).toJS(),
      edData: this.resetData(fromJS(data).toJS()),
      columns,
      tableId: config.uuid
    })
@@ -335,8 +365,43 @@
  UNSAFE_componentWillReceiveProps(nextProps) {
    if (!is(fromJS(this.props.data), fromJS(nextProps.data))) {
      this.setState({data: nextProps.data || []})
      this.resetData(fromJS(nextProps.data).toJS())
    } else if (!is(fromJS(this.props.subjects), fromJS(nextProps.subjects))) {
      this.resetSubjects(nextProps.subjects)
    }
  }
  resetSubjects = (subjects) => {
    const { config } = this.props
    let columns = fromJS(this.state.columns).toJS()
    this.setState({
      columns: columns.map(col => {
        if (col.key === 'subjectscode') {
          return {
            title: '会计科目',
            dataIndex: 'subjectscode',
            key: 'subjectscode',
            width: '34%',
            onCell: record => ({
              record,
              subjects,
              col: {uuid: 'subjectscode', field: 'subjectscode', tableId: config.uuid},
            })
          }
        }
        return col
      })
    })
  }
  resetData = (data) => {
    data = this.initData(data)
    data.push(this.getTotalLine(data))
    this.setState({
      edData: data
    })
  }
  initData = (data) => {
@@ -349,7 +414,7 @@
    if (_data.length < 4) {
      for (let i = _data.length - 1; i < 4; i++) {
        _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subject: '', debtor: '', creditor: ''})
        _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''})
      }
    }
    return _data
@@ -478,7 +543,7 @@
      MKEmitter.emit('tdFocus', 'remark' + edData[record.index + 1].uuid)
    } else {
      let _data = fromJS(edData).toJS()
      let line = {uuid: Utils.getuuid(), index: _data.length - 1, remark: record.remark || '', subject: '', debtor: '', creditor: ''}
      let line = {uuid: Utils.getuuid(), index: _data.length - 1, remark: record.remark || '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''}
      _data.splice(_data.length - 1, 0, line)
@@ -512,7 +577,7 @@
    if (_data.length < 4) {
      for (let i = _data.length - 1; i < 4; i++) {
        _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subject: '', debtor: '', creditor: ''})
        _data.push({uuid: Utils.getuuid(), index: i + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''})
      }
    }
@@ -535,7 +600,7 @@
    _data.pop()
    if (record.index === _data.length - 1) {
      _data.push({uuid: Utils.getuuid(), index: record.index + 1, remark: '', subject: '', debtor: '', creditor: ''})
      _data.push({uuid: Utils.getuuid(), index: record.index + 1, remark: '', subjectscode: '', subjectsname: '', debtor: '', creditor: ''})
    }
    _data.push(this.getTotalLine(_data))
src/tabviews/custom/components/module/voucher/voucherTable/index.scss
@@ -141,6 +141,22 @@
      height: 60px;
    }
  }
  .ant-select {
    padding: 0px;
    position: absolute;
    top: 0px;
    left: 0px;
    right: 0px;
    bottom: 0px;
    .ant-select-selection {
      height: 100%;
      border-radius: 0;
      .ant-select-arrow {
        display: none;
      }
    }
  }
  .editing_table_cell {
    .ant-input {
      padding: 0px;
@@ -181,3 +197,10 @@
    }
  }
}
.edit-table-dropdown {
  .ant-select-dropdown-menu-item {
    white-space: unset;
    text-overflow: unset;
  }
}
src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { notification } from 'antd'
import * as XLSX from 'xlsx'
import * as XLSX from 'sheetjs-style'
import Utils from '@/utils/utils.js'
import './index.scss'
src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -303,7 +303,7 @@
      })
    }
    let result = getExcelInSql(btn, data, this.state.dict, (this.props.BID || ''))
    let result = getExcelInSql(btn, data, this.state.dict, (this.props.BID || ''), this.state.primaryId)
    if (result.errors) {
      notification.warning({
src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -3,7 +3,7 @@
import moment from 'moment'
import { is, fromJS } from 'immutable'
import { Button, Modal, notification, message } from 'antd'
import * as XLSX from 'xlsx'
import * as XLSX from 'sheetjs-style'
import Utils from '@/utils/utils.js'
import options from '@/store/options.js'
@@ -602,11 +602,15 @@
        let _header = []
        let _topRow = {}
        let colwidth = []
        columns.forEach(col => {
        let requires = []
        columns.forEach((col, i) => {
          _header.push(col.Column)
          _topRow[col.Column] = col.Text
          colwidth.push({width: col.Width || 20})
          if (col.required === 'true') {
            requires.push(i)
          }
        })
  
        let table = []
@@ -638,8 +642,18 @@
        })
  
        const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true})
        ws['!cols'] = colwidth
        if (requires.length) {
          let cols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
          requires.forEach(col => {
            if (cols[col]) {
              ws[cols[col] + '1'].s = {font: { color: { rgb: 'F5222D' } }}
            }
          })
        }
        // ws["A1"].s = {fill: { bgColor: { rgb: "FFFFAA"  }}, font: { color: { rgb: "1890FF" } }}
  
        const wb = XLSX.utils.book_new()
        XLSX.utils.book_append_sheet(wb, ws, 'Sheet1')
src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
@@ -49,7 +49,7 @@
      _dec += ','
    }
    let _sql = `Declare @${btn.sheet} table (${_dec}jskey nvarchar(50) )
    let _sql = `Declare @${btn.sheet.replace(/@db@/ig, '')} table (${_dec}jskey nvarchar(50) )
      Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512)
      Select @ErrorCode='', @retmsg=''
    `
@@ -183,7 +183,7 @@
        }
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'${param.timestamp}'`)
        param.LText = param.LText.replace(/\n/g, ' ')
        
        // 外联数据库替换
@@ -298,7 +298,7 @@
          </Col>
          <Col span={24} className="sqlfield">
            <Form.Item label={'可用字段'}>
              <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'公共值,请按照@xxx@格式使用。'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id</span></Tooltip>,&nbsp;
              <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'公共值,请按照@xxx@格式使用。'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>,&nbsp;
              <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'系统变量,系统会定义变量并赋值。'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>,&nbsp;
              {usefulfields}
            </Form.Item>
src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx
@@ -37,7 +37,7 @@
        inputType: 'input',
        editable: true,
        unique: true,
        width: '17%'
        width: '16%'
      },
      {
        title: '名称',
@@ -45,7 +45,7 @@
        inputType: 'input',
        editable: true,
        unique: true,
        width: '17%'
        width: '16%'
      },
      {
        title: '列宽',
@@ -54,7 +54,7 @@
        min: 5,
        max: 200,
        editable: true,
        width: '12%',
        width: '10%',
        render: (text) => text || 20
      },
      {
@@ -63,7 +63,7 @@
        inputType: 'select',
        editable: true,
        required: false,
        width: '14%',
        width: '12%',
        render: (text) => {
          if (text === 'image') {
            return '图片'
@@ -85,7 +85,7 @@
        inputType: 'radio',
        editable: true,
        required: false,
        width: '14%',
        width: '12%',
        render: (text) => {
          if (text === 'true') {
            return '是'
@@ -114,7 +114,7 @@
        inputType: 'radio',
        editable: true,
        required: false,
        width: '14%',
        width: '12%',
        render: (text) => {
          if (text !== 'false') {
            return '是'
@@ -126,7 +126,19 @@
          {value: 'true', text: '是'},
          {value: 'false', text: '否'}
        ]
      }
      },
      {
        title: '红色标题',
        dataIndex: 'required',
        width: '10%',
        editable: true,
        inputType: 'radio',
        render: (text, record) => record.required === 'true' ? '是' : '否',
        options: [
          {value: 'true', text: '是'},
          {value: 'false', text: '否'}
        ]
      },
    ],
    scriptsColumns: [
      {
@@ -215,13 +227,12 @@
    if (card.intertype !== 'system') {
      _verify.enable = 'false'
    }
    if (_verify.columns[0] && (!_verify.columns[0].type || !_verify.columns[0].output)) {
      _verify.columns = _verify.columns.map(col => {
        col.type = col.type || 'text'
        col.output = col.output || 'true'
        return col
      })
    }
    _verify.columns = _verify.columns.map(col => {
      col.type = col.type || 'text'
      col.output = col.output || 'true'
      col.required = col.required || 'false'
      return col
    })
    let defaultscript = ''
    if (!_verify.script && card.intertype === 'system') {
@@ -459,6 +470,7 @@
    values.uuid = Utils.getuuid()
    values.abs = 'false'
    values.output = 'true'
    values.required = 'false'
    verify.columns.push(values)
    this.setState({
@@ -751,6 +763,7 @@
        Width: 20,
        abs: 'false',
        output: 'true',
        required: 'false',
        type: 'text',
        uuid: Utils.getuuid()
      }
@@ -798,6 +811,7 @@
          Width: 20,
          abs: 'false',
          output: col.output || 'true',
          required: col.required || 'false',
          type: 'text',
        }
@@ -995,7 +1009,7 @@
            <Button className="excel-col-add mk-red" title="清空Excel列" onClick={this.clearField}>
              清空Excel列
            </Button>
            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>如需导出序号,请使用字段 $Index;数值类型导出时可进行数据处理(取绝对值、保留小数位)。</div>
            <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>如需导出序号,请使用字段 $Index;数值类型导出时可进行数据处理(取绝对值、保留小数位);红色标题导出时列头文字为红色。</div>
            <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/>
          </TabPane>
          {card.intertype === 'system' ? <TabPane tab={
src/templates/zshare/editTable/index.scss
@@ -13,6 +13,9 @@
    .ant-select {
      width: 100%;
    }
    span.ant-radio + * {
      padding-left: 2px;
    }
    > td {
      padding: 14px 10px;
    }
src/utils/utils.js
@@ -844,7 +844,7 @@
 * @return {Object} dict   字典项
 * @return {String} BID    上级Id
 */
export function getExcelInSql (item, data, dict, BID) {
export function getExcelInSql (item, data, dict, BID, primaryId) {
  let btn = item.verify
  let keys = ['delete', 'drop', 'insert', 'truncate', 'update']
  let userName = sessionStorage.getItem('User_Name') || ''
@@ -897,20 +897,30 @@
    btn.scripts.forEach(script => {
      if (script.status === 'false') return
      let _sql = script.sql
      _sql = _sql.replace(/@ID@/ig, `'${primaryId || ''}'`)
      _sql = _sql.replace(/@BID@/ig, `'${BID}'`)
      _sql = _sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`)
      _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`)
      _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`)
      _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`)
      _sql = _sql.replace(/@typename@/ig, `'admin'`)
      if (script.position === 'init') {
        _initCustomScript += `
      /* 自定义脚本 */
      ${script.sql}
      ${_sql}
      `
      } else if (script.position === 'front') {
        _prevCustomScript += `
      /* 自定义脚本 */
      ${script.sql}
      ${_sql}
      `
      } else {
        _backCustomScript += `
      /* 自定义脚本 */
      ${script.sql}
      ${_sql}
      `
      }
    })