zhangherong
2025-04-27 dbb3445dc720a8f36b3424e73f2e02a6b0f9deb6
src/views/eam/maintenance/EamInspectionOrderList.vue
@@ -1,39 +1,33 @@
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
    <div class="table-page-search-wrapper" v-if="isDisplayOperation">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="工单号">
              <a-input placeholder="请输入工单号" v-model="queryParam.orderNum"></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-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="设备编号">
              <lx-search-equipment-select placeholder="请输入设备编号或名称搜索" v-model="queryParam.equipmentId"></lx-search-equipment-select>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="点检日期">
                <j-date placeholder="请选择点检日期" v-model="queryParam.inspectionDate"></j-date>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="点检时间">
                <j-date placeholder="请选择点检时间" v-model="queryParam.operateTime"></j-date>
              </a-form-item>
            </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="计划点检日期">
              <a-range-picker v-model="queryParam.inspectionDateRange" @change="onInspectionDateChange" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="点检状态">
              <j-dict-select-tag placeholder="请选择点检状态" dict-code="inspection_status" v-model="queryParam.inspectionStatus" />
            </a-form-item>
          </a-col>
          <a-col :xl="4" :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>
              <a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
@@ -42,21 +36,30 @@
    <!-- 查询区域-END -->
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
    <div class="table-operator" v-if="isDisplayOperation">
      <a-button @click="handleAdd" type="primary" icon="plus" v-if="isShowAuth('eam:inspection:add')">新增</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchZf(5)"><a-icon type="snippets"/>作废</a-menu-item>
          <a-menu-item key="2" @click="batchLq(2)"><a-icon type="form"/>领取</a-menu-item>
          <a-menu-item key="1" v-if="isShowAuth('eam:inspection:abolish')" @click="batchZf('ABOLISH')">
            <a-icon type="snippets"/>
            作废
          </a-menu-item>
          <a-menu-item key="2" v-if="isShowAuth('eam:inspection:collect')" @click="batchLq('UNDER_INSPECTION')">
            <a-icon type="form"/>
            领取
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
        <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>项
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;" v-if="isDisplayOperation">
        <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>
@@ -74,44 +77,25 @@
        class="j-table-force-nowrap"
        @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 v-if="record.inspectionStatus === '1'" @click="handleEdit(record)">编辑</a>
            <a @click="handleEdit(record)" v-if="isShowAuth('eam:inspection:edit') && record.inspectionStatus === 'WAIT_INSPECTION'" >编辑</a>
          <a-divider v-if="record.inspectionStatus === '1'" type="vertical" />
          <a-divider type="vertical" v-if="isShowAuth('eam:inspection:edit') && record.inspectionStatus === 'WAIT_INSPECTION'" />
          <a-popconfirm v-if="record.inspectionStatus === '1'" title="确定领取吗?" @confirm="() => handleInspection(record.id)">
          <a-popconfirm title="确定领取吗?" v-if="isShowAuth('eam:inspection:collect') && record.inspectionStatus === 'WAIT_INSPECTION'"
                        @confirm="() => handleInspection(record.id)">
                  <a>领取</a>
          </a-popconfirm>
          <a-divider v-if="record.inspectionStatus === '1'" type="vertical" />
          <a-divider type="vertical" v-if="isShowAuth('eam:inspection:collect') && record.inspectionStatus === 'WAIT_INSPECTION'" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <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  v-if="record.inspectionStatus === '1'" >
              <a-menu-item v-if="isShowAuth('eam:inspection:abolish') && record.inspectionStatus === 'WAIT_INSPECTION'">
                <a-popconfirm title="确定作废吗?" @confirm="() => handleOrReceive(record.id)">
                  <a>作废</a>
                </a-popconfirm>
@@ -119,12 +103,12 @@
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <eam-inspection-order-modal ref="modalForm" @ok="modalFormOk"></eam-inspection-order-modal>
    <EamInspectionOrderModalXq ref="modalFormXq" @ok="modalFormOk"></EamInspectionOrderModalXq>
    <inspection-order-handle ref="modalFormXq" :selectShenpiData="selectInspectionOrderXqData"/>
  </a-card>
</template>
@@ -134,276 +118,284 @@
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import EamInspectionOrderModal from './modules/EamInspectionOrderModal'
  import EamInspectionOrderModalXq from './modules/EamInspectionOrderModalXq.vue'
  import { deleteAction, getAction } from '@api/manage'
  import InspectionOrderHandle from '../../flowable/workflow/InspectionOrder/InspectionOrderHandle'
  import LxSearchEquipmentSelect from '@views/eam/equipment/modules/LxSearchEquipmentSelect.vue'
  export default {
    name: 'EamInspectionOrderList',
    mixins:[JeecgListMixin, mixinDevice],
    mixins: [JeecgListMixin, mixinDevice],
    components: {
      InspectionOrderHandle,
      EamInspectionOrderModal,
      EamInspectionOrderModalXq
      LxSearchEquipmentSelect,
    },
    data () {
    props: {
      isDisplayOperation: {
        type: Boolean,
        default: true
      }
    },
    data() {
      return {
        description: 'eam_inspection_order管理页面',
        disableMixinCreated: true,
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title:'工单号',
            align:"center",
            title: '工单号',
            align: 'center',
            dataIndex: 'orderNum'
          },
          {
            title:'设备编号',
            align:"center",
            dataIndex: 'equipmentId_dictText'
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentCode'
          },
          {
            title:'标准编码',
            align:"center",
            title: '设备名称',
            align: 'center',
            dataIndex: 'equipmentName'
          },
          {
            title: '标准名称',
            align: 'center',
            dataIndex: 'standardId_dictText'
          },
          {
            title:'点检日期',
            align:"center",
            title: '点检日期',
            align: 'center',
            dataIndex: 'inspectionDate',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            customRender: function(text) {
              return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
            }
          },
          {
            title:'点检过期时间',
            align:"center",
            title: '点检过期日期',
            align: 'center',
            dataIndex: 'expirationTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            customRender: function(text) {
              return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
            }
          },
          {
            title:'创建方式',
            align:"center",
            title: '创建方式',
            align: 'center',
            dataIndex: 'creationMethod_dictText'
          },
          {
            title:'点检状态',
            align:"center",
            title: '点检状态',
            align: 'center',
            dataIndex: 'inspectionStatus_dictText'
          },
          {
            title:'点检时间',
            align:"center",
            dataIndex: 'operateTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'点检人',
            align:"center",
            title: '点检人',
            align: 'center',
            dataIndex: 'operator_dictText'
          },
          {
            title:'班组长确认',
            align:"center",
            dataIndex: 'confirmUser'
            title: '点检时间',
            align: 'center',
            dataIndex: 'operateTime',
          },
          {
            title:'确认时间',
            align:"center",
            title: '班组长确认',
            align: 'center',
            dataIndex: 'confirmUser_dictText'
          },
          {
            title: '确认时间',
            align: 'center',
            dataIndex: 'confirmTime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
            title: '确认意见',
            align: 'center',
            dataIndex: 'confirmComment',
          }
        ],
        url: {
          list: "/eam/eamInspectionOrder/list",
          cancelInspectionOrder: "/eam/eamInspectionOrder/cancelInspectionOrder",
          deleteBatch: "/eam/eamInspectionOrder/deleteBatch",
          exportXlsUrl: "/eam/eamInspectionOrder/exportXls",
          importExcelUrl: "eam/eamInspectionOrder/importExcel",
          receiveInspectionOrder : "eam/eamInspectionOrder/receiveInspectionOrder",
          cancelOrReceive: "eam/eamInspectionOrder/cancelOrReceive"
          list: '/eam/eamInspectionOrder/list',
          cancelInspectionOrder: '/eam/eamInspectionOrder/cancelInspectionOrder',
          deleteBatch: '/eam/eamInspectionOrder/deleteBatch',
          exportXlsUrl: '/eam/eamInspectionOrder/exportXls',
          importExcelUrl: 'eam/eamInspectionOrder/importExcel',
          receiveInspectionOrder: 'eam/eamInspectionOrder/receiveInspectionOrder',
          cancelOrReceive: 'eam/eamInspectionOrder/cancelOrReceive'
        },
        dictOptions:{},
        superFieldList:[],
        dictOptions: {},
        superFieldList: [],
        selectInspectionOrderXqData: {}
      }
    },
    created() {
    this.getSuperFieldList();
      if (!this.isDisplayOperation) {
        return
      }
      const operationColumn = {
        title: '操作',
        dataIndex: 'action',
        align: 'center',
        fixed: 'right',
        width: 200,
        scopedSlots: { customRender: 'action' }
      }
      this.columns = [...this.columns, operationColumn]
      this.loadData(1)
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
      importExcelUrl: function() {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'orderNum',text:'工单号',dictCode:''})
        fieldList.push({type:'string',value:'equipmentId',text:'设备ID',dictCode:''})
        fieldList.push({type:'string',value:'standardId',text:'标准ID',dictCode:''})
        fieldList.push({type:'date',value:'inspectionDate',text:'点检日期'})
        fieldList.push({type:'date',value:'operateTime',text:'点检时间'})
        fieldList.push({type:'string',value:'operator',text:'点检人',dictCode:''})
        fieldList.push({type:'date',value:'expirationTime',text:'点检过期时间'})
        fieldList.push({type:'string',value:'creationMethod',text:'创建方式',dictCode:''})
        fieldList.push({type:'string',value:'inspectionStatus',text:'点检状态',dictCode:''})
        fieldList.push({type:'string',value:'confirmUser',text:'设备管理员确认',dictCode:''})
        fieldList.push({type:'date',value:'confirmTime',text:'确认时间'})
        fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
        fieldList.push({type:'string',value:'imageFiles',text:'照片文件ids;id以逗号分隔',dictCode:''})
        this.superFieldList = fieldList
      initDictConfig() {
      },
      //详情
      handleDetail: function(record) {
        this.$refs.modalFormXq.edit(record);
        this.$refs.modalFormXq.title = "详情";
        this.$refs.modalFormXq.disableSubmit = true;
        this.selectInspectionOrderXqData = Object.assign({}, record)
        this.$refs.modalFormXq.visible = true
        this.$refs.modalFormXq.title = '详情'
        this.$refs.modalFormXq.disableSubmit = true
        this.$refs.modalFormXq.getAllApproveData(record)
        this.$refs.modalFormXq.getBasicInformation({ ...record, dataId: record.id })
      },
      handleInspection(id) {
        if (!this.url.receiveInspectionOrder) {
          this.$message.error("请设置url.receiveInspectionOrder!")
          this.$message.error('请设置url.receiveInspectionOrder!')
          return
        }
        var that = this;
        var that = this
        getAction(that.url.receiveInspectionOrder, { id: id }).then((res) => {
          if (res.success) {
            that.$notification.success({
              message: '消息',
              description: res.message
            });
            that.loadData();
            })
            that.loadData()
          } else {
            // that.$message.warning(res.message);
            that.$notification.warning({
              message: '消息',
              description: res.message
            });
            })
          }
        });
        })
      },
      handleOrReceive(id){
      handleOrReceive(id) {
        if (!this.url.cancelInspectionOrder) {
          this.$message.error("请设置url.cancelInspectionOrder!")
          this.$message.error('请设置url.cancelInspectionOrder!')
          return
        }
        var that = this;
        var that = this
        getAction(that.url.cancelInspectionOrder, { id: id }).then((res) => {
          if (res.success) {
            that.$notification.success({
              message: '消息',
              description: res.message
            });
            that.loadData();
            })
            that.loadData()
          } else {
            // that.$message.warning(res.message);
            that.$notification.warning({
              message: '消息',
              description: res.message
            });
            })
          }
        });
        })
      },
      batchZf(type){
      batchZf(type) {
        if (this.selectedRowKeys.length <= 0) {
          this.$notification.warning({
            message:'消息',
            description:"请选择一条记录"
          });
            message: '消息',
            description: '请选择一条记录'
          })
        } else {
          var ids = "";
          var ids = ''
          for (var a = 0; a < this.selectedRowKeys.length; a++) {
            ids += this.selectedRowKeys[a] + ",";
            ids += this.selectedRowKeys[a] + ','
          }
          var that = this;
          var that = this
          this.$confirm({
            title: "确认作废",
            content: "是否作废选中数据,只有待点检状态的数据才可作废成功?",
            onOk: function () {
              that.loading = true;
              getAction(that.url.cancelOrReceive, {ids: ids,type:type}).then((res) => {
            title: '确认作废',
            content: '是否作废选中数据,只有待点检状态的数据才可作废成功?',
            onOk: function() {
              that.loading = true
              getAction(that.url.cancelOrReceive, { ids: ids, type: type }).then((res) => {
                if (res.success) {
                  that.$notification.success({
                    message:'消息',
                    description:res.message
                  });
                  that.loadData();
                  that.onClearSelected();
                    message: '消息',
                    description: res.message
                  })
                  that.loadData()
                  that.onClearSelected()
                } else {
                  // that.$message.warning(res.message);
                  that.$notification.warning({
                    message:'消息',
                    description:res.message
                  });
                    message: '消息',
                    description: res.message
                  })
                }
              }).finally(() => {
                that.loading = false;
              });
                that.loading = false
              })
            }
          });
          })
        }
      },
      batchLq(type){
      batchLq(type) {
        if (this.selectedRowKeys.length <= 0) {
          this.$notification.warning({
            message:'消息',
            description:"请选择一条记录"
          });
            message: '消息',
            description: '请选择一条记录'
          })
        } else {
          var ids = "";
          var ids = ''
          for (var a = 0; a < this.selectedRowKeys.length; a++) {
            ids += this.selectedRowKeys[a] + ",";
            ids += this.selectedRowKeys[a] + ','
          }
          var that = this;
          var that = this
          this.$confirm({
            title: "确认领取",
            content: "是否领取选中数据,只有待点检状态的数据才可领取成功?",
            onOk: function () {
              that.loading = true;
              getAction(that.url.cancelOrReceive, {ids: ids,type:type}).then((res) => {
            title: '确认领取',
            content: '是否领取选中数据,只有待点检状态的数据才可领取成功?',
            onOk: function() {
              that.loading = true
              getAction(that.url.cancelOrReceive, { ids: ids, type: type }).then((res) => {
                if (res.success) {
                  that.$notification.success({
                    message:'消息',
                    description:res.message
                  });
                  that.loadData();
                  that.onClearSelected();
                    message: '消息',
                    description: res.message
                  })
                  that.loadData()
                  that.onClearSelected()
                } else {
                  // that.$message.warning(res.message);
                  that.$notification.warning({
                    message:'消息',
                    description:res.message
                  });
                    message: '消息',
                    description: res.message
                  })
                }
              }).finally(() => {
                that.loading = false;
              });
                that.loading = false
              })
            }
          });
          })
        }
      },
      onInspectionDateChange: function(value, dateString) {
        this.queryParam.inspectionDateBegin = dateString[0]
        this.queryParam.inspectionDateEnd = dateString[1]
      },
    }
  }
</script>