1、新增设备类型管理、效率段管理、设备开动率等页面
2、修改项目名称和logo
已添加26个文件
已修改5个文件
已删除3个文件
8496 ■■■■ 文件已修改
public/index.html 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/lxzn.png 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/lxzn_white.png 补丁 | 查看 | 原始文档 | blame | 历史
src/components/layouts/TabLayout.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/tools/Logo.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/tools/UserMenu.vue 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dashboard/Analysis.vue 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dashboard/IndexBdc.vue 519 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dashboard/IndexChart.vue 268 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dashboard/IndexTask.vue 372 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/DeviceParamThresholdManagement.vue 250 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/DeviceRepair.vue 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/EfficiencyPOReport.vue 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/MdcEquipmentTypeList.vue 218 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/MdcUtilizationRateList.vue 209 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/Torqueconfiguration.vue 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/DeviceParamThresholdManagement/ParamThresholdModal.vue 252 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeForm.vue 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.Style#Drawer.vue 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.vue 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationForm.vue 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationList.vue 762 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModal.vue 385 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalEdit.vue 372 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalList.vue 340 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/deviceRepair/DeviceRepairEditListModel.vue 238 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/deviceRepair/DeviceRepairList.vue 638 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/deviceRepair/DeviceRepairListModel.vue 365 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/deviceRepair/DeviceRepairModel.vue 519 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/deviceRepair/DeviceRepairModelAdd.vue 390 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/deviceRepair/DeviceRepairModelEdit.vue 485 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/deviceRepair/JDate.vue 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/efficiencyPOReport/EfficiencyPOList.vue 727 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/mdcUtilizationRate/MdcUtilizationRateModel.vue 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/index.html
@@ -5,8 +5,8 @@
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>JeecgBoot ä¼ä¸šçº§ä½Žä»£ç å¹³å°</title>
  <link rel="icon" href="<%= BASE_URL %>logo.png">
  <title>MDC智慧车间</title>
  <link rel="icon" href="<%= BASE_URL %>lzxn.png">
  <script src="<%= BASE_URL %>cdn/babel-polyfill/polyfill_7_2_5.js"></script>
  <style>
    html,
@@ -220,7 +220,7 @@
    }
    /* æ»šåŠ¨æ¡ä¼˜åŒ– start */
    ::-webkit-scrollbar{
      width:8px;
      width:0;
      height:8px;
    }
    ::-webkit-scrollbar-track{
@@ -249,7 +249,7 @@
    <div id="loader"></div>
    <div class="loader-section section-left"></div>
    <div class="loader-section section-right"></div>
    <div class="load_title">正在加载 JeecgBoot ä½Žä»£ç å¹³å°,请耐心等待
    <div class="load_title">正在加载MDC智慧车间,请耐心等待
    </div>
  </div>
public/lxzn.png
src/assets/lxzn_white.png
src/components/layouts/TabLayout.vue
@@ -183,7 +183,7 @@
       * @param title è¦ä¿®æ”¹çš„æ–°æ ‡é¢˜
       */
      changeTitle(title) {
        let projectTitle = "Jeecg-Boot ä¼ä¸šçº§ä½Žä»£ç å¹³å°"
        let projectTitle = "MDC智慧车间"
        // é¦–页特殊处理
        if (this.$route.path === indexKey) {
          document.title = projectTitle
src/components/tools/Logo.vue
@@ -3,8 +3,8 @@
    <router-link :to="routerLinkTo">
      <!-- update-begin- author:sunjianlei --- date:20190814 --- for: logo颜色根据主题颜色变化 -->
      <img v-if="navTheme === 'dark'" src="~@/assets/logo-white.png" alt="logo">
      <img v-else src="~@/assets/logo.svg" alt="logo">
      <img v-if="navTheme === 'dark'" src="~@/assets/lxzn_white.png" alt="logo">
      <img v-else src="~@/assets/lxzn.png" alt="logo">
      <!-- update-begin- author:sunjianlei --- date:20190814 --- for: logo颜色根据主题颜色变化 -->
      <h1 v-if="showTitle">{{ title }}</h1>
@@ -21,7 +21,7 @@
    props: {
      title: {
        type: String,
        default: 'Jeecg-Boot Pro',
        default: 'MDC智慧车间',
        required: false
      },
      showTitle: {
src/components/tools/UserMenu.vue
@@ -26,11 +26,6 @@
    <!-- update-end author:sunjianlei date:20200219 for: èœå•搜索改为动态组件,在手机端呈现出弹出框 -->
    <!-- update-end author:sunjianlei date:20191220 for: è§£å†³å…¨å±€æ ·å¼å†²çªçš„问题 -->
    <!-- update_end  author:zhaoxin date:20191129 for: åšå¤´éƒ¨èœå•栏导航 -->
    <span class="action">
      <a class="logout_title" target="_blank" href="http://doc.jeecg.com">
        <a-icon type="question-circle-o"></a-icon>
      </a>
    </span>
    <header-notice class="action"/>
    <a-dropdown>
      <span class="action action-full ant-dropdown-link user-dropdown-menu">
@@ -38,30 +33,30 @@
        <span v-if="isDesktop()">欢迎您,{{ nickname() }}</span>
      </span>
      <a-menu slot="overlay" class="user-dropdown-menu-wrapper">
        <a-menu-item key="0">
          <router-link :to="{ name: 'account-center' }">
            <a-icon type="user"/>
            <span>个人中心</span>
          </router-link>
        </a-menu-item>
        <a-menu-item key="1">
          <router-link :to="{ name: 'account-settings-base' }">
            <a-icon type="setting"/>
            <span>账户设置</span>
          </router-link>
        </a-menu-item>
        <a-menu-item key="3"  @click="systemSetting">
           <a-icon type="tool"/>
           <span>系统设置</span>
        </a-menu-item>
        <!--<a-menu-item key="0">-->
          <!--<router-link :to="{ name: 'account-center' }">-->
            <!--<a-icon type="user"/>-->
            <!--<span>个人中心</span>-->
          <!--</router-link>-->
        <!--</a-menu-item>-->
        <!--<a-menu-item key="1">-->
          <!--<router-link :to="{ name: 'account-settings-base' }">-->
            <!--<a-icon type="setting"/>-->
            <!--<span>账户设置</span>-->
          <!--</router-link>-->
        <!--</a-menu-item>-->
        <!--<a-menu-item key="3"  @click="systemSetting">-->
           <!--<a-icon type="tool"/>-->
           <!--<span>系统设置</span>-->
        <!--</a-menu-item>-->
        <a-menu-item key="4" @click="updatePassword">
          <a-icon type="setting"/>
          <span>密码修改</span>
        </a-menu-item>
        <a-menu-item key="5" @click="updateCurrentDepart">
          <a-icon type="cluster"/>
          <span>切换部门</span>
        </a-menu-item>
        <!--<a-menu-item key="5" @click="updateCurrentDepart">-->
          <!--<a-icon type="cluster"/>-->
          <!--<span>切换部门</span>-->
        <!--</a-menu-item>-->
        <a-menu-item key="6" @click="clearCache">
          <a-icon type="sync"/>
          <span>清理缓存</span>
src/views/dashboard/Analysis.vue
@@ -1,34 +1,18 @@
<template>
  <div>
    <index-chart v-if="indexStyle==1"></index-chart>
    <index-bdc v-if="indexStyle==2"></index-bdc>
    <index-task v-if="indexStyle==3"></index-task>
    <div style="width: 100%;text-align: right;margin-top: 20px">
      è¯·é€‰æ‹©é¦–页样式:
      <a-radio-group v-model="indexStyle">
        <a-radio :value="1">统计图表</a-radio>
        <a-radio :value="2">统计图表2</a-radio>
        <a-radio :value="3">任务表格</a-radio>
      </a-radio-group>
    </div>
  </div>
</template>
<script>
  import IndexChart from './IndexChart'
  import IndexTask from "./IndexTask"
  import IndexBdc from './IndexBdc'
  export default {
    name: "Analysis",
    components: {
      IndexChart,
      IndexTask,
      IndexBdc
    },
    data() {
      return {
        indexStyle:1
      }
    },
    created() {
src/views/dashboard/IndexBdc.vue
ÎļþÒÑɾ³ý
src/views/dashboard/IndexChart.vue
ÎļþÒÑɾ³ý
src/views/dashboard/IndexTask.vue
ÎļþÒÑɾ³ý
src/views/mdc/base/DeviceParamThresholdManagement.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,250 @@
<template>
  <a-card :bordered="false">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="12">
            <a-form-item label="中文名">
              <j-input placeholder="请输入中文名" v-model="queryParam.chineseName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="英文名">
              <j-input placeholder="请输入英文名" v-model="queryParam.englishName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="驱动类型">
              <a-auto-complete
                v-model="queryParam.controlSystemType"
                :data-source="driveTypeList"
                placeholder="请选择控制系统类型"
                :filter-option="filterOption"
                :allowClear="true"
              />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
            <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator" style="border-top: 5px">
      <a-button @click="handleAdd" type="primary" icon="plus">添加参数阈值</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay" @click="handleMenuClick">
          <a-menu-item key="1">
            <a-icon type="delete" @click="batchDel"/>
            åˆ é™¤
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px">
          æ‰¹é‡æ“ä½œ
          <a-icon type="down"/>
        </a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i>已选择&nbsp;<a style="font-weight: 600">{{
        selectedRowKeys.length }}</a>项&nbsp;&nbsp;
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        bordered
        size="middle"
        rowKey="id"
        :scroll="{x:'max-content',y:600}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <template slot="avatarslot" slot-scope="text, record, index">
          <div class="anty-img-wrap">
            <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>
          </div>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical"/>
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <ParamThresholdModal ref="modalForm" @ok="modalFormOk" :driveTypeList="driveTypeList"/>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import api from '@/api/mdc'
  import ParamThresholdModal from './modules/DeviceParamThresholdManagement/ParamThresholdModal'
  export default {
    name: 'EquipmentList',
    mixins: [JeecgListMixin],
    components: {
      ParamThresholdModal
    },
    data() {
      return {
        name: 'DeviceParamThresholdManagement',
        description: '这是设备参数阈值管理页面',
        queryParam: {},
        /* åˆ†é¡µå‚æ•° */
        ipagination:{
          current: 1,
          pageSize: 30,
          pageSizeOptions: ['30', '50', '100'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " å…±" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '中文名',
            align: 'center',
            dataIndex: 'chineseName',
            width: 350
            // sorter: true
          },
          {
            title: '英文名',
            align: 'center',
            width: 350,
            dataIndex: 'englishName'
          },
          {
            title: '驱动类型',
            align: 'center',
            width: 350,
            dataIndex: 'controlSystemType'
          },
          {
            title: '阈值上限',
            align: 'center',
            width: 270,
            dataIndex: 'maxThreshold'
            // scopedSlots: {customRender: "avatarslot"}
          },
          {
            title: '阈值下限',
            align: 'center',
            width: 270,
            dataIndex: 'minThreshold'
            // sorter: true
          },
          {
            title: '操作',
            dataIndex: 'action',
            scopedSlots: { customRender: 'action' },
            align: 'center',
            fixed: 'right',
            width: 150
          }
        ],
        driveTypeList: [],
        url: {
          list: '/mdc/mdcEquipmentThreshold/list',
          delete: '/mdc/mdcEquipmentThreshold/delete',
          deleteBatch: '/mdc/mdcEquipmentThreshold/deleteBatch'
        }
      }
    },
    created() {
      this.getDriveTypeByApi()
    },
    methods: {
      handleEdit: function(record) {
        this.$refs.modalForm.edit(record)
        this.$refs.modalForm.title = '编辑'
        // è°ƒç”¨æŠ½å±‰è¡¨å•组件中的清除表单验证方法
        this.$refs.modalForm.removeValidate()
      },
      handleAdd: function() {
        this.$refs.modalForm.add()
        this.$refs.modalForm.title = '新增'
        // è°ƒç”¨æŠ½å±‰è¡¨å•组件中的清除表单验证方法
        this.$refs.modalForm.removeValidate()
      },
      handleMenuClick(e) {
        if (e.key == 1) {
          this.batchDel()
        } else if (e.key == 2) {
          this.batchFrozen(2)
        } else if (e.key == 3) {
          this.batchFrozen(1)
        }
      },
      /**
       * è°ƒç”¨æŽ¥å£èŽ·å–æŽ§åˆ¶ç³»ç»Ÿç±»åž‹
       */
      getDriveTypeByApi() {
        api.getDriveTypeApi().then((res) => {
          this.driveTypeList = res.result.map(item => item.value)
        })
      },
      /**
       * è”想输入框筛选功能
       * @param input è¾“入的内容
       * @param option é…ç½®
       * @returns {boolean} åˆ¤æ–­æ˜¯å¦ç­›é€‰
       */
      filterOption(input, option) {
        return (
          option.componentOptions.children[0].text.toUpperCase().indexOf(input.toUpperCase()) >= 0
        )
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
src/views/mdc/base/DeviceRepair.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,141 @@
<template>
  <div style="width: 100%; height: 100%;">
    <a-card :bordered="false">
      <a-row type="flex" :gutter="16">
        <a-col :md="5">
          <a-tabs :activeKey="activeKey" @change="tabChange">
            <a-tab-pane key="1" tab="车间层级" force-render>
              <base-tree @getCurrSelected="changeSelectionNode"></base-tree>
            </a-tab-pane>
            <a-tab-pane v-if="isDepartType == 0" key="2" tab="部门层级">
              <depart-tree @getCurrSelectedDD="changeSelectionNodedd"></depart-tree>
            </a-tab-pane>
          </a-tabs>
        </a-col>
        <a-col :md="19">
          <device-repair-list ref="DeviceRepairList" :nodeTree='selectEquement'  :nodePeople='selectPeople' :Type="slectTypeTree" />
        </a-col>
      </a-row>
    </a-card>
  </div>
</template>
<script>
  import { putAction, getAction } from '@/api/manage'
  import { frozenBatch } from '@/api/api'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  import BaseTree from '../common/BaseTree'
  import DeviceRepairList from './modules/deviceRepair/DeviceRepairList'
  import JSuperQuery from '@/components/jeecg/JSuperQuery'
  import JThirdAppButton from '@/components/jeecgbiz/thirdApp/JThirdAppButton'
  import DepartTree from './modules/DepartList/DepartListTree/DepartTree'
  import {mapActions} from 'vuex'
  export default {
    name: 'DeviceRepair',
    components: {
      JThirdAppButton,
      JInput,
      BaseTree,
      JSuperQuery,
      DepartTree,
      DeviceRepairList
    },
    data() {
      return {
        activeKey: '1',
        description: '设备信息',
        selectEquementId: '',
        selectEquement: {},
        selectPeople:{},
        slectTypeTree: '',
        url: {
          equipmentStatistics: '/mdc/equipment/equipmentStatistics'
        },
        isDepartType:'',
      }
    },
    created() {
      this.queryTreeData()
    },
    methods: {
      ...mapActions(['QueryDepartTree']),
      queryTreeData() {
        this.QueryDepartTree().then(res => {
          if (res.success) {
            this.isDepartType = res.result[0].value
          } else {
            // this.$message.warn(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() =>{
        })
      },
      tabChange(val) {
        // console.log(val)
        this.activeKey = val
        this.slectTypeTree = val
      },
      /*      changeSelection(val) {
              this.selectEquementId = val
              this.$refs.DeviceRepairList.pQuery(val)
            },*/
      changeSelectionNode(val) {
        this.selectEquement = val
        this.slectTypeTree = '1'
      },
      changeSelectionNodedd(val) {
        this.selectPeople = val
        this.slectTypeTree = '2'
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
  .equipMessage {
    width: 100%;
    height: 10%;
  }
  .equipMessage table {
    width: 60%;
    height: 100%;
    line-height: 50%;
  }
  .equipMessage table td {
    text-align: center;
  }
  .equipMessage table td span {
    display: inline-block;
    width: 15px;
    height: 15px;
  }
  .equipMessage table td .equipShutdown {
    background-color: #808080;
  }
  .equipMessage table td .equipStandby {
    background-color: #ffbf37;
  }
  .equipMessage table td .equipRun {
    background-color: #19FE01;
  }
  .equipMessage table td .equipAlarm {
    background-color: #FD0008;
  }
</style>
src/views/mdc/base/EfficiencyPOReport.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,140 @@
<template>
  <div style="width: 100%; height: 100%;">
    <a-card :bordered="false">
      <a-row type="flex" :gutter="16">
        <a-col :md="5">
          <a-tabs :activeKey="activeKey"  @change="tabChange">
            <a-tab-pane key="1" tab="车间层级" force-render>
              <base-tree @getCurrSelected="changeSelectionNode"></base-tree>
            </a-tab-pane>
            <a-tab-pane v-if="isDepartType == 0" key="2" tab="部门层级">,
              <depart-tree  @getCurrSelectedDD="changeSelectionNodedd"></depart-tree>
            </a-tab-pane>
          </a-tabs>
        </a-col>
        <a-col :md="19">
          <efficiencyPO-list ref="EfficiencyPOList" :nodeTree='selectEquement'  :nodePeople='selectPeople' :Type="slectTypeTree"/>
        </a-col>
      </a-row>
    </a-card>
  </div>
</template>
<script>
import { putAction, getAction } from '@/api/manage'
import { frozenBatch } from '@/api/api'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JInput from '@/components/jeecg/JInput'
import BaseTree from '../common/BaseTree'
import EfficiencyPOList from './modules/efficiencyPOReport/EfficiencyPOList'
import JSuperQuery from '@/components/jeecg/JSuperQuery'
import JThirdAppButton from '@/components/jeecgbiz/thirdApp/JThirdAppButton'
import DepartTree from './modules/DepartList/DepartListTree/DepartTree'
import {mapActions} from 'vuex'
export default {
  name: 'EfficiencyPOReport',
  components: {
    JThirdAppButton,
    JInput,
    BaseTree,
    JSuperQuery,
    DepartTree,
    EfficiencyPOList
  },
  data() {
    return {
      activeKey: '1',
      description: '设备信息',
      selectEquementId: '',
      selectEquement: {},
      selectPeople:{},
      slectTypeTree:"",
      url: {
        equipmentStatistics: '/mdc/equipment/equipmentStatistics'
      },
      isDepartType:'',
    }
  },
  created() {
    this.queryTreeData()
  },
  methods: {
    ...mapActions(['QueryDepartTree']),
    queryTreeData() {
      this.QueryDepartTree().then(res => {
        if (res.success) {
          this.isDepartType = res.result[0].value
        } else {
          // this.$message.warn(res.message)
          this.$notification.warning({
            message:'消息',
            description:res.message
          });
        }
      }).finally(() =>{
      })
    },
    tabChange(val) {
      // console.log(val);
      this.activeKey = val
      this.slectTypeTree = val
    },
    // changeSelection(val) {
    //   this.selectEquementId = val
    //   this.$refs.efficiencyList.pQuery(val)
    //   this.$refs.efficiencyList.searchQuery()
    // },
    changeSelectionNode(val) {
      this.selectEquement = val
      this.slectTypeTree = "1"
    },
    changeSelectionNodedd(val) {
      this.selectPeople = val
      this.slectTypeTree = "2"
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
.equipMessage {
  width: 100%;
  height: 10%;
}
.equipMessage table {
  width: 60%;
  height: 100%;
  line-height: 50%;
}
.equipMessage table td {
  text-align: center;
}
.equipMessage table td span {
  display: inline-block;
  width: 15px;
  height: 15px;
}
.equipMessage table td .equipShutdown {
  background-color: #808080;
}
.equipMessage table td .equipStandby {
  background-color: #ffbf37;
}
.equipMessage table td .equipRun {
  background-color: #19FE01;
}
.equipMessage table td .equipAlarm {
  background-color: #FD0008;
}
</style>
src/views/mdc/base/MdcEquipmentTypeList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,218 @@
<template>
  <a-card :bordered="false">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="设备类型名称">
              <a-input placeholder="请输入设备类型名称" v-model="queryParam.equipmentTypeName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <!--<a @click="handleToggleSearch" style="margin-left: 8px">-->
                <!--{{ toggleSearchStatus ? '收起' : '展开' }}-->
                <!--<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
              <!--</a>-->
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <!--<a-button type="primary" icon="download" @click="handleExportXls('设备类型')">导出</a-button>-->
      <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
        <!--<a-button type="primary" icon="import">导入</a-button>-->
      <!--</a-upload>-->
      <!-- é«˜çº§æŸ¥è¯¢åŒºåŸŸ -->
      <!--<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ <a-icon type="down" /></a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange"
        :scroll="{x:'max-content',y:465}"
      >
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            ä¸‹è½½
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <mdc-equipment-type-modal ref="modalForm" @ok="modalFormOk"></mdc-equipment-type-modal>
  </a-card>
</template>
<script>
  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import MdcEquipmentTypeModal from './modules/EquipmentTypeList/MdcEquipmentTypeModal'
  import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  export default {
    name: 'MdcEquipmentTypeList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      MdcEquipmentTypeModal
    },
    data () {
      return {
        description: '设备类型管理页面',
        /* åˆ†é¡µå‚æ•° */
        ipagination:{
          current: 1,
          pageSize: 30,
          pageSizeOptions: ['30', '50', '100'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " å…±" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'设备类型名称',
            align:"center",
            dataIndex: 'equipmentTypeName',
            width:530
          },
          {
            title:'设备类型图片',
            align:"center",
            dataIndex: 'equipmentTypePictures',
            scopedSlots: {customRender: 'imgSlot'},
            width:530
          },
          {
            title:'设备类型状态',
            align:"center",
            dataIndex: 'equipmentTypeStates',
            customRender: (text) => (text ? filterMultiDictText(this.dictOptions['equipmentTypeStates'], text) : ''),
            width:530
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' },
            width:150,
            fixed:'right'
          }
        ],
        url: {
          list: "/mdc/mdcEquipmentType/queryWrapper",
          delete: "/mdc/mdcEquipmentType/deleteEquipmentType",
          deleteBatch: "/mdc/mdcEquipmentType/deleteBatchEquipmentType",
          exportXlsUrl: "/mdcequipmenttype/mdcEquipmentType/exportXls",
          importExcelUrl: "mdcequipmenttype/mdcEquipmentType/importExcel",
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
      this.$set(this.dictOptions, 'equipmentTypeStates', [{text:'是',value:'Y'},{text:'否',value:'N'}])
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'equipmentTypeName',text:'设备类型名称',dictCode:''})
        fieldList.push({type:'string',value:'equipmentTypePictures',text:'设备类型图片',dictCode:''})
        fieldList.push({type:'switch',value:'equipmentTypeStates',text:'设备类型状态'})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
src/views/mdc/base/MdcUtilizationRateList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,209 @@
<template>
  <a-card :bordered="false" class="mdcutilization_list">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="类别">
              <a-input placeholder="请输入类别" v-model="queryParam.rateParameterCategory"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-space>
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <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 type="primary" @click="searchQuery" icon="search">查询</a-button>-->
      <!--<a-button type="primary" @click="searchReset" icon="reload">重置</a-button>-->
    <!--</div>-->
    <!-- table区域-begin -->
    <div>
      <a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :dataSource="dataSource"
               :pagination="ipagination" :loading="loading"
               @change="handleTableChange">
        <span slot="rateParameterColor" slot-scope="text, record">
          <div :style="{background:record.rateParameterColor}"> &nbsp;&nbsp;</div>
        </span>
        <span slot="action" slot-scope="text, record">
          <a href="javascript:;" @click="handleEdit(record)">编辑</a>
        </span>
        <!--<span slot="action1" slot-scope="text,record">-->
          <!--<span><=</span>-->
        <!--</span>-->
      </a-table>
    </div>
    <!-- table区域-end -->
    <mdc-utilization-rate-model ref="formModel" @ok="modalFormOk"></mdc-utilization-rate-model>
  </a-card>
</template>
<script>
  import {
    JeecgListMixin
  } from '@/mixins/JeecgListMixin'
  import JDictSelectTag from '@/components/dict/JDictSelectTag'
  import {
    initDictOptions,
    filterDictText
  } from '@/components/dict/JDictSelectUtil'
  import {
    requestPut
  } from '@/api/manage'
  import JInput from '@/components/jeecg/JInput'
  import JEllipsis from '@/components/jeecg/JEllipsis'
  import JDate from '@/components/jeecg/JDate'
  import moment from 'moment'
  import {
    getAction,
    postAction,
    deleteAction
  } from '@/api/manage'
  import MdcUtilizationRateModel from './modules/mdcUtilizationRate/MdcUtilizationRateModel'
  export default {
    name: 'MdcUtilizationRateList',
    mixins: [JeecgListMixin],
    components: {
      JDictSelectTag,
      JInput,
      JEllipsis,
      JDate,
      MdcUtilizationRateModel
    },
    data() {
      return {
        /* åˆ†é¡µå‚æ•° */
        ipagination:{
          current: 1,
          pageSize: 30,
          pageSizeOptions: ['30', '50', '100'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " å…±" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        columns: [{
          title: '类别',
          align: 'center',
          dataIndex: 'rateParameterCategory'
        },
          {
            title: '颜色',
            align: 'center',
            dataIndex: 'rateParameterColor',
            scopedSlots: {
              customRender: 'rateParameterColor'
            }
          },
          {
            title: '最小范围(单位:%)',
            align: 'center',
            dataIndex: 'minimumRange'
          },
          // {
          //   title:'',
          //   dataIndex:'action1',
          //   align:'center',
          //   scopedSlots: {
          //     customRender: 'action1'
          //   }
          // },
          {
            title: '最大范围(单位:%)',
            align: 'center',
            dataIndex: 'maximumRange'
          },
          {
            title: '等级',
            align: 'center',
            dataIndex: 'rateParameterLevel'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            scopedSlots: {
              customRender: 'action'
            }
          }
        ],
        url: {
          list: '/mdc/MdcUtilizationRate/queryWrapper'
        }
      }
    },
    created() {
      this.loadData()
    },
    methods: {
      searchReset() {
        this.queryParam = {}
        this.loadData()
        this.onClearSelected()
      },
      searchQuery() {
        this.loadData()
        this.onClearSelected()
      },
      modalFormOk(val) {
        // æ–°å¢ž/修改 æˆåŠŸæ—¶ï¼Œé‡è½½åˆ—è¡¨
        this.loadData()
        this.selectedRowKeys = [val.borrowSubId]
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedRowKeys = selectedRowKeys
        this.selectionRows = selectionRows
      },
      handleEdit(record) {
        this.$refs.formModel.edit(record)
        this.$refs.formModel.title = '编辑'
        this.$refs.formModel.disableSubmit = false
      }
    }
  }
</script>
<style>
  @import '~@assets/less/common.less';
  @media screen and (min-width: 1920px){
    .mdcutilization_list{
      height: 825px!important;
      overflow: scroll;
    }
  }
  @media screen and (min-width: 1680px) and (max-width: 1920px){
    .mdcutilization_list{
      height: 825px!important;
      overflow: scroll;
    }
  }
  @media screen and (min-width: 1400px) and (max-width: 1680px){
    .mdcutilization_list{
      height: 655px!important;
      overflow: scroll;
    }
  }
  @media screen and (min-width: 1280px) and (max-width: 1400px){
    .mdcutilization_list{
      height: 552px!important;
      overflow: scroll;
    }
  }
  @media screen and (max-width: 1280px){
    .mdcutilization_list{
      height: 552px!important;
      overflow: scroll;
    }
  }
</style>
src/views/mdc/base/Torqueconfiguration.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,139 @@
<template>
  <div style="width: 100%; height: 100%;">
    <a-card :bordered="false">
      <a-row type="flex" :gutter="16">
        <a-col :md="5">
          <a-tabs :activeKey="activeKey"  @change="tabChange">
            <a-tab-pane key="1" tab="车间层级" force-render>
              <base-tree @getCurrSelected="changeSelectionNode"></base-tree>
            </a-tab-pane>
            <a-tab-pane  v-if="isDepartType == 0" key="2" tab="部门层级">,
              <depart-tree  @getCurrSelectedDD="changeSelectionNodedd"></depart-tree>
            </a-tab-pane>
          </a-tabs>
        </a-col>
        <a-col :md="19">
          <torqueconfiguration-list  ref="TorqueconfigurationList" :nodePeople='selectPeople' :nodeTree = 'selectEquement' :Type="slectTypeTree"></torqueconfiguration-list>
        </a-col>
      </a-row>
    </a-card>
  </div>
</template>
<script>
  import { putAction, getAction } from '@/api/manage'
  import { frozenBatch } from '@/api/api'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  import BaseTree from '../common/BaseTree'
  import TorqueconfigurationList from './modules/TorqueconfigurationList/TorqueconfigurationList'
  import JSuperQuery from '@/components/jeecg/JSuperQuery'
  import JThirdAppButton from '@/components/jeecgbiz/thirdApp/JThirdAppButton'
  import DepartTree from './modules/DepartList/DepartListTree/DepartTree'
  import {mapActions} from 'vuex'
  export default {
    name: 'Torqueconfiguration',
    components: {
      JThirdAppButton,
      JInput,
      BaseTree,
      JSuperQuery,
      DepartTree,
      TorqueconfigurationList
    },
    data() {
      return {
        activeKey: '1',
        description: '设备信息',
        selectEquementId: '',
        selectEquement: {},
        selectPeople:{},
        slectTypeTree:"",
        url: {
          equipmentStatistics: '/mdc/equipment/equipmentStatistics'
        },
        isDepartType:'',
      }
    },
    created() {
      this.queryTreeData()
    },
    methods: {
      ...mapActions(['QueryDepartTree']),
      queryTreeData() {
        this.QueryDepartTree().then(res => {
          if (res.success) {
            this.isDepartType = res.result[0].value
          } else {
            // this.$message.warn(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() =>{
        })
      },
      tabChange(val) {
        // console.log(val);
        this.activeKey = val
        this.slectTypeTree = val
      },
      // changeSelection(val) {
      //   this.selectEquementId = val
      //   this.$refs.efficiencyList.pQuery(val)
      //   this.$refs.efficiencyList.searchQuery()
      // },
      changeSelectionNode(val) {
        this.selectEquement = val
        this.slectTypeTree = "1"
      },
      changeSelectionNodedd(val) {
        this.selectPeople = val
        this.slectTypeTree = "2"
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
  .equipMessage {
    width: 100%;
    height: 10%;
  }
  .equipMessage table {
    width: 60%;
    height: 100%;
    line-height: 50%;
  }
  .equipMessage table td {
    text-align: center;
  }
  .equipMessage table td span {
    display: inline-block;
    width: 15px;
    height: 15px;
  }
  .equipMessage table td .equipShutdown {
    background-color: #808080;
  }
  .equipMessage table td .equipStandby {
    background-color: #ffbf37;
  }
  .equipMessage table td .equipRun {
    background-color: #19FE01;
  }
  .equipMessage table td .equipAlarm {
    background-color: #FD0008;
  }
</style>
src/views/mdc/base/modules/DeviceParamThresholdManagement/ParamThresholdModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,252 @@
<template>
  <a-modal
    :title="title"
    :maskClosable="true"
    :width="modalWidth"
    @cancel="visible=false"
    :visible="visible">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :form="form" :model="model" :rules="validatorRules" :labelCol="labelCol"
                    :wrapperCol="wrapperCol">
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item prop="controlSystemType" label="驱动类型">
              <a-select v-model="model.controlSystemType" @change="handleDriveTypeChange"
                        placeholder="请选择驱动类型">
                <a-select-option v-for="(item,index) in driveTypeList" :key="index" :value="item">
                  {{item}}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item prop="chineseName" label="参数">
              <a-select v-model="model.chineseName" placeholder="请选择参数">
                <a-select-option v-for="item in paramList" :key="item.value" :value="item.value">
                  {{item.label}}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-model-item prop="maxThreshold" label="阈值上限">
              <a-input-number v-model="model.maxThreshold" placeholder="请输入阈值上限" style="width: 100%"></a-input-number>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item prop="minThreshold" label="阈值下限">
              <a-input-number v-model="model.minThreshold" placeholder="请输入阈值下限" style="width: 100%"></a-input-number>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
    <template slot="footer">
      <a-popconfirm title="确定放弃操作?" @confirm="visible=false" okText="确定" cancelText="取消">
        <a-button style="margin-right: .8rem">取消</a-button>
      </a-popconfirm>
      <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">提交</a-button>
    </template>
  </a-modal>
</template>
<script>
  import pick from 'lodash.pick'
  import api from '@/api/mdc'
  export default {
    name: 'ParamThresholdModal',
    components: {},
    props: {
      driveTypeList: {
        type: Array
      }
    },
    data() {
      return {
        modalWidth: 700,
        form: this.$form.createForm(this),
        validatorRules: {
          controlSystemType: [
            {
              required: true, message: '请选择驱动类型'
            }
          ],
          chineseName: [
            {
              required: true, message: '请选择参数'
            }
          ],
          minThreshold: [
            {
              required: true, message: '请输入阈值上限'
            },
            {
              pattern: /^[0-9]+$/,
              message: '请输入阿拉伯数字'
            }
          ],
          maxThreshold: [
            {
              required: true, message: '请输入阈值下限'
            },
            {
              pattern: /^[0-9]+$/,
              message: '请输入阿拉伯数字'
            }
          ]
        },
        title: '操作',
        visible: false,
        model: {
          controlSystemType: '',
          chineseName: '',
          minThreshold: '',
          maxThreshold: ''
        },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 15 }
        },
        confirmLoading: false,
        url: {
          userId: '/sys/user/generateUserId' // å¼•入生成添加用户情况下的url
        },
        paramList: []
      }
    },
    created() {
    },
    methods: {
      add() {
        this.visible = true
        this.model = {
          controlSystemType: this.driveTypeList[0],
          chineseName: '',
          minThreshold: '',
          maxThreshold: ''
        }
        console.log('driveType',this.driveTypeList)
        this.handleDriveTypeChange(this.driveTypeList[0])
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, 'controlSystemType', 'chineseName', 'minThreshold', 'maxThreshold'))
        })
      },
      edit(record) {
        this.visible = true
        this.model = Object.assign({}, record)
        api.getParamListByDriveTypeApi(record.controlSystemType)
          .then(res => {
            if (res.success) {
              this.paramList = res.result
            }
          })
        this.model.chineseName = `${record.englishName}(${record.chineseName})`
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, 'controlSystemType', 'chineseName', 'minThreshold', 'maxThreshold'))
        })
      },
      handleSubmit() {
        const that = this
        // è§¦å‘表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            if (this.model.maxThreshold > this.model.minThreshold) {
              that.confirmLoading = true
              let obj
              if (this.title == '新增') {
                obj = api.addParamThresholdApi(this.model)
              } else {
                obj = api.editParamThresholdApi(this.model)
              }
              obj.then((res) => {
                if (res.success) {
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                  that.$emit('ok')
                } else {
                  that.$notification.warning({
                    message: '消息',
                    description: res.message
                  })
                }
              }).finally(() => {
                that.confirmLoading = false
                this.visible = false
              })
            } else {
              this.$notification.warning({
                message: '消息',
                description: '阈值上限不能小于等于阈值下限'
              })
            }
          } else {
            return false
          }
        })
      },
      /**
       * è”想输入框筛选功能
       * @param input è¾“入的内容
       * @param option é…ç½®
       * @returns {boolean} åˆ¤æ–­æ˜¯å¦ç­›é€‰
       */
      filterOption(input, option) {
        return (
          option.componentOptions.children[0].text.toUpperCase().indexOf(input.toUpperCase()) >= 0
        )
      },
      /**
       * é©±åŠ¨å‚æ•°ç±»åž‹é€‰ä¸­åŽæ¸²æŸ“ç›¸åº”çš„å‚æ•°åˆ—è¡¨
       * @param value é©±åŠ¨å‚æ•°ç±»åž‹é€‰ä¸­é¡¹
       */
      handleDriveTypeChange(value) {
        api.getParamListByDriveTypeApi(value)
          .then(res => {
            if (res.success) {
              this.paramList = res.result
              this.model.chineseName = res.result.length ? res.result[0].value : undefined
              if (this.model.chineseName) this.$refs.form.clearValidate('chineseName')
            }
          })
      },
      /**
       * ç¼–辑或查看详情数据时清除抽屉表单验证
       */
      removeValidate() {
        if (this.$refs.form) this.$refs.form.clearValidate()
      }
    }
  }
</script>
<style scoped>
</style>
src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,126 @@
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="设备类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentTypeName">
              <a-input v-model="model.equipmentTypeName" placeholder="请输入设备类型名称"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="设备类型图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentTypePictures">
              <j-image-upload  v-model="model.equipmentTypePictures" ></j-image-upload>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="设备类型状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentTypeStates">
              <j-switch v-model="model.equipmentTypeStates"  ></j-switch>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>
<script>
  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'
  export default {
    name: 'MdcEquipmentTypeForm',
    components: {
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        model:{
         },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
           equipmentTypeName: [
              { required: true, message: '请输入设备类型名称!'},
              { validator: (rule, value, callback) => validateDuplicateValue('mdc_equipment_type', 'equipment_type_name', value, this.model.id, callback)},
           ],
        },
        url: {
          add: "/mdc/mdcEquipmentType/addEquipmentType",
          edit: "/mdc/mdcEquipmentType/editEquipmentType",
          queryById: "/mdc/mdcEquipmentType/queryById"
        }
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
       //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
    },
    methods: {
      add () {
        this.edit(this.modelDefault);
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      submitForm () {
        const that = this;
        // è§¦å‘表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                // that.$message.success(res.message);
                that.$notification.success({
                  message:'消息',
                  description:res.message
                });
                that.$emit('ok');
              }else{
                // that.$message.warning(res.message);
                that.$notification.warning({
                  message:'消息',
                  description:res.message
                });
              }
            }).finally(() => {
              that.confirmLoading = false;
            })
          }
        })
      },
    }
  }
</script>
src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.Style#Drawer.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,84 @@
<template>
  <a-drawer
    :title="title"
    :width="width"
    placement="right"
    :closable="false"
    @close="close"
    destroyOnClose
    :visible="visible">
    <mdc-equipment-type-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></mdc-equipment-type-form>
    <div class="drawer-footer">
      <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
      <a-button v-if="!disableSubmit"  @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
    </div>
  </a-drawer>
</template>
<script>
  import MdcEquipmentTypeForm from './MdcEquipmentTypeForm'
  export default {
    name: 'MdcEquipmentTypeModal',
    components: {
      MdcEquipmentTypeForm
    },
    data () {
      return {
        title:"操作",
        width:800,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        });
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>
<style lang="less" scoped>
/** Button按钮间距 */
  .ant-btn {
    margin-left: 30px;
    margin-bottom: 30px;
    float: right;
  }
  .drawer-footer{
    position: absolute;
    bottom: -8px;
    width: 100%;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    text-align: right;
    left: 0;
    background: #fff;
    border-radius: 0 0 2px 2px;
  }
</style>
src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,60 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <mdc-equipment-type-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></mdc-equipment-type-form>
  </j-modal>
</template>
<script>
  import MdcEquipmentTypeForm from './MdcEquipmentTypeForm'
  export default {
    name: 'MdcEquipmentTypeModal',
    components: {
      MdcEquipmentTypeForm
    },
    data () {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false
      }
    },
    methods: {
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,124 @@
<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="设备编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentid">
              <a-input v-model="model.equipmentid" placeholder="请输入设备编号"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="设备名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentname">
              <a-input v-model="model.equipmentname" placeholder="请输入设备名称"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startdate">
              <j-date placeholder="请选择时间" v-model="model.startdate"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="扭矩值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="torquevalue">
              <a-input v-model="model.torquevalue" placeholder="请输入扭矩值"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="notes">
              <a-input v-model="model.notes" placeholder="请输入备注"  ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>
<script>
  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'
  export default {
    name: 'TorqueconfigurationForm',
    components: {
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        model:{
         },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
        },
        url: {
          add: "/torquec/torqueconfiguration/add",
          edit: "/torquec/torqueconfiguration/edit",
          queryById: "/torquec/torqueconfiguration/queryById"
        }
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
       //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
    },
    methods: {
      add () {
        this.edit(this.modelDefault);
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      submitForm () {
        const that = this;
        // è§¦å‘表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
            })
          }
        })
      },
    }
  }
</script>
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,762 @@
<template>
  <div class="device_list">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div style=" background-color: #fff;overflow: auto" class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24" style="width: 100%;">
          <a-col :md="7" :sm="7">
            <a-form-item label="时间">
              <a-range-picker @change="dateParamChange" v-model="dates"  format="YYYY-MM-DD HH:mm:ss"/>
            </a-form-item>
          </a-col>
          <a-col :md="5" :sm="5">
            <a-form-item label="设备编号">
              <a-input placeholder="输入设备编号查询" v-model="queryParams.equipmentId"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="5" :sm="5" :xs="5">
            <a-form-item label="设备名称">
              <a-input placeholder="输入设备名称查询" v-model="queryParams.equipmentName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="2" :sm="2" :xs="2">
            <a-space>
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
            </a-space>
          </a-col>
          <!--<a-col :md="2" :sm="3" :xs="3">-->
            <!--<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>-->
          <!--</a-col>-->
          <!--<a-col :md="2" :sm="2" :xs="2">-->
            <!--<a-button type="primary" @click="searchReset" icon="reload">重置</a-button>-->
          <!--</a-col>-->
          <!--<a-col :lg="2" :md="3" :sm="3" :xs="3">-->
            <!--<a-button type="primary" @click="exportExcel" icon="download">导出</a-button>-->
          <!--</a-col>-->
        </a-row>
      </a-form>
    </div>
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator" style="display: inline;">
      <a-button @click="handleAdd" type="primary" icon="plus">新增
      </a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('扭矩配置')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
      <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete"/>
            åˆ é™¤
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ
          <a-icon type="down"/>
        </a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div id="DeviceList" style="flex: 1;overflow: hidden">
      <a-table ref="table" bordered size="middle" rowKey="id" :columns="columns"
               :dataSource="dataSource" :pagination="ipagination" :loading="loading"
               :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
               @change="handleTableChange" :scroll="{x:'max-content',y:scrollY}">
        <span slot="action" slot-scope="text, record">
        <a @click="handleEdit(record)">编辑</a>
            <a-divider type="vertical" />
          <a @click="handleDelete(record.id)">删除</a>
        </span>
        <!--字符串超长截取省略号显示-->
        <span slot="num" slot-scope="text" style="font-weight: bold">
          <j-ellipsis :value="text" :length="8"/>
        </span>
        <span slot="name" slot-scope="text" style="font-weight: bold">
          <j-ellipsis :value="text" :length="8"/>
        </span>
        <span slot="model" slot-scope="text" style="font-weight: bold">
          <j-ellipsis :value="text" :length="8"/>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <!--<device-repair-model></device-repair-model>-->
    <torqueconfiguration-modal ref="modalForm" @ok="modalFormOk"></torqueconfiguration-modal>
    <torqueconfiguration-modaledit  ref="modalFormedit" @ok="modalFormOk">></torqueconfiguration-modaledit>
    <!--<device-repair-model-add  ref="modalFormadd" @ok="modalFormOk"></device-repair-model-add>-->
    <!--<device-repair-model-edit ref="modalFormedit" @ok="modalFormOk"></device-repair-model-edit>-->
    <!--<repair-model ref="repairModelFrom" @ok="modalFormOk"></repair-model>-->
  </div>
</template>
<script>
  import moment from 'moment'
  import $ from 'jquery'
  import JDictSelectTag from '@/components/dict/JDictSelectTag'
  import JDate from '../../../../../components/jeecg/JDate'
  import {
    requestPut,
    deleteAction,
    getAction,
    downFile,
    getFileAccessHttpUrl
  } from '@/api/manage'
  import TorqueconfigurationModal from './TorqueconfigurationModal'
  import TorqueconfigurationModaledit from './TorqueconfigurationModalEdit'
  // import DeviceRepairModelAdd from './DeviceRepairModelAdd'
  // import DeviceRepairModelEdit from './DeviceRepairModelEdit'
  import '@/components/table2excel/table2excel'
  import {
    JeecgListMixin
  } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  import JEllipsis from '@/components/jeecg/JEllipsis'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api'
  export default {
    name: 'TorqueconfigurationList',
    mixins: [JeecgListMixin],
    components: {
      Tooltip,
      TorqueconfigurationModal,
      TorqueconfigurationModaledit,
      // DeviceRepairModelAdd,
      // DeviceRepairModelEdit,
      JDictSelectTag,
      JInput,
      JDate,
      JEllipsis
    },
    props: {  nodeTree: '', Type:'',nodePeople: '' },
    data() {
      return {
        typeTree:"",
        typeParent:1,
        typeEquipment:1,
        dates: [],
        xianshi:"",
        readOnly:true,
        queryParam: {},
        queryParams:{},
        queryParamEquip:{},
        queryParamPeople:{},
        dataStartsoucre:[],
        scrollY:465,
        /* åˆ†é¡µå‚æ•° */
        ipagination:{
          current: 1,
          pageSize: 30,
          pageSizeOptions: ['30', '50', '100'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " å…±" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        columns: [
          {
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentId',
            width:200
          },
          {
            title: '设备名称',
            align: 'center',
            dataIndex: 'equipmentName',
            width:250
            // defaultSortOrder:'descend',
            // sorter: (a, b) => {return a.equipmentName>b.equipmentName?1:-1}
          },
          {
            title: '时间',
            align: 'center',
            dataIndex: 'torqueDate',
            width:250
            // scopedSlots:{customRender:'startTime'},
            // customRender:(text,row,index) => {
            //   return moment(text).format("YYYY-MM-DD HH:mm:ss")
            // }
          },
          {
            title: '扭矩值',
            align: 'center',
            dataIndex: 'torqueValue',
            width:150
          },
          {
            title: '进给参数',
            align: 'center',
            dataIndex: 'feedParameter',
            width:150
          },
          {
            title: '备注',
            align: 'center',
            dataIndex: 'notes',
            width:250
          },
          {
            title: '操作',
            dataIndex: 'action',
            scopedSlots: {customRender: 'action'},
            align: "center",
            width: 150,
            fixed:'right'
          }
        ],
        url: {
          list: '/mdc/MdcTorqueConfig/pageList',
          delete: '/mdc/MdcTorqueConfig/deleteMdcTorqueConfig',
          deleteBatch: '/mdc/MdcTorqueConfig/deleteBatchMdcTorqueConfig',
          getEquipmentByPid: '/mdc/mdcequipment/getEquipmentByPid',
          exportXlsUrl: "/mdc/MdcTorqueConfig/exportXls",
          importExcelUrl: "/mdc/MdcTorqueConfig/importExcel",
        }
      }
    },
    watch:{
      Type(valmath){
        this.dataList = [];
        this.queryParams.typeTree = valmath
        console.log(valmath,'触发Type的watch方法')
        // console.log(this.queryParams.typeTree)
      },
      nodeTree(val) { //监听currSelected å˜åŒ–,将变化后的数值传递给 getCurrSelected äº‹ä»¶
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParamEquip.parentId =  ""
            this.queryParams.equipmentId = val.equipmentId
            this.queryParamEquip.equipmentId = val.equipmentId
          } else {
            this.queryParamEquip.parentId = val.key
            this.queryParams.equipmentId = ''
          }
          this.searchQuery()
        }
      },
      nodePeople(val){
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParamEquip.parentId =  ""
            this.queryParams.equipmentId = val.equipmentId
            this.queryParamEquip.equipmentId = val.equipmentId
          } else {
            this.queryParamPeople.parentId = val.key
            this.queryParams.equipmentId = ''
          }
          this.searchQuery()
        }
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      dateParamChange(v1, v2) {
        // console.log(v1,v2)
        this.queryParam.startTime = v2[0]
        this.queryParam.endTime = v2[1]
        // console.log(v2[0],v2[1])
      },
      onChange(value, dateString) {
        // console.log('Selected Time: ', value);
        // console.log('Formatted Selected Time: ', dateString);
      },
      onOk(value) {
        console.log('onOk: ', value);
      },
      /**
       * æŸ¥è¯¢åŒºåŸŸé‡ç½®æŒ‰é’®
       */
      searchReset() {
        if(this.queryParams.typeTree == "1"){
          console.log('第一个的typeTree',this.queryParams.typeTree)
          this.typeTree = this.queryParams.typeTree
          this.typeParent =  this.queryParams.parentId
          this.typeEquipment = this.queryParams.equipmentId
          this.queryParams = {}
          this.queryParam = {}
          this.dates = []
          this.queryParams.typeTree = this.typeTree
          this.queryParams.parentId = this.typeParent
          console.log('进入第一个')
          if(this.queryParams.parentId !=  ""){
            this.queryParams.equipmentId =  ""
          }else{
            if(this.queryParams.equipmentId == this.queryParamEquip.equipmentId){
              this.queryParams.equipmentId =  this.typeEquipment
            }else{
              this.queryParams.equipmentId = this.queryParamEquip.equipmentId
            }
          }
          this.ipagination.current = 1
          this.ResetloadData();
        }else{
          console.log('进入第二个')
          console.log('第二个的typeTree',this.queryParams.typeTree)
          this.typeTree = this.queryParams.typeTree
          this.typeParent =  this.queryParams.parentId
          // this.typeEquipment = this.queryParams.equipmentId
          this.queryParams = {}
          this.queryParam = {}
          this.dates = []
          this.queryParams.typeTree = this.typeTree
          this.queryParams.parentId = this.typeParent
          // this.queryParams.equipmentId =  this.typeEquipment
          this.ipagination.current = 1
          this.ResetloadData();
        }
      },
      ResetloadData() {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        var params = this.getQueryParams();//查询条件
        if(!params){
          return false;
        }
        params.typeTree = this.queryParams.typeTree
        params.parentId = this.queryParams.parentId
        params.equipmentId = this.queryParams.equipmentId
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records||res.result;
            // this.initDeviceType(this.dataSource)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            // this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      handleEdit: function (record) {
        this.$refs.modalFormedit.edit(record);
        this.$refs.modalFormedit.title = "编辑";
        this.$refs.modalFormedit.disableSubmit = false;
      },
      handleTableChange(pagination, filters, sorter) {
        this.dataSource = []
        //分页、排序、筛选变化时触发
        //TODO ç­›é€‰
        // console.log(pagination)
        if (Object.keys(sorter).length > 0) {
          this.isorter.column = sorter.field;
          this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
        }
        this.ipagination = pagination;
        //获取查询条件
        let sqp = {}
        if(this.superQueryParams){
          sqp['superQueryParams']=encodeURI(this.superQueryParams)
          sqp['superQueryMatchType'] = this.superQueryMatchType
        }
        var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters);
        param.pageNo = this.ipagination.current;
        param.pageSize = this.ipagination.pageSize;
        param.field = this.getQueryField();
        param.parentId = this.queryParams.parentId;
        param.equipmentId = this.queryParams.equipmentId;
        param.startTime = this.queryParam.startTime;
        param.endTime =  this.queryParam.endTime;
        getAction(this.url.list,param).then((res) => {
          if(res.success){
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      searchQueryEdit(){
        if(this.queryParams.typeTree == "1"){
          this.queryParams.parentId =  this.queryParamEquip.parentId
        }else{
          this.queryParams.parentId = this.queryParamPeople.parentId
          this.queryParams.equipmentIds = ""
        }
        this.dataSource = [];
        //获取查询条件
        let sqp = {}
        if(this.superQueryParams){
          sqp['superQueryParams']=encodeURI(this.superQueryParams)
          sqp['superQueryMatchType'] = this.superQueryMatchType
        }
        var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters);
        param.pageNo = this.ipagination.current;
        param.pageSize = this.ipagination.pageSize;
        param.field = this.getQueryField();
        param.parentId = this.queryParams.parentId;
        param.equipmentId = this.queryParams.equipmentId;
        param.startTime = this.queryParam.startTime;
        param.endTime =  this.queryParam.endTime;
        getAction(this.url.list,param).then((res) => {
          if(res.success){
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      searchQuery(){
        if(this.queryParams.typeTree == "1"){
          this.queryParams.parentId =  this.queryParamEquip.parentId
          // this.queryParams.equipmentId =  this.queryParamEquip.equipmentId
        }else{
          this.queryParams.parentId = this.queryParamPeople.parentId
          // this.queryParams.equipmentId = ""
        }
        this.dataSource = [];
        //获取查询条件
        let sqp = {}
        if(this.superQueryParams){
          sqp['superQueryParams']=encodeURI(this.superQueryParams)
          sqp['superQueryMatchType'] = this.superQueryMatchType
        }
        var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters);
        param.pageNo = 1;
        param.pageSize = this.ipagination.pageSize;
        param.field = this.getQueryField();
        param.parentId = this.queryParams.parentId;
        param.equipmentId = this.queryParams.equipmentId;
        param.startTime = this.queryParam.startTime;
        param.endTime =  this.queryParam.endTime;
        console.log('param',param);
        getAction(this.url.list,param).then((res) => {
          if(res.success){
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      handleExportXls(fileName){
        if(!fileName || typeof fileName != "string"){
          fileName = "导出文件"
        }
        let param = this.getQueryParams();
        if(this.selectedRowKeys && this.selectedRowKeys.length>0){
          param['selections'] = this.selectedRowKeys.join(",")
        }
        param.pageSize = this.ipagination.pageSize;
        param.field = this.getQueryField();
        param.parentId = this.queryParams.parentId;
        param.equipmentId = this.queryParams.equipmentId;
        param.startTime = this.queryParam.startTime;
        param.endTime =  this.queryParam.endTime;
        console.log("导出参数",param)
        downFile(this.url.exportXlsUrl,param).then((data)=>{
          if (!data) {
            this.$message.warning("文件下载失败")
            return
          }
          if (typeof window.navigator.msSaveBlob !== 'undefined') {
            window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
          }else{
            let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
            let link = document.createElement('a')
            link.style.display = 'none'
            link.href = url
            link.setAttribute('download', fileName+'.xls')
            document.body.appendChild(link)
            link.click()
            document.body.removeChild(link); //下载完成移除元素
            window.URL.revokeObjectURL(url); //释放掉blob对象
          }
        })
      },
      loadData(arg) {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        var params = this.getQueryParams();//查询条件
        if(!params){
          return false;
        }
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records||res.result;
            // this.initDeviceType(this.dataSource)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            // this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      modalFormOk(val) {
        // æ–°å¢ž/修改 æˆåŠŸæ—¶ï¼Œé‡è½½åˆ—è¡¨
        this.searchQueryEdit();
        // this.$emit('openBasetree','')
        this.selectedRowKeys = []
      },
      handleDelete: function (id) {
        if(!this.url.delete){
          this.$message.error("请设置url.delete属性!")
          return
        }
        var that = this;
        deleteAction(that.url.delete, {id: id}).then((res) => {
          if (res.success) {
            //重新计算分页问题
            that.reCalculatePage(1)
            // that.$message.success(res.message);
            that.$notification.success({
              message:'消息',
              description:res.message
            });
            that.searchQuery();
          } else {
            // that.$message.warning(res.message);
            that.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        });
      },
      batchDel: function () {
        if(!this.url.deleteBatch){
          this.$message.error("请设置url.deleteBatch属性!")
          return
        }
        if (this.selectedRowKeys.length <= 0) {
          // this.$message.warning('请选择一条记录!');
          this.$notification.warning({
            message:'消息',
            description:"请选择一条记录"
        });
          return;
        } else {
          var ids = "";
          for (var a = 0; a < this.selectedRowKeys.length; a++) {
            ids += this.selectedRowKeys[a] + ",";
          }
          var that = this;
          this.$confirm({
            title: "确认删除",
            content: "是否删除选中数据?",
            onOk: function () {
              that.loading = true;
              deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
                if (res.success) {
                  //重新计算分页问题
                  that.reCalculatePage(that.selectedRowKeys.length)
                  // that.$message.success(res.message);
                  that.$notification.warning({
                    message:'消息',
                    description:res.message
                  });
                  that.loadData();
                  that.onClearSelected();
                } else {
                  // that.$message.warning(res.message);
                  that.$notification.warning({
                    message:'消息',
                    description:res.message
                  });
                }
              }).finally(() => {
                that.loading = false;
              });
            }
          });
        }
      },
      handleAdd() {
        console.log(this.$refs.modalForm.edit)
        this.$refs.modalForm.add(this.node)
        this.$refs.modalForm.title = '新增'
        this.$refs.modalForm.disableSubmit = false
      },
      handleAddXIU() {
        this.$refs.modalFormadd.add()
        this.$refs.modalFormadd.title = '新增'
        this.$refs.modalFormadd.disableSubmit = false
      },
      pQuery(parentId) {
        this.queryParam.parentId = parentId[0]
        if(this.selectedRowKeys.length >= 1) {
          this.selectedRowKeys.length = 0
        }
        this.loadData()
      },
      onSelectChange(selectedRowKeys) {
        this.selectedRowKeys = selectedRowKeys
      },
      initEquipment(id) {
        let _this = this
        getAction(this.url.getEquipmentByPid, { pid: id }).then((res) => {
          if (res.success) {
            if (res.result) {
              _this.$set(this.queryParams, 'equipmentName', res.result.equipmentName)
              _this.$set(this.queryParams, 'equipmentId', res.result.equipmentId)
              _this.equipment = res.result
              _this.searchQuery()
            } else {
              // _this.$message.warning('请配置设备!')
              _this.$notification.warning({
                message:'消息',
                description:'请联系管理员,开放设备权限!'
              });
            }
          }
        })
      },
      exportExcel() {
        $("#DeviceList").table2excel({
          exclude: ".noExl",
          name: "Excel Document Name",
          filename: "扭矩配置",
          exclude_img: true,
          fileext: ".xls",
          exclude_links: true,
          exclude_inputs: true
        });
      },
      /**
       * å½“浏览器可视窗口尺寸发生改变时触发
       */
      handleWindowResize(){
        const boxHeight = +window.getComputedStyle(document.getElementById('DeviceList')).height.slice(0,-2)
        const tableHeadHeight = +window.getComputedStyle(document.querySelector('.ant-table-thead th')).height.slice(0,-2)
        this.scrollY = boxHeight - tableHeadHeight - 50
      }
      // /**
      //  * è½¦é—´é€‰ä¸­é¡¹å–消后触发此事件,由BaseTree组件由事件总线触发
      //  * @param value æç¤ºä¿¡æ¯
      //  */
      // treeClearSelected(value){
      //   this.queryParams.equipmentId=''
      //   this.queryParams.parentId=''
      //   this.ResetloadData()
      // }
    },
    created() {
      this.queryParam.typeTree = "1"
      // this.$bus.$on('treeClearSelected',this.treeClearSelected)
    },
    mounted(){
      window.addEventListener('resize',this.handleWindowResize)
      this.handleWindowResize()
    },
    beforeDestroy(){
      window.removeEventListener('resize',this.handleWindowResize)
    }
  }
</script>
<style lang="less" scoped>
  @import '~@assets/less/common.less';
  .device_list{
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  @media screen and (min-width: 1920px){
    .device_list{
      height: 811px!important;
    }
  }
  @media screen and (min-width: 1680px) and (max-width: 1920px){
    .device_list{
      height: 811px!important;
    }
  }
  @media screen and (min-width: 1400px) and (max-width: 1680px){
    .device_list{
      height: 663px!important;
    }
  }
  @media screen and (min-width: 1280px) and (max-width: 1400px){
    .device_list{
      height: 564px!important;
    }
  }
  @media screen and (max-width: 1280px){
    .device_list{
      height: 564px!important;
    }
  }
</style>
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,385 @@
<template>
  <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading"
           :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="设备组" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input-search :readOnly="true" v-decorator="['equipmentIds', validatorRules.equipmentIds]"
                              @search="deviceSearch" enter-button placeholder="请选择设备"/>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择时间"
                      v-decorator="['torqueDate', validatorRules.torqueDate]" style="width: 100%"></j-date>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="扭矩值" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input-number :min="0" :disabled="disableSubmit" placeholder="请输入扭矩值"
                              v-decorator="['torqueValue', validatorRules.torqueValue]"/>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="进给参数" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input placeholder="请输入进给参数" v-decorator="['feedParameter', validatorRules.feedParameter]"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item label="备注" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
              <a-textarea :maxLength="20" v-decorator="['notes', validatorRules.notes]"
                          placeholder="请输入备注"></a-textarea>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <select-device-drawer ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'选择设备'"/>
  </a-modal>
</template>
<script>
  import moment from 'moment'
  import pick from 'lodash.pick'
  import TorqueconfigurationModalList from './TorqueconfigurationModalList'
  // import JDate from './JDate'
  import {
    getAction,
    postAction,
    requestPut
  } from '@/api/manage'
  import {
    duplicateCheck
  } from '@/api/api'
  import SelectDeviceDrawer from '../../../../system/modules/SelectDeviceDrawer'
  export default {
    name: 'TorqueconfigurationModal',
    components: { SelectDeviceDrawer },
    props: {},
    data() {
      return {
        mesag: 21,
        readOnly: true,
        title: '',
        visible: false,
        show: false,
        model: {},
        checked: false,
        startData: '',
        endData: '',
        labelCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 6
          }
        },
        wrapperCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 18
          }
        },
        labelColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 3
          }
        },
        wrapperColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 21
          }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {
          equipmentIds: {
            rules: [
              {
                required: true,
                message: '请选择设备'
              }
            ]
          },
          torqueDate: {
            rules: [
              {
                required: true,
                message: '请选择时间'
              }
            ]
          },
          torqueValue: {
            rules: [
              {
                required: true,
                message: '请输入扭矩值'
              }
            ]
          },
          feedParameter:{
            rules:[
              {
                required:true,
                message:'请输入进给参数'
              }
            ]
          }
        },
        url: {
          add: '/mdc/MdcTorqueConfig/addMdcTorqueConfig',
          edit: '/mdc/MdcTorqueConfig/editMdcTorqueConfig'
        },
        disableSubmit: true,
        partCategoryCascade: [],
        cascadeDefaultValue: []
      }
    },
    created() {
    },
    methods: {
      // disabledDate(current){
      //   //Can not slect days before today and today
      //   // return current && current < moment().endOf("day");
      //   return current < moment().subtract(+1, 'day')//今天之前的年月日不可选,不包括今天
      // },
      moment,
      // onChange(dates) {
      //   // console.log(111)
      //   // console.log(dates,dateStrings)
      //   // console.log('From: ', dates[0], ', to: ', dates[1]);
      //   // console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
      //   // this.startTime = dateStrings[0];
      //   // this.endData = dateStrings[1];
      //   // console.log(this.startData,this.endData);
      // },
      onChangeEnd(dates, dateStrings) {
        this.endTime = dateStrings[0]
      },
      getDeviceRows(val) {
        var equipmentIds
        for (var i = 0; i < val.length; i++) {
          if (i == 0) {
            equipmentIds = val[i].equipmentId
          } else {
            equipmentIds = equipmentIds + ',' + val[i].equipmentId
          }
        }
        // console.log("========",equipmentIds);
        this.form.setFieldsValue({
          equipmentIds: equipmentIds
        })
        //   this.form.setFieldsValue({
        // equipmentId: val.equipmentId,
        // equipmentName: val.equipmentName,
        // equipmentModel: val.equipmentModel,
        // equipmentIp: val.equipmentIp,
        // dataPort: val.dataPort,
        // driveType: val.driveType
        // })
      },
      deviceSearch() {
        this.$refs.selectDeviceDrawer.visible = true
        this.$refs.selectDeviceDrawer.selectedRowKeys = []
        this.$refs.selectDeviceDrawer.selectedRows = []
        this.$refs.selectDeviceDrawer.checkedKeys = this.form.getFieldValue('equipmentIds') ? this.form.getFieldValue('equipmentIds').split(',') : []
      },
      //级联框onChange事件
      // onChange(value) {
      //
      // },
      getParentIdsById(id) {
        let that = this
        getAction(this.url.getParentIdsById, {
          id: id
        }).then((res) => {
          if (res.success) {
            that.form.setFieldsValue({
              partCategoryId: res.result
            })
          }
        })
      },
      add(node) {
        let _this = this
        this.visible = true
        this.form.resetFields()
        this.model = {}
        this.$nextTick(() => {
          // _this.form.setFieldsValue({ 'tierType': node.entity.tierType + 1, 'parentName': node.title })
          // _this.model.parentId = node.key
        })
      },
      edit(record) {
        this.form.resetFields()
        this.model = Object.assign({}, record)
        this.visible = true
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, 'equipmentIds', 'equipmentName', 'mdcRepairType', 'startTime', 'endTime'
          ))
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
        this.show = false
      },
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            // let start = moment(formData.startTime).format('YYYY-MM-DD HH:mm:ss');
            // let end = moment(formData.endTime).format('YYYY-MM-DD HH:mm:ss');
            // let startOne = start.replace(/:/g,'');
            // let endOne = end.replace(/:/g,'');
            // var data = new Date();
            // let stertDate = moment(data).format("YYYY-MM-DD HH:mm:ss");
            // let dataStart = stertDate.replace(/:/g,'');
            // if(startOne < dataStart){
            //   that.$message.warning("开始时间不能小于当前时间")
            //   that.confirmLoading = false
            // }else{
            //   if(startOne>=endOne){
            //     that.$message.warning("结束时间不能小于开始时间");
            //     // console.log(this.model)
            //     // this.endTime = ''
            //     that.confirmLoading = false
            //   }else{
            let obj
            if (!this.model.id) {
              obj = postAction(this.url.add, formData)
            } else {
              obj = requestPut(this.url.edit, formData, {
                id: this.model.id
              })
            }
            obj.then((res) => {
              if (res.success) {
                // that.$message.success("添加成功")
                that.$notification.success({
                  message: '消息',
                  description: '添加成功'
                })
                // that.$message.success(res.message)
                that.$emit('ok', res.result)
              } else {
                // that.$message.warning(res.message)
                that.$notification.warning({
                  message: '消息',
                  description: res.message
                })
              }
            }).finally(() => {
              that.confirmLoading = false
              that.close()
            })
          }
          // }
          // }
        })
      },
      handleCancel() {
        this.close()
      },
      // loadCascade() {
      //   getAction(this.url.loadCascadeData).then((res) => {
      //     if (res.success) {
      //       this.partCategoryCascade = res.result
      //     }
      //   })
      // },
      onCascadeChange(value, selectedOptions) {
        this.cascadeDefaultValue = [...value]
      },
      filter(inputValue, path) {
        return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
      },
      //验证 ç¼–码
      validateNum(rule, value, callback) {
        var params = {
          tableName: 'lxmes_base_part',
          fieldName: 'num',
          fieldVal: value,
          dataId: this.model.id,
          //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
          delFlag: 'true'
        }
        duplicateCheck(params).then((res) => {
          if (res.success) {
            callback()
          } else {
            callback('存货编码已存在!')
          }
        })
      },
      checkboxChange(e) {
        this.checked = e.target.checked
      },
      /**
       * é€‰æ‹©å·²æœ‰è®¾å¤‡åŽç‚¹å‡»ç¡®å®šæ—¶è§¦å‘
       * @param data å·²é€‰æ‹©çš„设备
       */
      selectOK(data) {
        // let params = {}
        // params.equipmentIdList = []
        // for (var a = 0; a < data.length; a++) {
        //   params.equipmentIdList.push(data[a])
        // }
        console.log('data=', data)
        this.form.setFieldsValue({
          equipmentIds: data.join(',')
        })
      }
    }
  }
</script>
<style scoped lang="less">
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
  /deep/ .ant-input-number {
    width: 100% !important;
  }
</style>
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalEdit.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,372 @@
<template>
  <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading"
           :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="设备编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="请输入设备编号"
                       v-decorator="['equipmentId',validatorRules.equipmentId]"/>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="设备名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="请输入设备名称"
                       v-decorator="['equipmentName',validatorRules.equipmentName]"/>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择时间"
                      class="query-group-cust" v-decorator="['torqueDate', validatorRules.torqueDate]" style="width: 100%"></j-date>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="扭矩值" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input-number :min="0" :disabled="disableSubmit" placeholder="请输入扭矩值"
                       v-decorator="['torqueValue', validatorRules.torqueValue]"/>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="进给参数" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input placeholder="请输入进给参数" v-decorator="['feedParameter', validatorRules.feedParameter]"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-form-item label="备注" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
            <a-textarea :maxLength="20" :disabled="disableSubmit"  v-decorator="['notes', validatorRules.notes]" placeholder="请输入备注"  ></a-textarea>
          </a-form-item>
        </a-row>
      </a-form>
    </a-spin>
    <!--<device-repair-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-repair-list-model>-->
    <!--<device-repair-edit-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-repair-edit-list-model>-->
  </a-modal>
</template>
<script>
  import moment from 'moment'
  import pick from 'lodash.pick'
  // import DeviceRepairListModel from './DeviceRepairListModel'
  // import DeviceRepairEditListModel from './DeviceRepairEditListModel'
  // import JDate from './JDate'
  import {
    getAction,
    postAction,
    requestPut
  } from '@/api/manage'
  import {
    duplicateCheck
  } from '@/api/api'
  export default {
    name: 'TorqueconfigurationModalEdit',
    // components: {DeviceRepairListModel,JDate,DeviceRepairEditListModel},
    props: {},
    data() {
      return {
        readOnly:true,
        title: '',
        visible: false,
        show: false,
        model: {},
        checked: false,
        startData:"",
        endData:"",
        labelCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 6
          }
        },
        wrapperCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 18
          }
        },
        labelColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 3
          }
        },
        wrapperColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 21
          }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {
          equipmentId:{
            rules:[
              {
                required:true,
                message: ""
              },
            ],
          },
          equipmentName:{
            rules:[
              {
                required:true,
                message: ""
              },
            ],
          },
          torqueDate:{
            rules:[
              {
                required:true,
                message: "请选择时间"
              },
            ],
          },
          torqueValue:{
            rules:[
              {
                required:true,
                message: "请输入扭矩值"
              },
            ],
          },
          feedParameter:{
            rules:[
              {
                required:true,
                message:'请输入进给参数'
              }
            ]
          }
          // mdcRepairType:{
          //   rules:[
          //     {
          //       required:true,
          //       message: ""
          //     },
          //   ],
          //   initialValue: '休班'
          // }
        },
        url: {
          add: '/mdc/mdcEquipmentRepair/add',
          edit: '/mdc/MdcTorqueConfig/editMdcTorqueConfig'
        },
        disableSubmit: true,
        partCategoryCascade: [],
        cascadeDefaultValue: [],
        editStart:''
      }
    },
    created() {
    },
    methods: {
      disabledDate(current){
        //Can not slect days before today and today
        // return current && current < moment().endOf("day");
        return current < moment().subtract(+1, 'day')//今天之前的年月日不可选,不包括今天
      },
      moment,
      // onChange(dates) {
      //   console.log(111)
      //   console.log(dates,dateStrings)
      //   // console.log('From: ', dates[0], ', to: ', dates[1]);
      //   // console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
      //   // this.startTime = dateStrings[0];
      //   // this.endData = dateStrings[1];
      //   // console.log(this.startData,this.endData);
      // },
      onChangeEnd(dates, dateStrings){
        this.endTime = dateStrings[0];
      },
      getDeviceRows(val) {
        this.form.setFieldsValue({
          equipmentId: val.equipmentId,
          equipmentName: val.equipmentName,
        //   // equipmentModel: val.equipmentModel,
        //   // equipmentIp: val.equipmentIp,
        //   // dataPort: val.dataPort,
        //   // driveType: val.driveType
        })
        // var equipmentIds;
        // for(var i = 0;i<val.length;i++){
        //   if (i == 0) {
        //     equipmentIds =  val[i].equipmentId;
        //   } else {
        //     equipmentIds = equipmentIds + "," + val[i].equipmentId;
        //   }
        // }
        // console.log("========",equipmentIds);
        // this.form.setFieldsValue({
        //   equipmentId: equipmentIds,
        // })
      },
      deviceSearch() {
        this.$refs.deviceRepairListModel.openPage()
        this.$refs.deviceRepairListModel.title = '选择设备'
        this.$refs.deviceRepairListModel.disableSubmit = false
      },
      //级联框onChange事件
      // onChange(value) {
      //
      // },
      getParentIdsById(id) {
        let that = this
        getAction(this.url.getParentIdsById, {
          id: id
        }).then((res) => {
          if (res.success) {
            that.form.setFieldsValue({
              partCategoryId: res.result
            })
          }
        })
      },
      add(node) {
        let _this = this
        this.visible = true
        this.form.resetFields()
        this.model = {}
        this.$nextTick(() => {
          // _this.form.setFieldsValue({ 'tierType': node.entity.tierType + 1, 'parentName': node.title })
          // _this.model.parentId = node.key
        })
      },
      edit(record) {
        this.form.resetFields()
        this.model = Object.assign({}, record)
        // this.editStart  = (this.model.startTime).replace(/:/g,'');
        this.visible = true
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,'equipmentId', 'equipmentName','torqueDate', 'torqueValue','feedParameter','notes'
          ))
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
        this.show = false
      },
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            let obj
            if (!this.model.id) {
              obj = postAction(this.url.add, formData)
            } else {
              obj = requestPut(this.url.edit, formData, {
                id: this.model.id
              })
            }
            obj.then((res) => {
              if (res.success) {
                // that.$message.success("修改成功")
                that.$notification.success({
                  message:'消息',
                  description:"修改成功"
                });
                // that.$message.success(res.message)
                that.$emit('ok', res.result)
              } else {
                // that.$message.warning(res.message)
                that.$notification.warning({
                  message:'消息',
                  description:res.message
                });
              }
            }).finally(() => {
              that.confirmLoading = false
              that.close()
            })
          }
        })
      },
      handleCancel() {
        this.close()
      },
      // loadCascade() {
      //   getAction(this.url.loadCascadeData).then((res) => {
      //     if (res.success) {
      //       this.partCategoryCascade = res.result
      //     }
      //   })
      // },
      onCascadeChange(value, selectedOptions) {
        this.cascadeDefaultValue = [...value]
      },
      filter(inputValue, path) {
        return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
      },
      //验证 ç¼–码
      validateNum(rule, value, callback) {
        var params = {
          tableName: 'lxmes_base_part',
          fieldName: 'num',
          fieldVal: value,
          dataId: this.model.id,
          //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
          delFlag: 'true'
        }
        duplicateCheck(params).then((res) => {
          if (res.success) {
            callback()
          } else {
            callback('存货编码已存在!')
          }
        })
      },
      checkboxChange(e) {
        this.checked = e.target.checked
      }
    }
  }
</script>
<style scoped lang="less">
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
  /deep/ .ant-input-number{
    width: 100%!important;
  }
</style>
src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,340 @@
<template>
  <a-modal :title="title" width="70%" :visible="visible" :maskClosable="false" @ok="handleOk" @cancel="handleCancel"
           cancelText="关闭">
    <a-card :bordered="false">
      <!-- æŸ¥è¯¢åŒºåŸŸ -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="6" :sm="6"  v-if="isDepartType == 0">
              <a-form-item label="部门" v-if="isDepartType == 0">
                <!--<a-select v-model="queryParam.sectionPid" placeholder="请选择部门" :options="sectionPData" @change="initGroupOptions" />-->
                <a-tree-select
                  v-model="value"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  :tree-data="treeData"
                  placeholder="请选择部门"
                  tree-default-expand-all
                >
                  <!--<span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">-->
                  <!--Child Node1 {{ value }}-->
                  <!--</span>-->
                </a-tree-select>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="车间" >
                <!--<a-select v-model="queryParam.sectionId" placeholder="请选择团队" :options="sectionData"/>-->
                <a-tree-select
                  v-model="valueProduct"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  :tree-data="sectionData"
                  placeholder="请选择车间"
                  tree-default-expand-all
                >
                  <!--<span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">-->
                  <!--Child Node1 {{ value }}-->
                  <!--</span>-->
                </a-tree-select>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="统一编码">
                <a-input placeholder="请输入统一编码检索" v-model="queryParam.equipmentId"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="设备名称">
                <a-input placeholder="请输入设备名称检索" v-model="queryParam.equipmentName"></a-input>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
      <div class="table-operator">
        <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
        <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
      </div>
      <!-- table区域-begin -->
      <div>
        <a-table ref="table" size="middle" bordered rowKey="id" :scroll="{  y: 400 }" :columns="columns"
                 :dataSource="dataSource" :pagination="ipagination" :loading="loading"
                 :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
                 @change="handleTableChange">
        </a-table>
      </div>
      <!-- table区域-end -->
    </a-card>
  </a-modal>
</template>
<script>
  import {mapActions} from 'vuex'
  import {
    ajaxGetSelectItems
  } from '@/api/api'
  import JDictSelectTag from '@/components/dict/JDictSelectTag'
  import {
    deleteAction,
    requestPut,
    getAction,
    postAction
  } from '@/api/manage'
  import {
    JeecgListMixin
  } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  import JEllipsis from '@/components/jeecg/JEllipsis'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import JDate from '@/components/jeecg/JDate'
  import moment from 'moment'
  export default {
    name: 'DeviceCalendarListModel',
    mixins: [JeecgListMixin],
    components: {
      JDictSelectTag,
      JEllipsis,
      JInput,
      Tooltip,
      JDate
    },
    props: {
      status: {
        type: Number,
        default: 1
      }
    },
    data() {
      return {
        isDepartType:'',
        /*readOnly:true,*/
        title:'',
        visible: false,
        SelectedList:[],
        treeData:[],
        /*disableMixinCreated: true,
        queryParam: {},*/
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },{
            title: '统一编码',
            align: 'center',
            dataIndex: 'equipmentId',
          },
          {
            title: '设备名称',
            align: 'center',
            dataIndex: 'equipmentName',
          },
          {
            title: '驱动类型',
            align: 'center',
            dataIndex: 'driveType'
          },
          {
            title: '数控系统',
            align: 'center',
            dataIndex: 'controlSystem'
          },
        ],
        sectionPData: [],
        sectionData: [],
        url: {
          list: '/mdc/mdcEquipment/findEquipmentList',
          loadOptions: '/sys/sysDepart/loadDepartTreeOptions',
          loadProductionOptions:'/mdc/mdcProduction/loadProductionTreeOptions'
        },
        value:undefined,
        valueProduct:undefined
      }
    },
    created() {
      this.queryTreeData()
    },
    watch: {
      value(value) {
        // console.log(value);
        this.queryParam.departId = value
      },
      valueProduct(value){
        this.queryParam.productionId = value
      }
    },
    methods: {
      ...mapActions(['QueryDepartTree']),
      queryTreeData() {
        this.QueryDepartTree().then(res => {
          if (res.success) {
            this.isDepartType = res.result[0].value
          } else {
            // this.$message.warn(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() =>{
        })
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        // this.SelectedList.push(selectedRowKeys);
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows
        // this.SelectedList =[...this.SelectedList,...selectionRows];
        // console.log(this.SelectedList);
      },
      handleTableChange(pagination, filters, sorter) {
        // this.onClearSelected()
        //分页、排序、筛选变化时触发
        //TODO ç­›é€‰
        if (Object.keys(sorter).length > 0) {
          this.isorter.column = sorter.field;
          this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
        }
        this.ipagination = pagination;
        this.loadData();
      },
      openPage() {
        this.visible = true
        this.onClearSelected()
        this.dataSource = [];
        this.queryParam = {
          status: this.status
        };
        this.loadData();
        this.initOptions();
        this.initGroupOptions()
      },
      loadData(arg) {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        var params = this.getQueryParams();//查询条件
        if(!params){
          return false;
        }
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            // console.log(res)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      modalFormOk(val) {
        // æ–°å¢ž/修改 æˆåŠŸæ—¶ï¼Œé‡è½½åˆ—è¡¨
        this.loadData();
        this.selectedRowKeys = [val.id];
      },
      searchQuery() {
        this.loadData();
        this.onClearSelected()
      },
      searchReset() {
        this.queryParam = {
          status: 1
        };
        this.loadData();
        this.onClearSelected()
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      handleCancel() {
        this.close()
      },
      handleOk() {
        // this.selectionRows =  this.SelectedList;
        // console.log(this.selectionRows);
        this.$emit('sendSelectionRows', this.selectionRows)
        this.close()
      },
      initOptions() {
        getAction(this.url.loadOptions).then(res => {
          if (res.success) {
            this.treeData = res.result
          } else {
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        })
      },
      initGroupOptions() {
        getAction(this.url.loadProductionOptions).then(res => {
          if (res.success) {
            this.sectionData = res.result
          } else {
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        })
      }
    },
  }
</script>
<style>
  @import '~@assets/less/common.less';
  .frozenRowClass {
    color: #c9c9c9;
  }
  .success {
    color: green;
  }
  .error {
    color: red;
  }
</style>
src/views/mdc/base/modules/deviceRepair/DeviceRepairEditListModel.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,238 @@
<template>
  <a-modal :title="title" :width="1000" :visible="visible" :maskClosable="false" @ok="handleOk" @cancel="handleCancel"
           cancelText="关闭">
    <a-card :bordered="false">
      <!-- æŸ¥è¯¢åŒºåŸŸ -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="6" :sm="6">
              <a-form-item label="统一编码">
                <a-input placeholder="请输入统一编码检索" v-model="queryParam.equipmentId"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="设备名称">
                <a-input placeholder="请输入设备名称检索" v-model="queryParam.equipmentName"></a-input>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
      <div class="table-operator">
        <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
        <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
      </div>
      <!-- table区域-begin -->
      <div>
        <a-table ref="table" size="middle" bordered rowKey="id" :scroll="{  y: 300 }" :columns="columns"
                 :dataSource="dataSource" :pagination="ipagination" :loading="loading"
                 :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:'radio'}"
                 @change="handleTableChange">
        </a-table>
      </div>
      <!-- table区域-end -->
    </a-card>
  </a-modal>
</template>
<script>
  import {
    ajaxGetSelectItems
  } from '@/api/api'
  import JDictSelectTag from '@/components/dict/JDictSelectTag'
  import {
    deleteAction,
    requestPut,
    getAction,
    postAction
  } from '@/api/manage'
  import {
    JeecgListMixin
  } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  import JEllipsis from '@/components/jeecg/JEllipsis'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import JDate from '@/components/jeecg/JDate'
  import moment from 'moment'
  export default {
    name: 'DeviceRepairEditListModel',
    mixins: [JeecgListMixin],
    components: {
      JDictSelectTag,
      JEllipsis,
      JInput,
      Tooltip,
      JDate
    },
    props: {
      status: {
        type: Number,
        default: 1
      }
    },
    data() {
      return {
        readOnly:true,
        title:'',
        visible: false,
        disableMixinCreated: true,
        queryParam: {},
        columns: [{
          title: '统一编码',
          align: 'center',
          dataIndex: 'equipmentId',
        },
          {
            title: '设备名称',
            align: 'center',
            dataIndex: 'equipmentName',
          },
          // {
          //   title: '设备型号',
          //   align: 'center',
          //   dataIndex: 'equipmentModel',
          // },
          // // {
          // //   title: '设备类型',
          // //   align: 'center',
          // //   dataIndex: 'equipmentType',
          // // },
          // {
          //   title: '机床IP',
          //   align: 'center',
          //   dataIndex: 'equipmentIp',
          // },
          // {
          //   title: '驱动类型',
          //   align: 'center',
          //   dataIndex: 'driveType',
          // },
          // {
          //   title: '端口',
          //   align: 'center',
          //   dataIndex: 'dataPort',
          // },
          // {
          //   title: '数控系统',
          //   align: 'center',
          //   dataIndex: 'controlSystem',
          // }
        ],
        url: {
          list: '/mdc/mdcequipment/findListEquipment',
        },
      }
    },
    created() {
    },
    methods: {
      openPage() {
        this.visible = true
        this.onClearSelected()
        this.dataSource = [];
        this.queryParam = {
          status: this.status
        };
        this.loadData();
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        // this.SelectedList.push(selectedRowKeys);
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows
        // this.SelectedList =[...this.SelectedList,...selectionRows];
        // console.log(this.SelectedList);
      },
      loadData(arg) {
        if(!this.url.list){
          // this.$message.error("请设置url.list属性!")
          this.$notification.error({
            message:'消息',
            description:"请设置url.list属性!"
          });
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        var params = this.getQueryParams();//查询条件
        if(!params){
          return false;
        }
        this.loading = true;
        postAction(this.url.list, params).then((res) => {
          if (res.success) {
            // console.log(res)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      modalFormOk(val) {
        // æ–°å¢ž/修改 æˆåŠŸæ—¶ï¼Œé‡è½½åˆ—è¡¨
        this.loadData();
        this.selectedRowKeys = [val.id];
      },
      searchQuery() {
        this.loadData();
        this.onClearSelected()
      },
      searchReset() {
        this.queryParam = {
          status: 1
        };
        this.loadData();
        this.onClearSelected()
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      handleCancel() {
        this.close()
      },
      handleOk() {
        this.$emit('sendSelectionRows', this.selectionRows[0])
        this.close()
      },
    },
  }
</script>
<style>
  @import '~@assets/less/common.less';
  .frozenRowClass {
    color: #c9c9c9;
  }
  .success {
    color: green;
  }
  .error {
    color: red;
  }
</style>
src/views/mdc/base/modules/deviceRepair/DeviceRepairList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,638 @@
<template>
  <div class="device_list">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div style="background-color: #fff" class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24" style="width: 100%;">
          <a-col :md="7" :sm="7">
            <a-form-item label="时间">
              <a-range-picker @change="dateParamChange" v-model="dates"  format="YYYY-MM-DD HH:mm:ss"/>
            </a-form-item>
          </a-col>
          <a-col :md="5" :sm="5">
            <a-form-item label="设备编号">
              <a-input placeholder="输入设备编号查询" v-model="queryParams.equipmentId"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="5" :sm="5" :xs="5">
            <a-form-item label="设备名称">
              <a-input placeholder="输入设备名称查询" v-model="queryParams.equipmentName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="2" :sm="2" :xs="2">
            <a-space>
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
            </a-space>
          </a-col>
          <!--<a-col :md="2" :sm="3" :xs="3">-->
            <!--<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>-->
          <!--</a-col>-->
          <!--<a-col :md="2" :sm="2" :xs="2">-->
            <!--<a-button type="primary" @click="searchReset" icon="reload">重置</a-button>-->
          <!--</a-col>-->
          <!--<a-col :lg="2" :md="3" :sm="3" :xs="3">-->
            <!--&lt;!&ndash;<a-button type="primary" @click="exportExcel" icon="download">导出</a-button>&ndash;&gt;-->
            <!--<a-button type="primary" @click="handleExportXls('维修休班管理')" icon="download">导出</a-button>-->
          <!--</a-col>-->
        </a-row>
      </a-form>
    </div>
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator" style="display: inline;">
      <a-button  @click="handleAdd" type="primary" icon="plus">新增
      </a-button>
      <a-button type="primary" @click="handleExportXls('维修休班管理')" icon="download">导出</a-button>
      <!--<a-button v-has="'user.add'"  @click="handleAddXIU" type="primary" icon="plus">休班新增-->
      <!--</a-button>-->
    </div>
    <!-- table区域-begin -->
    <div id="DeviceList" style="flex: 1;overflow: hidden">
      <a-table ref="table" bordered size="middle" rowKey="id" :columns="columns"
               :dataSource="dataSource" :pagination="ipagination" :loading="loading"
               :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
               @change="handleTableChange" :scroll="{x:'max-content',y:scrollY}">
        <span slot="action" slot-scope="text, record">
        <a @click="handleEdit(record)">编辑</a>
            <a-divider type="vertical" />
          <a @click="handleDelete(record.id)">删除</a>
        </span>
        <!--字符串超长截取省略号显示-->
        <span slot="num" slot-scope="text" style="font-weight: bold">
          <j-ellipsis :value="text" :length="8"/>
        </span>
        <span slot="name" slot-scope="text" style="font-weight: bold">
          <j-ellipsis :value="text" :length="8"/>
        </span>
        <span slot="model" slot-scope="text" style="font-weight: bold">
          <j-ellipsis :value="text" :length="8"/>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <device-repair-model ref="modalForm" :equipmentId="queryParams.equipmentId" @ok="modalFormOk"></device-repair-model>
    <!--<device-repair-model-add  ref="modalFormadd" @ok="modalFormOk"></device-repair-model-add>-->
    <device-repair-model-edit ref="modalFormedit" @ok="modalFormOk"></device-repair-model-edit>
    <!--<repair-model ref="repairModelFrom" @ok="modalFormOk">0</repair-model>-->
  </div>
</template>
<script>
  import moment from 'moment'
  import $ from 'jquery'
  import JDictSelectTag from '@/components/dict/JDictSelectTag'
  import JDate from '../../../../../components/jeecg/JDate'
  import {
    requestPut,
    deleteAction,
    getAction
  } from '@/api/manage'
  import DeviceRepairModel from './DeviceRepairModel'
  import DeviceRepairModelAdd from './DeviceRepairModelAdd'
  import DeviceRepairModelEdit from './DeviceRepairModelEdit'
  import '@/components/table2excel/table2excel'
  import {
    JeecgListMixin
  } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  import JEllipsis from '@/components/jeecg/JEllipsis'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api'
  import ACol from 'ant-design-vue/es/grid/Col'
  export default {
    name: 'DeviceRepairList',
    mixins: [JeecgListMixin],
    components: {
      ACol,
      Tooltip,
      DeviceRepairModel,
      DeviceRepairModelAdd,
      DeviceRepairModelEdit,
      JDictSelectTag,
      JInput,
      JDate,
      JEllipsis
    },
    props: {  nodeTree: '', Type:'',nodePeople: '' },
    data() {
      return {
        typeTree:"",
        typeParent:1,
        typeEquipment:1,
        dates: [],
        xianshi:"",
        readOnly:true,
        queryParam: {},
        queryParams:{},
        queryParamEquip:{},
        queryParamPeople:{},
        dataStartsoucre:[],
        scrollY:465,
        /* åˆ†é¡µå‚æ•° */
        ipagination:{
          current: 1,
          pageSize: 30,
          pageSizeOptions: ['30', '50', '100'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " å…±" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        columns: [
          {
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentId',
            width:250
          },
          {
            title: '设备名称',
            align: 'center',
            dataIndex: 'equipmentName',
            defaultSortOrder:'descend',
            sorter: (a, b) => {return a.equipmentName>b.equipmentName?1:-1},
            width:250
          },
          {
            title: '维修类型',
            align: 'center',
            dataIndex: 'mdcRepairTypeDictText',
            width:250
          },
          {
            title: '开始时间',
            align: 'center',
            dataIndex: 'startTime',
            width:250
            // scopedSlots:{customRender:'startTime'},
            // customRender:(text,row,index) => {
            //   return moment(text).format("YYYY-MM-DD HH:mm:ss")
            // }
          },
          {
            title: '结束时间',
            align: 'center',
            dataIndex: 'endTime',
            width:250
          },
          {
            title: '操作',
            dataIndex: 'action',
            scopedSlots: {customRender: 'action'},
            align: "center",
            width: 150,
            fixed:'right'
          }
        ],
        url: {
          list: '/mdc/mdcEquipmentRepair/pageList',
          deleteBatch: '/mdc/mdcEquipmentRepair/delete',
          getEquipmentByPid: '/mdc/mdcequipment/getEquipmentByPid',
          exportXlsUrl:'/mdc/mdcEquipmentRepair/exportXls'
        }
      }
    },
    watch:{
      Type(valmath){
        this.dataList = [];
        this.queryParams.typeTree = valmath
        // console.log(this.queryParams.typeTree)
      },
      nodeTree(val) { //监听currSelected å˜åŒ–,将变化后的数值传递给 getCurrSelected äº‹ä»¶
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParamEquip.parentId =  ""
            this.queryParams.equipmentId = val.equipmentId
            this.queryParamEquip.equipmentId = val.equipmentId
          } else {
            this.queryParamEquip.parentId = val.key
            this.queryParams.equipmentId =''
          }
        }else{
          this.queryParams.equipmentId=''
          this.queryParamEquip.parentId = ""
        }
        this.searchQuery()
      },
      nodePeople(val){
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParamEquip.parentId =  ""
            this.queryParams.equipmentId = val.equipmentId
            this.queryParamEquip.equipmentId = val.equipmentId
          } else {
            this.queryParamPeople.parentId = val.key
            this.queryParams.equipmentId = ''
          }
          this.searchQuery()
        }
      }
    },
    methods: {
      dateParamChange(v1, v2) {
        // console.log(v1,v2)
        this.queryParam.startTime = v2[0]
        this.queryParam.endTime = v2[1]
        // console.log(v2[0],v2[1])
      },
      onChange(value, dateString) {
        // console.log('Selected Time: ', value);
        // console.log('Formatted Selected Time: ', dateString);
      },
      onOk(value) {
        console.log('onOk: ', value);
      },
      searchReset() {
        if(this.queryParams.typeTree == "1"){
          this.typeTree = this.queryParams.typeTree
          this.typeParent =  this.queryParams.parentId
          this.typeEquipment = this.queryParams.equipmentId
          this.queryParams = {}
          this.queryParam = {}
          this.dates = []
          this.queryParams.typeTree = this.typeTree
          this.queryParams.parentId = this.typeParent
          if(this.queryParams.parentId !=  ""){
            this.queryParams.equipmentId =  ""
          }else{
            if(this.queryParams.equipmentId == this.queryParamEquip.equipmentId){
              this.queryParams.equipmentId =  this.typeEquipment
            }else{
              this.queryParams.equipmentId = this.queryParamEquip.equipmentId
            }
          }
          this.ipagination.current = 1
          this.ResetloadData();
        }else{
          this.typeTree = this.queryParams.typeTree
          this.typeParent =  this.queryParams.parentId
          // this.typeEquipment = this.queryParams.equipmentId
          this.queryParams = {}
          this.queryParam = {}
          this.dates = []
          this.queryParams.typeTree = this.typeTree
          this.queryParams.parentId = this.typeParent
          // this.queryParams.equipmentId =  this.typeEquipment
          this.ipagination.current = 1
          this.ResetloadData();
        }
      },
      ResetloadData() {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        var params = this.getQueryParams();//查询条件
        if(!params){
          return false;
        }
        params.typeTree = this.queryParams.typeTree
        params.parentId = this.queryParams.parentId
        params.equipmentId = this.queryParams.equipmentId
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records||res.result;
            // this.initDeviceType(this.dataSource)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            // this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      handleEdit: function (record) {
        this.$refs.modalFormedit.edit(record);
        this.$refs.modalFormedit.title = "编辑";
        this.$refs.modalFormedit.disableSubmit = false;
      },
      handleTableChange(pagination, filters, sorter) {
        this.dataSource = []
        //分页、排序、筛选变化时触发
        //TODO ç­›é€‰
        // console.log(pagination)
        if (Object.keys(sorter).length > 0) {
          this.isorter.column = sorter.field;
          this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
        }
        this.ipagination = pagination;
        //获取查询条件
        let sqp = {}
        if(this.superQueryParams){
          sqp['superQueryParams']=encodeURI(this.superQueryParams)
          sqp['superQueryMatchType'] = this.superQueryMatchType
        }
        var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters);
        param.pageNo = this.ipagination.current;
        param.pageSize = this.ipagination.pageSize;
        param.field = this.getQueryField();
        param.parentId = this.queryParams.parentId;
        param.equipmentId = this.queryParams.equipmentId;
        param.startTime = this.queryParam.startTime;
        param.endTime =  this.queryParam.endTime;
        getAction(this.url.list,param).then((res) => {
          if(res.success){
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      searchQueryEdit(){
        if(this.queryParams.typeTree == "1"){
          this.queryParams.parentId =  this.queryParamEquip.parentId
        }else{
          this.queryParams.parentId = this.queryParamPeople.parentId
          this.queryParams.equipmentIds = ""
        }
        this.dataSource = [];
        //获取查询条件
        let sqp = {}
        if(this.superQueryParams){
          sqp['superQueryParams']=encodeURI(this.superQueryParams)
          sqp['superQueryMatchType'] = this.superQueryMatchType
        }
        var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters);
        param.pageNo = this.ipagination.current;
        param.pageSize = this.ipagination.pageSize;
        param.field = this.getQueryField();
        param.parentId = this.queryParams.parentId;
        param.equipmentId = this.queryParams.equipmentId;
        param.startTime = this.queryParam.startTime;
        param.endTime =  this.queryParam.endTime;
        getAction(this.url.list,param).then((res) => {
          if(res.success){
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      searchQuery(){
        if(this.queryParams.typeTree == "1"){
          this.queryParams.parentId =  this.queryParamEquip.parentId
          // this.queryParams.equipmentId =  this.queryParamEquip.equipmentId
        }else{
          this.queryParams.parentId = this.queryParamPeople.parentId
          // this.queryParams.equipmentId = ""
        }
        this.dataSource = [];
        //获取查询条件
        let sqp = {}
        if(this.superQueryParams){
          sqp['superQueryParams']=encodeURI(this.superQueryParams)
          sqp['superQueryMatchType'] = this.superQueryMatchType
        }
        var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters);
        param.pageNo = 1;
        param.pageSize = this.ipagination.pageSize;
        param.field = this.getQueryField();
        param.parentId = this.queryParams.parentId;
        param.equipmentId = this.queryParams.equipmentId;
        param.startTime = this.queryParam.startTime;
        param.endTime =  this.queryParam.endTime;
        // console.log(param);
        getAction(this.url.list,param).then((res) => {
          if(res.success){
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      loadData(arg) {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        var params = this.getQueryParams();//查询条件
        if(!params){
          return false;
        }
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records||res.result;
            // this.initDeviceType(this.dataSource)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            // this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      modalFormOk(val) {
        // æ–°å¢ž/修改 æˆåŠŸæ—¶ï¼Œé‡è½½åˆ—è¡¨
        this.searchQueryEdit();
        // this.$emit('openBasetree','')
        this.selectedRowKeys = []
      },
      handleDelete: function (id) {
        if(!this.url.deleteBatch){
          this.$message.error("请设置url.delete属性!")
          return
        }
        var that = this;
        deleteAction(that.url.deleteBatch, {id: id}).then((res) => {
          if (res.success) {
            //重新计算分页问题
            that.reCalculatePage(1)
            // that.$message.success(res.message);
            that.$notification.success({
              message:'消息',
              description:res.message
            });
            that.searchQuery();
          } else {
            // that.$message.warning(res.message);
            that.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        });
      },
      /**
       * æ‰“开新增维修或休班弹窗
       */
      handleAdd() {
        this.$refs.modalForm.add(this.node)
        this.$refs.modalForm.title = '新增'
        this.$refs.modalForm.disableSubmit = false
      },
      // handleAddXIU() {
      //   this.$refs.modalFormadd.add()
      //   this.$refs.modalFormadd.title = '新增'
      //   this.$refs.modalFormadd.disableSubmit = false
      // },
      pQuery(parentId) {
        this.queryParam.parentId = parentId[0]
        if(this.selectedRowKeys.length >= 1) {
          this.selectedRowKeys.length = 0
        }
        this.loadData()
      },
      onSelectChange(selectedRowKeys) {
        this.selectedRowKeys = selectedRowKeys
      },
      initEquipment(id) {
        let _this = this
        getAction(this.url.getEquipmentByPid, { pid: id }).then((res) => {
          if (res.success) {
            if (res.result) {
              _this.$set(this.queryParams, 'equipmentName', res.result.equipmentName)
              _this.$set(this.queryParams, 'equipmentId', res.result.equipmentId)
              _this.equipment = res.result
              _this.searchQuery()
            } else {
              // _this.$message.warning('请配置设备!')
              _this.$notification.warning({
                message:'消息',
                description:"请配置设备!"
              });
            }
          }
        })
      },
      exportExcel() {
        $("#DeviceList").table2excel({
          exclude: ".noExl",
          name: "Excel Document Name",
          filename: "维修休班管理",
          exclude_img: true,
          fileext: ".xls",
          exclude_links: true,
          exclude_inputs: true
        });
      },
      /**
       * å½“浏览器可视窗口尺寸发生改变时触发
       */
      handleWindowResize(){
        const boxHeight = +window.getComputedStyle(document.getElementById('DeviceList')).height.slice(0,-2)
        const tableHeadHeight = +window.getComputedStyle(document.querySelector('.ant-table-thead th')).height.slice(0,-2)
        this.scrollY = boxHeight - tableHeadHeight - 50
      }
    },
    created() {
      this.queryParam.typeTree = "1"
    },
    mounted(){
      window.addEventListener('resize',this.handleWindowResize)
      this.handleWindowResize()
    },
    beforeDestroy(){
      window.removeEventListener('resize',this.handleWindowResize)
    }
  }
</script>
<style lang="less" scoped>
  @import '~@assets/less/common.less';
  .device_list{
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  @media screen and (min-width: 1920px){
    .device_list{
      height: 811px!important;
    }
  }
  @media screen and (min-width: 1680px) and (max-width: 1920px){
    .device_list{
      height: 811px!important;
    }
  }
  @media screen and (min-width: 1400px) and (max-width: 1680px){
    .device_list{
      height: 663px!important;
    }
  }
  @media screen and (min-width: 1280px) and (max-width: 1400px){
    .device_list{
      height: 564px!important;
    }
  }
  @media screen and (max-width: 1280px){
    .device_list{
      height: 564px!important;
    }
  }
</style>
src/views/mdc/base/modules/deviceRepair/DeviceRepairListModel.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,365 @@
<template>
  <a-modal :title="title" width="70%" :visible="visible" :maskClosable="false" @ok="handleOk" @cancel="handleCancel"
           cancelText="关闭">
    <a-card :bordered="false">
      <!-- æŸ¥è¯¢åŒºåŸŸ -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="6" :sm="6"  v-if="isDepartType == 0">
              <a-form-item label="部门" v-if="isDepartType == 0">
                <!--<a-select v-model="queryParam.sectionPid" placeholder="请选择部门" :options="sectionPData" @change="initGroupOptions" />-->
                <a-tree-select
                  v-model="value"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  :tree-data="treeData"
                  placeholder="请选择部门"
                  tree-default-expand-all
                >
                  <!--<span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">-->
                  <!--Child Node1 {{ value }}-->
                  <!--</span>-->
                </a-tree-select>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="车间" >
                <!--<a-select v-model="queryParam.sectionId" placeholder="请选择团队" :options="sectionData"/>-->
                <a-tree-select
                  v-model="valueProduct"
                  style="width: 100%"
                  :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                  :tree-data="sectionData"
                  placeholder="请选择车间"
                  tree-default-expand-all
                >
                  <!--<span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">-->
                  <!--Child Node1 {{ value }}-->
                  <!--</span>-->
                </a-tree-select>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="统一编码">
                <a-input placeholder="请输入统一编码检索" v-model="queryParam.equipmentId"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="6">
              <a-form-item label="设备名称">
                <a-input placeholder="请输入设备名称检索" v-model="queryParam.equipmentName"></a-input>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
      <div class="table-operator">
        <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
        <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
      </div>
      <!-- table区域-begin -->
      <div>
        <a-table ref="table" size="middle" bordered rowKey="id" :scroll="{  y: 400 }" :columns="columns"
                 :dataSource="dataSource" :pagination="ipagination" :loading="loading"
                 :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,getCheckboxProps:getCheckboxProps,selections: true,}"
                 @change="handleTableChange">
        </a-table>
      </div>
      <!-- table区域-end -->
    </a-card>
  </a-modal>
</template>
<script>
  import {mapActions} from 'vuex'
  import {
    ajaxGetSelectItems
  } from '@/api/api'
  import JDictSelectTag from '@/components/dict/JDictSelectTag'
  import {
    deleteAction,
    requestPut,
    getAction,
    postAction
  } from '@/api/manage'
  import {
    JeecgListMixin
  } from '@/mixins/JeecgListMixin'
  import JInput from '@/components/jeecg/JInput'
  import JEllipsis from '@/components/jeecg/JEllipsis'
  import Tooltip from 'ant-design-vue/es/tooltip'
  import JDate from '@/components/jeecg/JDate'
  import moment from 'moment'
  export default {
    name: 'DeviceCalendarListModel',
    mixins: [JeecgListMixin],
    components: {
      JDictSelectTag,
      JEllipsis,
      JInput,
      Tooltip,
      JDate
    },
    props: {
      status: {
        type: Number,
        default: 1
      },
      selectedEquipmentIds:{
        type:String
      }
    },
    data() {
      return {
        isDepartType:'',
        /*readOnly:true,*/
        title:'',
        visible: false,
        SelectedList:[],
        treeData:[],
        /*disableMixinCreated: true,
        queryParam: {},*/
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },{
            title: '统一编码',
            align: 'center',
            dataIndex: 'equipmentId',
          },
          {
            title: '设备名称',
            align: 'center',
            dataIndex: 'equipmentName',
          },
          {
            title: '驱动类型',
            align: 'center',
            dataIndex: 'driveType'
          },
          {
            title: '数控系统',
            align: 'center',
            dataIndex: 'controlSystem'
          },
        ],
        sectionPData: [],
        sectionData: [],
        url: {
          list: '/mdc/mdcEquipment/findEquipmentList',
          loadOptions: '/sys/sysDepart/loadDepartTreeOptions',
          loadProductionOptions:'/mdc/mdcProduction/loadProductionTreeOptions'
        },
        value:undefined,
        valueProduct:undefined
      }
    },
    created() {
      this.queryTreeData()
    },
    watch: {
      value(value) {
        // console.log(value);
        this.queryParam.departId = value
      },
      valueProduct(value){
        this.queryParam.productionId = value
      }
    },
    methods: {
      ...mapActions(['QueryDepartTree']),
      queryTreeData() {
        this.QueryDepartTree().then(res => {
          if (res.success) {
            this.isDepartType = res.result[0].value
          } else {
            // this.$message.warn(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() =>{
        })
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        // this.SelectedList.push(selectedRowKeys);
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows
        // this.SelectedList =[...this.SelectedList,...selectionRows];
        // console.log(this.SelectedList);
        console.log('selectedRowKeys',selectedRowKeys)
        console.log('selectionRows',selectionRows)
      },
      handleTableChange(pagination, filters, sorter) {
        // this.onClearSelected()
        //分页、排序、筛选变化时触发
        //TODO ç­›é€‰
        if (Object.keys(sorter).length > 0) {
          this.isorter.column = sorter.field;
          this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
        }
        this.ipagination = pagination;
        this.loadData();
      },
      openPage() {
        this.visible = true
        this.onClearSelected()
        this.dataSource = [];
        this.queryParam = {
          status: this.status
        };
        this.loadData();
        this.initOptions();
        this.initGroupOptions()
      },
      loadData(arg) {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        var params = this.getQueryParams();//查询条件
        if(!params){
          return false;
        }
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            // console.log(res)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
      },
      modalFormOk(val) {
        // æ–°å¢ž/修改 æˆåŠŸæ—¶ï¼Œé‡è½½åˆ—è¡¨
        this.loadData();
        this.selectedRowKeys = [val.id];
      },
      searchQuery() {
        this.loadData();
        this.onClearSelected()
      },
      searchReset() {
        this.queryParam = {
          status: 1
        };
        this.loadData();
        this.onClearSelected()
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      handleCancel() {
        this.close()
      },
      handleOk() {
        // this.selectionRows =  this.SelectedList;
        // console.log(this.selectionRows);
        this.$emit('sendSelectionRows', this.selectionRows)
        this.close()
      },
      initOptions() {
        getAction(this.url.loadOptions).then(res => {
          if (res.success) {
            this.treeData = res.result
          } else {
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        })
      },
      initGroupOptions() {
        getAction(this.url.loadProductionOptions).then(res => {
          if (res.success) {
            this.sectionData = res.result
          } else {
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        })
      },
      /**
       * æ¯æ¬¡åŠ è½½åˆ—è¡¨æ—¶åˆ¤æ–­å·²é€‰ä¸­è®¾å¤‡ç¼–å·æ•°ç»„æ˜¯å¦åŒ…å«è¡¨æ ¼æ•°æ®ä¸­çš„è®¾å¤‡ç¼–å·ï¼Œå¦‚æžœåŒ…å«åˆ™é€‰ä¸­
       * @param record
       * @returns {{props: {defaultChecked: boolean}}}
       */
      getCheckboxProps(record){
        if(this.selectedEquipmentIds){
          let selectedEquipmentIdsArr=this.selectedEquipmentIds.split(',')
          return {
            props:{
              defaultChecked: selectedEquipmentIdsArr.includes(record.equipmentId)
            }
          }
        }else{
          return {
            props:{
              defaultChecked:false
            }
          }
        }
      }
    },
  }
</script>
<style>
  @import '~@assets/less/common.less';
  .frozenRowClass {
    color: #c9c9c9;
  }
  .success {
    color: green;
  }
  .error {
    color: red;
  }
</style>
src/views/mdc/base/modules/deviceRepair/DeviceRepairModel.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,519 @@
<template>
  <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading"
           :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="24">
            <!--<a-form-item label="设备编号" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
            <!--<a-input-search :readOnly="true" v-decorator="['equipmentId', validatorRules.equipmentId]"-->
            <!--@search="deviceSearch" enter-button/>-->
            <!--&lt;!&ndash;<a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="请输入设备编号"&ndash;&gt;-->
            <!--&lt;!&ndash;v-decorator="['equipmentId',validatorRules.equipmentId]"/>&ndash;&gt;-->
            <!--</a-form-item>-->
            <!--</a-col>-->
            <!--<a-col :span="12">-->
            <!--<a-form-item label="设备名称" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
            <!--<a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="请输入设备名称"-->
            <!--v-decorator="['equipmentName',validatorRules.equipmentName]"/>-->
            <!--</a-form-item>-->
            <a-form-item label="设备组" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
              <a-input-search :readOnly="true" v-decorator="['equipmentIds', validatorRules.equipmentIds]"
                              @search="deviceSearch" enter-button placeholder="请选择设备"/>
              <!--<a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="请输入设备编号"-->
              <!--v-decorator="['equipmentId',validatorRules.equipmentId]"/>-->
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item label="维修类型" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
              <a-radio-group v-decorator="['mdcRepairType', validatorRules.mdcRepairType]">
                <a-radio :value="1">
                  ç»´ä¿®
                </a-radio>
                <a-radio :value="2">
                  ä¼‘班
                </a-radio>
              </a-radio-group>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date :show-time="{defaultValue:moment('08:00:00','HH:mm:ss'),hideDisabledOptions:true}"
                      date-format="YYYY-MM-DD HH:mm:ss"
                      placeholder="请选择开始时间"
                      :disabledDate="disabledDate" class="query-group-cust"
                      v-decorator="['startTime', validatorRules.startTime]" :disabledTime="disabledDateTime"
                      :showToday="false"></j-date>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date :show-time="{defaultValue:moment('08:00:00','HH:mm:ss'),hideDisabledOptions:true}"
                      date-format="YYYY-MM-DD HH:mm:ss"
                      placeholder="请选择结束时间"
                      :disabledDate="disabledDate" class="query-group-cust"
                      v-decorator="['endTime', validatorRules.endTime]" :disabledTime="disabledDateTime"
                      :showToday="false"></j-date>
            </a-form-item>
          </a-col>
        </a-row>
        <!--<a-row :gutter="24">-->
        <!--<a-col :span="12">-->
        <!--<a-form-item v-show="this.mesag == 1" label="维修类型" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
        <!--<a-input :disabled="disableSubmit" :readOnly="readOnly" placeholder="请选择设备类型"-->
        <!--:triggerChange="true"-->
        <!--v-decorator="['mdcRepairType', validatorRules.mdcRepairType]"/>-->
        <!--</a-form-item>-->
        <!--</a-col>-->
        <!--</a-row>-->
      </a-form>
    </a-spin>
    <select-device-drawer ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'选择设备'"/>
  </a-modal>
</template>
<script>
  import moment from 'moment'
  import pick from 'lodash.pick'
  import JDate from './JDate'
  import {
    getAction,
    postAction,
    requestPut
  } from '@/api/manage'
  import {
    duplicateCheck
  } from '@/api/api'
  import Vue from 'vue'
  import SelectDeviceDrawer from '../../../../system/modules/SelectDeviceDrawer'
  export default {
    name: 'DeviceRepairModel',
    components: { SelectDeviceDrawer, JDate },
    props: {
      equipmentId: {
        type: String
      }
    },
    data() {
      return {
        mesag: 21,
        readOnly: true,
        title: '',
        visible: false,
        show: false,
        model: {},
        checked: false,
        startData: '',
        endData: '',
        labelCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 6
          }
        },
        wrapperCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 18
          }
        },
        labelColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 3
          }
        },
        wrapperColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 21
          }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {
          equipmentIds: {
            rules: [
              {
                required: true,
                message: '请选择设备'
              }
            ],
            initialValue: ''
          },
          equipmentName: {
            rules: [
              {
                required: true,
                message: ''
              }
            ]
          },
          mdcRepairType: {
            rules: [
              {
                required: true,
                message: ''
              }
            ],
            initialValue: 1
          },
          startTime: {
            rules: [
              {
                required: true,
                message: '请选择开始时间'
              }
            ]
          },
          endTime: {
            rules: [
              {
                required: true,
                message: '请选择结束时间'
              }
            ]
          }
        },
        url: {
          add: '/mdc/mdcEquipmentRepair/add',
          edit: '/mdc/mdcEquipmentRepair/edit'
        },
        disableSubmit: true,
        partCategoryCascade: [],
        cascadeDefaultValue: [],
        selectedEquipmentIds: ''
      }
    },
    created() {
    },
    watch: {
      // ç›‘控设备编号,当改变树中选项时将值赋值给新增弹窗的设备组选项
      equipmentId: function(val) {
        this.validatorRules.equipmentIds.initialValue = val
      },
      // ç›‘控弹窗显示,如果关闭则清空已选择的多选,如果开启则将树中已选择项赋值给已选择多选
      visible: function(val) {
        if (!val) {
          this.selectedEquipmentIds = ''
        } else {
          this.selectedEquipmentIds = this.validatorRules.equipmentIds.initialValue
        }
      }
    },
    methods: {
      disabledDate(current) {
        //Can not slect days before today and today
        // return current && current < moment().endOf("day");
        return current < moment().subtract(+2, 'day').endOf('day')//前一天之前的年月日不可选,不包括前一天
      },
      moment,
      // onChange(dates) {
      //   // console.log(111)
      //   // console.log(dates,dateStrings)
      //   // console.log('From: ', dates[0], ', to: ', dates[1]);
      //   // console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
      //   // this.startTime = dateStrings[0];
      //   // this.endData = dateStrings[1];
      //   // console.log(this.startData,this.endData);
      // },
      onChangeEnd(dates, dateStrings) {
        this.endTime = dateStrings[0]
      },
      getDeviceRows(val) {
        // var equipmentIds
        // for (var i = 0; i < val.length; i++) {
        //   if (i == 0) {
        //     equipmentIds = val[i].equipmentId
        //   } else {
        //     equipmentIds = equipmentIds + ',' + val[i].equipmentId
        //   }
        // }
        // // console.log("========",equipmentIds);
        // this.form.setFieldsValue({
        //   equipmentIds: equipmentIds
        // })
        for (var i = 0; i < val.length; i++) {
          if (i == 0) {
            this.selectedEquipmentIds = val[i].equipmentId
          } else {
            this.selectedEquipmentIds = this.selectedEquipmentIds + ',' + val[i].equipmentId
          }
        }
        // console.log("========",equipmentIds);
        this.form.setFieldsValue({
          equipmentIds: this.selectedEquipmentIds
        })
        //   this.form.setFieldsValue({
        // equipmentId: val.equipmentId,
        // equipmentName: val.equipmentName,
        // equipmentModel: val.equipmentModel,
        // equipmentIp: val.equipmentIp,
        // dataPort: val.dataPort,
        // driveType: val.driveType
        // })
      },
      deviceSearch() {
        this.$refs.selectDeviceDrawer.visible = true
        this.$refs.selectDeviceDrawer.selectedRowKeys = []
        this.$refs.selectDeviceDrawer.selectedRows = []
        this.$refs.selectDeviceDrawer.checkedKeys = this.form.getFieldValue('equipmentIds') ? this.form.getFieldValue('equipmentIds').split(',') : []
      },
      //级联框onChange事件
      // onChange(value) {
      //
      // },
      getParentIdsById(id) {
        let that = this
        getAction(this.url.getParentIdsById, {
          id: id
        }).then((res) => {
          if (res.success) {
            that.form.setFieldsValue({
              partCategoryId: res.result
            })
          }
        })
      },
      add(node) {
        let _this = this
        this.visible = true
        this.form.resetFields()
        this.model = {}
        this.$nextTick(() => {
          // _this.form.setFieldsValue({ 'tierType': node.entity.tierType + 1, 'parentName': node.title })
          // _this.model.parentId = node.key
        })
      },
      edit(record) {
        this.form.resetFields()
        this.model = Object.assign({}, record)
        this.visible = true
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, 'equipmentIds', 'equipmentName', 'mdcRepairType', 'startTime', 'endTime'
          ))
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
        this.show = false
      },
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            let start = moment(formData.startTime).format('YYYY-MM-DD HH:mm:ss')
            let end = moment(formData.endTime).format('YYYY-MM-DD HH:mm:ss')
            let startOne = start.replace(/:/g, '')
            let endOne = end.replace(/:/g, '')
            var data = new Date()
            let stertDate = moment(data).format('YYYY-MM-DD HH:mm:ss')
            let dataStart = stertDate.replace(/:/g, '')
            // if (startOne < dataStart) {
            //   // that.$message.warning("开始时间不能小于当前时间")
            //   that.$notification.warning({
            //     message: '消息',
            //     description: '开始时间不能小于当前时间'
            //   })
            //   that.confirmLoading = false
            // } else {
            //   if (startOne >= endOne) {
            //     // that.$message.warning("结束时间不能小于开始时间");
            //     that.$notification.warning({
            //       message: '消息',
            //       description: '结束时间不能小于开始时间'
            //     })
            //     // console.log(this.model)
            //     // this.endTime = ''
            //     that.confirmLoading = false
            //   } else {
            //     let obj
            //     if (!this.model.id) {
            //       obj = postAction(this.url.add, formData)
            //     } else {
            //       obj = requestPut(this.url.edit, formData, {
            //         id: this.model.id
            //       })
            //     }
            //     obj.then((res) => {
            //       if (res.success) {
            //         // that.$message.success("添加成功")
            //         that.$notification.success({
            //           message: '消息',
            //           description: '添加成功'
            //         })
            //         // that.$message.success(res.message)
            //         that.$emit('ok', res.result)
            //       } else {
            //         // that.$message.warning(res.message)
            //         that.$notification.warning({
            //           message: '消息',
            //           description: res.message
            //         })
            //       }
            //     }).finally(() => {
            //       that.confirmLoading = false
            //       that.close()
            //     })
            //   }
            // }
            if (startOne >= endOne) {
              // that.$message.warning("结束时间不能小于开始时间");
              that.$notification.warning({
                message: '消息',
                description: '结束时间不能小于开始时间'
              })
              // console.log(this.model)
              // this.endTime = ''
              that.confirmLoading = false
            } else {
              let obj
              if (!this.model.id) {
                obj = postAction(this.url.add, formData)
              } else {
                obj = requestPut(this.url.edit, formData, {
                  id: this.model.id
                })
              }
              obj.then((res) => {
                if (res.success) {
                  // that.$message.success("添加成功")
                  that.$notification.success({
                    message: '消息',
                    description: '添加成功'
                  })
                  // that.$message.success(res.message)
                  that.$emit('ok', res.result)
                } else {
                  // that.$message.warning(res.message)
                  that.$notification.warning({
                    message: '消息',
                    description: res.message
                  })
                }
              }).finally(() => {
                that.confirmLoading = false
                that.close()
              })
            }
          }
        })
      },
      handleCancel() {
        this.close()
      },
      loadCascade() {
        getAction(this.url.loadCascadeData).then((res) => {
          if (res.success) {
            this.partCategoryCascade = res.result
          }
        })
      },
      onCascadeChange(value, selectedOptions) {
        this.cascadeDefaultValue = [...value]
      },
      filter(inputValue, path) {
        return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
      },
      //验证 ç¼–码
      validateNum(rule, value, callback) {
        var params = {
          tableName: 'lxmes_base_part',
          fieldName: 'num',
          fieldVal: value,
          dataId: this.model.id,
          //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
          delFlag: 'true'
        }
        duplicateCheck(params).then((res) => {
          if (res.success) {
            callback()
          } else {
            callback('存货编码已存在!')
          }
        })
      },
      checkboxChange(e) {
        this.checked = e.target.checked
      },
      range(start, end) {
        const result = []
        for (let i = start; i < end; i++) {
          result.push(i)
        }
        return result
      },
      /**
       * ç¦ç”¨æ—¥æœŸé€‰æ‹©å™¨ä¸­çš„æ—¶é—´é€‰æ‹©
       * @returns {{disabledSeconds: (function(): number[])}} è¿”回值为一个对象,可以禁止小时、分钟、秒,目前仅禁止所有秒数,最低从1开始,从0开始确定按钮将被禁用
       */
      disabledDateTime() {
        return {
          disabledSeconds: () => this.range(1, 60)
        }
      },
      /**
       * é€‰æ‹©å·²æœ‰è®¾å¤‡åŽç‚¹å‡»ç¡®å®šæ—¶è§¦å‘
       * @param data å·²é€‰æ‹©çš„设备
       */
      selectOK(data) {
        // let params = {}
        // params.equipmentIdList = []
        // for (var a = 0; a < data.length; a++) {
        //   params.equipmentIdList.push(data[a])
        // }
        console.log('data=', data)
        this.form.setFieldsValue({
          equipmentIds: data.join(',')
        })
      }
    }
  }
</script>
<style scoped>
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
</style>
src/views/mdc/base/modules/deviceRepair/DeviceRepairModelAdd.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,390 @@
<template>
  <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading"
           :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="24">
            <!--<a-form-item label="设备编号" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
              <!--<a-input-search :readOnly="true" v-decorator="['equipmentId', validatorRules.equipmentId]"-->
                              <!--@search="deviceSearch" enter-button/>-->
              <!--&lt;!&ndash;<a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="请输入设备编号"&ndash;&gt;-->
              <!--&lt;!&ndash;v-decorator="['equipmentId',validatorRules.equipmentId]"/>&ndash;&gt;-->
            <!--</a-form-item>-->
            <a-form-item label="设备组" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
              <a-input-search :readOnly="true" v-decorator="['equipmentIds', validatorRules.equipmentIds]"
                              @search="deviceSearch" enter-button/>
              <!--<a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="请输入设备编号"-->
              <!--v-decorator="['equipmentId',validatorRules.equipmentId]"/>-->
            </a-form-item>
          </a-col>
          <!--<a-col :span="12">-->
            <!--<a-form-item label="设备名称" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
              <!--<a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="请输入设备名称"-->
                       <!--v-decorator="['equipmentName',validatorRules.equipmentName]"/>-->
            <!--</a-form-item>-->
          <!--</a-col>-->
        </a-row>
        <!--<a-row :gutter="24">-->
          <!--<a-col :span="24">-->
            <!--<a-form-item label="设备名称" :labelCol="labelColLong" :wrapperCol="wrapperColLong">-->
              <!--<a-input :readOnly="true" v-decorator="['equipmentName', validatorRules.equipmentName]"-->
                               <!--enter-button/>-->
            <!--</a-form-item>-->
          <!--</a-col>-->
        <!--</a-row>-->
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date :show-time="{defaultValue:moment('08:00:00','HH:mm:ss')}" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" :disabledDate="disabledDate"
                      class="query-group-cust" v-decorator="['startTime', validatorRules.startTime]"></j-date>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date :show-time="{defaultValue:moment('08:00:00','HH:mm:ss')}" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" :disabledDate="disabledDate"
                      class="query-group-cust" v-decorator="['endTime', validatorRules.endTime]"></j-date>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item v-show="this.mesag == 1" label="维修类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" :readOnly="readOnly" placeholder="请选择设备类型"
                       :triggerChange="true"
                       v-decorator="['mdcRepairType', validatorRules.mdcRepairType]"/>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <device-repair-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-repair-list-model>
  </a-modal>
</template>
<script>
  import moment from 'moment'
  import pick from 'lodash.pick'
  import DeviceRepairListModel from './DeviceRepairListModel'
  import JDate from './JDate'
  import {
    getAction,
    postAction,
    requestPut
  } from '@/api/manage'
  import {
    duplicateCheck
  } from '@/api/api'
  export default {
    name: 'DeviceRepairModel',
    components: {DeviceRepairListModel,JDate},
    props: {},
    data() {
      return {
        mesag:21,
        readOnly:true,
        title: '',
        visible: false,
        show: false,
        model: {},
        checked: false,
        startData:"",
        endData:"",
        labelCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 6
          }
        },
        wrapperCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 18
          }
        },
        labelColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 3
          }
        },
        wrapperColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 21
          }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {
          equipmentId:{
            rules:[
              {
                required:true,
                message: ""
              },
            ],
          },
          equipmentName:{
            rules:[
              {
                required:true,
                message: ""
              },
            ],
          },
          mdcRepairType:{
            rules:[
              {
                required:true,
                message: ""
              },
            ],
            initialValue: 2
          }
        },
        url: {
          add: '/mdc/mdcEquipmentRepair/add',
          edit: '/mdc/mdcEquipmentRepair/edit'
        },
        disableSubmit: true,
        partCategoryCascade: [],
        cascadeDefaultValue: []
      }
    },
    created() {
    },
    methods: {
      disabledDate(current){
        //Can not slect days before today and today
        // return current && current < moment().endOf("day");
        return current < moment().subtract(+1, 'day')//今天之前的年月日不可选,不包括今天
      },
      moment,
      onChange(dates) {
        // console.log(111)
        // console.log(dates,dateStrings)
        // console.log('From: ', dates[0], ', to: ', dates[1]);
        // console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
        // this.startTime = dateStrings[0];
        // this.endData = dateStrings[1];
        // console.log(this.startData,this.endData);
      },
      onChangeEnd(dates, dateStrings){
        this.endTime = dateStrings[0];
      },
      // getDeviceRows(val) {
      //   this.form.setFieldsValue({
      //     equipmentId: val.equipmentId,
      //     equipmentName: val.equipmentName,
      //     // equipmentModel: val.equipmentModel,
      //     // equipmentIp: val.equipmentIp,
      //     // dataPort: val.dataPort,
      //     // driveType: val.driveType
      //   })
      // },
      getDeviceRows(val) {
        var equipmentIds;
        // var equipmentNames;
        for(var i = 0;i<val.length;i++){
          if (i == 0) {
            equipmentIds =  val[i].equipmentId;
            // equipmentNames = val[i].equipmentName;
          } else {
            equipmentIds = equipmentIds + "," + val[i].equipmentId;
            // equipmentNames = equipmentNames + ',' + val[i].equipmentName
          }
        }
        // console.log("========",equipmentIds);
        this.form.setFieldsValue({
          equipmentIds: equipmentIds,
          // equipmentName:equipmentNames
        })
      },
      deviceSearch() {
        this.$refs.deviceRepairListModel.openPage()
        this.$refs.deviceRepairListModel.title = '选择设备'
        this.$refs.deviceRepairListModel.disableSubmit = false
      },
      //级联框onChange事件
      onChange(value) {
      },
      getParentIdsById(id) {
        let that = this
        getAction(this.url.getParentIdsById, {
          id: id
        }).then((res) => {
          if (res.success) {
            that.form.setFieldsValue({
              partCategoryId: res.result
            })
          }
        })
      },
      add(node) {
        let _this = this
        this.visible = true
        this.form.resetFields()
        this.model = {}
        this.$nextTick(() => {
          // _this.form.setFieldsValue({ 'tierType': node.entity.tierType + 1, 'parentName': node.title })
          // _this.model.parentId = node.key
        })
      },
      edit(record) {
        this.form.resetFields()
        this.model = Object.assign({}, record)
        this.visible = true
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, 'tierType', 'parentName', 'equipmentId', 'equipmentName', 'mdcRepairType', 'startTime', 'endTime',
          ))
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
        this.show = false
      },
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            let start = moment(formData.startTime).format('YYYY-MM-DD HH:mm:ss');
            let end = moment(formData.endTime).format('YYYY-MM-DD HH:mm:ss');
            let startOne = start.replace(/:/g,'');
            let endOne = end.replace(/:/g,'');
            var data = new Date();
            let stertDate = moment(data).format("YYYY-MM-DD HH:mm:ss");
            let dataStart = stertDate.replace(/:/g,'');
            if(startOne < dataStart) {
              // that.$message.warning("开始时间不能小于当前时间")
              that.$notification.warning({
                message:'消息',
                description:"开始时间不能小于当前时间"
              });
              that.confirmLoading = false
            }else{
              if(startOne>=endOne){
                // that.$message.warning("结束时间不能小于开始时间");
                that.$notification.warning({
                  message:'消息',
                  description:"结束时间不能小于开始时间"
                });
                // console.log(this.model)
                // this.endTime = ''
                that.confirmLoading = false
              }else{
                let obj
                if (!this.model.id) {
                  obj = postAction(this.url.add, formData)
                } else {
                  obj = requestPut(this.url.edit, formData, {
                    id: this.model.id
                  })
                }
                obj.then((res) => {
                  if (res.success) {
                    // that.$message.success("添加成功")
                    that.$notification.success({
                      message:'消息',
                      description:"添加成功"
                    });
                    // that.$message.success(res.message)
                    that.$emit('ok', res.result)
                  } else {
                    // that.$message.warning(res.message)
                    that.$notification.warning({
                      message:'消息',
                      description:res.message
                    });
                  }
                }).finally(() => {
                  that.confirmLoading = false
                  that.close()
                })
              }
            }
          }
        })
      },
      handleCancel() {
        this.close()
      },
      loadCascade() {
        getAction(this.url.loadCascadeData).then((res) => {
          if (res.success) {
            this.partCategoryCascade = res.result
          }
        })
      },
      onCascadeChange(value, selectedOptions) {
        this.cascadeDefaultValue = [...value]
      },
      filter(inputValue, path) {
        return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
      },
      //验证 ç¼–码
      validateNum(rule, value, callback) {
        var params = {
          tableName: 'lxmes_base_part',
          fieldName: 'num',
          fieldVal: value,
          dataId: this.model.id,
          //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
          delFlag: 'true'
        }
        duplicateCheck(params).then((res) => {
          if (res.success) {
            callback()
          } else {
            callback('存货编码已存在!')
          }
        })
      },
      checkboxChange(e) {
        this.checked = e.target.checked
      }
    }
  }
</script>
<style scoped>
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
</style>
src/views/mdc/base/modules/deviceRepair/DeviceRepairModelEdit.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,485 @@
<template>
  <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading"
           :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date :show-time="{hideDisabledOptions:true}" date-format="YYYY-MM-DD HH:mm:ss"
                      placeholder="请选择开始时间" :disabledDate="disabledDate"
                      class="query-group-cust" v-decorator="['startTime', validatorRules.startTime]"
                      :disabledTime="disabledDateTime" :showToday="false"></j-date>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="设备名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="请输入设备名称"
                       v-decorator="['equipmentName',validatorRules.equipmentName]"/>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date :show-time="{hideDisabledOptions:true}" date-format="YYYY-MM-DD HH:mm:ss"
                      placeholder="请选择结束时间"
                      :disabledDate="disabledDate"
                      class="query-group-cust" v-decorator="['endTime', validatorRules.endTime]"
                      :disabledTime="disabledDateTime" :showToday="false"></j-date>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="设备编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="请输入设备编号"
                       v-decorator="['equipmentId',validatorRules.equipmentId]"/>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
    <!--<device-repair-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-repair-list-model>-->
    <device-repair-edit-list-model ref="deviceRepairListModel"
                                   @sendSelectionRows="getDeviceRows"></device-repair-edit-list-model>
  </a-modal>
</template>
<script>
  import moment from 'moment'
  import pick from 'lodash.pick'
  import DeviceRepairListModel from './DeviceRepairListModel'
  import DeviceRepairEditListModel from './DeviceRepairEditListModel'
  import JDate from './JDate'
  import {
    getAction,
    postAction,
    requestPut
  } from '@/api/manage'
  import {
    duplicateCheck
  } from '@/api/api'
  export default {
    name: 'DeviceRepairModelEdit',
    components: { DeviceRepairListModel, JDate, DeviceRepairEditListModel },
    props: {},
    data() {
      return {
        readOnly: true,
        title: '',
        visible: false,
        show: false,
        model: {},
        checked: false,
        startData: '',
        endData: '',
        labelCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 6
          }
        },
        wrapperCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 18
          }
        },
        labelColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 3
          }
        },
        wrapperColLong: {
          xs: {
            span: 24
          },
          sm: {
            span: 21
          }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {
          equipmentId: {
            rules: [
              {
                required: true,
                message: ''
              }
            ]
          },
          equipmentName: {
            rules: [
              {
                required: true,
                message: ''
              }
            ]
          },
          startTime: {
            rules: [
              {
                required: true,
                message: '请选择开始时间'
              }
            ]
          },
          endTime: {
            rules: [
              {
                required: true,
                message: '请选择结束时间'
              }
            ]
          }
          // mdcRepairType:{
          //   rules:[
          //     {
          //       required:true,
          //       message: ""
          //     },
          //   ],
          //   initialValue: '休班'
          // }
        },
        url: {
          add: '/mdc/mdcEquipmentRepair/add',
          edit: '/mdc/mdcEquipmentRepair/edit'
        },
        disableSubmit: true,
        partCategoryCascade: [],
        cascadeDefaultValue: [],
        editStart: ''
      }
    },
    created() {
    },
    methods: {
      disabledDate(current) {
        //Can not slect days before today and today
        // return current && current < moment().endOf("day");
        return current < moment().subtract(+2, 'day').endOf('day')//前一天之前的年月日不可选,不包括前一天
      },
      moment,
      // onChange(dates) {
      //   console.log(111)
      //   console.log(dates,dateStrings)
      //   // console.log('From: ', dates[0], ', to: ', dates[1]);
      //   // console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
      //   // this.startTime = dateStrings[0];
      //   // this.endData = dateStrings[1];
      //   // console.log(this.startData,this.endData);
      // },
      onChangeEnd(dates, dateStrings) {
        this.endTime = dateStrings[0]
      },
      getDeviceRows(val) {
        this.form.setFieldsValue({
          equipmentId: val.equipmentId,
          equipmentName: val.equipmentName
          //   // equipmentModel: val.equipmentModel,
          //   // equipmentIp: val.equipmentIp,
          //   // dataPort: val.dataPort,
          //   // driveType: val.driveType
        })
        // var equipmentIds;
        // for(var i = 0;i<val.length;i++){
        //   if (i == 0) {
        //     equipmentIds =  val[i].equipmentId;
        //   } else {
        //     equipmentIds = equipmentIds + "," + val[i].equipmentId;
        //   }
        // }
        // console.log("========",equipmentIds);
        // this.form.setFieldsValue({
        //   equipmentId: equipmentIds,
        // })
      },
      deviceSearch() {
        this.$refs.deviceRepairListModel.openPage()
        this.$refs.deviceRepairListModel.title = '选择设备'
        this.$refs.deviceRepairListModel.disableSubmit = false
      },
      //级联框onChange事件
      // onChange(value) {
      //
      // },
      getParentIdsById(id) {
        let that = this
        getAction(this.url.getParentIdsById, {
          id: id
        }).then((res) => {
          if (res.success) {
            that.form.setFieldsValue({
              partCategoryId: res.result
            })
          }
        })
      },
      add(node) {
        let _this = this
        this.visible = true
        this.form.resetFields()
        this.model = {}
        this.$nextTick(() => {
          // _this.form.setFieldsValue({ 'tierType': node.entity.tierType + 1, 'parentName': node.title })
          // _this.model.parentId = node.key
        })
      },
      edit(record) {
        this.form.resetFields()
        this.model = Object.assign({}, record)
        this.editStart = (this.model.startTime).replace(/:/g, '')
        this.visible = true
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, 'tierType', 'parentName', 'equipmentId', 'equipmentName', 'startTime', 'endTime'
          ))
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
        this.show = false
      },
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            let start = moment(formData.startTime).format('YYYY-MM-DD HH:mm:ss')
            let end = moment(formData.endTime).format('YYYY-MM-DD HH:mm:ss')
            let startOne = start.replace(/:/g, '')
            let endOne = end.replace(/:/g, '')
            var data = new Date()
            let stertDate = moment(data).format('YYYY-MM-DD HH:mm:ss')
            let dataStart = stertDate.replace(/:/g, '')
            // if (this.editStart != startOne) {
            //   if (startOne < dataStart) {
            //     // that.$message.warning("开始时间不能小于当前时间")
            //     that.$notification.warning({
            //       message: '消息',
            //       description: '开始时间不能小于当前时间'
            //     })
            //     that.confirmLoading = false
            //   } else {
            //     if (startOne >= endOne) {
            //       // that.$message.warning("结束时间不能小于开始时间");
            //       that.$notification.warning({
            //         message: '消息',
            //         description: '结束时间不能小于当前时间'
            //       })
            //       // console.log(this.model)
            //       // this.endTime = ''
            //       that.confirmLoading = false
            //
            //     } else {
            //       let obj
            //       if (!this.model.id) {
            //         obj = postAction(this.url.add, formData)
            //       } else {
            //
            //         obj = requestPut(this.url.edit, formData, {
            //           id: this.model.id
            //         })
            //         let shijian = startOne
            //       }
            //       obj.then((res) => {
            //         if (res.success) {
            //           // that.$message.success("修改成功")
            //           // that.$message.success(res.message)
            //           that.$notification.success({
            //             message: '消息',
            //             description: res.message
            //           })
            //           that.$emit('ok', res.result)
            //         } else {
            //           // that.$message.warning(res.message)
            //           that.$notification.warning({
            //             message: '消息',
            //             description: res.message
            //           })
            //         }
            //       }).finally(() => {
            //         that.confirmLoading = false
            //         that.close()
            //       })
            //     }
            //   }
            // } else {
            //   if (startOne >= endOne) {
            //     // that.$message.warning("结束时间不能小于开始时间");
            //     that.$notification.warning({
            //       message: '消息',
            //       description: '结束时间不能小于开始时间'
            //     })
            //     // console.log(this.model)
            //     // this.endTime = ''
            //     that.confirmLoading = false
            //
            //   } else {
            //     let obj
            //     if (!this.model.id) {
            //       obj = postAction(this.url.add, formData)
            //     } else {
            //
            //       obj = requestPut(this.url.edit, formData, {
            //         id: this.model.id
            //       })
            //       let shijian = startOne
            //     }
            //     obj.then((res) => {
            //       if (res.success) {
            //         // that.$message.success("修改成功")
            //         // that.$message.success(res.message)
            //         that.$notification.success({
            //           message: '消息',
            //           description: res.message
            //         })
            //         that.$emit('ok', res.result)
            //       } else {
            //         // that.$message.warning(res.message)
            //         that.$notification.warning({
            //           message: '消息',
            //           description: res.message
            //         })
            //       }
            //     }).finally(() => {
            //       that.confirmLoading = false
            //       that.close()
            //     })
            //   }
            // }
            if (startOne >= endOne) {
              // that.$message.warning("结束时间不能小于开始时间");
              that.$notification.warning({
                message: '消息',
                description: '结束时间不能小于开始时间'
              })
              // console.log(this.model)
              // this.endTime = ''
              that.confirmLoading = false
            } else {
              let obj
              if (!this.model.id) {
                obj = postAction(this.url.add, formData)
              } else {
                obj = requestPut(this.url.edit, formData, {
                  id: this.model.id
                })
              }
              obj.then((res) => {
                if (res.success) {
                  // that.$message.success("添加成功")
                  that.$notification.success({
                    message: '消息',
                    description: '修改成功'
                  })
                  // that.$message.success(res.message)
                  that.$emit('ok', res.result)
                } else {
                  // that.$message.warning(res.message)
                  that.$notification.warning({
                    message: '消息',
                    description: res.message
                  })
                }
              }).finally(() => {
                that.confirmLoading = false
                that.close()
              })
            }
          }
        })
      },
      handleCancel() {
        this.close()
      },
      loadCascade() {
        getAction(this.url.loadCascadeData).then((res) => {
          if (res.success) {
            this.partCategoryCascade = res.result
          }
        })
      },
      onCascadeChange(value, selectedOptions) {
        this.cascadeDefaultValue = [...value]
      },
      filter(inputValue, path) {
        return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
      },
      //验证 ç¼–码
      validateNum(rule, value, callback) {
        var params = {
          tableName: 'lxmes_base_part',
          fieldName: 'num',
          fieldVal: value,
          dataId: this.model.id,
          //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
          delFlag: 'true'
        }
        duplicateCheck(params).then((res) => {
          if (res.success) {
            callback()
          } else {
            callback('存货编码已存在!')
          }
        })
      },
      checkboxChange(e) {
        this.checked = e.target.checked
      },
      range(start, end) {
        const result = []
        for (let i = start; i < end; i++) {
          result.push(i)
        }
        return result
      },
      /**
       * ç¦ç”¨æ—¥æœŸé€‰æ‹©å™¨ä¸­çš„æ—¶é—´é€‰æ‹©
       * @returns {{disabledSeconds: (function(): number[])}} è¿”回值为一个对象,可以禁止小时、分钟、秒,目前仅禁止所有秒数,最低从1开始,从0开始确定按钮将被禁用
       */
      disabledDateTime() {
        return {
          disabledSeconds: () => this.range(1, 60)
        }
      }
    }
  }
</script>
<style scoped>
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
</style>
src/views/mdc/base/modules/deviceRepair/JDate.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,86 @@
<template>
  <a-date-picker
    dropdownClassName="j-date-picker"
    :disabled="disabled || readOnly"
    :placeholder="placeholder"
    @change="handleDateChange"
    :value="momVal"
    :showTime="showTime"
    :format="dateFormat"
    :getCalendarContainer="getCalendarContainer"
    v-bind="$attrs"/>
</template>
<script>
import moment from 'moment'
export default {
  name: 'JDate',
  props: {
    placeholder:{
      type: String,
      default: '',
      required: false
    },
    value:{
      type: String,
      required: false
    },
    dateFormat:{
      type: String,
      default: 'YYYY-MM-DD',
      required: false
    },
    //此属性可以被废弃了
    triggerChange:{
      type: Boolean,
      required: false,
      default: false
    },
    readOnly:{
      type: Boolean,
      required: false,
      default: false
    },
    disabled:{
      type: Boolean,
      required: false,
      default: false
    },
    showTime:{
      type: Object,
      required: {},
      default: {}
    },
    getCalendarContainer: {
      type: Function,
      default: (node) => node.parentNode
    }
  },
  data () {
    let dateStr = this.value;
    return {
      decorator:"",
      momVal:!dateStr?null:moment(dateStr,this.dateFormat)
    }
  },
  watch: {
    value (val) {
      if(!val){
        this.momVal = null
      }else{
        this.momVal = moment(val,this.dateFormat)
      }
    }
  },
  methods: {
    moment,
    handleDateChange(mom,dateStr){
      this.$emit('change', dateStr);
    }
  },
  //2.2新增 åœ¨ç»„件内定义 æŒ‡å®šçˆ¶ç»„件调用时候的传值属性和事件类型 è¿™ä¸ªç‰›é€¼
  model: {
    prop: 'value',
    event: 'change'
  }
}
</script>
src/views/mdc/base/modules/efficiencyPOReport/EfficiencyPOList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,727 @@
<template>
  <div style="width: 100%;">
    <div :bordered="false">
      <!-- æŸ¥è¯¢åŒºåŸŸ -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="5" :sm="5">
              <a-form-item label="设备类型">
                <a-select
                  :value="queryParams.equipmentType"
                  mode="multiple"
                  placeholder="请选择设备类型"
                  allow-clear
                  :maxTagCount="1"
                  @change="selectChange($event,'equipmentType')"
                >
                  <a-select-option v-for="(item,index) in equipmentTypeList" :value="item.value" :key="index">
                    {{item.label}}
                  </a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :md="5" :sm="5">
              <a-form-item label="驱动类型">
                <a-select
                  :value="queryParams.driveType"
                  mode="multiple"
                  placeholder="请选择驱动类型"
                  allow-clear
                  :maxTagCount="1"
                  @change="selectChange($event,'driveType')"
                >
                  <a-select-option v-for="(item,index) in driveTypeList" :value="item.value" :key="index">
                    {{item.label}}
                  </a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :md="4" :sm="4">
              <a-form-item label="时间">
                <a-range-picker @change="dateParamChange" :disabledDate="disabledDate" format="YYYYMMDD" v-model="dates" :allowClear="false"/>
              </a-form-item>
            </a-col>
            <a-col :md="5" :sm="5" :xs="5">
              <a-form-item label="设备级别">
                <a-select
                  :value="queryParams.deviceLevel"
                  mode="multiple"
                  placeholder="请选择设备级别"
                  allow-clear
                  :maxTagCount="1"
                  @change="selectChange($event,'deviceLevel')"
                >
                  <a-select-option v-for="(item,index) in device_level_list" :value="item.value" :key="index">
                    {{item.label}}
                  </a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :md="4" :sm="4" :xs="4">
              <a-form-item label="设备种类">
                <a-select
                  :value="queryParams.deviceCategory"
                  mode="multiple"
                  placeholder="请选择设备种类"
                  allow-clear
                  :maxTagCount="1"
                  @change="selectChange($event,'deviceCategory')"
                >
                  <a-select-option v-for="(item,index) in device_category_list" :value="item.value" :key="index">
                    {{item.label}}
                  </a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24" type="flex" align="middle">
            <a-col :md="24" :sm="24" :xs="24"
                   style="display: flex;justify-content: space-between;align-items: flex-start">
              <div>
                <a-space style="margin-right: 20px">
                  <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                  <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
                  <a-button type="primary" @click="exportExcel" icon="download">导出</a-button>
                  <a-button type="primary" icon="printer" v-print="'#EfficiencyPO'"
                            v-has="'EfficiencyPO:print'">打印
                  </a-button>
                </a-space>
                <a-checkbox-group :value="checkedList" :default-value="['lyl']" :options="efficiencyOptions"
                                  @change="efficiencyOptionsOnChange"/>
              </div>
              <table cellpadding="5" cellspacing="1" style="border: 1px solid darkgray;">
                <tr>
                  <td v-for="(item, index) in identifying">{{item.title}}</td>
                </tr>
                <tr>
                  <td style="text-align:center;" v-for="(item, index) in identifying">
                    <div class="identifyingclass" :style="{background: item.color}"></div>
                  </td>
                </tr>
              </table>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <a-spin :spinning="spinning">
        <div class="container" id="EfficiencyPO" style="margin-top: 20px;" >
          <div class="table2">
            <table class="dataContent table" border="1" cellspacing="0" cellpadding="0" style="white-space: nowrap" v-if="dataList.length>0">
              <thead>
              <tr class="thead fixed equipname">
                <th class="thgu dong1 name" rowspan="2" style="min-width: 50px; max-width: 50px;width: 50px;height: 66px">公司</th>
                <th  class="thgu dong2 name" rowspan="2" style="min-width: 50px; max-width: 50px;width: 50px;">车间</th>
                <th  class="thgu dong3 name" rowspan="2" style="min-width: 50px; max-width: 50px;width: 50px;">工段</th>
                <th class="thgu dong4 name" rowspan="2" style="min-width: 100px; max-width: 100px;width: 100px;">设备编号</th>
                <th class="thgu dong5 name" rowspan="2" style="min-width: 162px; max-width: 162px;width: 162px;">设备名称</th>
                <th class="thgu dong6 name" rowspan="2" style="min-width: 100px; max-width: 100px;width: 100px;">设备类型</th>
                <!--<th rowspan="2">组别</th>-->
                <template v-for="(tableHead, index) in tableHeads">
                  <th class="timeth" :colspan="checkedList.length">{{tableHead}}</th>
                </template>
              </tr>
              <tr class="thead notfixed gudingth">
                <template v-for="(tableHead, index) in tableHeads">
                  <th v-if="checkedList.indexOf('lyl') > -1">开动率(%)</th>
                  <th v-if="checkedList.indexOf('kjl') > -1">开机率(%)</th>
                  <th v-if="checkedList.indexOf('kjsj') > -1">开机时间(小时)</th>
                  <th v-if="checkedList.indexOf('jgsj') > -1">加工时间(小时)</th>
                  <th v-if="checkedList.indexOf('djsj') > -1">待机时间(小时)</th>
                  <th v-if="checkedList.indexOf('gjsj') > -1">关机时间(小时)</th>
                </template>
              </tr>
              </thead>
              <tbody>
              <tr class="mathData" v-for="(item, index) in dataList">
                <template v-if="item.level1!=='合计'&&item.level1!=='平均值'">
                  <td  class="tdgu kaitou" :rowspan="item.level1span" :class="{hidden: item.level1dis,noExl:item.level1dis}"  v-show="!item.level1dis">
                    <div class="wenzi">
                      {{item.level1}}
                    </div>
                  </td>
                  <td  class="tdgu1 kaitou" :rowspan="item.level2span" :class="{hidden: item.level2dis,noExl:item.level2dis}"  v-show="!item.level2dis">
                    <div class="wenzi">
                      {{item.level2}}
                    </div>
                  </td>
                  <td  class="tdgu2 kaitou" :rowspan="item.level3span" :class="{hidden: item.level3dis,noExl:item.level3dis}"  v-show="!item.level3dis">
                    <div class="wenzi">
                      {{item.level3}}
                    </div>
                  </td>
                  <td  class="tdgu3  kaitou">{{item.equipmentId}}</td>
                  <td style="min-width: 162px; max-width: 162px;width: 162px;"  class="tdgu4 kaitou">{{item.equipmentName}}</td>
                  <td  class="tdgu5 kaitou">{{item.equipmentType}}</td>
                </template>
                <template v-else>
                  <td colspan="6" class="tdgu kaitou">{{item.level1}}</td>
                </template>
                <template v-for="(tableHead, index) in item.dataList">
                  <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('lyl') > -1">{{tableHead.startRate | numFilter}}</td>
                  <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('kjl') > -1">
                    {{tableHead.openRate | numFilter}}
                  </td>
                  <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('kjsj') > -1">
                    {{tableHead.openLong | getFormattedTime}}
                  </td>
                  <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('jgsj') > -1">
                    {{tableHead.processLong | getFormattedTime}}
                  </td>
                  <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('djsj') > -1">
                    {{tableHead.waitLong | getFormattedTime}}
                  </td>
                  <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('gjsj') > -1">
                    {{tableHead.closeLong | getFormattedTime}}
                  </td>
                </template>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
      </a-spin>
    </div>
  </div>
</template>
<script>
import moment from 'moment'
import { putAction, getAction } from '@/api/manage'
import $ from 'jquery'
import '@/components/table2excel/table2excel'
import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api'
import api from '@/api/mdc'
export default {
  name: 'EfficiencyPOList',
  components: {},
  data() {
    return {
      typeTree:"",
      typeParent:1,
      typeEquipment:1,
      dates: [],
      equipmentTypeList:[],
      driveTypeList:[],
      device_level_list: [],
      device_category_list: [],
      queryParam: {},
      queryParams: {
        equipmentType: [],
        driveType: [],
        deviceLevel: [],
        deviceCategory: []
      },
      queryParamEquip:{},
      queryParamPeople:{},
      identifying: [],
      efficiencyOptions: [
        { label: '开动率', value: 'lyl' },
        { label: '开机率', value: 'kjl' },
        { label: '开机时间', value: 'kjsj' },
        { label: '加工时间', value: 'jgsj' },
        { label: '待机时间', value: 'djsj' },
        { label: '关机时间', value: 'gjsj' }
      ],
      checkedList: ['lyl'],
      dataList: [],
      url: {
        list: '/mdc/efficiencyReport/efficiencyPOList',
        listByType: '/mdc/MdcUtilizationRate/getByType',
        queryEquipmentType: '/mdc/mdcEquipmentType/queryEquipmentType'
      },
      tableHeads: [],
      spinning:false
    }
  },
  props: { nodeTree: '', Type:'',nodePeople: ''},
  created() {
    this.showIdentifying()
    this.dates = [moment().subtract('days', 8), moment().subtract('days', 1)]
    this.queryParam.startTime = moment(this.dates[0]).format('YYYYMMDD')
    this.queryParam.endTime = moment(this.dates[1]).format('YYYYMMDD')
    this.queryParam.typeTree = "1"
    this.loadData()
    this.queryGroup()
    this.getDriveTypeByApi()
    this.initDictData('device_level')
    this.initDictData('device_category')
  },
  mounted() {
    window.addEventListener('resize', this.handleWindowResize)
    this.handleWindowResize()
  },
  watch: {
    Type(valmath){
      this.dataList = [];
      this.queryParam.typeTree = valmath
    },
    nodeTree(val) { //监听currSelected å˜åŒ–,将变化后的数值传递给 getCurrSelected äº‹ä»¶
      if (JSON.stringify(val) != '{}') {
        if (val.equipmentId != null) {
          this.queryParamEquip.parentId = ''
          this.queryParamEquip.equipmentId = val.equipmentId
        } else {
          this.queryParamEquip.parentId = val.key
          this.queryParamEquip.equipmentId = ''
        }
        this.searchQuery()
      }
    },
    nodePeople(val){
      if (JSON.stringify(val) != '{}') {
        if (val.equipmentId != null) {
          this.queryParamPeople.parentId = val.equipmentId
          this.queryParamPeople.equipmentId = ''
        } else {
          this.queryParamPeople.parentId = val.key
          this.queryParamPeople.equipmentId = ''
        }
        this.searchQuery()
      }
    }
  },
  filters: {
    numFilter(value) {
      if (value) {
        return parseFloat((value * 100).toFixed(2))
      } else {
        return '0'
      }
    },
    /**
     * æ ¼å¼åŒ–æ—¶é—´
     * @param seconds ç§’æ•°
     * @returns '' æ ¼å¼åŒ–后时间字符串
     */
    getFormattedTime(seconds) {
      if (seconds) {
        return parseFloat((seconds / 3600).toFixed(2))
      } else {
        return '0'
      }
    },
  },
  methods: {
    initDictData(dictCode) {
      // //优先从缓存中读取字典配置
      if (getDictItemsFromCache(dictCode)) {
        this[dictCode + '_list'] = getDictItemsFromCache(dictCode)
        return
      }
      //根据字典Code, åˆå§‹åŒ–字典数组
      ajaxGetDictItems(dictCode, null).then((res) => {
        if (res.success) {
          this[dictCode + '_list'] = res.result
          return
        }
      })
    },
    selectChange(value, key) {
      this.queryParams[key] = value
    },
    checkSameData(dataList){
      let cache = {};  //存储的是键是kclx çš„值,值是kclx åœ¨indeces中数组的下标
      let indices = [];  //数组中每一个值是一个数组,数组中的每一个元素是原数组中相同kclx的下标
      dataList.map((item,index)=>{
        let level1 = item.level1;
        let _index = cache[level1];
        if(_index!==undefined){
          indices[_index].push(index)
        }else{
          cache[level1] = indices.length
          indices.push([index])
        }
      })
      let result = [];
      indices.map((item)=>{
        item.map((index)=>{
          result.push(dataList[index])
        })
      })
      this.dataList = result
    },
    checkSameData1(dataList){
      let cache = {};  //存储的是键是kclx çš„值,值是kclx åœ¨indeces中数组的下标
      let indices = [];  //数组中每一个值是一个数组,数组中的每一个元素是原数组中相同kclx的下标
      dataList.map((item,index)=>{
        let level2 = item.level2;
        let _index = cache[level2];
        if(_index!==undefined){
          indices[_index].push(index)
        }else{
          cache[level2] = indices.length
          indices.push([index])
        }
      })
      let result = [];
      indices.map((item)=>{
        item.map((index)=>{
          result.push(dataList[index])
        })
      })
      this.dataList = result
    },
    checkSameData2(dataList){
      let cache = {};  //存储的是键是kclx çš„值,值是kclx åœ¨indeces中数组的下标
      let indices = [];  //数组中每一个值是一个数组,数组中的每一个元素是原数组中相同kclx的下标
      dataList.map((item,index)=>{
        let level3 = item.level3;
        let _index = cache[level3];
        if(_index!==undefined){
          indices[_index].push(index)
        }else{
          cache[level3] = indices.length
          indices.push([index])
        }
      })
      let result = [];
      indices.map((item)=>{
        item.map((index)=>{
          result.push(dataList[index])
        })
      })
      this.dataList = result
    },
    // åˆå¹¶
    combineCell() {
      console.log(this.dataList)
      let list =this.dataList;
      for (let field in list[0]) {
        var k = 0;
        while (k < list.length) {
          list[k][field + 'span'] = 1;
          list[k][field + 'dis'] = false;
          for (var i = k + 1; i <= list.length - 1; i++) {
            if (list[k][field] == list[i][field] && list[k][field] != '') {
              list[k][field + 'span']++;
              list[k][field + 'dis'] = false;
              list[i][field + 'span'] = 1;
              list[i][field + 'dis'] = true;
            } else {
              break;
            }
          }
          k = i;
        }
      }
      return list;
    },
    disabledDate(current){
      //Can not slect days before today and today
      return current && current > moment().subtract('days', 1);
    },
    initDeviceType(deviceList) {
      let dictCode = 'mdc_equipmentType'
      let items = []
      items = getDictItemsFromCache(dictCode)
      if (deviceList && items.length > 0) {
        for (let a = 0; a < deviceList.length; a++) {
          if (items && items.length > 0) {
            for (let i = 0; i < items.length; i++) {
              if (deviceList[a].equipmentType == items[i].value) {
                deviceList[a].equipmentType = items[i].title
              }
            }
          } else {
            ajaxGetDictItems(dictCode, null).then((res) => {
              if (res.success) {
                let items = res.result
                for (let i = 0; i < items.length; i++) {
                  if (deviceList[a].equipmentType == items[i].value) {
                    deviceList[a].equipmentType = items[i].title
                  }
                }
              }
            })
          }
        }
      }
    },
    exportExcel() {
      $("#EfficiencyPO").table2excel({
        exclude: ".noExl",
        name: "Excel Document Name",
        filename: "设备开动率",
        exclude_img: true,
        fileext: ".xls",
        exclude_links: true,
        exclude_inputs: true
      });
    },
    showIdentifying() {
      getAction(this.url.listByType, { type: 'kdl' }).then(res => {
        if (res.success) {
          this.identifying = res.result
        }
      })
    },
    dateParamChange(v1, v2) {
      this.queryParam.startTime = v2[0]
      this.queryParam.endTime = v2[1]
      // ç‚¹å‡»æ—¶é—´é€‰æ‹©å™¨çš„æ¸…空按钮时会触发此判断(点击重置按钮不会触发),实现重置列表功能,切实改变列表显示效果
      if(!this.queryParam.startTime&&!this.queryParam.endTime)this.searchReset()
    },
    efficiencyOptionsOnChange(checkedList) {
      // let index = checkedList.indexOf('lyl')
      // if (index < 0) {
      //   // this.$message.warn('不能取消查询利用率')
      //   this.$notification.warning({
      //     message:'消息',
      //     description:"不能取消查询利用率"
      //   })
      //   return false
      // }
      this.checkedList = checkedList
    },
    searchQuery() {
      if(this.queryParam.typeTree == "1"){
        this.queryParam.parentId =  this.queryParamEquip.parentId
        this.queryParam.equipmentId = this.queryParamEquip.equipmentId
      }else{
        this.queryParam.parentId = this.queryParamPeople.parentId
        this.queryParam.equipmentId = ""
      }
      Object.keys(this.queryParams).forEach(item => {
        this.queryParam[item] = this.queryParams[item].join()
        // æ­¤å¤„为保证接口参数不多余,可省略
        if (this.queryParams[item].length === 0) delete this.queryParam[item]
      })
      this.loadData()
    },
    searchReset() {
      this.typeTree = this.queryParam.typeTree
      this.typeParent =  this.queryParam.parentId
      this.typeEquipment = this.queryParam.equipmentId
      this.queryParam = {}
      this.queryParam.typeTree = this.typeTree
      this.queryParam.parentId = this.typeParent
      this.queryParam.equipmentId =  this.typeEquipment
      this.dates = [moment().subtract('days', 8), moment().subtract('days', 1)]
      this.queryParam.startTime = moment(this.dates[0]).format('YYYYMMDD')
      this.queryParam.endTime = moment(this.dates[1]).format('YYYYMMDD')
      // this.ipagination.current = 1
      this.queryParams = {
        equipmentType: [],
        driveType: [],
        deviceLevel: [],
        deviceCategory: []
      }
      this.loadData();
    },
    loadData() {
      this.spinning=true
      this.tableHeads = []
      this.dataList = []
      getAction(this.url.list, this.queryParam).then(res => {
        if (res.success) {
          // console.log(res.result)
          this.tableHeads = res.result.dates
          this.dataList = res.result.mdcEfficiencyList
          if (res.result.mdcEfficiencyList && !res.result.mdcEfficiencyList.length) {
            this.$notification.info({
              message: '消息',
              description: '暂无该设备类型数据'
            })
          }
          this.checkSameData(this.dataList)
          this.checkSameData1(this.dataList)
          this.checkSameData2(this.dataList)
          this.combineCell();
          // this.initDeviceType(this.dataList)
        }
      }).finally(()=>{
        this.spinning=false
      })
    },
    queryGroup() {
      getAction(this.url.queryEquipmentType).then(res => {
        if (res.success) {
          this.equipmentTypeList = res.result.map(item => {
            return {
              label: item.equipmentTypeName,
              value: item.equipmentTypeName
            }
          })
        } else {
          // this.$message.warning(res.message)
          this.$notification.warning({
            message: '消息',
            description: res.message
          })
        }
      }).finally(() => {
        this.loading = false
      })
    },
    /**
     * è°ƒç”¨æŽ¥å£èŽ·å–æŽ§åˆ¶ç³»ç»Ÿç±»åž‹
     */
    getDriveTypeByApi(){
      api.getDriveTypeApi().then((res)=>{
        if (res.success) this.driveTypeList = res.result
      })
    },
    /**
     * åˆ†è¾¨çŽ‡æ”¹å˜æ—¶åŒæ—¶æ”¹å˜è¡¨æ ¼é«˜åº¦å·²ä¿è¯é¦–é¡µä¸€è¿›å…¥ä¸æ‹–åŠ¨åž‚ç›´æ»šåŠ¨æ¡æ—¶å³å¯æ‹–åŠ¨è¡¨æ ¼æ°´å¹³æ»šåŠ¨æ¡
     */
    handleWindowResize() {
      const tableContainer = document.getElementById('EfficiencyPO') // è¡¨æ ¼å®¹å™¨
      const clientHeight = document.documentElement.clientHeight || document.body.clientHeight // æµè§ˆå™¨å¯è§†åŒºåŸŸé«˜åº¦
      const containerTopToClientTopHeight = tableContainer.getBoundingClientRect().top // è¡¨æ ¼å®¹å™¨é¡¶éƒ¨åˆ°æµè§ˆå™¨å¯è§†åŒºåŸŸé¡¶éƒ¨çš„间距
      tableContainer.style.height = (clientHeight - containerTopToClientTopHeight - 32) + 'px'
    }
  }
}
</script>
<style scoped>
/*table样式*/
.table2{
  width: 100%;
  height: 100%;
  overflow: auto;
}
.table2 thead tr th:first-child,
.table tbody tr .tdgu{
  position: sticky;
  left: 0;
  z-index: 1;
}
.table tbody tr .wenzi{
  /*writing-mode: vertical-lr;*/
  /*text-orientation: upright;*/
  transform: rotate(360deg);
  writing-mode: vertical-lr;
  letter-spacing: 2px;
}
.table tbody tr .kaitou{
  z-index: 1;
  background-color: white;
}
.table tbody tr .tdgu1{
  position: sticky;
  left: 50px;
  z-index: 2;
}
.table tbody tr .tdgu2{
  position: sticky;
  left: 100px;
  z-index: 2;
}
.table tbody tr .tdgu3{
  position: sticky;
  left: 150px;
  z-index: 2;
}
.table tbody tr .tdgu4{
  position: sticky;
  left: 250px;
  z-index: 2;
}
.table tbody tr .tdgu5{
  position: sticky;
  left: 412px;
  z-index: 2;
}
.table2 thead tr .timeth,
.table2 thead tr  .thgu {
  position: sticky;
  top:0;
  z-index: 3;
}
.table2 thead .gudingth th{
  position: sticky;
  top: 32px;
  z-index: 2;
}
.table2 thead .equipname .name{
  z-index: 3;
}
.table2 thead .equipname .dong1{
  z-index: 4;
  left: 0;
}
.table2 thead .equipname .dong2{
  z-index: 5;
  left: 50px;
}
.table2 thead .equipname .dong3{
  z-index: 5;
  left: 100px;
}
.table2 thead .equipname .dong4{
  z-index: 5;
  left: 150px;
}
.table2 thead .equipname .dong5{
  z-index: 5;
  left: 250px;
}
.table2 thead .equipname .dong6{
  z-index: 5;
  left: 412px;
}
#EfficiencyPO{
  overflow: hidden;
}
.identifyingclass {
  width: 55px;
  height: 15px;
  display: inline-block
}
.dataContent {
  white-space: nowrap;
  /*margin: 0;*/
  border-collapse: separate;
  border-spacing: 0;
  /*table-layout: fixed;*/
  border: 1px solid #ccc;
  /*border: 1px solid #ccc;*/
  width: 100%;
  /*height: 100%;*/
  /*overflow: hidden;*/
  /*overflow-y: auto;*/
  text-align: center;
}
.dataContent .thead th {
  background-color: #fafafa;
  text-align: center;
  height: 30px;
  padding: 5px;
}
.dataContent .notfixed th {
  width: auto;
}
.dataContent .mathData td {
  padding: 10px;
}
</style>
src/views/mdc/base/modules/mdcUtilizationRate/MdcUtilizationRateModel.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,204 @@
<template>
  <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading"
           :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="类别">
              <a-input :disabled="true" v-decorator="['rateParameterCategory', validatorRules.rateParameterCategory]"/>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="等级" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="true" v-decorator="['rateParameterLevel', validatorRules.rateParameterLevel]"/>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item label="最小范围(单位:%)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="请输入最小范围"
                       v-decorator="['minimumRange',validatorRules.minimumRange]"/>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item label="最大范围(单位:%)" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="请输入最大范围"
                       v-decorator="['maximumRange',validatorRules.maximumRange]"/>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item label="颜色" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input type="color" v-decorator="['rateParameterColor',validatorRules.rateParameterColor]"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
  import pick from 'lodash.pick'
  import {
    getAction,
    postAction,
    requestPut
  } from '@/api/manage'
  import {
    duplicateCheck
  } from '@/api/api'
  export default {
    name: 'MdcUtilizationRateModel',
    props: {},
    data() {
      return {
        title: '',
        visible: false,
        show: false,
        model: {},
        checked: false,
        labelCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 6
          }
        },
        wrapperCol: {
          xs: {
            span: 24
          },
          sm: {
            span: 18
          }
        },
        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules: {},
        url: {
          edit: '/mdc/MdcUtilizationRate/editUtilization'
        },
        disableSubmit: true
      }
    },
    created() {
    },
    methods: {
      //级联框onChange事件
      onChange(value) {
      },
      edit(record) {
        this.form.resetFields()
        this.model = Object.assign({}, record)
        this.visible = true
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, 'rateParameterCategory', 'rateParameterLevel', 'minimumRange', 'maximumRange', 'rateParameterColor'))
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
        this.show = false
      },
      handleOk() {
        const that = this
        // è§¦å‘表单验证
        this.form.validateFields((err, values) => {
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            requestPut(this.url.edit, formData, {
              id: this.model.id
            }).then((res) => {
              if (res.success) {
                // that.$message.success("保存成功")
                that.$notification.success({
                  message: '消息',
                  description: '保存成功'
                })
                that.$emit('ok', res.result)
              } else {
                // that.$message.warning(res.message)
                that.$notification.warning({
                  message: '消息',
                  description: res.message
                })
              }
            }).finally(() => {
              that.confirmLoading = false
              that.close()
            })
          }
        })
      },
      handleCancel() {
        this.close()
      },
      loadCascade() {
        getAction(this.url.loadCascadeData).then((res) => {
          if (res.success) {
            this.partCategoryCascade = res.result
          }
        })
      },
      onCascadeChange(value, selectedOptions) {
        this.cascadeDefaultValue = [...value]
      },
      filter(inputValue, path) {
        return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
      },
      //验证 ç¼–码
      validateNum(rule, value, callback) {
        var params = {
          tableName: 'lxmes_base_part',
          fieldName: 'num',
          fieldVal: value,
          dataId: this.model.id,
          //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
          delFlag: 'true'
        }
        duplicateCheck(params).then((res) => {
          if (res.success) {
            callback()
          } else {
            callback('存货编码已存在!')
          }
        })
      },
      checkboxChange(e) {
        this.checked = e.target.checked
      }
    }
  }
</script>
<style scoped>
  .ant-btn {
    padding: 0 10px;
    margin-left: 3px;
  }
  .ant-form-item-control {
    line-height: 0px;
  }
  /** ä¸»è¡¨å•行间距 */
  .ant-form .ant-form-item {
    margin-bottom: 10px;
  }
  /** Tab页面行间距 */
  .ant-tabs-content .ant-form-item {
    margin-bottom: 0px;
  }
</style>