<template>
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      v-model:page="page"
      v-model="form"
      ref="crud"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template #menu="{ row }">
        <el-button type="text" @click="assignFn(row)">转派</el-button>
        <el-button type="text" @click="handleFn(row)">处理</el-button>
      </template>
    </avue-crud>

    <taskHandleDialog
      v-if="isHandleShow"
      :showDialog="isHandleShow"
      @closeDialog="closeDialog"
      :flag="false"
    ></taskHandleDialog>

    <assignDaialog
      v-if="isAssignShow"
      :showDialog="isAssignShow"
      @closeDialog="closeDialog"
    ></assignDaialog>
  </basic-container>
</template>
<script>
import { status } from "nprogress";
import taskHandleDialog from "./components/taskHandleDialog.vue";
import assignDaialog from "./components/assignDaialog.vue";

export default {
  components: {
    taskHandleDialog,
    assignDaialog,
  },
  data() {
    return {
      page: {},
      data: [],
      form: {},
      option: {
        tip: false,
        height: "auto",
        calcHeight: 32,
        columnSort: true,
        // simplePage: true,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: true,
        selection: false,
        viewBtn: false,
        delBtn: false,
        addBtn: false,
        editBtn: false,
        editBtnText: "修改",
        viewBtnText: "详情",
        addBtnIcon: " ",
        viewBtnIcon: " ",
        delBtnIcon: " ",
        editBtnIcon: " ",
        labelWidth: "200px",
        dialogWidth: 600,
        menuWidth: 120,
        dialogClickModal: false,
        searchEnter: true,
        filterBtn: true,
        searchShowBtn: false,
        excelBtn: true,
        showOverflowTooltip: true,
        align: "center",
        searchLabelPosition: "left",
        searchLabelPosition: "left",
        searchGutter: 24,
        searchSpan: 6,
        menuAlign: "left",
        gridBtn: false,
        searchMenuPosition: "right",
        column: [
          {
            label: "物料号",
            prop: "partCode",
            bind: "dsTasking.partCode",
            search: true,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "物料名称",
            prop: "partName",
            bind: "dsTasking.partName",
            search: true,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "镀种",
            prop: "plate",
            bind: "dsTasking.plate",
            search: true,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "批次号",
            prop: "batchNo",
            search: false,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "流程卡号",
            prop: "cardNo",
            search: false,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "版本",
            prop: "versionNo",
            bind: "dsTasking.versionNo",
            search: true,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "PDM发布时间",
            prop: "createTime",
            bind: "dsTasking.createTime",
            search: false,
            sortable: true,
            filter: true,
            width: 140,
          },
          {
            label: "工艺路线详情",
            prop: "wayDetails",
            bind: "dsTasking.wayDetails",
            search: false,
            sortable: true,
            filter: true,
            width: 140,
          },
          {
            label: "在制品意见",
            prop: "wipTake",
            bind: "dsTasking.wipTake",
            search: false,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "更改单号",
            prop: "ecnNo",
            bind: "dsTasking.ecnNo",
            search: true,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "调度员",
            prop: "searchCode",
            search: true,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "完成时间",
            prop: "dispatchTime",
            search: false,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "任务时间",
            prop: "createTime",
            search: false,
            sortable: true,
            filter: true,
            width: 120,
          },
          {
            label: "状态",
            prop: "status",
            search: true,
            sortable: true,
            filter: true,
            width: 120,
            type: "select",
            dicData: [
              {
                label: "待处理",
                value: 1,
              },
              {
                label: "已处理",
                value: 2,
              },
            ],
          },
        ],
      },
      isHandleShow: false,
      isAssignShow: false,
    };
  },
  mounted() {},
  methods: {
    assignFn(row) {
      this.isAssignShow = true;
    },
    handleFn(row) {
      this.isHandleShow = true;
    },
    closeDialog() {
      this.isHandleShow = false;
      this.isAssignShow = false;
    },
    receiveData(row) {
      this.$confirm("确定接收此工单?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {});
    },
    finishData(row) {
      this.$confirm("确定完成此工单?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {});
    },
    onLoad() {
      this.data = [
        {
          batchNo: "Y6942304004",
          cardNo: "1016803763",
          createTime: null,
          ddtId: 1485,
          disAssignMan: null,
          disAssignManName: null,
          disAssignTime: "2023-10-17 09:38:11",
          disOutFlag: true,
          disTaskStatus: 1,
          disTaskStatusTitle: "已分派",
          dispatchMan: {
            accountId: 388,
            card: null,
            createTime: "2023-02-08",
            curStatus: 1,
            deleted: false,
            deptName: null,
            dimissionTime: null,
            factoryId: 41,
            head: 0,
            jobName: "表面处理工",
            keyValue: 449,
            ldapName: "08355",
            mail: null,
            mobile: null,
            pfDepartment: {
              appLink: null,
              createTime: "2023-02-08",
              deleted: false,
              deptCode: "23",
              deptId: 65,
              deptName: "外协业务交付管理室",
              deptType: 1,
              deptTypeTitle: "厂",
              keyValue: 65,
              memo: null,
              orders: "23",
              parentDeptId: 41,
              parentPath: null,
              ucDeptId: null,
              updateTime: "2023-02-08 16:41:39",
            },
            pinyinIndex: "08355,08355",
            ucUserId: null,
            updateTime: "2023-02-08 17:25:13",
            userCode: "08355",
            userId: 449,
            userName: "08355",
            userSex: 1,
            userSources: "08355",
            userString: "449:A:08355",
            userType: "A",
          },
          dispatchManName: null,
          dispatchTime: null,
          dsTasking: {
            askForMold: false,
            assignMan: null,
            assignTime: null,
            craftMan: null,
            craftManName: null,
            craftTime: null,
            craftWay: null,
            createTime: null,
            dtId: 32545,
            ecnLink: null,
            ecnNo: null,
            extension: false,
            finalPlate: null,
            inProduction: false,
            keyValue: 32545,
            material: null,
            memo: null,
            outFlag: true,
            outType: "4",
            outTypeTitle: "审理单超时",
            partCode: "21E8-170-816-E9",
            partId: null,
            partName: null,
            plate: "XXXX",
            syncTime: "2023-10-17 09:38:11",
            taskStatus: 1,
            taskStatusTitle: "已分派",
            transferMess: null,
            versionNo: null,
            wayDetails: null,
            wipTake: null,
          },
          extension: true,
          handleResult: null,
          memo:
            "流程卡号为: 1016803763 ,批次号为 Y6942304004 的 0025 检验工序的单子已超过三小时未处理!!!",
          rsCode: null,
        },
        {
          batchNo: "Y0262304119",
          cardNo: "1016835815",
          createTime: null,
          ddtId: 1484,
          disAssignMan: null,
          disAssignManName: null,
          disAssignTime: "2023-10-17 09:38:11",
          disOutFlag: true,
          disTaskStatus: 1,
          disTaskStatusTitle: "已分派",
          dispatchMan: {
            accountId: 369,
            card: null,
            createTime: "2023-02-08",
            curStatus: 1,
            deleted: false,
            deptName: null,
            dimissionTime: null,
            factoryId: 41,
            head: 0,
            jobName: "表面处理工",
            keyValue: 355,
            ldapName: "07188",
            mail: null,
            mobile: null,
            pfDepartment: {
              appLink: null,
              createTime: "2023-02-08",
              deleted: false,
              deptCode: "36",
              deptId: 79,
              deptName: "热处理班",
              deptType: 1,
              deptTypeTitle: "厂",
              keyValue: 79,
              memo: null,
              orders: "36",
              parentDeptId: 41,
              parentPath: null,
              ucDeptId: null,
              updateTime: "2023-02-08 16:44:17",
            },
            pinyinIndex: "07188,07188",
            ucUserId: null,
            updateTime: "2023-02-08 17:25:08",
            userCode: "07188",
            userId: 355,
            userName: "07188",
            userSex: 1,
            userSources: "07188",
            userString: "355:A:07188",
            userType: "A",
          },
          dispatchManName: null,
          dispatchTime: null,
          dsTasking: {
            askForMold: false,
            assignMan: null,
            assignTime: null,
            craftMan: null,
            craftManName: null,
            craftTime: null,
            craftWay: null,
            createTime: null,
            dtId: 32544,
            ecnLink: null,
            ecnNo: null,
            extension: false,
            finalPlate: null,
            inProduction: false,
            keyValue: 32544,
            material: null,
            memo: null,
            outFlag: true,
            outType: "4",
            outTypeTitle: "审理单超时",
            partCode: "21E8-001-1825-E9-D",
            partId: null,
            partName: null,
            plate: "XXXX",
            syncTime: "2023-10-17 09:38:11",
            taskStatus: 1,
            taskStatusTitle: "已分派",
            transferMess: null,
            versionNo: null,
            wayDetails: null,
            wipTake: null,
          },
          extension: true,
          handleResult: null,
          memo:
            "流程卡号为: 1016835815 ,批次号为 Y0262304119 的 0035 检验工序的单子已超过三小时未处理!!!",
          rsCode: null,
        },
      ];
    },
  },
};
</script>
<style lang="scss" scoped></style>
