king
2019-10-16 910e22f4bccbe5e5d8951398bd53a7d6d636b852
complete-datamanage
9个文件已修改
2个文件已添加
278 ■■■■ 已修改文件
public/index.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/options.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/main.scss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/img/loginbg.jpg 补丁 | 查看 | 原始文档 | blame | 历史
src/components/sidemenu/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/datamanage/index.jsx 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/datamanage/index.scss 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/datamanage/modules/action/index.jsx 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/tabform/index.jsx 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/index.scss 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/index.html
@@ -8,6 +8,7 @@
    <meta name="description" content="minkesoft" />
    <link rel="apple-touch-icon" href="logo.png" />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <script src="./options.js"></script>
    <title>MinkeSoft</title>
  </head>
  <body>
public/options.js
New file
@@ -0,0 +1,3 @@
window.GLOB = {
  service: 'mkwms'
}
src/api/index.js
@@ -30,7 +30,7 @@
class Api {
  constructor() {
    if (process.env.NODE_ENV === 'production') {
      axios.defaults.baseURL = document.location.origin
      axios.defaults.baseURL = document.location.origin + (window.GLOB.service ? '/' + window.GLOB.service : '')
    } else {
      // axios.defaults.baseURL = 'http://127.0.0.1:8888'
    }
src/assets/css/main.scss
@@ -121,6 +121,6 @@
}
// 确认提示框高度
.ant-modal {
  top: 38vh!important;
.ant-modal.ant-modal-confirm {
  top: 38vh;
}
src/assets/img/loginbg.jpg
src/components/sidemenu/index.jsx
@@ -48,10 +48,10 @@
              child.src = '#/main/' + _msg
              if (child.LinkUrl === 'CommonTable') {
                child.type = 'CommonTable'
              } else if (child.LinkUrl === 'DataManage' || child.LinkUrl === 'Main/Index?MenuNo=sProcExcepM') {
              } else if (child.LinkUrl === 'DataManage') {
                child.type = 'DataManage'
              } else if (child.LinkUrl === 'bda/rdt?pageno=rolemenus&MenuNo=RoleMenuM') {
                child.type = 'RoleManage'
              // } else if (child.LinkUrl === 'bda/rdt?pageno=rolemenus&MenuNo=RoleMenuM') {
              //   child.type = 'RoleManage'
              } else if (child.LinkUrl.split('?')[0] === 'Main/Index' || child.LinkUrl.split('?')[0] === 'bda/rdt') {
                child.type = 'iframe'
              }
src/tabviews/datamanage/index.jsx
@@ -2,7 +2,8 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import {connect} from 'react-redux'
import { BackTop, notification } from 'antd'
import { BackTop, notification, Button } from 'antd'
import MutilForm from '@/components/mutilform'
import {refreshTabView} from '@/store/action'
import Api from '@/api'
import DataSearch from './modules/search'
@@ -28,12 +29,16 @@
    mainKey: null, // 主键
    selectable: false, // 表格是否可选
    datafunc: null, // 获取数据及显示列的存储过程名称
    data: null,
    total: 0,
    loading: true
    data: null, // 列表数据
    total: 0, // 总数
    loading: true, // 表格加载中
    confirmloading: false, // 表单提交确认中
    formparam: null, // 表单参数
    showdetail: false // 是否显示详情或表单页面
  }
  async loadconfig () {
    // 加载搜索条件及按钮信息
    let param = {
      func: 's_Get_Page_wheproc',
      MenuNo: this.props.MenuNo
@@ -67,6 +72,7 @@
  }
  async loadDbdata (searches, pageIndex = 1, pageSize = 10, orderColumn = '', orderType = '') {
    // 加载显示列及表格数据
    let param = {
      func: this.state.datafunc,
      MenuNo: this.props.MenuNo,
@@ -159,7 +165,7 @@
  }
  gettableselected = () => {
    // 获取表格选择项
    // 获取表格已选择项
    let data = []
    this.refs.dataTable.state.selectedRowKeys.forEach(item => {
      data.push(this.refs.dataTable.props.data[item])
@@ -168,7 +174,87 @@
  }
  switchview = (param) => {
    console.log(param)
    // 切换至详情或表单页面
    let cols = param.execAction.FormLineQty
    if (![1, 2, 3].includes(cols)) {
      cols = 2
    }
    param.cols = cols
    this.setState({
      formparam: param,
      showdetail: true
    })
  }
  handleOk = () => {
    // 表单提交
    let _param = this.state.formparam
    // 从表单中获取填写数据
    this.formRef.handleConfirm().then(res => {
      this.setState({
        confirmloading: true
      })
      let values = []
      _param.formdata.forEach(column => { // 依次选取表单值、初始值,获取提交信息
        let value = ''
        if (res.hasOwnProperty(column.FieldName)) {
          value = res[column.FieldName]
        } else if (column.InitVal) {
          value = column.InitVal
        }
        values.push(column.FieldName + 'equal\'' + value + '\'')
      })
      let queryparam = { // 请求参数
        func: _param.execAction.AuditProc || _param.defaultproc[_param.execAction.Action],
        ID: (_param.tabledata && _param.primarykey) ? _param.tabledata[_param.primarykey] : '', // 主键字段
        BID: (_param.tabledata && _param.bidkey) ? _param.tabledata[_param.bidkey] : '' // BID字段
      }
      // 添加和修改请求参数字段不同
      if (_param.execAction.Action === 'Add') {
        queryparam.AddLongText = values.join(',')
      } else if (_param.execAction.Action === 'Update') {
        queryparam.UptLongText = values.join(',')
      }
      // 提交请求
      Api.submitInterface(queryparam).then(result => {
        if (result.status) {
          notification.success({
            top: 92,
            message: this.state.dict['main.action.confirm.success']
          })
          this.refreshbyaction(_param.execAction.ReloadForm) // 刷新主列表页面
          if (_param.execAction.BackPre !== 'false') { // 页面返回
            this.handleCancel()
          }
        } else {
          // 错误提示,取消提交中状态
          notification.error({
            top: 92,
            message: result.message,
            duration: 15
          })
          this.setState({
            confirmloading: false
          })
        }
      })
    }, () => {})
  }
  handleCancel = () => {
    // 关闭当前窗口,返回原列表页
    this.setState({
      confirmloading: false,
      formparam: null,
      showdetail: false
    })
    // 提交成功或返回时,滚动至顶部
    document.body.scrollTop = 0
    document.documentElement.scrollTop = 0
  }
  UNSAFE_componentWillMount () {
@@ -194,6 +280,8 @@
    return (
      <div className="datamanage">
        {!this.state.searchlist && <Loading />}
        <div className={this.state.showdetail ? 'hidden-table' : ''}>
          {/* 搜索条件 */}
        {this.state.searchlist &&
          <DataSearch
            refreshdata={this.refreshbysearch}
@@ -201,18 +289,20 @@
            dict={this.state.dict}
          />
        }
          {/* 按钮组 */}
        {this.state.actions && this.state.columns &&
          <DataAction
            MenuNo={this.props.MenuNo}
            columns={this.state.columns}
            mainKey={this.state.mainKey}
            refreshdata={this.refreshbyaction}
            switchview={this.switchview}
              switchformview={this.switchview}
            gettableselected={this.gettableselected}
            actions={this.state.actions}
            dict={this.state.dict}
          />
        }
          {/* 表格 */}
        {this.state.columns &&
          <DataTable
            ref="dataTable"
@@ -226,6 +316,28 @@
            dict={this.state.dict}
          />
        }
        </div>
        {/* 详情或修改表单 */}
        {this.state.showdetail && (
          <div className="tabform">
            <MutilForm
              dict={this.state.dict}
              formlist={this.state.formparam.formdata}
              data={this.state.formparam.tabledata}
              cols={this.state.formparam.cols}
              wrappedComponentRef={(inst) => this.formRef = inst}
            />
            <div className="operation">
              <Button type="primary" htmlType="submit" onClick={() => {this.handleOk()}} loading={this.state.confirmloading}>
                {this.state.dict['main.confirm']}
              </Button>
              <Button onClick={() => {this.handleCancel()}}>
                {this.state.dict['main.return']}
              </Button>
            </div>
          </div>)
        }
        {/* 返回顶部 */}
        <BackTop>
          <div className="ant-back-top">
            <div className="ant-back-top-content">
src/tabviews/datamanage/index.scss
@@ -1,6 +1,26 @@
.datamanage {
  min-height: calc(100vh - 94px);
  padding-top: 16px;
  .hidden-table {
    position: absolute;
    z-index: -1;
    opacity: 0;
  }
  .tabform {
    padding: 25px 25px 120px;
    .operation {
      text-align: center;
      margin: 20px 0;
      .ant-btn {
        height: 40px;
        padding: 0 30px;
        font-size: 16px;
      }
      .ant-btn-primary {
        margin-right: 40px;
      }
    }
  }
}
.ant-back-top {
  bottom: 30px;
src/tabviews/datamanage/modules/action/index.jsx
@@ -157,9 +157,8 @@
                    top: 92,
                    message: _this.props.dict['main.action.confirm.success']
                  })
                  if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
                    _this.props.refreshdata(item.ReloadForm)
                  }
                  _this.props.refreshdata(item.ReloadForm) // 刷新页面
                }
              } else {
                if (res.status) {
@@ -167,9 +166,8 @@
                    top: 92,
                    message: _this.props.dict['main.action.confirm.success']
                  })
                  if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
                    _this.props.refreshdata(item.ReloadForm)
                  }
                  _this.props.refreshdata(item.ReloadForm) // 刷新页面
                } else {
                  notification.error({
                    top: 92,
@@ -202,9 +200,8 @@
                top: 92,
                message: this.props.dict['main.action.confirm.success']
              })
              if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
                this.props.refreshdata(item.ReloadForm)
              }
              this.props.refreshdata(item.ReloadForm) // 刷新页面
            }
          } else {
            if (res.status) {
@@ -212,9 +209,8 @@
                top: 92,
                message: this.props.dict['main.action.confirm.success']
              })
              if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
                this.props.refreshdata(item.ReloadForm)
              }
              this.props.refreshdata(item.ReloadForm) // 刷新页面
            } else {
              notification.error({
                top: 92,
@@ -227,7 +223,7 @@
    } else if (item.OpenType === 'newpage') { // 打开新页面
      let src = '#/' + item.LinkUrl + '?param=' + window.btoa(JSON.stringify({UserId: sessionStorage.getItem('UserID'), ID: datalist[0][ID[0]], BID: BID.length === 1 ? datalist[0][BID[0]] : ''}))
      window.open(src)
    } else if (item.OpenType === 'pop') {
    } else if (item.OpenType === 'pop') { // 模态框
      this.setState({
        formdata: this.props.columns.map(column => {
          column.readonly = false
@@ -242,7 +238,7 @@
        bidkey: BID.length === 1 ? BID[0] : '',
        tabledata: datalist[0] || ''
      })
    } else if (item.OpenType === 'tab') {
    } else if (item.OpenType === 'tab') { // 打开新标签页
      let menu = {
        MenuNo: this.props.MenuNo,
        MenuID: item.MenuID,
@@ -284,8 +280,21 @@
        tabs.splice(_index + 1, 0, menu)
      }
      this.props.modifyTabview(tabs)
    } else if (item.OpenType === 'blank') {
      this.props.switchview(item)
    } else if (item.OpenType === 'blank') { // 当前页面跳转
      this.props.switchformview({
        formdata: this.props.columns.map(column => {
          column.readonly = false
          if (column.ReadOnly.includes(item.MenuID)) {
            column.readonly = true
          }
          return column
        }),
        execAction: item,
        primarykey: ID[0],
        bidkey: BID.length === 1 ? BID[0] : '',
        tabledata: datalist[0] || '',
        defaultproc: this.state.defaultproc
      })
    } else {
      notification.warning({
        top: 92,
@@ -295,19 +304,8 @@
    }
  }
  changemenu(e) {
    let menu = {}
    let tabs = JSON.parse(JSON.stringify(this.props.tabviews))
    tabs = tabs.filter(tab => {
      tab.selected = false
      return tab.MenuID !== menu.MenuID
    })
    menu.selected = true
    tabs.push(menu)
    this.props.modifyTabview(tabs)
  }
  getModels = () => {
    // 获取弹窗表单信息
    if (!this.state.execAction) return
    let cols = +this.state.execAction.FormLineQty
    if (![1, 2, 3].includes(cols)) {
@@ -341,23 +339,31 @@
        confirmLoading: true
      })
      let values = []
      // 从表单中获取填写数据
      this.props.columns.forEach(column => {
        let value = ''
        if (res[column.FieldName] || res[column.FieldName] === 0) { // 依次选取表单值、表格数据值、初始值
        if (res.hasOwnProperty(column.FieldName)) { // 依次选取表单值、初始值
          value = res[column.FieldName]
        } else if (this.state.tabledata && this.state.tabledata[column.FieldName]) {
          value = this.state.tabledata[column.FieldName]
        } else if (column.InitVal) {
          value = column.InitVal
        }
        values.push(value)
      })
      Api.submitInterface({
      let queryparam = { // 请求参数
        func: this.state.execAction.AuditProc || this.state.defaultproc[this.state.execAction.Action],
        AddLongText: values.join(','), // 表单数据
        ID: (this.state.tabledata && this.state.primarykey) ? this.state.tabledata[this.state.primarykey] : '', // 主键字段
        BID: (this.state.tabledata && this.state.bidkey) ? this.state.tabledata[this.state.bidkey] : '' // BID字段
      }).then(result => {
      }
      // 添加和修改请求参数字段不同
      if (this.state.execAction.Action === 'Add') {
        queryparam.AddLongText = values.join(',')
      } else if (this.state.execAction.Action === 'Update') {
        queryparam.UptLongText = values.join(',')
      }
      // 提交请求
      Api.submitInterface(queryparam).then(result => {
        if (result.status) {
          notification.success({
            top: 92,
@@ -367,9 +373,8 @@
            confirmLoading: false,
            visible: false
          })
          if (this.state.execAction.ReloadForm && this.state.execAction.ReloadForm !== 'false' && this.state.execAction.ReloadForm !== 'singlegrid') {
            this.props.refreshdata(this.state.execAction.ReloadForm)
          }
          this.props.refreshdata(this.state.execAction.ReloadForm) // 刷新页面
        } else {
          this.setState({
            confirmLoading: false
@@ -385,15 +390,12 @@
  }
  handleCancel = () => {
    // 取消
    this.setState({
      confirmLoading: false,
      visible: false
    })
    this.formRef.handleReset()
  }
  UNSAFE_componentWillMount () {
  }
  render() {
src/tabviews/tabform/index.jsx
@@ -20,28 +20,35 @@
  }
  handleOk = () => {
    this.formRef.handleConfirm().then(res => {
    this.setState({
      loading: true
    })
    this.formRef.handleConfirm().then(res => {
      let values = []
      this.props.param.formdata.forEach(column => {
        let value = ''
        if (res[column.FieldName] || res[column.FieldName] === 0) { // 依次选取表单值、表格数据值、初始值
        if (res.hasOwnProperty(column.FieldName)) { // 依次选取表单值、初始值
          value = res[column.FieldName]
        } else if (this.state.tabledata && this.state.tabledata[column.FieldName]) {
          value = this.state.tabledata[column.FieldName]
        } else if (column.InitVal) {
          value = column.InitVal
        }
        values.push(column.FieldName + 'equal\'' + value + '\'')
      })
      Api.submitInterface({
      let queryparam = { // 请求参数
        func: this.props.param.execAction.AuditProc || this.props.param.defaultproc[this.props.param.execAction.Action],
        UptLongText: values.join(','), // 表单数据
        ID: (this.props.param.tabledata && this.props.param.primarykey) ? this.props.param.tabledata[this.props.param.primarykey] : '', // 主键字段
        BID: (this.props.param.tabledata && this.props.param.bidkey) ? this.props.param.tabledata[this.props.param.bidkey] : '' // BID字段
      }).then(result => {
      }
      // 添加和修改请求参数字段不同
      if (this.props.param.execAction.Action === 'Add') {
        queryparam.AddLongText = values.join(',')
      } else if (this.props.param.execAction.Action === 'Update') {
        queryparam.UptLongText = values.join(',')
      }
      Api.submitInterface(queryparam).then(result => {
        if (result.status) {
          notification.success({
            top: 92,
@@ -49,24 +56,24 @@
          })
          
          // 刷新主列表页面
          if (this.props.param.execAction.ReloadForm && this.props.param.execAction.ReloadForm !== 'false' && this.props.param.execAction.ReloadForm !== 'singlegrid') {
            this.props.refreshTabView({
              MenuNo: this.props.MenuNo,
              ReloadForm: this.props.param.execAction.ReloadForm
            })
          }
          if (this.props.param.execAction.BackPre !== 'false') { // 页面返回
          this.handleCancel()
          }
        } else {
          notification.error({
            top: 92,
            message: result.message,
            duration: 15
          })
        }
        this.setState({
          loading: false
        })
        }
      })
    }, () => {})
  }
@@ -83,6 +90,9 @@
      return tab.MenuID !== this.props.MenuID
    })
    this.props.modifyTabview(tabs)
    // 提交成功或返回时,滚动至顶部
    document.body.scrollTop = 0
    document.documentElement.scrollTop = 0
  }
  shouldComponentUpdate (nextProps, nextState) {
src/views/login/index.scss
@@ -13,7 +13,7 @@
  .login-middle {
    height: calc(100vh - 194px);
    min-height: 420px;
    background: url('../../assets/img/loginbg.png');
    background: url('../../assets/img/loginbg.jpg');
    background-size: cover;
    background-position: center center;
    border-bottom: 2px solid #06b4f7;