“linengliang”
2023-10-16 581ec6c1e6de150da170a651909a3de7d739cb36
保养计划
已添加5个文件
1192 ■■■■■ 文件已修改
src/views/eam/EquipmentMaintenancePlanDetailList.vue 186 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/EquipmentMaintenancePlanList.vue 316 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanForm.vue 341 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanModal.vue 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/modules/maintenancePlan/StandardSelect.vue 285 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/EquipmentMaintenancePlanDetailList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,186 @@
<template>
  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator" v-if="mainId">
      <!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <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"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <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-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  export default {
    name: "EquipmentMaintenancePlanDetailList",
    mixins:[JeecgListMixin],
    components: {},
    props:{
      mainId:{
        type:String,
        default:'',
        required:false
      }
    },
    watch:{
      mainId:{
        immediate: true,
        handler(val) {
          if(!this.mainId){
            this.clearList()
          }else{
            this.queryParam['planId'] = val
            this.loadData(1);
          }
        }
      }
    },
    data () {
      return {
        description: '保养计划管理页面',
        disableMixinCreated:true,
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:45,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'保养标准',
            align:"center",
            dataIndex: 'standardNum',
            width:300,
          },
          {
            title:'设备统一编码',
            align:"center",
            dataIndex: 'equipmentNum',
            width:300,
          },
          {
            title:'设备名称',
            align:"center",
            dataIndex: 'equipmentName',
            width:300,
          },
          {
            title:'设备型号',
            align:"center",
            dataIndex: 'model',
            width:300,
          },
          {
            title:'计划开始时间',
            align:"center",
            dataIndex: 'planStartTime',
            width:300,
          },
          {
            title:'计划结束时间',
            align:"center",
            dataIndex: 'planEndTime',
            width:300,
          },
        ],
        url: {
          list: "/eam/equipmentMaintenancePlan/listEquipmentMaintenancePlanDetailByMainId",
          delete: "/eam/equipmentMaintenancePlan/deleteEquipmentMaintenancePlanDetail",
          deleteBatch: "/eam/equipmentMaintenancePlan/deleteBatchEquipmentMaintenancePlanDetail",
          exportXlsUrl: "/eam/equipmentMaintenancePlan/exportEquipmentMaintenancePlanDetail",
          importUrl: "/eam/equipmentMaintenancePlan/importEquipmentMaintenancePlanDetail",
        },
        dictOptions:{
        }
      }
    },
    created() {
    },
    computed: {
      importExcelUrl(){
        return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`;
      }
    },
    methods: {
      clearList(){
        this.dataSource=[]
        this.selectedRowKeys=[]
        this.ipagination.current = 1
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
src/views/eam/EquipmentMaintenancePlanList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,316 @@
<template>
  <a-card :bordered="false">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
    </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"
        class="j-table-force-nowrap"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
        :customRow="clickThenSelect"
        @change="handleTableChange">
        <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)" v-if="record.status==='created'||record.status==='rejected'">编辑</a>
          <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'"/>
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)" v-if="record.status==='created'||record.status==='rejected'">
              <a>删除</a>
          </a-popconfirm>
          <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'"/>
          <a-popconfirm title="提交后不可撤回,确定提交吗?" @confirm="() => handleSubmit(record)" v-if="record.status==='created'||record.status==='rejected'">
              <a>提交</a>
          </a-popconfirm>
          <a-divider type="vertical" v-if="record.status==='created'||record.status==='rejected'"/>
          <a-popconfirm title="通过后不可撤销,确定通过吗?" @confirm="() => handleAudit(record)" v-if="record.status==='submitted'">
              <a>通过</a>
          </a-popconfirm>
          <a-divider type="vertical" v-if="record.status==='submitted'"/>
          <a-popconfirm title="确定驳回吗?" @confirm="() => handleReject(record)" v-if="record.status==='submitted'">
              <a>驳回</a>
          </a-popconfirm>
          <a-divider type="vertical" v-if="record.status==='submitted'"/>
          <a-popconfirm title="下发后不可撤销,确定下发吗?" @confirm="() => handleDistrbute(record)" v-if="record.status==='passed'">
              <a>下发</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="保养计划明细" key="1" >
        <EquipmentMaintenancePlanDetailList :mainId="equipmentMaintenancePlanDetailMainId" />
      </a-tab-pane>
    </a-tabs>
    <equipmentMaintenancePlan-modal ref="modalForm" @ok="modalFormOk"></equipmentMaintenancePlan-modal>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import EquipmentMaintenancePlanModal from './modules/maintenancePlan/EquipmentMaintenancePlanModal'
  import { getAction } from '@/api/manage'
  import EquipmentMaintenancePlanDetailList from './EquipmentMaintenancePlanDetailList'
  import '@/assets/less/TableExpand.less'
import { putAction } from '../../api/manage'
  export default {
    name: "EquipmentMaintenancePlanList",
    mixins:[JeecgListMixin],
    components: {
      EquipmentMaintenancePlanDetailList,
      EquipmentMaintenancePlanModal
    },
    data () {
      return {
        description: '保养计划管理页面',
        // è¡¨å¤´
        columns: [
          {
            title:'计划单号',
            align:"center",
            dataIndex: 'num',
          },
          {
            title:'计划单类型',
            align:"center",
            dataIndex: 'type_dictText',
            width:200,
          },
          {
            title:'计划单状态',
            align:"center",
            dataIndex: 'status_dictText',
            width:200,
          },
          {
            title:'设备数量',
            align:"center",
            dataIndex: 'equipNo',
            width:200,
          },
          {
            title:'创建人',
            align:"center",
            dataIndex: 'createBy',
            width:200,
          },
          {
            title:'创建时间',
            align:"center",
            dataIndex: 'createTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            },
            width:200,
          },
          {
            title:'修改人',
            align:"center",
            dataIndex: 'updateBy',
             width:200,
          },
          {
            title:'修改时间',
            align:"center",
            dataIndex: 'updateTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            },
            width:200,
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:200,
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/eam/equipmentMaintenancePlan/list",
          delete: "/eam/equipmentMaintenancePlan/delete",
          deleteBatch: "/eam/equipmentMaintenancePlan/deleteBatch",
          exportXlsUrl: "/eam/equipmentMaintenancePlan/exportXls",
          importExcelUrl: "eam/equipmentMaintenancePlan/importExcel",
          submit:"eam/equipmentMaintenancePlan/submit",
          reject:"eam/equipmentMaintenancePlan/reject",
          distrbute:"eam/equipmentMaintenancePlan/distrbute",
          audit:"eam/equipmentMaintenancePlan/audit"
        },
        dictOptions:{
        },
        /* åˆ†é¡µå‚æ•° */
        ipagination:{
          current: 1,
          pageSize: 5,
          pageSizeOptions: ['5', '10', '50'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " å…±" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        selectedMainId:'',
        superFieldList:[],
        equipmentMaintenancePlanDetailMainId: '',
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      initDictConfig(){
      },
      clickThenSelect(record) {
        return {
          on: {
            click: () => {
              this.onSelectChange(record.id.split(","), [record]);
            }
          }
        }
      },
      onClearSelected() {
        this.selectedRowKeys = [];
        this.selectionRows = [];
        this.selectedMainId=''
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedMainId=selectedRowKeys[0]
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows;
        this.equipmentMaintenancePlanDetailMainId = selectionRows[0]['id']
      },
      loadData(arg) {
        if(!this.url.list){
          this.$message.error("请设置url.list属性!")
          return
        }
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        this.onClearSelected()
        var params = this.getQueryParams();//查询条件
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records;
            this.ipagination.total = res.result.total;
          }
          if(res.code===510){
            this.$message.warning(res.message)
          }
          this.loading = false;
        })
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'num',text:'计划单号',dictCode:''})
        fieldList.push({type:'string',value:'type',text:'计划单类型(数据字典:maintenance_plan_type)',dictCode:''})
        fieldList.push({type:'string',value:'status',text:'计划单状态(数据字典:maintenance_plan_type)',dictCode:''})
        fieldList.push({type:'int',value:'equipNo',text:'设备数量',dictCode:''})
        fieldList.push({type:'string',value:'createBy',text:'createBy',dictCode:''})
        fieldList.push({type:'date',value:'createTime',text:'createTime'})
        fieldList.push({type:'string',value:'updateBy',text:'updateBy',dictCode:''})
        fieldList.push({type:'date',value:'updateTime',text:'updateTime'})
        this.superFieldList = fieldList
      },
      handleSubmit(record){
         putAction(this.url.submit,record).then(res=>{
             if(res.success){
                this.$message.success("操作成功");
             }else{
                this.$message.success("操作失败");
             }
         })
      },
      handleAudit(record){
         putAction(this.url.audit,record).then(res=>{
          if(res.success){
                this.$message.success("操作成功");
             }else{
                this.$message.success("操作失败");
             }
         })
      },
      handleDistrbute(record){
        putAction(this.url.distrbute,record).then(res=>{
          if(res.success){
                this.$message.success("操作成功");
             }else{
                this.$message.success("操作失败");
             }
        })
      },
      handleReject(record){
        putAction(this.url.reject,record).then(res=>{
          if(res.success){
                this.$message.success("操作成功");
             }else{
                this.$message.success("操作失败");
             }
        })
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,341 @@
<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="12" >
            <a-form-model-item label="计划单号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num">
              <a-input v-model="model.num" placeholder="请输入计划单号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="计划单类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type">
              <j-dict-select-tag
                allow-clear
                placeholder="请选择计划单类型"
                :triggerChange="true"
                dictCode="maintenance_type"
                v-model="model.type"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
      <!-- å­è¡¨å•区域 -->
    <a-tabs v-model="activeKey" @change="handleChangeTabs">
      <a-tab-pane tab="保养计划明细" :key="refKeys[0]" :forceRender="true">
        <j-vxe-table
          keep-source
          :ref="refKeys[0]"
          :loading="equipmentMaintenancePlanDetailTable.loading"
          :columns="equipmentMaintenancePlanDetailTable.columns"
          :dataSource="equipmentMaintenancePlanDetailTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :toolbar="true"
          bordered
          :alwaysEdit="true"
          :toolbarConfig='toolbarConfig'
          >
          <template slot='toolbarPrefix'>
          <a-button type='primary' @click='standardSelect' :disabled="formDisabled"  icon="plus">设备-保养标准
            </a-button>
          </template>
        </j-vxe-table>
      </a-tab-pane>
    </a-tabs>
    <standard-select  @selectionRows='selectionRows' ref='standardSelectModel' ></standard-select>
  </a-spin>
</template>
<script>
  import { getAction } from '@/api/manage'
  import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
  import { JVXETypes } from '@/components/jeecg/JVxeTable'
  import { getRefPromise,VALIDATE_FAILED} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
  import { validateDuplicateValue } from '@/utils/util'
  import JFormContainer from '@/components/jeecg/JFormContainer'
  import StandardSelect from './StandardSelect'
  import { duplicateCheck } from '@/api/api'
  import dayjs from 'dayjs'
  export default {
    name: 'EquipmentMaintenancePlanForm',
    mixins: [JVxeTableModelMixin],
    components: {
      JFormContainer,
      StandardSelect,
      dayjs
    },
    data() {
      return {
        toolbarConfig: {
        // prefix å‰ç¼€ï¼›suffix åŽç¼€
        slot: ['prefix', 'suffix'],
        // add æ–°å¢žæŒ‰é’®ï¼›remove åˆ é™¤æŒ‰é’®ï¼›clearSelection æ¸…空选择按钮
        btn: ['remove', 'clearSelection']
        },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        model:{
         },
        // æ–°å¢žæ—¶å­è¡¨é»˜è®¤æ·»åŠ å‡ è¡Œç©ºæ•°æ®
        addDefaultRowNum: 1,
        validatorRules: {
          num: [
          { required: true, message: '请输入编码!' },
          { min: 1, max: 30, message: '长度在 2 åˆ° 30 ä¸ªå­—符', trigger: 'blur' },
          { validator: this.validateNum },
        ],
          type: [
          { required: true, message: '请选择计划单类型!' },
        ],
        },
        refKeys: ['equipmentMaintenancePlanDetail', ],
        tableKeys:['equipmentMaintenancePlanDetail', ],
        activeKey: 'equipmentMaintenancePlanDetail',
        // ä¿å…»è®¡åˆ’明细
        equipmentMaintenancePlanDetailTable: {
          loading: false,
          dataSource: [
          ],
          columns: [
          {
              title: '保养标准id',
              key: 'standardId',
              type: JVXETypes.hidden,
              placeholder: '请输入${title}',
              defaultValue: '',
              align:'center',
              width:"230px",
            },
            {
              title: '保养标准',
              key: 'standardNum',
              type: JVXETypes.normal,
              placeholder: '请输入${title}',
              defaultValue: '',
              align:'center',
              width:"230px",
            },
            {
              title: '设备统一编码',
              key: 'equipmentNum',
              type: JVXETypes.normal,
              placeholder: '请输入${title}',
              defaultValue: '',
              align:'center',
              width:"230px",
            },
            {
              title: '设备名称',
              key: 'equipmentName',
              type: JVXETypes.normal,
              placeholder: '请输入${title}',
              defaultValue: '',
              align:'center',
              width:"230px",
            },
            {
              title: '设备型号',
              key: 'model',
              type: JVXETypes.normal,
              placeholder: '请输入${title}',
              defaultValue: '',
              align:'center',
              width:"230px",
            },
            {
              title: '计划开始时间',
              key: 'planStartTime',
              type: JVXETypes.datetime,
              placeholder: '请输入${title}',
              align:'center',
              width:"250px",
              validateRules: [
              {
                required: true, // å¿…å¡«
                message: '请输入${title}' // æ˜¾ç¤ºçš„æ–‡æœ¬
              },
              {
                handler({ cellValue, row, column }, callback, target) {
                    var start = dayjs(cellValue);
                    var end = dayjs(row.planEndTime);
                    if (!start.isBefore(end)) {
                        callback(false, '结束时间需滞后于开始时间') // false = æœªé€šè¿‡ï¼Œå¯ä»¥è·Ÿè‡ªå®šä¹‰æç¤º
                    } else {
                        callback(true) // true = é€šè¿‡éªŒè¯
                    }
                },
                message: '${title}默认提示'
              }
              ]
            },
            {
              title: '计划结束时间',
              key: 'planEndTime',
              type: JVXETypes.datetime,
              placeholder: '请输入${title}',
              align:'center',
              width:"250px",
              validateRules: [
              {
                required: true, // å¿…å¡«
                message: '请输入${title}' // æ˜¾ç¤ºçš„æ–‡æœ¬
              },
              {
                handler({ cellValue, row, column }, callback, target) {
                    var start = dayjs(row.planStartTime);
                    var end = dayjs(cellValue);
                    if (!start.isBefore(end)) {
                        callback(false, '结束时间需滞后于开始时间') // false = æœªé€šè¿‡ï¼Œå¯ä»¥è·Ÿè‡ªå®šä¹‰æç¤º
                    } else {
                        callback(true) // true = é€šè¿‡éªŒè¯
                    }
                },
                message: '${title}默认提示'
              }
              ]
            },
          ]
        },
        url: {
          add: "/eam/equipmentMaintenancePlan/add",
          edit: "/eam/equipmentMaintenancePlan/edit",
          queryById: "/eam/equipmentMaintenancePlan/queryById",
          equipmentMaintenancePlanDetail: {
            list: '/eam/equipmentMaintenancePlan/listEquipmentMaintenancePlanDetailByMainId'
          },
        }
      }
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
    },
    methods: {
      addBefore(){
        this.equipmentMaintenancePlanDetailTable.dataSource=[]
      },
      getAllTable() {
        let values = this.tableKeys.map(key => getRefPromise(this, key))
        return Promise.all(values)
      },
      /** è°ƒç”¨å®Œedit()方法之后会自动调用此方法 */
      editAfter() {
        this.$nextTick(() => {
        })
        // åŠ è½½å­è¡¨æ•°æ®
        if (this.model.id) {
          let params = { planId: this.model.id }
          this.requestSubTableData(this.url.equipmentMaintenancePlanDetail.list, params, this.equipmentMaintenancePlanDetailTable)
        }
      },
      //校验所有一对一子表表单
        validateSubForm(allValues){
            return new Promise((resolve,reject)=>{
              Promise.all([
              ]).then(() => {
                resolve(allValues)
              }).catch(e => {
                if (e.error === VALIDATE_FAILED) {
                  // å¦‚果有未通过表单验证的子表,就自动跳转到它所在的tab
                  this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
                } else {
                  console.error(e)
                }
              })
            })
        },
      /** æ•´ç†æˆformData */
      classifyIntoFormData(allValues) {
        let main = Object.assign(this.model, allValues.formValue)
        return {
          ...main, // å±•å¼€
          equipmentMaintenancePlanDetailList: allValues.tablesValue[0].tableData,
        }
      },
      validateError(msg){
        this.$message.error(msg)
      },
      standardSelect() {
      let ids = []
      let tableData = this.$refs.equipmentMaintenancePlanDetail.getTableData()
      for (let i = 0; i < tableData.length; i++) {
        ids.push(tableData[i].standardId)
      }
      this.$refs.standardSelectModel.showModal(ids)
      this.$refs.standardSelectModel.title = '选择精度参数'
      this.$refs.standardSelectModel.disableSubmit = false
    },
    addSelected(data) {
      let tableData = this.$refs.equipmentMaintenancePlanDetail.getTableData()
      var tableStr = JSON.stringify(tableData)
      const addRows = []
      for (let i = 0; i < data.length; i++) {
        var equipmentMaintenancePlanDetail = {}
        if (tableStr.indexOf(data[i].id) == -1) {
          equipmentMaintenancePlanDetail = {
            standardId:data[i].id,
            standardNum: data[i].num,
            equipmentNum:data[i].equipmentNum,
            equipmentName:data[i].equipmentName,
            model:data[i].equipmentModel,
            planId:this.model.id,
          }
        }
        addRows.push(equipmentMaintenancePlanDetail)
      }
      this.$refs.equipmentMaintenancePlanDetail.pushRows(addRows)
    },
    selectionRows(data) {
      // å¢žåŠ é€‰ä¸­çš„è®¾å¤‡åˆ°åˆ—è¡¨ä¸­
      this.addSelected(data)
    },
    validateNum(rule, value, callback) {
      var params = {
        tableName: 'mom_eam_equipment_maintenance_plan',
        fieldName: 'num',
        fieldVal: value,
        dataId: this.model.id,
        //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
        delFlag: '0',
      };
      duplicateCheck(params).then((res) => {
        if (res.success) {
          callback();
        } else {
          callback("编号已存在!");
        }
      })
    },
    }
  }
</script>
<style scoped>
</style>
src/views/eam/modules/maintenancePlan/EquipmentMaintenancePlanModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,64 @@
<template>
  <j-modal
    :title="title"
    :width="1600"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel">
    <equipment-maintenance-plan-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/>
  </j-modal>
</template>
<script>
  import EquipmentMaintenancePlanForm from './EquipmentMaintenancePlanForm'
  export default {
    name: 'EquipmentMaintenancePlanModal',
    components: {
      EquipmentMaintenancePlanForm
    },
    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.handleOk();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>
<style scoped>
</style>
src/views/eam/modules/maintenancePlan/StandardSelect.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,285 @@
<template>
  <!--支持全屏缩放-->
  <a-modal
    :visible="visible"
    :title="title"
    switchFullscreen
    @ok="handleSubmit"
    @cancel="close"
    style="top:50px"
    cancelText="关闭"
    :width="1050"
  >
    <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="8"
              :sm="6"
            >
              <a-form-item label="检验项目名称">
                <a-input
                  placeholder="请输入检验项目名称"
                  v-model="queryParam.name"
                />
              </a-form-item>
            </a-col>
            <a-col :md="3">
              <span
                style="float: left;overflow: hidden;"
                class="table-page-search-submitButtons"
              >
                <a-button
                  type="primary"
                  @click="searchQuery"
                  icon="search"
                >查询</a-button>
                <a-button
                  @click="searchReset"
                  icon="reload"
                  style="margin-left: 10px"
                >重置</a-button>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <a-table
        ref="table"
        :scroll="scrollTrigger"
        size="middle"
        rowKey="id"
        bordered
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :rowSelection="rowSelection"
        :loading="loading"
        @change="handleTableChange"
      >
      </a-table>
    </a-card>
  </a-modal>
</template>
<script>
import { filterObj } from '@/utils/util'
import { getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'JSelectToolingModal',
  mixins: [JeecgListMixin],
  components: {},
  props: {
  },
  data() {
    return {
      queryParam: {
      },
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '版本',
          align: 'center',
          dataIndex: 'version',
          width: 100,
        },
        {
          title: '版本状态',
          align: 'center',
          dataIndex: 'versionStatusName',
          width: 130,
        },
        {
          title: '标准编码',
          align: 'center',
          dataIndex: 'num',
        },
        {
          title: '对象部门',
          align: 'center',
          dataIndex: 'useDepartName',
        },
        {
          title: '设备编码',
          align: 'center',
          dataIndex: 'equipmentNum',
        },
        {
          title: '设备名称',
          align: 'center',
          dataIndex: 'equipmentName',
        },
        {
          title: '设备型号',
          align: 'center',
          dataIndex: 'equipmentModel',
        },
      ],
      selectedRowKeys: [],
      oldSlelectRows: [],
      scrollTrigger: {},
      dataSource: [],
      selectionRows: [],
      title: '根据查询结果选择精度参数',
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['5', '10', '30', '50', '100'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' å…±' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      isorter: {
        column: 'num',
        order: 'desc'
      },
      departTree: [],
      visible: false,
      loading: false,
      url: {
        list: '/eam/maintenanceStandard/getMaintenanceStandardList',
      },
    }
  },
  computed: {
    rowSelection() {
      return {
        type: 'checkbox',
        onChange: (selectedRowKeys, selectedRows) => {
          this.selectedRowKeys = selectedRowKeys;
          this.onSelectChange(selectedRows);
        },
        getCheckboxProps: record => ({
          props: {
            disabled: record.distable
          },
        }),
        selectedRowKeys: this.selectedRowKeys,
      };
    },
  },
  watch: {
  },
  created() {
  },
  methods: {
    async loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1;
      }
      let that = this
      this.loading = true
      this.queryParam.versionStatus = '2'
      this.queryParam.type = 'daily'
      let params = this.getQueryParams()//查询条件
      await getAction(this.url.list, params).then((res) => {
        if (res.success) {
          for (let i = 0; i < res.result.records.length; i++) {
            if (that.oldSlelectRows.indexOf(res.result.records[i].id) > -1) {
              res.result.records[i].distable = true;
            } else {
              res.result.records[i].distable = false;
            }
          }
          this.dataSource = res.result.records;
          this.ipagination.total = res.result.total;
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false;
      })
    },
    showModal(oldSlelectRows) {
      this.oldSlelectRows = oldSlelectRows;
      this.visible = true;
      this.loadData(1);
    },
    getQueryParams() {
      let param = Object.assign({}, this.queryParam, this.isorter);
      param.field = this.getQueryField();
      param.pageNo = this.ipagination.current;
      param.pageSize = this.ipagination.pageSize;
      return filterObj(param);
    },
    //查询条件处理
    getQueryField() {
      let str = 'id,';
      for (let a = 0; a < this.columns.length; a++) {
        str += ',' + this.columns[a].dataIndex;
      }
      return str;
    },
    searchReset(num) {
      let that = this;
      this.queryParam = [];
      if (num !== 0) {
        that.loadData(1);
      }
      that.selectborrowIds = [];
    },
    close() {
      this.searchReset(0);
      this.selectedRowKeys = [];
      this.visible = false;
    },
    handleTableChange(pagination, filters, sorter) {
      //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();
    },
    handleSubmit() {
      this.$emit('selectionRows', this.selectionRows);
      this.searchReset(0)
      this.close();
    },
    onSelectChange(selectionRows) {
      this.selectionRows = selectionRows;
    },
    searchQuery() {
      this.loadData(1);
    },
  }
}
</script>
<style scoped>
.ant-table-tbody .ant-table-row td {
  padding-top: 10px;
  padding-bottom: 10px;
}
#components-layout-demo-custom-trigger .trigger {
  font-size: 18px;
  line-height: 64px;
  padding: 0 24px;
  cursor: pointer;
  transition: color 0.3s;
}
</style>