zhaowei
昨天 9be2e2f91332ed341406acf9739d8912dddbf6fe
src/views/eam/maintenance/EamInspectionOrderList.vue
@@ -1,91 +1,35 @@
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div
      class="table-page-search-wrapper"
      v-if="isDisplayOperation"
    >
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
    <div class="table-page-search-wrapper" v-if="isDisplayOperation">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col
            :xl="4"
            :lg="7"
            :md="8"
            :sm="24"
          >
          <a-col :xl="5" :lg="7" :md="8" :sm="24">
            <a-form-item label="统一编码">
              <lx-search-equipment-select placeholder="请输入统一编码或名称搜索" v-model="queryParam.equipmentId"/>
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="7" :md="8" :sm="24">
            <a-form-item label="工单号">
              <a-input
                placeholder="请输入工单号"
                v-model="queryParam.orderNum"
              ></a-input>
              <a-input placeholder="请输入工单号" v-model="queryParam.orderNum"/>
            </a-form-item>
          </a-col>
          <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>
          <a-col
            :xl="6"
            :lg="7"
            :md="8"
            :sm="24"
          >
          <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-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-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"
              />
              <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="info"
                @click="searchReset"
                icon="reload"
                style="margin-left: 8px"
              >重置</a-button>
          <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="info" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
@@ -94,348 +38,291 @@
    <!-- 查询区域-END -->
    <!-- 操作按钮区域 -->
    <div
      class="table-operator"
      v-if="isDisplayOperation"
    >
      <a-button
        @click="handleAdd"
        type="primary"
        icon="plus"
        v-if="isShowAuth('eam:inspection:add')"
      >新增</a-button>
    <div class="table-operator" v-if="isDisplayOperation">
      <a-button v-has="'eam:inspection:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item
            key="1"
            v-if="isShowAuth('eam:inspection:abolish')"
            @click="batchZf('ABOLISH')"
          >
            <a-icon type="snippets" />
          <a-menu-item key="1" @click="batchZf('ABOLISH')" v-has="'eam:inspection: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 key="2" @click="batchLq('UNDER_INSPECTION')" v-has="'eam:inspection:collect'">
            <a-icon type="form"/>
            领取
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作
          <a-icon type="down" />
          <a-icon type="down"/>
        </a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <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 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>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange"
      >
      <a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns"
               :dataSource="dataSource" :pagination="ipagination" :loading="loading"
               :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" class="j-table-force-nowrap"
               @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <template v-if=" record.inspectionStatus === 'WAIT_INSPECTION'">
            <a @click="handleEdit(record)">编辑</a>
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a
            @click="handleEdit(record)"
            v-if="isShowAuth('eam:inspection:edit') && record.inspectionStatus === 'WAIT_INSPECTION'"
          >编辑</a>
          <a-divider type="vertical"/>
          <a-divider
            type="vertical"
            v-if="isShowAuth('eam:inspection:edit') && record.inspectionStatus === 'WAIT_INSPECTION'"
          />
          <a-popconfirm
            title="确定领取吗?"
            v-if="isShowAuth('eam:inspection:collect') && record.inspectionStatus === 'WAIT_INSPECTION'"
            @confirm="() => handleInspection(record.id)"
          >
          <a-popconfirm title="确定领取吗?" @confirm="() => handleInspection(record.id)">
            <a>领取</a>
          </a-popconfirm>
          <a-divider
            type="vertical"
            v-if="isShowAuth('eam:inspection:collect') && record.inspectionStatus === 'WAIT_INSPECTION'"
          />
          <a-divider type="vertical"/>
          <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="isShowAuth('eam:inspection:abolish') && record.inspectionStatus === 'WAIT_INSPECTION'">
                <a-popconfirm
                  title="确定作废吗?"
                  @confirm="() => handleOrReceive(record.id)"
                >
                <a-popconfirm title="确定作废吗?" @confirm="() => handleAbolish(record.id)">
                  <a>作废</a>
                </a-popconfirm>
              </a-menu-item>
               <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
          </template>
          <a-divider
            v-if="record.inspectionStatus === 'COMPLETE'"
            type="vertical"
          />
          <a
            v-if="record.inspectionStatus === 'COMPLETE'"
            @click="handlePrint(record)"
          >打印</a>
          <template v-else>
            <template v-if="record.inspectionStatus=='COMPLETE'">
              <a @click="handlePrint(record)">预览</a>
              <a-divider type="vertical"/>
            </template>
             <a @click="handleDetail(record)">详情</a>
          </template>
        </span>
      </a-table>
    </div>
    <eam-inspection-order-modal
      ref="modalForm"
      @ok="modalFormOk"
    ></eam-inspection-order-modal>
    <eam-inspection-order-modal ref="modalForm" @ok="modalFormOk"/>
    <inspection-order-handle
      ref="modalFormXq"
      :selectShenpiData="selectInspectionOrderXqData"
    />
    <inspection-order-handle ref="modalFormXq" :selectShenpiData="selectInspectionOrderXqData"/>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import EamInspectionOrderModal from './modules/EamInspectionOrderModal'
  import { deleteAction, getAction } from '@api/manage'
  import InspectionOrderHandle from '../../flowable/workflow/InspectionOrder/InspectionOrderHandle'
  import LxSearchEquipmentSelect from '../equipment/modules/LxSearchEquipmentSelect'
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import EamInspectionOrderModal from './modules/EamInspectionOrderModal'
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],
  components: {
    InspectionOrderHandle,
    EamInspectionOrderModal,
    LxSearchEquipmentSelect,
  },
  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
  export default {
    name: 'EamInspectionOrderList',
    mixins: [JeecgListMixin],
    components: {
      LxSearchEquipmentSelect,
      InspectionOrderHandle,
      EamInspectionOrderModal
    },
    props: {
      isDisplayOperation: {
        type: Boolean,
        default: true
      }
    },
    data() {
      return {
        description: '点检工单页面',
        disableMixinCreated: true,
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            },
            fixed: 'left'
          },
          {
            title: '统一编码',
            align: 'center',
            dataIndex: 'equipmentCode',
            fixed: 'left'
          },
          {
            title: '设备名称',
            align: 'center',
            dataIndex: 'equipmentName',
            fixed: 'left'
          },
          {
            title: '设备型号',
            align: 'center',
            dataIndex: 'equipmentModel',
            fixed: 'left'
          },
          {
            title: '工单号',
            align: 'center',
            dataIndex: 'orderNum'
          },
          {
            title: '规范名称',
            align: 'center',
            dataIndex: 'standardId_dictText'
          },
          {
            title: '点检日期',
            align: 'center',
            dataIndex: 'inspectionDate',
            customRender: function(text) {
              return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
            },
            width: 150
          },
          {
            title: '点检过期日期',
            align: 'center',
            dataIndex: 'expirationTime',
            customRender: function(text) {
              return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
            },
            width: 150
          },
          {
            title: '创建方式',
            align: 'center',
            dataIndex: 'creationMethod_dictText'
          },
          {
            title: '点检状态',
            align: 'center',
            dataIndex: 'inspectionStatus_dictText'
          },
          {
            title: '点检人',
            align: 'center',
            dataIndex: 'operator_dictText'
          },
          {
            title: '点检时间',
            align: 'center',
            dataIndex: 'operateTime',
            width: 150
          },
          {
            title: '维修工',
            align: 'center',
            dataIndex: 'confirmUser_dictText'
          },
          {
            title: '确认时间',
            align: 'center',
            dataIndex: 'confirmTime',
            width: 150
          },
          {
            title: 'HF编码',
            align: 'center',
            dataIndex: 'hfCode',
            width: 250
          }
        ],
        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'
        },
        {
          title: '工单号',
          align: 'center',
          dataIndex: 'orderNum'
        },
        {
          title: '设备编号',
          align: 'center',
          dataIndex: 'equipmentCode'
        },
        {
          title: '设备名称',
          align: 'center',
          dataIndex: 'equipmentName'
        },
        {
          title: '标准名称',
          align: 'center',
          dataIndex: 'standardId_dictText'
        },
        {
          title: '点检日期',
          align: 'center',
          dataIndex: 'inspectionDate',
          customRender: function (text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '点检过期日期',
          align: 'center',
          dataIndex: 'expirationTime',
          customRender: function (text) {
            return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '创建方式',
          align: 'center',
          dataIndex: 'creationMethod_dictText'
        },
        {
          title: '点检状态',
          align: 'center',
          dataIndex: 'inspectionStatus_dictText'
        },
        {
          title: '点检人',
          align: 'center',
          dataIndex: 'operator_dictText'
        },
        {
          title: '点检时间',
          align: 'center',
          dataIndex: 'operateTime',
        },
        {
          title: '管理员确认',
          align: 'center',
          dataIndex: 'confirmUser_dictText'
        },
        {
          title: '确认时间',
          align: 'center',
          dataIndex: 'confirmTime',
        },
        {
          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'
        dictOptions: {},
        superFieldList: [],
        selectInspectionOrderXqData: {}
      }
    },
    created() {
      if (!this.isDisplayOperation) {
        return
      }
      const operationColumn = {
        title: '操作',
        dataIndex: 'action',
        align: 'center',
        scopedSlots: { customRender: 'action' },
        fixed: 'right'
      }
      this.columns = [...this.columns, operationColumn]
      this.loadData(1)
    },
    computed: {
      importExcelUrl: function() {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
    methods: {
      //详情
      handleDetail: function(record) {
        this.selectInspectionOrderXqData = Object.assign({}, record)
        this.$refs.modalFormXq.visible = true
        this.$refs.modalFormXq.title = '详情'
        this.$refs.modalFormXq.disableSubmit = true
        this.$refs.modalFormXq.handleDetail(record)
      },
      dictOptions: {},
      superFieldList: [],
      selectInspectionOrderXqData: {}
    }
  },
  created() {
    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}`
    }
  },
  methods: {
    initDictConfig() {
    },
    //详情
    handleDetail: function (record) {
      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!')
        return
      }
      var that = this
      getAction(that.url.receiveInspectionOrder, { id: id }).then((res) => {
        if (res.success) {
          that.$notification.success({
            message: '消息',
            description: res.message
      handleInspection(id) {
        var that = this
        this.loading = true
        getAction(that.url.receiveInspectionOrder, { id })
          .then((res) => {
            if (res.success) {
              that.$notification.success({
                message: '消息',
                description: res.message
              })
              that.loadData()
            } else {
              that.$notification.warning({
                message: '消息',
                description: res.message
              })
              this.loading = false
            }
          })
          that.loadData()
        } else {
          // that.$message.warning(res.message);
          that.$notification.warning({
            message: '消息',
            description: res.message
      },
      handleAbolish(id) {
        var that = this
        this.loading = true
        getAction(that.url.cancelInspectionOrder, { id })
          .then((res) => {
            if (res.success) {
              that.$notification.success({
                message: '消息',
                description: res.message
              })
              that.loadData()
            } else {
              that.$notification.warning({
                message: '消息',
                description: res.message
              })
              this.loading = false
            }
          })
        }
      })
    },
    handleOrReceive(id) {
      if (!this.url.cancelInspectionOrder) {
        this.$message.error('请设置url.cancelInspectionOrder!')
        return
      }
      var that = this
      getAction(that.url.cancelInspectionOrder, { id: id }).then((res) => {
        if (res.success) {
          that.$notification.success({
            message: '消息',
            description: res.message
          })
          that.loadData()
        } else {
          // that.$message.warning(res.message);
          that.$notification.warning({
            message: '消息',
            description: res.message
          })
        }
      })
    },
    batchZf(type) {
      if (this.selectedRowKeys.length <= 0) {
        this.$notification.warning({
          message: '消息',
          description: '请选择一条记录'
        })
      } else {
      },
      batchZf(type) {
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
@@ -444,9 +331,9 @@
        this.$confirm({
          title: '确认作废',
          content: '是否作废选中数据,只有待点检状态的数据才可作废成功?',
          onOk: function () {
          onOk: function() {
            that.loading = true
            getAction(that.url.cancelOrReceive, { ids: ids, type: type }).then((res) => {
            getAction(that.url.cancelOrReceive, { ids, type }).then((res) => {
              if (res.success) {
                that.$notification.success({
                  message: '消息',
@@ -466,15 +353,9 @@
            })
          }
        })
      }
    },
    batchLq(type) {
      if (this.selectedRowKeys.length <= 0) {
        this.$notification.warning({
          message: '消息',
          description: '请选择一条记录'
        })
      } else {
      },
      batchLq(type) {
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
@@ -483,42 +364,40 @@
        this.$confirm({
          title: '确认领取',
          content: '是否领取选中数据,只有待点检状态的数据才可领取成功?',
          onOk: function () {
          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()
              } else {
                // that.$message.warning(res.message);
                that.$notification.warning({
                  message: '消息',
                  description: res.message
                })
              }
            }).finally(() => {
              that.loading = false
            })
            getAction(that.url.cancelOrReceive, { ids, type })
              .then((res) => {
                if (res.success) {
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                  that.loadData()
                  that.onClearSelected()
                } else {
                  that.$notification.warning({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .finally(() => {
                that.loading = false
              })
          }
        })
      }
    },
    onInspectionDateChange: function (value, dateString) {
      this.queryParam.inspectionDateBegin = dateString[0]
      this.queryParam.inspectionDateEnd = dateString[1]
    },
      },
    handlePrint(record) {
      let href = `${window._CONFIG['domianURL']}/jmreport/view/1094871242505912320?id=` + record.id + `&equipmentId=` + record.equipmentId + `&inspectionDate=` + record.inspectionDate; //网站链接
      window.open(href, "_blank");
    },
      handlePrint(record) {
        let href = `${window._CONFIG['domianURL']}/jmreport/view/1105664887569121280?equipmentCode=` + record.equipmentCode
        window.open(href, '_blank')
      },
      onInspectionDateChange: function(value, dateString) {
        this.queryParam.inspectionDateBegin = dateString[0]
        this.queryParam.inspectionDateEnd = dateString[1]
      }
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
</script>