1、全局加载名称调整为MDC智慧车间
2、消息确认页面调整设备异常反馈功能
已添加1个文件
已修改3个文件
484 ■■■■ 文件已修改
public/index.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/MdcMessageconfirmationList.vue 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/MdcMessageApproval/MdcMessageApprovalModal.vue 101 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/MdcMessageApproval/SelectDeviceDrawer-SingleSelection.vue 240 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/index.html
@@ -251,7 +251,7 @@
    <div id="loader"></div>
    <div class="loader-section section-left"></div>
    <div class="loader-section section-right"></div>
    <div class="load_title">正在加载统计分析,请耐心等待
    <div class="load_title">正在加载MDC智慧车间,请耐心等待
    </div>
  </div>
src/views/mdc/base/MdcMessageconfirmationList.vue
@@ -5,30 +5,46 @@
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :span="6">
          <a-col :span="4">
            <a-form-item label="设备编号">
              <a-input placeholder="请输入设备编号" v-model="queryParam.equipmentId"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="6">
          <a-col :span="4">
            <a-form-item label="消息状态">
              <a-select v-model='queryParam.msgStatus' placeholder="请选择消息状态">
                <a-select-option v-for="item in msgStatusOptionList" :key="item.value" :value="item.value">
                  {{item.title}}
                </a-select-option>
              <j-dict-select-tag dictCode="mdcMsgStatus" v-model='queryParam.msgStatus' placeholder="请选择消息状态"/>
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="异常类型">
              <j-dict-select-tag dictCode="mdcMsgType" v-model='queryParam.msgType' placeholder="请选择异常类型"/>
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <a-form-item label="消息来源">
              <a-select v-model="queryParam.msgSource" placeholder="请选择消息来源">
                <a-select-option key="手动上报">手动上报</a-select-option>
                <a-select-option key="系统生成">系统生成</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
          <a-col :span="6">
            <a-space>
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
              <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
            </a-space>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸÂ· -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
    </div>
    <a-table
@@ -42,11 +58,10 @@
      :loading="loading"
      @change="handleTableChange">
      <span slot="action" slot-scope="text, record">
        <a @click="showModal(record,0)">查看</a>
        <a @click="showModal(record,1)">查看</a>
        <a-divider type="vertical" v-if="record.hasProcess||record.hasConfirm"></a-divider>
        <a @click="showModal(record,1)" v-if="record.hasProcess">上报</a>
        <a-divider type="vertical" v-if="record.hasConfirm&&record.hasProcess"></a-divider>
        <a @click="showModal(record,2)" v-if="record.hasConfirm">确认</a>
        <a @click="showModal(record,2)" v-if="record.hasProcess">上报</a>
        <a @click="showModal(record,3)" v-if="record.hasConfirm">确认</a>
        <!--<a @click="showModal(record,0)">查看</a>-->
        <!--<a-divider type="vertical"></a-divider>-->
        <!--<a @click="showModal(record,1)">上报</a>-->
@@ -54,7 +69,8 @@
        <!--<a @click="showModal(record,2)">确认</a>-->
      </span>
    </a-table>
    <mdc-message-approval-modal ref="modalRef" :title="modalTitle" :visible="modalVisible" :buttonId="buttonId"
    <mdc-message-approval-modal ref="modalForm" :title="modalTitle" :visible="modalVisible" :buttonId="buttonId"
                                :disableSubmit="disableSubmit"
                                @closeModal="modalVisible = false" @formHasSubmitted="loadData"/>
  </a-card>
</template>
@@ -75,53 +91,63 @@
        queryParam: {},
        columns: [
          {
            title: '消息来源',
            align: 'center',
            dataIndex: 'msgSource',
            width: 150
          },
          {
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentId'
            dataIndex: 'equipmentId',
            width: 150
          },
          {
            title: '异常类型',
            align: 'center',
            dataIndex: 'msgType',
            width: 150
          },
          {
            title: '标题',
            align: 'center',
            dataIndex: 'titile'
          }, {
          },
          {
            title: '内容',
            align: 'center',
            dataIndex: 'msgContent',
            width: 450
          }, {
            dataIndex: 'msgContent'
          },
          {
            title: '原因',
            align: 'center',
            dataIndex: 'reportContent',
            width: 450
          }, {
            title: '处理人',
            dataIndex: 'reportContent'
          },
          {
            title: '反馈人',
            align: 'center',
            dataIndex: 'senderNames'
          }, {
            dataIndex: 'senderNames',
            width: 120
          },
          {
            title: '确认人',
            align: 'center',
            dataIndex: 'approverNames'
          }, {
            dataIndex: 'approverNames',
            width: 120
          },
          {
            title: '状态',
            align: 'center',
            dataIndex: 'msgStatus',
            customRender: function(text) {
              if (text == '0') {
                return '待处理'
              } else if (text == '1') {
                return '待确认'
              } else if (text == '2') {
                return '已确认'
              } else {
                return '已拒绝'
              }
            }
          }, {
            dataIndex: 'msgStatus_dictText',
            width: 120,
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          }],
          }
        ],
        url: {
          list: '/mdc/mdcMessageApproval/list'
        },
@@ -129,25 +155,17 @@
        msgStatusOptionList: [],
        modalTitle: '',
        modalVisible: false,
        disableSubmit: false,
        buttonId: null
      }
    },
    created() {
      this.initDictData('mdcMsgStatus')
    },
    methods: {
      /**
       * è°ƒç”¨æŽ¥å£èŽ·å–æ•°æ®å­—å…¸é…ç½®msgStatus
       * @param dictCode æ•°æ®å­—典编号
       */
      initDictData(dictCode) {
        //根据字典Code, åˆå§‹åŒ–字典数组
        ajaxGetDictItems(dictCode, null).then((res) => {
          if (res.success) {
            console.log('res================', res)
            this.msgStatusOptionList = res.result
          }
        })
      handleAdd() {
        this.modalTitle = '新增'
        this.buttonId = null
        this.disableSubmit = false
        this.$refs.modalForm.formParams = {}
        this.modalVisible = true
      },
      /**
@@ -157,20 +175,21 @@
       */
      showModal(record, buttonId) {
        this.buttonId = buttonId
        this.disableSubmit = true
        switch (buttonId) {
          case 0:
          case 1:
            this.modalTitle = '消息内容'
            break
          case 1:
          case 2:
            this.modalTitle = '上报原因'
            break
          case 2:
          case 3:
            this.modalTitle = '确认消息'
            break
          default:
            this.modalTitle = '消息内容'
        }
        this.$refs.modalRef.formParams = Object.assign({}, record)
        this.$refs.modalForm.formParams = Object.assign({}, record)
        this.modalVisible = true
      }
    }
src/views/mdc/base/modules/MdcMessageApproval/MdcMessageApprovalModal.vue
@@ -4,28 +4,32 @@
           @cancel="closeModal"
           :visible="visible"
           :footer="null">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :form="form" :model="formParams" :rules="validatorRules">
        <a-form-model-item label="设备编号" :labelCol="{span: 4}" :wrapperCol="{span: 8}">
          <a-input v-model="formParams.equipmentId" disabled></a-input>
    <a-spin :spinning="spinning">
      <a-form-model ref="form" :form="form" :model="formParams" :rules="validatorRules" :labelCol="{span: 4}"
                    :wrapperCol="{span: 20}">
        <a-form-model-item label="设备编号" :labelCol="{span: 4}" :wrapperCol="{span: 10}" prop="equipmentId">
          <a-input-search :readOnly="true" :disabled="disableSubmit" v-model="formParams.equipmentId"
                          @search="deviceSearch" enter-button
                          placeholder="请选择设备"/>
        </a-form-model-item>
        <a-form-model-item label="标题" :labelCol="{span: 4}" :wrapperCol="{span: 20}">
          <a-input v-model="formParams.titile" disabled></a-input>
        <a-form-model-item label="异常类型" :labelCol="{span: 4}" :wrapperCol="{span: 10}"
                           :prop="!buttonId?'msgType':''">
          <j-dict-select-tag dictCode="mdcMsgType" v-model='formParams.msgType' placeholder="请选择异常类型"
                             :disabled="disableSubmit&&buttonId!==2"/>
        </a-form-model-item>
        <a-form-model-item label="内容" :labelCol="{span: 4}" :wrapperCol="{span: 20}">
          <a-input v-model="formParams.msgContent" disabled></a-input>
        <a-form-model-item label="标题">
          <a-input placeholder="请输入标题" v-model="formParams.titile" :disabled="disableSubmit"/>
        </a-form-model-item>
        <a-form-model-item label="内容">
          <a-input placeholder="请输入内容" v-model="formParams.msgContent" :disabled="disableSubmit"/>
        </a-form-model-item>
        <a-form-model-item label="原因" :labelCol="{span: 4}" :wrapperCol="{span: 20}" prop="reportContent"
                           v-if="buttonId===1">
          <a-textarea v-model="formParams.reportContent" :disabled="buttonId!==1"></a-textarea>
        </a-form-model-item>
        <a-form-model-item label="原因" :labelCol="{span: 4}" :wrapperCol="{span: 20}" v-else>
          <a-textarea v-model="formParams.reportContent" :disabled="buttonId!==1"></a-textarea>
        <a-form-model-item label="原因" prop="reportContent" v-if="buttonId">
          <a-textarea v-model="formParams.reportContent" :disabled="buttonId!==2"/>
        </a-form-model-item>
        <a-form-model-item label="确认" :labelCol="{span: 4}" :wrapperCol="{span: 12}" prop="isConfirm"
                           v-if="buttonId==2">
                           v-if="buttonId==3">
          <a-select v-model='formParams.isConfirm' placeholder="请选择是否确认">
            <a-select-option value="2">确认</a-select-option>
            <a-select-option value="3">拒绝</a-select-option>
@@ -34,20 +38,26 @@
      </a-form-model>
    </a-spin>
    <div class="drawer-bottom-button" v-show="buttonId!==0">
      <a-popconfirm title="确定放弃操作?" @confirm="closeModal" okText="确定" cancelText="取消">
        <a-button style="margin-right: .8rem">取消</a-button>
      </a-popconfirm>
      <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">提交</a-button>
    <div class="drawer-bottom-button" v-show="buttonId!==1">
      <a-space>
        <a-popconfirm title="确定放弃操作?" @confirm="closeModal" okText="确定" cancelText="取消">
          <a-button>取消</a-button>
        </a-popconfirm>
        <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">提交</a-button>
      </a-space>
    </div>
    <SelectDeviceDrawerSingleSelection ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'选择设备'"/>
  </a-modal>
</template>
<script>
  import { postAction } from '@/api/manage'
  import SelectDeviceDrawerSingleSelection from './SelectDeviceDrawer-SingleSelection'
  export default {
    name: 'MdcMessageApprovalModal',
    components: { SelectDeviceDrawerSingleSelection },
    props: {
      visible: {
        type: Boolean
@@ -57,11 +67,16 @@
      },
      buttonId: {
        type: Number
      },
      disableSubmit: {
        type: Boolean
      }
    },
    data() {
      return {
        form: this.$form.createForm(this),
        treeData: [],
        treeDefaultExpandedKeys: [],
        formParams: {
          equipmentId: '',
          titile: '',
@@ -71,7 +86,14 @@
          isConfirm: ''
        },
        confirmLoading: false,
        spinning: false,
        validatorRules: {
          equipmentId: [
            { required: true, message: '请选择设备', trigger: 'change' }
          ],
          msgType: [
            { required: true, message: '请选择异常类型' }
          ],
          reportContent: [
            { required: true, message: '请输入上报原因' }
          ],
@@ -80,29 +102,45 @@
          ]
        },
        url: {
          add: '/mdc/mdcMessageApproval/add',
          reportUrl: '/mdc/mdcMessageApproval/reportReason',
          confirmUrl: '/mdc/mdcMessageApproval/handleConfirm'
        }
      }
    },
    methods: {
      closeModal() {
        this.$refs.form.clearValidate()
        this.$emit('closeModal')
      deviceSearch() {
        this.$refs.selectDeviceDrawer.visible = true
        this.$refs.selectDeviceDrawer.checkedKeys = this.formParams.equipmentId ? [this.formParams.equipmentId] : []
        this.$refs.selectDeviceDrawer.selectedKeys = this.formParams.equipmentId ? [this.formParams.equipmentId] : []
      },
      /**
       * é€‰æ‹©å·²æœ‰è®¾å¤‡åŽç‚¹å‡»ç¡®å®šæ—¶è§¦å‘
       * @param data å·²é€‰æ‹©çš„设备
       */
      selectOK(data) {
        this.$set(this.formParams, 'equipmentId', data[0])
      },
      handleSubmit() {
        const that = this
        // è§¦å‘表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true
            that.confirmLoading = that.spinning = true
            this.formParams.msgStatus = this.formParams.isConfirm
            let obj
            if (this.buttonId === 1) {
              obj = postAction(this.url.reportUrl, this.formParams)
            if (!this.buttonId) {
              obj = postAction(this.url.add, this.formParams)
            } else {
              obj = postAction(this.url.confirmUrl, this.formParams)
              if (this.buttonId === 2) {
                obj = postAction(this.url.reportUrl, this.formParams)
              } else {
                obj = postAction(this.url.confirmUrl, this.formParams)
              }
            }
            obj.then((res) => {
              if (res.success) {
                that.$notification.success({
@@ -110,6 +148,7 @@
                  description: res.message
                })
                that.$emit('formHasSubmitted')
                that.closeModal()
              } else {
                that.$notification.warning({
                  message: '消息',
@@ -117,13 +156,17 @@
                })
              }
            }).finally(() => {
              that.confirmLoading = false
              that.closeModal()
              that.confirmLoading = that.spinning = false
            })
          } else {
            return false
          }
        })
      },
      closeModal() {
        this.$refs.form.clearValidate()
        this.$emit('closeModal')
      }
    }
  }
src/views/mdc/base/modules/MdcMessageApproval/SelectDeviceDrawer-SingleSelection.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,240 @@
<template>
  <a-drawer
    :title="title"
    :visible="visible"
    width="500"
    @ok="handleOk"
    @close="handleCancel"
  >
    <a-spin :spinning="loading">
      <!-- showLine -->
      <a-form>
        <a-form-item>
          <a-input-search @search="handleSearch" style="width:100%;" placeholder="检索 ç±»åˆ«ç¼–码/名称" allowClear
                          v-model="searchInput" @change="handleSearch"/>
        </a-form-item>
        <a-form-item label="车间层级:">
          <a-tree showLine ref="tree" :expandedKeys.sync="expandedKeys" :selectedKeys="selectedKeys"
                  :autoExpandParent="autoExpandParent" checkStrictly
                  :treeData="treeDataSource" checkable @check="onCheck" @select="onSelect" v-model="checkedKeys"
                  @expand="onExpand">
            <template slot="title" slot-scope="{ title, parentId, entity, key}">
              <span v-if="title.indexOf(searchValue) > -1">{{ title.substr(0, title.indexOf(searchValue)) }}
                <span class="replaceSearch">{{ searchValue }}</span>
                {{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
              </span>
              <span v-else>{{ title }}</span>
            </template>
          </a-tree>
        </a-form-item>
      </a-form>
    </a-spin>
    <div class="drawer-bottom-button">
      <a-dropdown
        style="float: left"
        :trigger="['click']"
        placement="topCenter"
      >
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="expandedKeys=allTreeKeys">展开所有</a-menu-item>
          <a-menu-item key="2" @click="expandedKeys=['-1']">合并所有</a-menu-item>
          <a-menu-item key="3" @click="queryTreeData">刷新</a-menu-item>
        </a-menu>
        <a-button>
          æ ‘操作
          <a-icon type="up"/>
        </a-button>
      </a-dropdown>
      <a-popconfirm title="确定放弃编辑?" @confirm="handleCancel" okText="确定" cancelText="取消">
        <a-button style="margin-right: .8rem">关闭</a-button>
      </a-popconfirm>
      <a-button @click="handleOk" type="primary">确定</a-button>
    </div>
  </a-drawer>
</template>
<script>
  import { getAction, postAction, deleteAction } from '@/api/manage'
  import { mapActions } from 'vuex'
  export default {
    name: 'SelectDeviceDrawer-SingleSelection',
    props: {
      editDisable: {
        type: Boolean,
        default() {
          return true
        }
      },
      title: {
        type: String
      }
    },
    data() {
      return {
        searchInput: '',
        searchValue: '',
        cardLoading: false,
        loading: false,
        treeDataSource: [],
        expandedKeys: [],
        checkedKeys: [],
        selectedKeys: [],
        autoExpandParent: true,
        dataList: [],
        allTreeKeys: [],
        visible: false,
        dataSource: []
      }
    },
    created() {
      this.queryTreeData()
    },
    methods: {
      ...mapActions(['QueryProduction']),
      queryTreeData() {
        this.loading = true
        this.cardLoading = true
        this.QueryProduction().then(res => {
          if (res.success) {
            this.dataList = []
            this.allTreeKeys = []
            this.getTreeDataSource(res.result)
            this.treeDataSource = res.result
            this.generateList(this.treeDataSource)
            this.expandedKeys = this.allTreeKeys
          } else {
            this.$message.warn(res.message)
          }
        }).finally(() => {
          this.loading = false
          this.cardLoading = false
        })
      },
      generateList(data) {
        for (let i = 0; i < data.length; i++) {
          const node = data[i]
          const key = node.key
          const title = node.title
          this.dataList.push({
            key,
            title: title
          })
          this.allTreeKeys.push(key)
          if (node.children) {
            this.generateList(node.children)
          }
        }
      },
      handleSearch(value) {
        let search = this.searchInput
        let expandedKeys = this.dataList
          .map(item => {
            if (item.title != null) {
              if (item.title.indexOf(search) > -1) {
                return this.getParentKey(item.key, this.treeDataSource)
              }
              return null
            }
          })
          .filter((item, i, self) => item && self.indexOf(item) === i)
        console.log('expandedKeys', expandedKeys)
        Object.assign(this, {
          expandedKeys,
          searchValue: search,
          autoExpandParent: true
        })
      },
      getParentKey(key, tree) {
        let parentKey
        for (let i = 0; i < tree.length; i++) {
          const node = tree[i]
          if (node.children) {
            if (node.children.some(item => item.key === key)) {
              parentKey = node.key
            } else if (
              this.getParentKey(key, node.children)) {
              parentKey = this.getParentKey(key, node.children)
            }
          }
        }
        return parentKey
      },
      getTreeDataSource(data) {
        data.forEach(item => {
          if (item.children && item.children.length > 0) {
            this.getTreeDataSource(item.children)
          }
          item.key = item.equipmentId ? item.equipmentId : item.key
          item.value = item.equipmentId ? item.equipmentId : item.value
        })
      },
      /**
       * å¤šé€‰æ¡†é€‰ä¸­æ—¶è§¦å‘
       * @param selectedKeys æ ‘节点选中列表(check事件第一个参数未用到,此参数是由select事件传入的)
       * @param event å¤šé€‰æ¡†äº‹ä»¶å¯¹è±¡
       */
      onCheck(selectedKeys, event) {
        let checkedKeys
        if (event) checkedKeys = event.checkedNodes.filter(item => item.data.props.equipmentId).map(item => item.data.props.equipmentId)
        else checkedKeys = selectedKeys
        this.checkedKeys = this.selectedKeys = checkedKeys.slice(-1)
      },
      /**
       * æ ‘节点选中时触发
       * @param selectedKeys æ ‘节点选中列表(传入check事件第一个参数)
       * @param event æ ‘节点选中事件对象
       */
      onSelect(selectedKeys, event) {
        if (event.selectedNodes[0].data.props.equipmentId) this.onCheck(selectedKeys)
      },
      /**
       * æ ‘展开合并时触发
       * @param expandedKeys
       */
      onExpand(expandedKeys) {
        this.expandedKeys = expandedKeys
        this.autoExpandParent = false
      },
      handleOk() {
        this.$emit('selectFinished', this.checkedKeys)
        this.handleCancel()
      },
      handleCancel() {
        this.visible = false
      }
    }
  }
</script>
<style lang="less" scoped>
  .replaceSearch {
    color: #40a9ff;
    font-weight: bold;
    background-color: rgb(204, 204, 204);
  }
  .drawer-bottom-button {
    position: absolute;
    bottom: 0;
    width: 100%;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    text-align: right;
    left: 0;
    background: #fff;
    border-radius: 0 0 2px 2px;
  }
</style>