cuilei
2025-06-24 c7bbdaab4503cc0e470623e87cca3b8a1840bff0
设备管理-大修项修页面
已添加2个文件
已修改2个文件
984 ■■■■ 文件已修改
src/views/eam/repair/EamMajorPartialRepairList.vue 395 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue 137 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/repair/modules/EamMajorPartialRepairForm.vue 306 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/repair/modules/EamMajorPartialRepairModal.vue 146 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/eam/repair/EamMajorPartialRepairList.vue
@@ -1,35 +1,41 @@
<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.delFlag"></a-input>
            <a-form-item label="维修编码">
              <a-input placeholder="请输入维修编码" v-model="queryParam.repairCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="设备ID">
              <a-input placeholder="请输入设备ID" v-model="queryParam.equipmentId"></a-input>
            <a-form-item label="项目名称">
              <a-input placeholder="请输入项目名称" v-model="queryParam.repairName"></a-input>
            </a-form-item>
          </a-col>
        <template v-if="toggleSearchStatus">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="维修状态">
                <j-dict-select-tag placeholder="请选择维修状态" v-model="queryParam.repairStatus" dictCode="major_partial_repair_status"/>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="维修类型">
              <a-input placeholder="请输入维修类型" v-model="queryParam.repairType"></a-input>
                <a-select v-model="queryParam.repairType" placeholder="请选择维修类型">
                  <a-select-option value="大修">大修</a-select-option>
                  <a-select-option value="项修">项修</a-select-option>
                </a-select>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="计划开始时间">
              <a-input placeholder="请输入计划开始时间" v-model="queryParam.planStartTime"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="计划结束时间">
              <a-input placeholder="请输入计划结束时间" v-model="queryParam.planEndTime"></a-input>
              <a-form-item label="计划开始日期">
                <a-range-picker
                  v-model="planDateRange"
                  @change="selectDateChange"
                  format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD"
                />
            </a-form-item>
          </a-col>
          </template>
@@ -43,21 +49,26 @@
              </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>
<!--      <a-button type="primary" icon="download" @click="handleExportXls('eam_major_partial_repair')">导出</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-item key="1" @click="batchSubmit"><a-icon type="form"/>提交</a-menu-item>
          <a-menu-item key="2" @click="batchConfirm"><a-icon type="check"/>确认</a-menu-item>
          <a-menu-item key="3" @click="batchRepeal"><a-icon type="close"/>作废</a-menu-item>
          <a-menu-item key="4" @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>
@@ -73,23 +84,64 @@
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
        <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="handleDetail(record)">详情</a>
          <span v-if="record.repairStatus === 'PENDING_SUBMISSION'">
            <a-divider type="vertical" />
            <a-popconfirm title="确定要提交吗?" @confirm="() => handleSubmit(record.id)">
              <a>提交</a>
            </a-popconfirm>
          </span>
          <span v-if="record.repairStatus === 'PENDING_CONFIRMATION'">
            <a-divider type="vertical" />
            <a-popconfirm title="要完成确认吗?" @confirm="() => handleConfirm(record.id)">
              <a>确认</a>
            </a-popconfirm>
          </span>
          <span v-if="record.repairStatus === 'CONFIRMED'">
            <a-divider type="vertical" />
            <a @click="handleFill(record)">填报</a>
          </span>
          <span v-if="record.repairStatus === 'PENDING_SUBMISSION'">
          <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="handleEdit(record)">编辑</a>
                </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
@@ -98,26 +150,31 @@
            </a-menu>
          </a-dropdown>
        </span>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <!-- è¡¨å•区域 -->
    <eamMajorPartialRepair-modal ref="modalForm" @ok="modalFormOk"></eamMajorPartialRepair-modal>
    <eam-major-partial-repair-modal ref="modalForm" @ok="modalFormOk"></eam-major-partial-repair-modal>
    <eam-major-partial-repair-detail-modal ref="modalDetailForm" @ok="modalFormOk"></eam-major-partial-repair-detail-modal>
  </a-card>
</template>
<script>
  import '@/assets/less/TableExpand.less'
  import EamMajorPartialRepairModal from './modules/EamMajorPartialRepairModal'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import EamMajorPartialRepairModal from './modules/EamMajorPartialRepairModal'
  import EamMajorPartialRepairDetailModal from './modules/EamMajorPartialRepairDetailModal'
  import { getAction } from '../../../api/manage'
  export default {
    name: "EamMajorPartialRepairList",
    mixins:[JeecgListMixin],
    name: 'EamMajorPartialRepairList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      EamMajorPartialRepairModal
      EamMajorPartialRepairModal,
      EamMajorPartialRepairDetailModal
    },
    data () {
      return {
@@ -135,14 +192,19 @@
            }
           },
           {
            title: '删除标记',
            title:'维修编码',
            align:"center",
            dataIndex: 'delFlag'
            dataIndex: 'repairCode'
           },
           {
            title: '设备ID',
            title:'项目名称',
            align:"center",
            dataIndex: 'equipmentId'
            dataIndex: 'repairName'
          },
          {
            title:'维修状态',
            align:"center",
            dataIndex: 'repairStatus_dictText'
           },
           {
            title: '维修类型',
@@ -150,29 +212,24 @@
            dataIndex: 'repairType'
           },
           {
            title: '计划开始时间',
            title:'申请人',
            align:"center",
            dataIndex: 'planStartTime'
            dataIndex: 'applicant_dictText'
           },
           {
            title: '计划结束时间',
            title:'申请车间',
            align:"center",
            dataIndex: 'planEndTime'
            dataIndex: 'applicantProduction_dictText'
           },
           {
            title: '维修编码',
            title:'计划开始日期',
            align:"center",
            dataIndex: 'repairCode'
            dataIndex: 'planStartDate'
           },
           {
            title: '维修名称',
            title:'计划结束日期',
            align:"center",
            dataIndex: 'repairName'
           },
           {
            title: '维修状态',
            align:"center",
            dataIndex: 'repairStatus'
            dataIndex: 'planEndDate'
           },
           {
            title: '实际开始时间',
@@ -189,54 +246,248 @@
            align:"center",
            dataIndex: 'totalAmount'
           },
           {
            title: '附件',
            align:"center",
            dataIndex: 'attachment'
           },
           {
            title: '维修描述',
            align:"center",
            dataIndex: 'repairDescription'
           },
           {
            title: '维修方式',
            align:"center",
            dataIndex: 'repairMethod'
           },
           {
            title: '委外公司',
            align:"center",
            dataIndex: 'outsourcedCompany'
           },
          // {
          //   title:'故障描述',
          //   align:"center",
          //   dataIndex: 'faultDescription'
          // },
          // {
          //   title:'申请原因',
          //   align:"center",
          //   dataIndex: 'applicantReason'
          // },
           {
            title: '责任人',
            align:"center",
            dataIndex: 'responsiblePerson'
            dataIndex: 'responsiblePerson_dictText'
          },
          {
            title:'备注',
            align:"center",
            dataIndex: 'remark'
           },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' },
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/eam/eamMajorPartialRepair/list",
          delete: "/eam/eamMajorPartialRepair/delete",
          deleteBatch: "/eam/eamMajorPartialRepair/deleteBatch",
          exportXlsUrl: "eam/eamMajorPartialRepair/exportXls",
          exportXlsUrl: "/eam/eamMajorPartialRepair/exportXls",
          importExcelUrl: "eam/eamMajorPartialRepair/importExcel",
          submit: "eam/eamMajorPartialRepair/submit",
          submitBatch: "eam/eamMajorPartialRepair/submitBatch",
          confirm: "eam/eamMajorPartialRepair/confirm",
          confirmBatch: "eam/eamMajorPartialRepair/confirmBatch",
          repeal: "eam/eamMajorPartialRepair/repeal",
          repealBatch: "eam/eamMajorPartialRepair/repealBatch"
       },
        planDateRange: [],
        dictOptions:{},
        superFieldList:[],
    }
    },
    created() {
    this.getSuperFieldList();
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
      },
  },
    methods: {
      searchReset() {
        this.planDateRange = []
        this.queryParam = {}
        this.loadData(1);
      },
      selectDateChange(value, dateString) {
        if (dateString && dateString.length === 2) {
          this.queryParam.planStartDate = dateString[0]
          this.queryParam.planEndDate = dateString[1]
        }
      },
      handleFill(record) {
        this.$refs.modalDetailForm.open(record);
        this.$refs.modalDetailForm.title = "填报";
        this.$refs.modalDetailForm.disableSubmit = false;
      },
      handleSubmit(id) {
        getAction(this.url.submit,{id:id}).then((res)=>{
          if(res.success){
            this.loadData();
            this.$message.success(res.message);
          } else {
            this.$message.warning(res.message);
          }
        })
      },
      handleConfirm(id) {
        getAction(this.url.confirm,{id:id}).then((res)=>{
          if(res.success){
            this.loadData();
            this.$message.success(res.message);
          } else {
            this.$message.warning(res.message);
          }
        })
      },
      batchSubmit() {
        if (this.selectedRowKeys.length <= 0) {
          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
              getAction(that.url.submitBatch, { ids: ids }).then((res) => {
                if (res.success) {
                  //重新计算分页问题
                  that.reCalculatePage(that.selectedRowKeys.length)
                  // that.$message.success(res.message);
                  that.$notification.success({
                    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
              })
            }
          })
        }
      },
      batchConfirm() {
        if (this.selectedRowKeys.length <= 0) {
          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
              getAction(that.url.confirmBatch, { ids: ids }).then((res) => {
                if (res.success) {
                  //重新计算分页问题
                  that.reCalculatePage(that.selectedRowKeys.length)
                  // that.$message.success(res.message);
                  that.$notification.success({
                    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
              })
            }
          })
        }
      },
      batchRepeal() {
        if (this.selectedRowKeys.length <= 0) {
          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
              getAction(that.url.repealBatch, { ids: ids }).then((res) => {
                if (res.success) {
                  //重新计算分页问题
                  that.reCalculatePage(that.selectedRowKeys.length)
                  // that.$message.success(res.message);
                  that.$notification.success({
                    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
              })
            }
          })
        }
      },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'repairCode',text:'维修编码',dictCode:''})
        fieldList.push({type:'string',value:'repairName',text:'项目名称',dictCode:''})
        fieldList.push({type:'string',value:'repairStatus',text:'维修状态',dictCode:''})
        fieldList.push({type:'string',value:'repairType',text:'维修类型',dictCode:''})
        fieldList.push({type:'string',value:'applicant',text:'申请人',dictCode:''})
        fieldList.push({type:'string',value:'applicantProduction',text:'申请车间',dictCode:''})
        fieldList.push({type:'date',value:'planStartDate',text:'计划开始日期'})
        fieldList.push({type:'date',value:'planEndDate',text:'计划结束日期'})
        fieldList.push({type:'date',value:'actualStartTime',text:'实际开始时间'})
        fieldList.push({type:'date',value:'actualEndTime',text:'实际结束时间'})
        fieldList.push({type:'BigDecimal',value:'totalAmount',text:'总金额',dictCode:''})
        fieldList.push({type:'string',value:'faultDescription',text:'故障描述',dictCode:''})
        fieldList.push({type:'string',value:'applicantReason',text:'申请原因',dictCode:''})
        fieldList.push({type:'string',value:'responsiblePerson',text:'责任人',dictCode:''})
        fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,137 @@
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <j-vxe-table
      ref="editableDetailTable"
      :rowNumber="true"
      :rowSelection="false"
      :bordered="false"
      :alwaysEdit="true"
      :toolbar="false"
      keep-source
      :height="300"
      :loading="detail.loading"
      :dataSource="detail.dataSource"
      :columns="equipmentColumns"
      style="margin-top: 8px;" />
  </j-modal>
</template>
<script>
import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
import { getAction, postAction } from '../../../../api/manage'
export default {
  name: 'EamMajorPartialRepairDetailModal',
  mixins: [JVxeTableModelMixin],
  data() {
    return {
      title: '',
      width: 1200,
      visible: false,
      disableSubmit: false,
      equipmentOptions: [],
      detail: {
        loading: false,
        dataSource: []
      },
      url: {
        queryDetailList: '/eam/eamMajorPartialRepairDetail/list',
        fillResult: '/eam/eamMajorPartialRepair/fillResult'
      }
    }
  },
  computed: {
    equipmentColumns() {
      return [
        {
          title: '设备',
          key: 'equipmentId_dictText',
          type: JVXETypes.normal,
          width: '25%',
          align: 'center'
        },
        {
          title: '单价',
          key: 'unitPrice',
          type: JVXETypes.normal,
          width: '10%',
          align: 'center'
        },
        {
          title: '维修结果',
          key: 'repairResult',
          type: JVXETypes.textarea,
          width: '30%',
          align: 'center',
          validateRules: [{ required: true, message: '维修结果不能为空!' }]
        },
        {
          title: '维修描述',
          key: 'repairDescription',
          type: JVXETypes.textarea,
          width: '30%',
          align: 'center',
          validateRules: [{ required: true, message: '维修描述不能为空!' }]
        }
      ];
    }
  },
  methods: {
    open(record) {
      this.visible = true
      getAction(this.url.queryDetailList, { repairId: record.id }).then((res) => {
        if (res.success) {
          if (res.result.total) {
            this.detail.dataSource = res.result.records
          }
        }
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    async handleOk() {
        // ðŸ‘‡ è§¦å‘表格校验
        const errMap = await this.$refs.editableDetailTable.validateTable();
        if (errMap) {
          return;
        }
        // æ ¡éªŒé€šè¿‡ï¼ŒèŽ·å–è¡¨æ ¼æ•°æ®
        const tableData = this.$refs.editableDetailTable.getTableData();
        postAction(this.url.fillResult, tableData).then((res) => {
          if (res.success) {
            this.$message.success(res.message)
            // ðŸ‘‡ æäº¤æˆåŠŸåŽå…³é—­å¼¹çª—
            this.submitCallback();
          } else {
            this.$message.warning(res.message)
          }
        })
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>
src/views/eam/repair/modules/EamMajorPartialRepairForm.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,306 @@
<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="8">
            <a-form-model-item label="维修编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairCode">
              <a-input v-model="model.repairCode" placeholder="系统自动生成" disabled ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="项目名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairName">
              <a-input v-model="model.repairName" placeholder="请输入项目名称"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="disabled">
            <a-form-model-item label="维修状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairStatus">
              <j-dict-select-tag placeholder="请选择维修状态" v-model="model.repairStatus" dictCode="major_partial_repair_status" disabled/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="维修类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairType">
              <a-select v-model="model.repairType" placeholder="请选择维修类型">
                <a-select-option value="大修">大修</a-select-option>
                <a-select-option value="项修">项修</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicant">
              <j-search-select-tag  placeholder="请选择申请人" v-model="model.applicant" dict="sys_user,realname, username, del_flag=0 and status=1"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请车间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicantProduction">
              <a-tree-select v-model="model.applicantProduction"
                             style="width: 100%"
                             :tree-data="treeData"
                             :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                             placeholder="请选择申请车间"
                             allow-clear
                             tree-default-expand-all
              >
              </a-tree-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="计划开始日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planStartDate">
              <j-date placeholder="请选择计划开始日期" v-model="model.planStartDate"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="计划结束日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planEndDate">
              <j-date placeholder="请选择计划结束日期" v-model="model.planEndDate"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="disabled">
            <a-form-model-item label="实际开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualStartTime">
              <j-date :show-time="true" dateFormat="YYYY-MM-DD HH" placeholder="请选择实际开始时间" v-model="model.actualStartTime"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="disabled">
            <a-form-model-item label="实际结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualEndTime">
              <j-date :show-time="true" dateFormat="YYYY-MM-DD HH" placeholder="请选择实际结束时间" v-model="model.actualEndTime"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="disabled">
            <a-form-model-item label="总金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalAmount">
              <a-input-number :min=0 :precision="2" v-model="model.totalAmount" placeholder="请输入总金额" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请原因" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicantReason">
              <a-input v-model="model.applicantReason" placeholder="请输入申请原因"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="责任人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responsiblePerson">
              <j-search-select-tag  placeholder="请选择责任人" v-model="model.responsiblePerson" dict="sys_user,realname, username, del_flag=0 and status=1"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="故障描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="faultDescription">
              <a-textarea v-model="model.faultDescription" placeholder="请输入故障描述"  ></a-textarea>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
              <a-textarea v-model="model.remark" placeholder="请输入备注"  ></a-textarea>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-tabs defaultActiveKey="1">
            <a-tab-pane key="1" tab="维修明细">
                <j-vxe-table
                  ref="editableDetailTable"
                  :rowNumber="true"
                  :rowSelection="true"
                  :bordered="true"
                  :alwaysEdit="true"
                  :toolbar="true"
                  :toolbar-config="detailToolbarConfig"
                  keep-source
                  :height="300"
                  :loading="detail.loading"
                  :dataSource="detail.dataSource"
                  :columns="equipmentColumns"
                  style="margin-top: 8px;"/>
            </a-tab-pane>
          </a-tabs>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>
<script>
import { getAction, httpAction } from '@/api/manage'
import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
export default {
    name: 'EamMajorPartialRepairForm',
    mixins: [JVxeTableModelMixin],
    components: {
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 7 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules: {
          repairName: { required: true, message: '请输入项目名称!' },
          repairType: { required: true, message: '请选择维修类型!' },
          applicant: { required: true, message: '请选择申请人!' },
          applicantProduction: { required: true, message: '请输入申请车间!' },
          planStartDate: { required: true, message: '请选择计划开始日期!' },
          planEndDate: { required: true, message: '请选择计划结束日期!' },
          applicantReason: { required: true, message: '请输入申请原因!' },
          responsiblePerson: { required: true, message: '请输入责任人!' },
          faultDescription: { required: true, message: '请输入故障描述!' }
        },
        treeData: [],
        equipmentOptions: [],
        detail: {
          loading: false,
          dataSource: [],
        },
        url: {
          add: "/eam/eamMajorPartialRepair/add",
          edit: "/eam/eamMajorPartialRepair/edit",
          queryById: "/eam/eamMajorPartialRepair/queryById",
          queryDetailList: "/eam/eamMajorPartialRepairDetail/list",
          queryEquipmentList: "/eam/equipment/asyncLoadEquipment",
          loadWorkShopOptions:'/mdc/mdcProduction/loadProductionTreeOptions'
        }
      }
    },
    computed: {
      detailToolbarConfig() {
        return {
          // å¦‚果是详情页,则不显示 add æŒ‰é’®
          btns: this.disabled ? ['remove', 'clearSelection'] : ['add', 'remove', 'clearSelection'],
          slots: ['prefix', 'suffix']
        };
      },
      formDisabled(){
        return this.disabled
      },
      equipmentColumns() {
        return [
          {
            title: '设备',
            key: 'equipmentId',
            type: JVXETypes.select,
            options: this.equipmentOptions,
            width: '20%',
            align: 'center',
            validateRules: [{ required: true, message: '设备不能为空!' }]
          },
          {
            title: '单价',
            key: 'unitPrice',
            type: JVXETypes.inputNumber,
            width: '10%',
            align: 'center',
            validateRules: [{ required: true, message: '单价不能为空!' }]
          },
          {
            title: '维修结果',
            key: 'repairResult',
            type: JVXETypes.textarea,
            width: '20%',
            align: 'center',
            visible: this.disabled
          },
          {
            title: '维修描述',
            key: 'repairDescription',
            type: JVXETypes.textarea,
            width: '30%',
            align: 'center',
            visible: this.disabled
          }
        ];
      }
    },
    created () {
       //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
      this.loadWorkShopTree()
    },
    methods: {
      loadWorkShopTree() {
        //加载车间选择树
        getAction(this.url.loadWorkShopOptions).then(res => {
          if (res.success) {
            this.treeData = [...res.result]
          }else {
            that.$message.warning(res.message)
          }
        })
      },
      add () {
        this.edit(this.modelDefault)
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true
        if (this.model.id) {
          getAction(this.url.queryDetailList, { repairId: this.model.id }).then((res) => {
            if (res.success) {
              console.log(res.result)
              if (res.result.total) {
                this.detail.dataSource = res.result.records
              }
            }
          })
        }
        getAction(this.url.queryEquipmentList, {}).then((res) => {
          if (res.success) {
            this.equipmentOptions = res.result.map(item => {
              return {
                label: item.text,
                value: item.value
              }
            })
          }
        })
      },
      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';
            }
            const detailList = this.$refs.editableDetailTable.getTableData()
            if (detailList.length === 0 || !detailList[0].equipmentId) {
              this.$message.warning('请添加维修明细!')
              that.confirmLoading = false;
              return
            }
            this.model.eamMajorPartialRepairDetailList = this.$refs.editableDetailTable.getTableData()
            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/eam/repair/modules/EamMajorPartialRepairModal.vue
@@ -1,156 +1,60 @@
<template>
  <j-modal
    :title="title"
    :width="800"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validatorRules">
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="delFlag" label="删除标记">
          <a-input-number v-model="model.delFlag"/>
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentId" label="设备ID">
          <a-input placeholder="请输入设备ID" v-model="model.equipmentId" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairType" label="维修类型">
          <a-input placeholder="请输入维修类型" v-model="model.repairType" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planStartTime" label="计划开始时间">
          <a-input placeholder="请输入计划开始时间" v-model="model.planStartTime" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planEndTime" label="计划结束时间">
          <a-input placeholder="请输入计划结束时间" v-model="model.planEndTime" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairCode" label="维修编码">
          <a-input placeholder="请输入维修编码" v-model="model.repairCode" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairName" label="维修名称">
          <a-input placeholder="请输入维修名称" v-model="model.repairName" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairStatus" label="维修状态">
          <a-input placeholder="请输入维修状态" v-model="model.repairStatus" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualStartTime" label="实际开始时间">
          <a-input placeholder="请输入实际开始时间" v-model="model.actualStartTime" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="actualEndTime" label="实际结束时间">
          <a-input placeholder="请输入实际结束时间" v-model="model.actualEndTime" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalAmount" label="总金额">
          <a-input placeholder="请输入总金额" v-model="model.totalAmount" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="attachment" label="附件">
          <a-input placeholder="请输入附件" v-model="model.attachment" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairDescription" label="维修描述">
          <a-input placeholder="请输入维修描述" v-model="model.repairDescription" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairMethod" label="维修方式">
          <a-input placeholder="请输入维修方式" v-model="model.repairMethod" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="outsourcedCompany" label="委外公司">
          <a-input placeholder="请输入委外公司" v-model="model.outsourcedCompany" />
        </a-form-model-item>
        <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responsiblePerson" label="责任人">
          <a-input placeholder="请输入责任人" v-model="model.responsiblePerson" />
        </a-form-model-item>
      </a-form-model>
    </a-spin>
    <eam-major-partial-repair-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></eam-major-partial-repair-form>
  </j-modal>
</template>
<script>
  import { httpAction } from '@/api/manage'
  import moment from "moment"
  import EamMajorPartialRepairForm from './EamMajorPartialRepairForm'
  export default {
    name: "EamMajorPartialRepairModal",
    name: 'EamMajorPartialRepairModal',
    components: {
      EamMajorPartialRepairForm
    },
    data () {
      return {
        title:"操作",
        title:'',
        width:1200,
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        validatorRules:{
        },
        url: {
          add: "/eam/eamMajorPartialRepair/add",
          edit: "/eam/eamMajorPartialRepair/edit",
        },
        disableSubmit: false
      }
    },
    created () {
    },
    methods: {
      add () {
        //初始化默认值
        this.edit({});
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
        this.$refs.form.clearValidate();
      },
      handleOk () {
        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;
              that.close();
            })
          }else{
             return false;
          }
        })
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      },
      }
    }
  }
</script>
<style lang="less" scoped>
</style>