king
2019-12-16 c0930736f5b5955efecdac4c0ca85957d4f7b574
2019-12-16
20个文件已修改
990 ■■■■ 已修改文件
src/api/index.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/main.scss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/header/editmenu/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/header/index.jsx 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/sidemenu/editsecmenu/index.jsx 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/sidemenu/editsecmenu/index.scss 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/sidemenu/editthdmenu/index.jsx 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/sidemenu/editthdmenu/index.scss 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/sidemenu/index.jsx 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/locales/zh-CN/comtable.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/action-type.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/action.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/reducer.js 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/commontable/index.jsx 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/commontable/mainAction/index.jsx 129 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/commontable/mutilform/index.jsx 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/actionform/index.jsx 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/index.jsx 159 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/index.jsx 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils.js 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js
@@ -137,6 +137,22 @@
  }
  /**
   * @description 获取或修改本地配置,增加appkey
   */
  getLocalConfig (param) {
    param.userid = sessionStorage.getItem('UserID')
    param.lang = localStorage.getItem('lang') || ''
    param.SessionUid = sessionStorage.getItem('SessionUid') || ''
    param.LoginUID = sessionStorage.getItem('LoginUID') || ''
    param.appkey = window.GLOB.appkey || ''
    return axios({
      url: '/webapi/dostar',
      data: param
    })
  }
  /**
   * @description 获取系统配置,优先从缓存中取值,增加appkey
   */
  getSystemCacheConfig (param) {
@@ -178,7 +194,7 @@
    param.lang = localStorage.getItem('lang') || ''
    param.SessionUid = sessionStorage.getItem('SessionUid') || ''
    param.LoginUID = sessionStorage.getItem('LoginUID') || ''
    param.appkey = window.GLOB.appkey || ''
    // param.appkey = window.GLOB.appkey || ''
    
    return axios({
      url: '/webapi/dostar',
src/assets/css/main.scss
@@ -136,6 +136,10 @@
  z-index: 1100!important;
}
.ant-select-dropdown {
  z-index: 1090!important;
}
// 确认提示框高度
.ant-modal.ant-modal-confirm {
  top: 38vh;
src/components/header/editmenu/index.jsx
@@ -323,7 +323,7 @@
            点击添加图标,可新增一级菜单。
          </div>
          <div className="tipcard card5">
            <p>编辑状态中,一级菜单之外区域会锁定,查看系统数据请点击。</p>
            <p>编辑状态中,菜单之外区域会锁定,查看系统数据请点击。</p>
            <div>
              <a target="blank" href="#/main" >新页面</a>
            </div>
src/components/header/index.jsx
@@ -6,7 +6,16 @@
import moment from 'moment'
import {Dropdown, Menu, Icon, Modal, Form, notification, Switch } from 'antd'
import asyncComponent from '@/utils/asyncComponent'
import {toggleCollapse, modifyMainMenu, resetState, resetDebug, resetEditState, resetEditLevel, logout} from '@/store/action'
import {
  toggleCollapse,
  modifyMainMenu,
  resetState,
  resetDebug,
  resetEditState,
  resetEditLevel,
  initPermission,
  logout
} from '@/store/action'
import Api from '@/api'
import zhCN from '@/locales/zh-CN/header.js'
import enUS from '@/locales/en-US/header.js'
@@ -184,7 +193,24 @@
    // 获取主菜单
    let result = await Api.getSystemConfig({func: 'sPC_Get_RolesMenu'})
    if (result.status) {
      let _permAction = {}
      let _permFuncField = []
      if (result.UserRoles && result.UserRoles[0] && result.UserRoles[0].RoleMenu) {
        result.UserRoles[0].RoleMenu.forEach(menu => {
          _permAction[menu.MenuID] = true
        })
      }
      if (result.sModular && result.sModular.length > 0) {
        result.sModular.forEach(field => {
          if (field.ModularNo) {
            _permFuncField.push(field.ModularNo)
          }
        })
        _permFuncField = _permFuncField.sort()
      }
      this.props.initPermission(_permAction, _permFuncField)
    }
  }
@@ -293,7 +319,9 @@
    selectmenu: state.selectedMainMenu,
    debug: state.debug,
    editState: state.editState,
    editLevel: state.editLevel
    editLevel: state.editLevel,
    permAction: state.permAction,
    permFuncField: state.permFuncField
  }
}
@@ -303,6 +331,7 @@
    modifyMainMenu: (selectmenu) => dispatch(modifyMainMenu(selectmenu)),
    resetEditState: (state) => dispatch(resetEditState(state)),
    resetEditLevel: (level) => dispatch(resetEditLevel(level)),
    initPermission: (permAction, permFuncField) => dispatch(initPermission(permAction, permFuncField)),
    resetState: () => dispatch(resetState()),
    resetDebug: () => dispatch(resetDebug()),
    logout: () => dispatch(logout())
src/components/sidemenu/editsecmenu/index.jsx
@@ -377,6 +377,26 @@
  render () {
    return (
      <div className="second-edit-box">
        <div className="mask">
          <div className="tipcard card1">
            拖动二级菜单可调整顺序,顺序调整后,请点击确定按钮保存。
          </div>
          <div className="tipcard card2">
            点击编辑图标可修改菜单属性,点击删除图标可删除菜单。
          </div>
          <div className="tipcard card3">
            点击解除冻结按钮,可还原已删除的二级菜单。
          </div>
          <div className="tipcard card4">
            点击添加图标,可新增二级菜单。
          </div>
          <div className="tipcard card5">
            <p>编辑状态中,菜单之外区域会锁定,查看系统数据请点击。</p>
            <div>
              <a target="blank" href="#/main" >新页面</a>
            </div>
          </div>
        </div>
        {this.state.show && <DndProvider backend={HTML5Backend}>
          <DragElement
            list={this.props.menulist}
src/components/sidemenu/editsecmenu/index.scss
@@ -0,0 +1,83 @@
.second-edit-box {
  .mask {
    position: fixed;
    top: 0px;
    left: 0px;
    right: 0px;
    bottom: 0px;
    .tipcard {
      position: absolute;
      min-height: 100px;
      font-size: 16px;
      border-radius: 6px;
      background-size: 100% 100%;
      background-repeat: no-repeat;
      padding: 15px;
    }
    .card1 {
      left: 30%;
      top: 20vh;
      width: 230px;
      min-height: 100px;
      background-image: url('../../../assets/img/card-bg2.jpg');
      color: #000000;
      font-style: oblique;
    }
    .card2 {
      left: 60%;
      top: 20vh;
      width: 230px;
      min-height: 100px;
      background-image: url('../../../assets/img/card-bg5.jpg');
      color: #000000;
      padding: 20px 30px;
      font-style: oblique;
    }
    .card3 {
      left: 30%;
      top: 50vh;
      width: 230px;
      min-height: 140px;
      background-image: url('../../../assets/img/card-bg8.jpg');
      color: #000000;
      padding: 20px 30px;
      font-style: oblique;
    }
    .card4 {
      left: 60%;
      top: 50vh;
      width: 230px;
      min-height: 140px;
      background-image: url('../../../assets/img/card-bg7.jpg');
      color: #000000;
      padding: 20px 30px;
      font-style: oblique;
    }
    .card5 {
      right: 5%;
      top: 20vh;
      width: 130px;
      min-height: 240px;
      background-image: url('../../../assets/img/card-bg6.jpg');
      color: #000000;
      padding: 40px 15px 10px;
      p {
        margin: 0 0 5px;
      }
      div {
        text-align: center;
        a {
          display: inline-block;
          color: #fff;
          padding: 2px 10px;
          border-radius: 4px;
          background-color: #1890ff;
          border-color: #1890ff;
          text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
          -webkit-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
          box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
        }
      }
    }
  }
}
src/components/sidemenu/editthdmenu/index.jsx
@@ -416,6 +416,28 @@
  render () {
    return (
      <div className="third-edit-box">
        {!this.state.tabview ?
          <div className="mask">
            <div className="tipcard card1">
              拖动三级菜单可调整顺序,顺序调整后,请点击确定按钮保存。
            </div>
            <div className="tipcard card2">
              点击编辑图标会根据菜单模板,进入相应的模板编辑页面,点击删除图标可删除菜单。
            </div>
            <div className="tipcard card3">
              点击解除冻结按钮,可还原已删除的三级菜单。
            </div>
            <div className="tipcard card4">
              点击添加图标,会显示系统模板和已使用模板,选择已使用模板时,会复制已添加菜单的配置信息。
            </div>
            <div className="tipcard card5">
              <p>编辑状态中,菜单之外区域会锁定,查看系统数据请点击。</p>
              <div>
                <a target="blank" href="#/main" >新页面</a>
              </div>
            </div>
          </div> : null
        }
        <div className="cus-submenu-title">
          <Icon type={this.props.supMenu.PageParam.Icon} />
          <span>{this.props.supMenu.text}</span>
src/components/sidemenu/editthdmenu/index.scss
@@ -1,4 +1,85 @@
.third-edit-box {
  .mask {
    position: fixed;
    top: 0px;
    left: 0px;
    right: 0px;
    bottom: 0px;
    .tipcard {
      position: absolute;
      min-height: 100px;
      font-size: 16px;
      border-radius: 6px;
      background-size: 100% 100%;
      background-repeat: no-repeat;
      padding: 15px;
    }
    .card1 {
      left: 30%;
      top: 20vh;
      width: 250px;
      min-height: 100px;
      background-image: url('../../../assets/img/card-bg2.jpg');
      color: #000000;
      font-style: oblique;
    }
    .card2 {
      left: 60%;
      top: 20vh;
      width: 250px;
      min-height: 100px;
      background-image: url('../../../assets/img/card-bg5.jpg');
      color: #000000;
      padding: 20px 30px;
      font-style: oblique;
    }
    .card3 {
      left: 30%;
      top: 50vh;
      width: 250px;
      min-height: 150px;
      background-image: url('../../../assets/img/card-bg8.jpg');
      color: #000000;
      padding: 20px 30px;
      font-style: oblique;
    }
    .card4 {
      left: 60%;
      top: 50vh;
      width: 250px;
      min-height: 150px;
      background-image: url('../../../assets/img/card-bg7.jpg');
      color: #000000;
      padding: 20px 30px;
      font-style: oblique;
    }
    .card5 {
      right: 5%;
      top: 20vh;
      width: 130px;
      min-height: 240px;
      background-image: url('../../../assets/img/card-bg6.jpg');
      color: #000000;
      padding: 40px 15px 10px;
      p {
        margin: 0 0 5px;
      }
      div {
        text-align: center;
        a {
          display: inline-block;
          color: #fff;
          padding: 2px 10px;
          border-radius: 4px;
          background-color: #1890ff;
          border-color: #1890ff;
          text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
          -webkit-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
          box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
        }
      }
    }
  }
  .cus-submenu-title {
    padding: 0px 24px;
    background: #364150;
src/components/sidemenu/index.jsx
@@ -3,7 +3,7 @@
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import { Menu, Icon } from 'antd'
import { Menu, Icon, notification } from 'antd'
import asyncComponent from '@/utils/asyncComponent'
import {modifyTabview, resetEditLevel} from '@/store/action'
import zhCN from '@/locales/zh-CN/header.js'
@@ -25,12 +25,12 @@
  }
  state = {
    dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS,
    mainMenuList: null, // 一级菜单,编辑调整上级菜单时获取
    subMenulist: null, // 二级菜单
    editMenu: null, // 编辑三级菜单时设置
    rootSubmenuKeys: null,
    createThirdMenu: false,
    dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS,
    openKeys: null,
    preview: null
  }
@@ -38,17 +38,39 @@
  async loadsubmenu (menu) {
    let result = await Api.getSystemConfig({func: 'sPC_Get_FunMenu', ParentID: menu.MenuID})
    if (result.status) {
      if (result.data.length === 0) { // 查询菜单为空
        this.setState({
          subMenulist: [],
          rootSubmenuKeys: [],
          openKeys: [],
          editMenu: null
        })
        return
      }
      let param = sessionStorage.getItem('view_param') // 是否为打开新页面
      let msg = sessionStorage.getItem('UserID') + '&' + sessionStorage.getItem('SessionUid') + '&' + sessionStorage.getItem('LoginUID')
      let submenuindex = 0 // 展开二级菜单索引
      let tabindex = null // 打开的tab页
      let submenuId = '' // 展开二级菜单ID
      let tabId = '' // 打开的tab页id
      if (param) {
        param = param.split('&')
        submenuindex = parseInt(param[1])
        tabindex = parseInt(param[2])
        submenuId = param[1]
        let submenu = result.data.filter(item => item.ParentID === submenuId)[0]
        if (!submenu) {
          submenuId = ''
        } else {
          tabId = param[2]
          let tabmenu = submenu.FunMenu.filter(item => item.MenuID === tabId)[0]
          if (!tabmenu) {
            submenuId = ''
            tabId = ''
          }
        }
        sessionStorage.removeItem('view_param')
      }
      let parentID = result.data[submenuindex] ? result.data[submenuindex].ParentID : '' // 展开二级菜单ID
      let parentID = submenuId ? submenuId : result.data[0].ParentID // 展开二级菜单ID
      let menulist = result.data.map((item, i) => {
        let _smenu = {}
@@ -63,7 +85,7 @@
        if (item.FunMenu) {
          _smenu.children = item.FunMenu.map((child, n) => {
            let _tmenu = {}
            let _msg = window.btoa(menu.MenuID + '&' + i + '&' + n + '&' + msg) // 待完善
            let _msg = window.btoa(menu.MenuID + '&' + _smenu.MenuID + '&' + child.MenuID + '&' + msg) // 待完善
            _tmenu.src = '#/main/' + _msg
            if (child.LinkUrl === 'CommonTable') {
              _tmenu.type = 'CommonTable'
@@ -100,30 +122,24 @@
      this.setState({
        subMenulist: menulist,
        rootSubmenuKeys: result.data.map(item => item.ParentID),
        openKeys: (this.props.collapse || !parentID) ? [] : [parentID],
        openKeys: this.props.collapse ? [] : [parentID],
        editMenu: this.props.editLevel === 'level3' && menulist.filter(menu => menu.MenuID === this.state.editMenu.MenuID)[0]
      })
      if (tabId) {
        let _menu = menulist.filter(menu => menu.MenuID === submenuId)[0]
        let opentab = _menu && _menu.children.filter(tab => tab.MenuID === tabId)[0]
      if (tabindex !== null) {
        let opentab = result.data[submenuindex].children[tabindex]
        if (opentab) {
        opentab.selected = true
        this.props.modifyTabview([opentab])
      }
      // this.props.modifyTabview([{
      //   Action: 'Index',
      //   Icon: 'Content/icons/L32X32/RoleM.png',
      //   LinkUrl: 'bda/rdt?pageno=rolemenus&MenuNo=RoleMenuM',
      //   MenuID: 'MMenu14002DBD0010',
      //   MenuName: '角色权限分配',
      //   MenuNo: 'RoleMenuM',
      //   Ot: '空',
      //   PageParam: '',
      //   SortSub: '720',
      //   id: 3,
      //   selected: true,
      //   type: 'RoleManage'
      // }])
      }
    } else {
      notification.warning({
        top: 92,
        message: result.message,
        duration: 10
      })
    }
  }
@@ -143,6 +159,7 @@
      })
      menu.selected = true
      tabs.push(menu)
      this.props.modifyTabview(tabs)
      e.preventDefault()
    }
src/locales/zh-CN/comtable.js
@@ -123,7 +123,7 @@
  'header.form.custom': '自定义',
  'header.form.datasource': '数据源',
  'header.form.actionhelp.datasource': '使用系统函数时,请填写数据源,使用自定义函数时,可忽略。',
  'header.form.actionhelp.sqlType': '使用系统函数时,请选择类型,使用自定义函数时,可忽略。',
  'header.form.actionhelp.sqlType': '使用系统函数时,请选择操作类型,使用自定义函数时,可忽略。',
  'header.form.action.type': '操作类型',
  'header.form.action.insert': '添加',
  'header.form.action.update': '修改',
src/store/action-type.js
@@ -25,5 +25,8 @@
// 重置编辑级别
export const RESET_EDITLEVEL = 'RESET_EDITLEVEL'
// 初始化按钮权限及创建存储过程可用字段
export const INIT_PERMISSION = 'INIT_PERMISSION'
// 退出
export const LOGOUT = 'LOGOUT'
src/store/action.js
@@ -70,6 +70,15 @@
  }
}
// 初始化按钮权限及创建存储过程可用字段
export const initPermission = (permAction, permFuncField) => {
  return {
    type: user.INIT_PERMISSION,
    permAction: permAction,
    permFuncField: permFuncField
  }
}
// 退出重置
export const logout = () => {
  return {
src/store/reducer.js
@@ -8,7 +8,9 @@
  debug: false, // 知否可以复制菜单参数, 是否可进入编辑模式
  editState: false, // 是否为编辑状态,值为false、true
  editLevel: null, // 编辑菜单级别,值为level1、level2、level3。。。
  refreshTab: null // 刷新tabview页面信息
  refreshTab: null,     // 刷新tabview页面信息
  permAction: {},
  permFuncField: []
}
// 用户消息
@@ -75,6 +77,13 @@
        editLevel: action.editLevel,
        tabviews: []
      }
    case Type.INIT_PERMISSION:
    // 初始化按钮权限及创建存储过程可用字段
      return {
        ...state,
        permAction: action.permAction,
        permFuncField: action.permFuncField
      }
    case Type.LOGOUT:
      return {
        selectedMainMenu: '',
@@ -84,7 +93,9 @@
        debug: false,
        editState: false,
        editLevel: null,
        refreshTab: null
        refreshTab: null,
        permAction: {},
        permFuncField: []
      }
    default:
      return state
src/tabviews/commontable/index.jsx
@@ -162,7 +162,6 @@
    let deffers = []
    searchlist.forEach(item => {
      if (item.type !== 'select' && item.type !== 'link') return
      if (item.setAll === 'true') {
        item.options.unshift({
          key: Utils.getuuid(),
@@ -172,11 +171,15 @@
      }
      if (item.resourceType === '1' && item.dataSource) {
        let arrfield = item.valueField + ',' + item.valueText
        if (item.type === 'link') {
          arrfield = arrfield + ',' + item.linkField
        }
        let param = {
          func: 'sPC_Get_SelectedList',
          LText: item.dataSourceSql,
          obj_name: 'data',
          arr_field: item.valueField + ',' + item.valueText
          arr_field: arrfield
        }
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
@@ -231,13 +234,26 @@
  improveAction = () => {
    const { config } = this.state
    config.action.forEach(item => {
      if (item.OpenType !== 'pop' && item.OpenType !== 'tab' && item.OpenType !== 'blank') return
    let conAction = config.action.filter(item => (item.OpenType === 'pop' || item.OpenType === 'tab' || item.OpenType === 'blank'))
    if (conAction.length > 0) {
      let deffers = conAction.map(item => {
        return new Promise(resolve => {
      Api.getSystemCacheConfig({
        func: 'sPC_Get_LongParam',
        MenuID: item.uuid
      }).then(res => {
            res.uuid = item.uuid
            resolve(res)
          })
        })
      })
      let _action = {}
      let error = ''
      Promise.all(deffers).then(result => {
        result.forEach(res => {
        if (res.status) {
          let _LongParam = ''
          if (res.LongParam) {
@@ -249,17 +265,107 @@
            }
          }
          this.setState({
            configMap: {...this.state.configMap, [item.uuid]: _LongParam}
          })
            if (_LongParam) {
              _action[res.uuid] = _LongParam
            }
        } else {
            error = res
          }
        })
        this.setState({
          configMap: {...this.state.configMap, ..._action}
        })
        if (error) {
          notification.warning({
            top: 92,
            message: res.message,
            message: error.message,
            duration: 10
          })
        } else {
          this.improveActionForm(Object.values(_action))
        }
      })
    }
  }
  improveActionForm = (actions) => {
    let subfields = []
    actions.forEach(item => {
      if (item.groups.length > 0) {
        item.groups.forEach(group => {
          group.sublist.forEach(field => {
            if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') {
              subfields.push(field)
            }
          })
        })
      } else {
        item.fields.forEach(field => {
          if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') {
            subfields.push(field)
          }
          })
        }
      })
    let deffers = subfields.map(item => {
      let arrfield = item.valueField + ',' + item.valueText
      if (item.type === 'link') {
        arrfield = arrfield + ',' + item.linkField
      }
      let param = {
        func: 'sPC_Get_SelectedList',
        LText: item.dataSourceSql,
        obj_name: 'data',
        arr_field: arrfield
      }
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
      param.secretkey = Utils.encrypt(param.LText, param.timestamp)
      console.log(item)
      return new Promise(resolve => {
        Api.getSystemCacheConfig(param).then(res => {
          res.search = item
          resolve(res)
        })
      })
    })
    let _field = {}
    let error = ''
    Promise.all(deffers).then(result => {
      result.forEach(res => {
        if (res.status) {
          let options = res.data.map(cell => {
            return {
              key: Utils.getuuid(),
              Value: cell[res.search.valueField],
              Text: cell[res.search.valueText]
            }
          })
          _field[res.search.uuid] = options
        } else {
          error = res
        }
      })
      this.setState({
        configMap: {...this.state.configMap, ..._field}
      })
      if (error) {
        notification.warning({
          top: 92,
          message: error.message,
          duration: 10
        })
      }
    })
  }
@@ -326,6 +432,7 @@
    this.setState({
      loading: true,
      pageIndex: 1,
      search: searches
    }, () => {
      this.loadmaindata()
@@ -353,15 +460,52 @@
    })
  }
  reloadtable = () => {
    this.refs.mainTable.resetTable()
    this.setState({
      loading: true,
      pageIndex: 1
    }, () => {
      this.loadmaindata()
    })
  }
  reloadview = () => {
    this.setState({
      loadingview: true,    // 页面加载中
      viewlost: false,      // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用
      lostmsg: '',          // 页面丢失时的提示信息
      config: {},
      searchlist: null,
      actions: null,
      columns: null,
      arr_field: '',
      setting: null,
      data: null,
      total: 0,
      loading: false,
      pageIndex: 1,
      pageSize: 10,
      orderColumn: '',
      orderType: 'asc',
      search: '',
      configMap: {}
    }, () => {
      this.loadconfig()
    })
  }
  refreshbyaction = (btn, type) => {
    // 按钮操作后刷新表格,重置页码及选择项
    console.log(btn)
    console.log(type)
    this.refs.mainTable.resetTable()
    // this.loadmaindata(1, this.state.param.pageSize, this.state.param.orderColumn, this.state.param.orderType, this.state.param.search)
    // this.setState({
    //   loading: true
    // })
    if (btn.execSuccess === 'grid' && type === 'success') {
      this.reloadtable()
    } else if (btn.execError === 'grid' && type === 'error') {
      this.reloadview()
    } else if (btn.execSuccess === 'view' && type === 'success') {
      this.reloadtable()
    } else if (btn.execError === 'view' && type === 'error') {
      this.reloadview()
    }
  }
  gettableselected = () => {
src/tabviews/commontable/mainAction/index.jsx
@@ -1,8 +1,9 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
// import { is, fromJS } from 'immutable'
import moment from 'moment'
import { Button, Affix, Modal, notification } from 'antd'
import MutilForm from '../mutilform'
import Utils from '@/utils/utils.js'
import Api from '@/api'
import './index.scss'
@@ -100,21 +101,27 @@
    }
  }
  execSubmit = (btn, data, _resolve) => {
  execSubmit = (btn, data, _resolve, formdata) => {
    const { setting } = this.props
    if (btn.intertype === 'inner') {
      // 使用内部接口时,内部函数和数据源不可同时为空
      if (!btn.innerFunc && !btn.sql) {
      // 使用内部接口时,内部函数和数据源不可同时为空, 使用系统函数时,类型不可为空
      if (!btn.innerFunc && (!btn.sql || (btn.sql && !btn.sqlType))) {
        this.actionSettingError()
        _resolve()
        return
      }
      if (btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') {
        // 获取id
        let param = {
      if (
        btn.Ot === 'notRequired' ||
        btn.Ot === 'requiredSgl' ||
        (btn.Ot === 'requiredOnce' && btn.OpenType !== 'pop') ||
        (btn.OpenType === 'pop' && !btn.innerFunc && btn.sql && btn.sqlType === 'insert')
      ) {
        let param = { // 系统存储过程
          func: 'sPC_TableData_InUpDe'
        }
        if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行
        let ID = ''
        if (btn.Ot === 'notRequired') {
          
@@ -125,13 +132,49 @@
          ID = ids.join(',')
        }
        if (btn.innerFunc) {
          param.func = btn.innerFunc
          param.ID = ID
          param.BID = ''
          if (btn.innerFunc) {
            param.func = btn.innerFunc
        } else if (btn.sql) {
          param.LText = btn.sql // 数据源
            param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting)) // 数据源
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
            param.secretkey = Utils.encrypt(param.LText, param.timestamp)
        }
        } else if (btn.OpenType === 'pop') { // 表单
          if (btn.innerFunc) {
            param.func = btn.innerFunc
            formdata.forEach(_data => {
              param[_data.key] = _data.value
            })
            if (setting.primaryKey) {
              if (!param.hasOwnProperty(setting.primaryKey) && data[0] && data[0][setting.primaryKey]) {
                param[setting.primaryKey] = data[0][setting.primaryKey]
              }
            }
            if (!param.hasOwnProperty('ID') && setting.primaryKey && data[0] && data[0][setting.primaryKey]) {
              param.ID = data[0][setting.primaryKey]
            }
            if (!param.hasOwnProperty('BID')) {
              param.BID = ''
            }
          } else if (btn.sql && btn.sqlType === 'insert') {
            param.ID = Utils.getguid()
            param.BID = ''
            param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata)) // 数据源
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
            param.secretkey = Utils.encrypt(param.LText, param.timestamp)
          } else if (btn.sql) {
            param.ID = data[0][setting.primaryKey]
            param.BID = ''
            param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata)) // 数据源
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
            param.secretkey = Utils.encrypt(param.LText, param.timestamp)
          }
        }
        Api.genericInterface(param).then((res) => {
          if (res.status) {
@@ -141,19 +184,43 @@
          }
          _resolve()
        })
      } else if (btn.Ot === 'required') {
      } else if (btn.Ot === 'required' || (btn.Ot === 'requiredOnce' && btn.OpenType === 'pop')) {
        let deffers = data.map(cell => {
          let param = {
            func: 'sPC_TableData_InUpDe'
          }
          let ID = cell[setting.primaryKey]
          if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 是否弹框或直接执行
            param.ID = cell[setting.primaryKey]
            param.BID = ''
          if (btn.innerFunc) {
            param.func = btn.innerFunc
            param.ID = ID
            param.BID = ''
          } else if (btn.sql) {
            param.LText = btn.sql // 数据源
              param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting)) // 数据源
              param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
              param.secretkey = Utils.encrypt(param.LText, param.timestamp)
            }
          } else if (btn.OpenType === 'pop') { // 表单
            if (btn.innerFunc) {
              param.func = btn.innerFunc
              formdata.forEach(_data => {
                param[_data.key] = _data.value
              })
              if (!param.hasOwnProperty(setting.primaryKey) && cell[setting.primaryKey]) {
                param[setting.primaryKey] = cell[setting.primaryKey]
              }
              if (!param.hasOwnProperty('ID') && cell[setting.primaryKey]) {
                param.ID = cell[setting.primaryKey]
              }
            } else if (btn.sql) {
              param.ID = cell[setting.primaryKey]
              param.BID = ''
              param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata)) // 数据源
              param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
              param.secretkey = Utils.encrypt(param.LText, param.timestamp)
            }
          }
          return new Promise(resolve => {
@@ -439,6 +506,11 @@
      message: this.props.dict['main.action.confirm.success'],
      duration: 5
    })
    if (btn.OpenType === 'pop') {
      this.setState({
        visible: false
      })
    }
    this.refreshdata(btn, 'success')
  }
@@ -464,26 +536,12 @@
      this.setState({
        confirmLoading: true
      })
      this.execSubmit(this.state.execAction, this.state.tabledata, () => {
        this.setState({
          confirmLoading: false
        })
      }, res)
      console.log(res)
      // Api.setActionSubmit({
      //   func: 'SetActionSubmitSuccess'
      // }).then((res) => {
      //   if (res.status) {
      //     notification.success({
      //       top: 92,
      //       message: this.props.dict['main.action.confirm.success']
      //     })
      //     this.setState({
      //       confirmLoading: false,
      //       visible: false
      //     })
      //   } else {
      //     notification.error({
      //       top: 92,
      //       message: res.message
      //     })
      //   }
      // })
    }, () => {})
  }
@@ -526,7 +584,8 @@
        <MutilForm
          dict={this.props.dict}
          action={execAction}
          data={this.state.tabledata}
          configMap={this.props.configMap}
          data={this.state.tabledata[0]}
          wrappedComponentRef={(inst) => this.formRef = inst}
        />
      </Modal>
src/tabviews/commontable/mutilform/index.jsx
@@ -2,6 +2,7 @@
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, InputNumber, Select, DatePicker } from 'antd'
import moment from 'moment'
import Utils from '@/utils/utils.js'
import './index.scss'
const {MonthPicker} = DatePicker
@@ -10,17 +11,20 @@
  static propTpyes = {
    action: PropTypes.object, // 搜索条件列表
    dict: PropTypes.object, // 字典项
    data: PropTypes.any // 表格数据
    data: PropTypes.any, // 表格数据
    configMap: PropTypes.object
  }
  state = {
    datatype: null,
    readtype: null,
    formlist: []
  }
  componentDidMount () {
    const { action } = this.props
    let datatype = {}
    let readtype = {}
    let formlist = []
    if (action.groups.length > 0) {
      action.groups.forEach(group => {
@@ -36,17 +40,36 @@
        group.sublist.forEach(item => {
          datatype[item.field] = item.type
          readtype[item.field] = item.readonly === 'true'
          formlist.push(item)
        })
      })
    } else {
      formlist = action.fields.map(item => {
        datatype[item.field] = item.type
        readtype[item.field] = item.readonly === 'true'
        if (item.type === 'select' || item.type === 'link') {
          if (item.setAll === 'true') {
            item.options.unshift({
              key: Utils.getuuid(),
              Value: '',
              Text: this.props.dict['main.all']
            })
          }
          if (item.resourceType === '1' && this.props.configMap.hasOwnProperty(item.uuid)) {
            item.options = [...item.options, ...this.props.configMap[item.uuid]]
          }
          console.log(item)
        }
        return item
      })
    }
    this.setState({
      readtype: readtype,
      datatype: datatype,
      formlist: formlist
    })
@@ -114,7 +137,7 @@
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'select') { // 下拉搜索
      } else if (item.type === 'select' || item.type === 'link') { // 下拉搜索
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
@@ -130,7 +153,7 @@
                <Select
                  showSearch
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  getPopupContainer={() => document.getElementById('form-box')}
                  // getPopupContainer={() => document.getElementById('form-box')}
                >
                  {item.options.map(option =>
                    <Select.Option id={option.key} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option>
@@ -226,39 +249,50 @@
        if (!err) {
          let search = []
          Object.keys(values).forEach(key => {
            if (this.state.style[key] === 'datetime') {
            if (this.state.datatype[key] === 'datetime') {
              let _value = ''
              if (values[key]) {
                _value = moment(values[key]).format('YYYY-MM-DD HH:mm:ss')
              }
              search.push({
                type: this.state.style[key],
                type: this.state.datatype[key],
                readonly: this.state.readtype[key],
                key: key,
                value: _value
              })
            } else if (this.state.style[key] === 'datemonth') {
            } else if (this.state.datatype[key] === 'datemonth') {
              let _value = ''
              if (values[key]) {
                _value = moment(values[key]).format('YYYY-MM')
              }
              search.push({
                type: this.state.style[key],
                type: this.state.datatype[key],
                readonly: this.state.readtype[key],
                key: key,
                value: _value
              })
            } else if (this.state.style[key] === 'date') {
            } else if (this.state.datatype[key] === 'date') {
              let _value = ''
              if (values[key]) {
                _value = moment(values[key]).format('YYYY-MM-DD')
              }
              search.push({
                type: this.state.style[key],
                type: this.state.datatype[key],
                readonly: this.state.readtype[key],
                key: key,
                value: _value
              })
            } else if (this.state.datatype[key] === 'number') {
              search.push({
                type: this.state.datatype[key],
                readonly: this.state.readtype[key],
                key: key,
                value: values[key]
              })
            } else {
              search.push({
                type: this.state.style[key],
                type: this.state.datatype[key],
                readonly: this.state.readtype[key],
                key: key,
                value: values[key].replace(/(^\s*|\s*$)/ig, '')
              })
src/templates/comtableconfig/actionform/index.jsx
@@ -210,6 +210,21 @@
      if (item.hidden) return
      if (item.type === 'text') { // 文本搜索
        let _rules = []
        if (item.key === 'innerFunc') {
          let str = '^(' + item.fields.join('|') + ')'
          let _patten = new RegExp(str + '[0-9a-zA-Z_]*', 'ig')
          _rules = [{
            pattern: _patten,
            message: '名称只允许包含数字、字母和下划线,且以指定字符开始。'
          }, {
            min: 6,
            message: '内部函数名称不小于6个字符。'
          }, {
            max: 100,
            message: '内部函数名称不超过100个字符。'
          }]
        }
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
@@ -224,7 +239,8 @@
                  {
                    required: item.readonly ? false : !!item.required,
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                  },
                  ..._rules
                ]
              })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)}
            </Form.Item>
@@ -317,13 +333,19 @@
            values.position = 'toolbar'
            values.Ot = 'notRequired'
          }
          console.log(values)
          if (values.innerFunc === '' && values.sql === '') {
            notification.warning({
              top: 92,
              message: this.props.dict['header.form.actionhelp.datasource'],
              duration: 10
            })
          } else if (values.innerFunc === '' && values.sql !== '' && values.sqlType === '') {
            notification.warning({
              top: 92,
              message: this.props.dict['header.form.actionhelp.sqlType'],
              duration: 10
            })
          } else {
            resolve({
              type: 'action',
src/templates/comtableconfig/index.jsx
@@ -1,5 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import { DndProvider } from 'react-dnd'
import HTML5Backend from 'react-dnd-html5-backend'
@@ -60,7 +61,8 @@
    selectedTables: [],      // 已选表名
    originMenu: null,        // 原始菜单
    originActions: null,
    delActions: []
    delActions: [],
    funcLoading: false
  }
  /**
@@ -471,6 +473,7 @@
  }
  handleAction = (card) => {
    let ableField = this.props.permFuncField.join(', ')
    this.setState({
      visible: true,
      formtemp: 'action',
@@ -557,9 +560,10 @@
          label: this.state.dict['header.form.innerFunc'],
          initVal: card.innerFunc,
          tooltip: <div>
            <p>内部接口: 可自定义数据处理函数,未设置时会调用系统函数,使用系统函数需完善数据源及操作类型;</p>
            <p>内部接口: 可自定义数据处理函数,函数名称需以{ableField}等字符开始;未设置时会调用系统函数,使用系统函数需完善数据源及操作类型;</p>
            <p>外部接口: 可自定义数据处理函数,提交数据经过内部函数处理后,传入外部接口,未设置时,数据会直接传入外部接口。</p>
          </div>,
          fields: this.props.permFuncField,
          tooltipClass: 'middle',
          required: false,
          readonly: false
@@ -686,10 +690,13 @@
          type: 'select',
          key: 'sqlType',
          label: this.state.dict['header.form.action.type'],
          initVal: card.sqlType || 'insert',
          initVal: card.sqlType || '',
          tooltip: this.state.dict['header.form.actionhelp.sqlType'],
          required: false,
          options: [{
            MenuID: '',
            text: this.state.dict['header.form.empty']
          }, {
            MenuID: 'insert',
            text: this.state.dict['header.form.action.insert']
          }, {
@@ -1039,15 +1046,21 @@
    }
  }
  /**
   * @description 创建按钮存储过程
   */
  creatFunc = () => {
    let _config = JSON.parse(JSON.stringify(this.state.config))
    this.formRef.handleConfirm().then(res => {
      let btn = res.values
      let LText = ''
      let DelText = ''
      let isExit = false
      let btn = res.values  // 按钮信息
      let newLText = ''     // 创建存储过程sql
      let DelText = ''      // 删除存储过程sql
      let isExit = false    // 存储过程是否存在
      let sysTVPText = ''   // 已有的存储过程语句(云端)
      let localTVPText = '' // 已有的存储过程语句(本地)
      // 创建存储过程,必须填写内部函数名
      if (!btn.innerFunc) {
        notification.warning({
          top: 92,
@@ -1057,8 +1070,14 @@
        return
      }
      // 创建中
      this.setState({
        funcLoading: true
      })
      new Promise(resolve => {
        // 内部请求
        // 弹窗(表单)类按钮,先获取按钮配置信息,如果尚未配置按钮则会报错并终止。
        // 获取信息后生成删除和创建存储过程的语句
        if (btn.OpenType === 'pop') {
          Api.getSystemConfig({
            func: 'sPC_Get_LongParam',
@@ -1090,7 +1109,7 @@
                fields: fields,
                menuNo: this.props.menu.MenuNo
              }
              LText = Utils.formatOptions(Utils.getfunc(_param))
              newLText = Utils.formatOptions(Utils.getfunc(_param))
              DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName))
              resolve(true)
            } else {
@@ -1109,44 +1128,101 @@
            fields: '',
            menuNo: this.props.menu.MenuNo
          }
          LText = Utils.formatOptions(Utils.getfunc(_param))
          newLText = Utils.formatOptions(Utils.getfunc(_param))
          DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName))
          resolve(true)
        }
      }).then(res => {
        // 获取云端及本地,是否已存在该存储过程的信息
        console.log(res)
        if (res === false) return res
        
        return Api.getSystemConfig({
          func: 'sPC_Get_TVP',
        let sysDefer = new Promise(resolve => {
          Api.getSystemConfig({
            func: 'sPC_Get_TVP', // 云端获取存储结果
          TVPName: btn.innerFunc
          }).then(result => {
            resolve(result)
        })
        })
        let localDefer = new Promise(resolve => {
          let _param = { // 获取本地存储过程信息
            func: 's_get_userproc',
            LText: btn.innerFunc
          }
          _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
          _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
          Api.getLocalConfig(_param).then(result => {
            resolve(result)
          })
        })
        return Promise.all([sysDefer, localDefer])
      }).then(res => {
        // 云端结果与新语句不同时,更新云端信息
        console.log(res)
        if (res === false) return res
        if (!res.status) {
        let isError = false
        res.forEach((result, index) => {
          if (!result.status) {
          notification.warning({
            top: 92,
            message: res.message,
              message: result.message,
            duration: 10
          })
          return false
        }
        if (res.TVPText && LText === res.TVPText) {
          return 'drop'
            isError = true
          } else if (index === 0) {
            sysTVPText = result.TVPText
        } else {
          if (res.TVPText) {
            console.log(result.Ltext)
            if (result.Ltext) { // 本地存储过程是否存在
            isExit = true
          }
            localTVPText = Utils.formatOptions(result.Ltext)
          }
        })
        if (isError) return false
        if ((newLText === localTVPText) && (newLText === sysTVPText)) {
          return 'drop'
        } else if (!localTVPText || (sysTVPText === localTVPText)) {
          // 本地存储过程不存在,或云端和本地存储过程一致时,将新的存储过程更新至云端
          return Api.getSystemConfig({
            func: 'sPC_TVP_InUp',
            TVPName: btn.innerFunc,
            TVPText: LText,
            TVPText: newLText,
            TypeName: 'P'
          })
        } else {
          return new Promise(resolve => {
            Api.getSystemConfig({ // 添加现有的本地存储过程至云端
              func: 'sPC_TVP_InUp',
              TVPName: btn.innerFunc,
              TVPText: localTVPText,
              TypeName: 'P'
            }).then(result => {
              if (result.status) {
                Api.getSystemConfig({
                  func: 'sPC_TVP_InUp', // 添加最新的存储过程至云端
                  TVPName: btn.innerFunc,
                  TVPText: newLText,
                  TypeName: 'P'
                }).then(response => {
                  resolve(response)
                })
              } else {
                resolve(result)
              }
            })
          })
        }
      }).then(res => {
        // 云端信息更新后,判断是删除或是直接新建存储过程
        console.log(res)
        if (res === false || res === 'drop') return res
@@ -1163,17 +1239,22 @@
          return 'create'
        }
      }).then(res => {
        // 删除存储过程
        console.log(res)
        if (res === false || res === 'create') return res
        let _param = {
          func: 'sPC_TableData_InUpDe',
          LText: DelText
          LText: DelText,
          TypeCharOne: 'proc' // 删除或创建存储过程
        }
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
        return Api.getSystemConfig(_param)
        return Api.getLocalConfig(_param)
      }).then(res => {
        // 根据上述操作结果,判断是否新建存储过程
        console.log(res)
        if (res === false || res === 'create') return res
@@ -1188,18 +1269,21 @@
          return 'create'
        }
      }).then(res => {
        // 新建存储过程
        console.log(res)
        if (res === false) return res
        let _param = {
          func: 'sPC_TableData_InUpDe',
          LText: LText
          LText: newLText,
          TypeCharOne: 'proc' // 删除或创建存储过程
        }
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
        return Api.getSystemConfig(_param)
        return Api.getLocalConfig(_param)
      }).then(res => {
        // 处理新建结果
        console.log(res)
        if (res === false) return res
@@ -1219,8 +1303,14 @@
          return true
        }
      }).then(res => {
        // 新建成功后,更新页面按钮信息
        console.log(res)
        if (res === false) return res
        if (res === false) {
          this.setState({
            funcLoading: false
          })
          return
        }
        let isupdate = false
        _config.action = _config.action.map(item => {
@@ -1263,7 +1353,8 @@
        this.setState({
          config: _config,
          actionloading: true
          actionloading: true,
          funcLoading: false
        }, () => {
          this.setState({
            actionloading: false
@@ -2177,7 +2268,7 @@
          onOk={this.handleSubmit}
          footer={[
            this.state.formtemp === 'action' ?
            <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.confirmLoading}>{this.state.dict['header.menu.func.create']}</Button> : null,
            <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button> : null,
            <Button key="cancel" onClick={() => { this.setState({ visible: false }) }}>{this.state.dict['header.cancel']}</Button>,
            <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button>
          ]}
@@ -2287,4 +2378,14 @@
  }
}
export default ComTableConfig
const mapStateToProps = (state) => {
  return {
    permFuncField: state.permFuncField
  }
}
const mapDispatchToProps = () => {
  return {}
}
export default connect(mapStateToProps, mapDispatchToProps)(ComTableConfig)
src/templates/modalconfig/index.jsx
@@ -75,6 +75,11 @@
      _config.setting.title = editAction.label
    }
    if (menu.LongParam.tables && menu.LongParam.tables.length > 0 && _config.tables.length === 0) {
      // 主菜单已有选择的表名,模态框没有表名时,复制主菜单表名
      _config.tables = menu.LongParam.tables
    }
    this.setState({
      config: _config,
      selectedTables: _config.tables || [],
@@ -483,10 +488,14 @@
      let _config = JSON.parse(JSON.stringify(this.state.config))
      if ((res.type === 'select' || res.type === 'link') && res.resourceType === '1') {
        let sql = 'select ' + res.valueField + ',' + res.valueText + ' from (' + res.dataSource + ')'
        if (res.orderBy) {
          sql = sql + ' ld order by ' + res.orderBy + ' ' + res.orderType
        let sql = 'select ' + res.valueField + ',' + res.valueText + ' from ' + res.dataSource
        if (res.type === 'link') {
          sql = 'select ' + res.valueField + ',' + res.valueText + ',' + res.linkField + ' from ' + res.dataSource
        }
        if (res.orderBy) {
          sql = sql + ' order by ' + res.orderBy + ' ' + res.orderType
        }
        console.log(sql)
        res.dataSourceSql = Utils.formatOptions(sql)
      }
src/utils/utils.js
@@ -25,13 +25,14 @@
   */
  static getguid () {
    // 产生一个新的GUID值
    let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
      let r = Math.random() * 16 | 0
      // eslint-disable-next-line
      let v = (c === 'x') ? r : (r & 0x3 | 0x8)
      return v.toString(16)
    })
    return uuid
    let uuid = []
    let d = new Date()
    let options = '0123456789abcdefghigklmnopqrstuv'
    for (let i = 0; i < 19; i++) {
      uuid.push(options.substr(Math.floor(Math.random() * 0x20), 1))
    }
    uuid = moment().format('YYYYMMDDHHmmss') + d.getMilliseconds() + uuid.join('')
    return uuid.toUpperCase()
  }
  /**
@@ -317,6 +318,59 @@
  }
  /**
   * @description 使用系统函数时(sPC_TableData_InUpDe ),生成sql语句
   * @return {String} type   执行类型
   * @return {String} table  表名
   */
  static getSysDefaultSql (btn, setting, formdata) {
    console.log(btn)
    console.log(formdata)
    let _sql = ''
    if (btn.OpenType === 'pop' && btn.sqlType === 'insert') {
      let keys = []
      let values = []
      formdata.forEach(item => {
        if (!item.readonly && item.type === 'number') {
          keys.push(item.key)
          values.push(item.value)
        } else if (!item.readonly) {
          keys.push(item.key)
          values.push('\'' + item.value + '\'')
        }
      })
      keys = keys.join(',')
      values = values.join(',')
      _sql = `insert into ${btn.sql} (${keys}, createuserid) select ${values},@userid`
    } else if (btn.OpenType === 'pop' && btn.sqlType === 'update') {
      let _form = []
      formdata.forEach(item => {
        if (!item.readonly && item.type === 'number') {
          _form.push(item.key + '=' + item.value)
        } else if (!item.readonly) {
          _form.push(item.key + '=\'' + item.value + '\'')
        }
      })
      _form = _form.join(',')
      _sql = `update ${btn.sql} set ${_form},modifydate=getdate(),modifyuserid=@userid where ${setting.primaryKey}=@id`
    } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'LogicDelete') { // 逻辑删除
      _sql = `update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid where ${setting.primaryKey}=@id`
    } else if ((btn.OpenType === 'prompt' || btn.OpenType === 'exec') && btn.sqlType === 'delete') {
      _sql = `insert into snote (remark,createuserid) select '删除表:${btn.sql} 数据: id='+@id,@userid delete ${btn.sql} where ${setting.primaryKey}=@id`
    }
    //insert into 表名 (表单字段,逗号分隔,如果主键为可编辑则传填写内容,只读或没有配置表单,则传前端生成id,+createuserid)
    // +select 表单字段值+@userid
    // 修改:update 表名 set 表单非只读字段=表单值,modifydate=getdate(),modifyuserid=@userid where 主键=@id行id
    // 逻辑删除:update 表名 set deleted=1,modifydate=getdate(),modifyuserid=@userid where 主键=@id行id
    // 物理删除:insert into snote (remark,createuserid) select '删除表 '+表名+'数据 '+id=@id delete 表名 where  主键=@id行id
    console.log(_sql)
    return _sql
  }
  /**
   * @description 删除存储过程sql
   * @return {String} name 存储过程名称
   */
@@ -338,7 +392,7 @@
        if (item.field) {
          let type = ''
          if (item.type.match(/date/ig)) {
            type = 'datetime is null'
            type = 'datetime=null'
          } else if (item.type === 'number') {
            type = `decimal(18,${item.decimal})=0`
          } else {
@@ -436,8 +490,8 @@
      ROLLBACK TRAN
      
    END`
    console.log(Ltext)
    Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k')
    console.log(Ltext)
    return Ltext
  }
}