zenglf
2023-09-18 92ff846fb659c62037a32b1d8c15eae9df9d9b54
src/views/eam/PredictiveWorkOrderList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,541 @@
<template>
  <a-card
    :bordered="false"
    title="预测维护工单"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="24">
          <a-col
            :md="6"
            :sm="8"
          >
            <a-form-item label="工单状态">
              <j-dict-select-tag
                allow-clear
                placeholder="请选择工单状态"
                :triggerChange="true"
                dictCode="repair_order_status"
                v-model="queryParam.status"
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="6"
            :sm="8"
          >
            <a-form-item label="维护工单编码">
              <a-input
                placeholder="请输入维护工单编码"
                v-model="queryParam.num"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col
            :md="6"
            :sm="8"
          >
            <a-form-item label="设备编码">
              <a-input
                placeholder="请输入设备编码"
                v-model="queryParam.equipmentNum"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col
            :md="6"
            :sm="8"
            >
              <a-form-item label="设备名称">
                <a-input
                  placeholder="请输入设备名称"
                  v-model="queryParam.equipmentName"
                ></a-input>
              </a-form-item>
            </a-col>
          <a-col
            :md="6"
            :sm="8"
          >
            <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>
            </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
        v-if="selectedRowKeys.length > 0"
        type="primary"
        @click="batchAssign"
        style="margin-left: 8px"
      >工单派工</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"
        :scroll="{ x: 'calc(1900px + 50%)', y: 900 }"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange"
      >
        <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a-popconfirm
            title="确定下发工单吗?"
            @confirm="() => handleOrderIssue(record)"
          >
            <a v-if="record.status == '1'">下发</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '1'"
            type="vertical"
          />
          <a-popconfirm
            title="确定撤回工单吗?"
            @confirm="() => handleOrderReset(record)"
          >
            <a v-if="record.status == '2'">撤回</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '2'"
            type="vertical"
          />
          <a-popconfirm
            title="确定恢复工单吗?"
            @confirm="() => handleOrderRecover(record)"
          >
            <a v-if="record.status == '7'">恢复</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '7'"
            type="vertical"
          />
          <a-popconfirm
            title="确定作废工单吗?"
            @confirm="() => handleOrderCancel(record)"
          >
            <a v-if="record.status == '2'">作废</a>
          </a-popconfirm>
          <a-divider
            v-if="record.status == '2'"
            type="vertical"
          />
          <a-popconfirm
            title="确定领取工单吗?"
            @confirm="() => handleOrderGet(record)"
          >
            <a v-if="record.status == '2' && record.assignMode == '1'">领取</a>
          </a-popconfirm>
          <a
            v-if="record.status == '2' && record.assignMode == '2'  "
            @click="handleAssignOrder(record)"
          >派工</a>
          <a
            v-if="record.status == '2'&& record.assignMode == '3'  && record.inspectionUserName != null  "
            @click="handleAssignOrder(record)"
          >改派</a>
          <a
            v-if="record.status == '3'"
            @click="handleAssignOrder(record)"
          >改派</a>
          <a-divider
            v-if="record.status == '2'"
            type="vertical"
          />
          <a-divider
            v-if="record.status === '3'"
            type="vertical"
          />
          <a
            v-if="record.status === '3' || record.status === '4'  "
            @click="handleOrderExe(record)"
          >执行</a>
          <a-divider
            v-if="record.status === '3' || record.status === '4' "
            type="vertical"
          />
          <a
            v-if="record.status === '1'"
            @click="handleEdit(record)"
          >编辑</a>
          <a-divider
            v-if="record.status === '1'"
            type="vertical"
          />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm
                  title="确定删除吗?"
                  @confirm="() => handleDelete(record.id)"
                >
                  <a v-if="record.status === '1'">删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
        <span
          slot="num"
          slot-scope="text, record"
        >
          <a
            v-if="record.status === '3' || record.status === '4' ||record.status === '5'  ||record.status === '7' "
            class="lot"
            @click="handleOrderExe(record)"
          >{{record.num}}</a>
          <span v-else>{{record.num}}</span>
        </span>
      </a-table>
    </div>
    <predictive-work-order-model
      ref="modalForm"
      @ok="modalFormOk"
    ></predictive-work-order-model>
    <predictive-work-order-drawer
      ref="PredictiveWorkOrderDrawer"
      @ok="modalFormOk"
    ></predictive-work-order-drawer>
    <order-assign-modal
    ref="OrderAssign"
    @ok="modalFormOk"
    >
    </order-assign-modal>
  </a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, postAction, requestPut } from '@/api/manage'
import PredictiveWorkOrderModel from './modules/predictiveWorkOrder/PredictiveWorkOrderModel'
import PredictiveWorkOrderDrawer from './modules/predictiveWorkOrder/PredictiveWorkOrderDrawer'
import OrderAssignModal from './modules/predictiveWorkOrder/OrderAssignModal.vue'
export default {
  name: 'PredictiveWorkOrderList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    PredictiveWorkOrderModel,
    PredictiveWorkOrderDrawer,
    OrderAssignModal
  },
  data() {
    return {
      description: '预测性维护工单',
      // è¡¨å¤´
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '状态',
          align: "center",
          dataIndex: 'status_dictText'
        },
        {
          title: '单据号',
          align: "center",
          dataIndex: 'num',
          scopedSlots: { customRender: 'num' }
        },
        {
          title: '监控类型',
          align: "center",
          dataIndex: 'monitorType_dictText'
        },
        {
          title: '设备编码',
          align: "center",
          dataIndex: 'equipmentNum',
        },
        {
          title: '设备名称',
          align: "center",
          dataIndex: 'equipmentName',
        },
        {
          title: '型号',
          align: "center",
          dataIndex: 'model',
        },
        {
          title: '标准编码',
          align: 'center',
          dataIndex: 'planNum',
        },
        {
          title: '版本',
          align: "center",
          dataIndex: 'version',
        },
        {
          title: '使用部门',
          align: "center",
          dataIndex: 'useId_dictText',
        },
        {
          title: '派工方式',
          align: "center",
          dataIndex: 'assignMode_dictText',
        },
        {
          title: '责任班组',
          align: "center",
          dataIndex: 'teamId_dictText',
          width: 170
        },
        {
          title: '责任人',
          align: "center",
          dataIndex: 'maintenanceUserId_dictText',
          width: 170
        },
        // {
        //   title: '工时定额(小时)',
        //   align: "center",
        //   dataIndex: 'planEndTime',
        //   width: 170
        // },
        {
          title: '实际工时',
          align: "center",
          dataIndex: 'actualWorkingHourQuota',
          width: 170
        },
        {
          title: '实际开始时间',
          align: "center",
          dataIndex: 'actualStartTime',
          width: 170
        },
        {
          title: '实际结束时间',
          align: "center",
          dataIndex: 'actualEndTime',
          width: 170
        },
        {
          title: '创建人',
          align: "center",
          dataIndex: 'createBy'
        },
        {
          title: '创建日期',
          align: "center",
          dataIndex: 'createTime',
          width: 170
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          fixed: "right",
          width: 300,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/eam/predictiveworkorder/pageOrderList",
        delete: "/eam/specialtyMaintenanceOrder/delete",
        deleteBatch: "/eam/specialtyMaintenanceOrder/deleteBatch",
        exportXlsUrl: "/eam/specialtyMaintenanceOrder/exportXls",
        importExcelUrl: "eam/specialtyMaintenanceOrder/importExcel",
        edit: "/eam/predictiveworkorder/editStatus",
        orderGet: "/eam/predictiveworkorder/orderGet",
      },
    }
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
    rowSelection() {
      return {
        type: 'checkbox',
        onChange: (selectedRowKeys, selectedRows) => {
          this.selectedRowKeys = selectedRowKeys;
          this.onSelectChange(selectedRows);
        },
        getCheckboxProps: record => ({
          props: {
            disabled: record.distable
          },
        }),
        selectedRowKeys: this.selectedRowKeys,
      };
    },
  },
  methods: {
    onSelectChange(selectionRows) {
      this.selectionRows = selectionRows;
    },
    handleOrderExe(record) {
      this.$refs. PredictiveWorkOrderDrawer.visible = true
      this.$refs. PredictiveWorkOrderDrawer.title = '专业保养工单执行'
      this.$refs. PredictiveWorkOrderDrawer.handleShow(record)
      if (record.status === '3') {
        this.$refs. PredictiveWorkOrderDrawer.buttonDistable = true//保存、暂存、报工
        this.$refs. PredictiveWorkOrderDrawer.revocationDistable = true//撤销按钮
        this.$refs. PredictiveWorkOrderDrawer.SWbuttonDistable = false//开工按钮
      } else if (record.status === '4') {
        this.$refs. PredictiveWorkOrderDrawer.buttonDistable = false
        this.$refs. PredictiveWorkOrderDrawer.revocationDistable = true
        this.$refs. PredictiveWorkOrderDrawer.SWbuttonDistable = true
      } else if (record.status === '5') {
        this.$refs. PredictiveWorkOrderDrawer.buttonDistable = true
        this.$refs. PredictiveWorkOrderDrawer.revocationDistable = false
        this.$refs. PredictiveWorkOrderDrawer.SWbuttonDistable = true
      } else if (record.status === '7') {
        this.$refs. PredictiveWorkOrderDrawer.buttonDistable = true
        this.$refs. PredictiveWorkOrderDrawer.revocationDistable = true
        this.$refs. PredictiveWorkOrderDrawer.SWbuttonDistable = true
      }
    },
    handleOrderIssue(record) {
      const that = this;
      requestPut(that.url.edit, { id: record.id, status: '2' }).then((res) => {
        if (res.success) {
          that.$message.success("工单下发成功!")
          that.loadData()
        } else {
          that.$message.warning("工单下发失败!")
        }
      })
    },
    //撤回
    handleOrderReset(record) {
      const that = this;
      requestPut(that.url.edit, { id: record.id, status: '1' }).then((res) => {
        if (res.success) {
          that.$message.success("工单撤回成功!")
          that.loadData()
        } else {
          that.$message.warning("工单撤回失败!")
        }
      })
    },
    handleOrderGet(record) {
      const that = this;
      requestPut(that.url.orderGet, { id: record.id, status: '1' }).then((res) => {
        if (res.success) {
          that.$message.success("工单领取成功!")
          that.loadData()
        } else {
          that.$message.warning("工单领取失败!")
        }
      })
    },
    //作废
    handleOrderCancel(record) {
      const that = this;
      requestPut(that.url.edit, { id: record.id, status: '7' }).then((res) => {
        if (res.success) {
          that.$message.success("工单作废成功!")
          that.loadData()
        } else {
          that.$message.warning("工单作废失败!")
        }
      })
    },
    //恢复
    handleOrderRecover(record) {
      const that = this;
      requestPut(that.url.edit, { id: record.id, status: '2' }).then((res) => {
        if (res.success) {
          that.$message.success("工单恢复成功!")
          that.loadData()
        } else {
          that.$message.warning("工单恢复失败!")
        }
      })
    },
    handleAssignOrder: function (record) {
      this.$refs.OrderAssign.edit(record)
      this.$refs.OrderAssign.title = '工单改派'
      this.$refs.OrderAssign.disableSubmit = false
    },
    // modalFormOk() {
    //   alert(0)
    //   // æ–°å¢ž/修改 æˆåŠŸæ—¶ï¼Œé‡è½½åˆ—è¡¨
    //   this.loadData();
    //   //清空列表选中
    //   this.onClearSelected()
    // },
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>