king
2025-04-21 f3d4db769ba9b51b799d981511a710fd443d0e08
src/menu/components/module/voucher/options.jsx
@@ -1,25 +1,36 @@
import { fromJS } from 'immutable'
import React from 'react'
import MenuUtils from '@/utils/utils-custom.js'
/**
 * @description Wrap表单配置信息
 */
export default function (wrap, id) {
  let roleList = sessionStorage.getItem('sysRoles')
  let appType = sessionStorage.getItem('appType')
  let menu = window.GLOB.customMenu
  let modules = MenuUtils.getSupModules(menu.components, id, menu.interfaces)
  let books = []
  let bookids = []
  menu.components.forEach(item => {
    if (item.subtype === 'account') {
      books.push({
        value: item.uuid,
        label: item.name
      })
      bookids.push(item.uuid)
    }
  })
  let menu = fromJS(window.GLOB.customMenu).toJS()
  let modules = MenuUtils.getSupModules(menu.components, id) || []
  if (roleList) {
  let menulist = sessionStorage.getItem('fstMenuList')
  if (menulist) {
    try {
      roleList = JSON.parse(roleList)
      menulist = JSON.parse(menulist)
    } catch (e) {
      roleList = []
      menulist = []
    }
  } else {
    roleList = []
    menulist = []
  }
  modules = modules.filter(item => !bookids.includes(item.value))
  const wrapForm = [
    // {
@@ -30,14 +41,25 @@
    //   required: false
    // },
    {
      type: 'radio',
      type: 'select',
      field: 'type',
      label: '类型',
      initval: wrap.type || 'edit',
      initval: wrap.type || 'createVoucher',
      required: true,
      options: [
        {value: 'edit', label: '编辑'},
        {value: 'check', label: '查看'},
        {value: 'createVoucher', label: '新增凭证'},
        {value: 'checkVoucher', label: '查看凭证'},
        {value: 'createTemp', label: '新增模板'},
        {value: 'checkTemp', label: '编辑模板'},
      ],
      controlFields: [
        {field: 'businessType', values: ['createVoucher', 'checkVoucher']},
        {field: 'voucherType', values: ['createVoucher', 'checkVoucher']},
        {field: 'voucherTypeText', values: ['createVoucher', 'checkVoucher']},
        {field: 'voucherSign', values: ['createVoucher', 'checkVoucher']},
        {field: 'printTemp', values: ['createVoucher', 'checkVoucher']},
        {field: 'supModule', values: ['checkTemp', 'checkVoucher']},
        {field: 'attachStatus', values: ['createVoucher', 'checkVoucher']},
      ]
    },
    {
@@ -60,6 +82,43 @@
      required: true
    },
    {
      type: 'select',
      field: 'supBook',
      label: '账套',
      initval: wrap.supBook || '',
      required: true,
      options: books,
      allowClear: true
    },
    {
      type: 'text',
      field: 'businessType',
      label: '业务类型',
      initval: wrap.businessType || 'fcc01',
      required: true
    },
    {
      type: 'text',
      field: 'voucherType',
      label: '凭证类型',
      initval: wrap.voucherType || 'fcc_keeping',
      required: true
    },
    {
      type: 'text',
      field: 'voucherTypeText',
      label: '凭证类型文本',
      initval: wrap.voucherTypeText || '记账凭证',
      required: true
    },
    {
      type: 'text',
      field: 'voucherSign',
      label: '凭证类型标识',
      initval: wrap.voucherSign || 'fcc_keeping',
      required: true
    },
    {
      type: 'cascader',
      field: 'supModule',
      label: '上级组件',
@@ -69,14 +128,55 @@
      allowClear: true,
    },
    {
      type: 'multiselect',
      field: 'blacklist',
      label: '黑名单',
      initval: wrap.blacklist || [],
      required: false,
      options: roleList,
      forbid: !!appType
      type: 'radio',
      field: 'attachStatus',
      label: '附件状态',
      initval: wrap.attachStatus || 0,
      tooltip: '添加或修改凭证时,上传附件的状态。',
      required: true,
      options: [
        {value: 0, label: '待审核'},
        {value: 10, label: '已审核'},
      ]
    },
    {
      type: 'printTemps',
      field: 'printTemp',
      label: '打印模板',
      initval: wrap.printTemp || '',
      help: (record) => {
        if (record.printTemp) {
          return <span onClick={() => {
            sessionStorage.setItem('mk-print-temp', record.printTemp)
            window.open('#/hs')
            setTimeout(() => {
              sessionStorage.removeItem('mk-print-temp')
            }, 50)
          }} style={{color: '#1890ff', cursor: 'pointer', fontSize: '13px'}}>#查看模板</span>
        }
        return ''
      },
      required: true
    },
    {
      type: 'number',
      field: 'space',
      label: '留白',
      initval: wrap.space || 0,
      tooltip: '表格主体部分两端的空白距离,表格在编辑时两端会有添加和删除图标。',
      required: false
    },
    {
      type: 'cascader',
      field: 'linkmenu',
      label: '刷新菜单',
      initval: wrap.linkmenu || [],
      tooltip: '点击保存时需要刷新的菜单。',
      required: false,
      allowClear: true,
      options: menulist
    }
  ]
  return wrapForm