src/views/business/unpass/index-manage.vue
@@ -28,52 +28,33 @@
                  :page="page" :tableLoading="tableLoading"></lims-table>
    </div>
    <el-dialog
      title="提交"
      :show-close="false"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      :visible.sync="dialogVisible"
      width="30%">
      <span>是否确认提交OA?</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitOA" :loading="submitOALoading">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="删除"
      :show-close="false"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      :visible.sync="deleteVisible"
      width="30%">
      <span>是否确认<span style="color: #FF4902">删除</span>OA?</span>
      <span>是否确认<span style="color: #FF4902">删除</span>该记录?</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="deleteVisible = false">取 消</el-button>
        <el-button type="primary" @click="cancelOA" :loading="cancelOALoading">确 定</el-button>
        <el-button type="primary" @click="deleteRecord" :loading="deleteLoading">确 定</el-button>
      </span>
    </el-dialog>
    <UnPassDialog ref="unPassDialog" v-if="unPassDialog"
                  :orderId="orderId"
                  @resetForm="resetForm1"
                  :unPassDialog="unPassDialog"></UnPassDialog>
    <OAProcess ref="OAProcess"
               :OAProcess="OAProcess"
               @closeOAProcess="closeOAProcess"
               v-if="OAProcess"></OAProcess>
  </div>
</template>
<script>
import UnPassDialog from "./components/unPassDialog.vue";
import OAProcess from "./components/OAProcess.vue";
import limsTable from "@/components/Table/lims-table.vue";
import {deleteUnqualifiedHandler, page, pushOA} from "@/api/business/unqualifiedHandler";
import {deleteUnqualifiedHandler, page} from "@/api/business/unqualifiedHandler";
export default {
  components: {
    limsTable,
    OAProcess,
    UnPassDialog,
  },
  data() {
@@ -87,34 +68,6 @@
      tableLoading: false,
      column: [
        { label: '编号', prop: 'no', width: "160px", },
        // {
        //   label: "OA审核状态",
        //   prop: "oaState",
        //   width: "100px",
        //   dataType: "tag",
        //   formatData: (params) => {
        //     if (params == 1) {
        //       return "待审核";
        //     } else if(params == 2) {
        //       return "审核中";
        //     }  else if(params == 3) {
        //       return "通过";
        //     } else {
        //       return "驳回";
        //     }
        //   },
        //   formatType: (params) => {
        //     if (params == 1) {
        //       return "warning";
        //     } else if(params == 2) {
        //       return "info";
        //     }  else if(params == 3) {
        //       return "success";
        //     } else {
        //       return "danger";
        //     }
        //   },
        // },
        { label: '订单号', prop: 'orderNo' },
        {
          label: "零件号",
@@ -190,31 +143,14 @@
          width: '180px',
          operation: [
            {
              name: '提交OA',
              type: 'text',
              clickFun: (row) => {
                this.openOA(row);
              },
              disabled: (row, index) => {
                return row.requestId !== null  // 有requestId说明已经提交过OA,不可再次提交
              }
            },
            {
              name: '查看OA流程',
              type: 'text',
              clickFun: (row) => {
                this.OAView(row);
              },
            },
            {
              name: '删除',
              type: 'text',
              clickFun: (row) => {
                this.deleteOA(row);
                this.openDelete(row);
              },
              disabled: (row, index) => {
                return row.requestId !== null  // 有requestId说明已经提交过OA,不可再次提交
              }
              showHide: (row) => {
                return this.checkPermi(["unpass:delete"]);
              },
            },
          ]
        }
@@ -225,13 +161,10 @@
        current: 1
      },
      statusList: [],
      dialogVisible: false, // 确认提交OA弹框
      unPassDialog: false, // 不合格处理弹框
      orderId: '',
      OAProcess: false, // OA流程弹框
      submitOALoading: false, // OA流程弹框提交按钮loading
      deleteVisible: false, // OA流程删除弹框
      cancelOALoading: false, // OA流程删除弹框提交按钮loading
      deleteVisible: false, // 删除确认弹框
      deleteLoading: false, // 删除按钮loading
    };
  },
  mounted() {
@@ -270,58 +203,27 @@
      this.$refs.unPassDialog.$refs['unPassForm'].resetFields();
      this.unPassDialog = false
    },
    // 打开删除OA确认弹框
    deleteOA (row) {
    // 打开删除确认弹框
    openDelete (row) {
      this.handlerId = row.handlerId
      this.deleteVisible = true
    },
    // 提交删除申请
    cancelOA () {
    // 删除记录
    deleteRecord () {
      this.de = true
      deleteUnqualifiedHandler({id: this.handlerId,}).then(res => {
        this.cancelOALoading = false
        this.deleteLoading = false
        if (res.code === 200) {
          this.deleteVisible = false
          this.$message.success('删除成功')
          this.refreshTable('page')
        }
      }).catch(error => {
        this.cancelOALoading = false
        this.deleteLoading = false
        console.error(error);
      });
    },
    // 查看提交OA的数据
    openOA (row) {
      this.handlerId = row.handlerId
      this.dialogVisible = true
    },
    // 查看OA流程
    OAView (row) {
      this.OAProcess = true
      this.$nextTick(() => {
        this.$refs.OAProcess.getInfo(row.handlerId)
      })
    },
    // 关闭查看OA流程的弹框
    closeOAProcess () {
      this.OAProcess = false
    },
    //提交OA
    submitOA(row) {
      // 提交OA
      this.submitOALoading = true
      pushOA({handlerId: this.handlerId,}).then(res => {
        this.submitOALoading = false
        if (res.code === 200) {
          this.dialogVisible = false
          this.$message.success('提交成功')
          this.refreshTable('page')
        }
      }).catch(error => {
        this.submitOALoading = false
        console.error(error);
      });
    }
  }
};
</script>