<template>
  <div>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      v-model="form"
      v-model:page="page"
      ref="crud"
      @row-del="rowDel"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template #menu-left>
        <el-button type="primary" @click="addFn()">增加</el-button>
        <el-button type="danger" @click="handleDelete()">删除</el-button>
      </template>
      <template #menu-right> </template>
      <template #menu="scope">
        <el-button
          type="primary"
          text
          plain
          style="border: 0; background-color: transparent !important"
          size="medium"
          @click.stop="addFn(row)"
          >修改</el-button
        >
      </template>
    </avue-crud>
    <addAnnmualEditDialog
      v-if="isOpen"
      :showDialog="isOpen"
      @closeDialog="closeDialog"
    ></addAnnmualEditDialog>
  </div>
</template>
<script>
import addAnnmualEditDialog from './components/addAnnmualEditDialog.vue';
export default {
  components: {
    addAnnmualEditDialog,
  },
  data() {
    return {
      selectionList: [],
      option: {
        height: 'auto',
        calcHeight: 32,
        tip: false,
        size: 'medium',
        simplePage: true,
        searchShow: true,
        searchMenuSpan: 18,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: true,
        selection: true,
        editBtn: false,
        viewBtn: false,
        delBtn: false,
        addBtn: false,
        editBtnText: '修改',
        viewBtnIcon: ' ',
        delBtnIcon: ' ',
        editBtnIcon: ' ',
        viewBtnText: '详情',
        labelWidth: 120,
        menuWidth: 70,
        dialogWidth: 640,
        dialogClickModal: false,
        searchEnter: true,
        excelBtn: false,
        filterBtn: true,
        searchShowBtn: false,
        columnSort: true,
        excelBtn: true,
        columnSort: true,
        index: false,
        showOverflowTooltip: true,
        searchLabelPosition: 'left',
        searchLabelPosition: 'left',
        searchGutter: 24,
        searchSpan: 6,
        menuAlign: 'left',
        gridBtn: false,
        searchMenuPosition: 'right',
        addBtnIcon: ' ',
        viewBtnIcon: ' ',
        delBtnIcon: ' ',
        editBtnIcon: ' ',
        align: 'center',
        column: [
          {
            label: '类别名称',
            prop: 'qatTypeTitle',
            sortable: true,
            filter: true,
            span: 24,
            search: true,
            headerAlign: 'center',
            align: 'left',
          },
          {
            label: '年份',
            prop: 'qatYear',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
          },
          {
            label: '目标值',
            prop: 'targetValue',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
          },
          {
            label: '作业中心',
            prop: 'wcName',
            bind: 'bsWorkCenter.wcName',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            headerAlign: 'center',
            align: 'left',
            dicUrl: '/blade-desk/bsWorkCenter/getList',
            props: {
              label: 'wcName',
              value: 'id',
            },
          },
          {
            label: '班组',
            prop: 'tsName',
            bind: 'bsTeamSet.tsName',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            headerAlign: 'center',
            align: 'left',
          },
        ],
      },
      form: {
        name: '',
      },
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      isOpen: false,
    };
  },
  methods: {
    addFn() {
      this.isOpen = true;
    },
    closeDialog() {
      this.isOpen = false;
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
      }
      this.$confirm('确定将选择数据删除?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {});
    },
    // 多选
    selectionChange(list) {
      this.selectionList = list;
    },
    onLoad() {
      this.loading = true;
      this.data = [
        {
          bsTeamSet: {
            bsClassesSet: null,
            bsWorkCenter: {
              area: 13000.0,
              batchNo: null,
              bigBatch: false,
              bsJfCenter: {
                createMan: {
                  userId: 1,
                  userName: 'admin',
                },
                createTime: '2024-12-09 00:00:00',
                deleted: false,
                jcCode: 'RBZX',
                jcId: 1,
                jcName: '热表中心',
                keyValue: 1,
                updateTime: '2024-12-09 00:00:00',
              },
              checkout: false,
              craftAbility: '化学镀镍',
              createMan: {
                userId: 1,
                userName: 'admin',
              },
              createTime: '2023-02-06 12:31:36',
              deleted: false,
              describe: null,
              endPoint: null,
              keyValue: 81,
              leaderUser: {
                userId: 541,
                userName: '崔殿龙',
              },
              limitType: 0,
              processes: '上挂、下挂、交检、化学镀镍、喷砂',
              quantity: null,
              roundCycle: null,
              saturation: 85.0,
              sign: '4',
              startPoint: null,
              team: '化学镀镍一班崔胜伟、化学镀镍一班郭家梁',
              updateTime: '2023-03-06 18:42:47',
              wcCode: '001',
              wcId: 81,
              wcName: '化学镀镍作业中心',
              whetherPlate: false,
            },
            createMan: {
              userId: 1,
              userName: 'admin',
            },
            createTime: '2023-02-06 12:30:26',
            dayPutDueTime: '00:30~01:00',
            deleted: false,
            dispatcher: {
              userId: 355,
              userName: '07188',
            },
            exChangeTime: null,
            keyValue: 61,
            planner: {
              userId: 355,
              userName: '07188',
            },
            specDayPutDueTime: null,
            special: false,
            specialTitle: '否',
            teamLeader: {
              userId: 68,
              userName: '03772',
            },
            teamMember: 'admin、10477、03772、03555、12645、10917、10711、03800、崔殿龙、张欣',
            tsCode: '001',
            tsId: 61,
            tsName: '化学镀镍一班崔胜伟',
            tsType: null,
            tsTypeTitle: null,
            updateTime: '2023-02-06 12:30:26',
          },
          bsWorkCenter: {
            area: 13000.0,
            batchNo: null,
            bigBatch: false,
            bsJfCenter: {
              createMan: {
                userId: 1,
                userName: 'admin',
              },
              createTime: '2024-12-09 00:00:00',
              deleted: false,
              jcCode: 'RBZX',
              jcId: 1,
              jcName: '热表中心',
              keyValue: 1,
              updateTime: '2024-12-09 00:00:00',
            },
            checkout: false,
            craftAbility: '化学镀镍',
            createMan: {
              userId: 1,
              userName: 'admin',
            },
            createTime: '2023-02-06 12:31:36',
            deleted: false,
            describe: null,
            endPoint: null,
            keyValue: 81,
            leaderUser: {
              userId: 541,
              userName: '崔殿龙',
            },
            limitType: 0,
            processes: '上挂、下挂、交检、化学镀镍、喷砂',
            quantity: null,
            roundCycle: null,
            saturation: 85.0,
            sign: '4',
            startPoint: null,
            team: '化学镀镍一班崔胜伟、化学镀镍一班郭家梁',
            updateTime: '2023-03-06 18:42:47',
            wcCode: '001',
            wcId: 81,
            wcName: '化学镀镍作业中心',
            whetherPlate: false,
          },
          createMan: {
            userId: 541,
            userName: '崔殿龙',
          },
          createTime: '2023-12-12 11:44:41',
          keyValue: 25,
          qatId: 25,
          qatType: 1,
          qatTypeTitle: '后工序不合格品率',
          qatYear: '2023-01-01 00:00:00',
          targetValue: 266.0,
        },
        {
          bsTeamSet: {
            bsClassesSet: null,
            bsWorkCenter: {
              area: 13000.0,
              batchNo: null,
              bigBatch: false,
              bsJfCenter: {
                createMan: {
                  userId: 1,
                  userName: 'admin',
                },
                createTime: '2024-12-09 00:00:00',
                deleted: false,
                jcCode: 'RBZX',
                jcId: 1,
                jcName: '热表中心',
                keyValue: 1,
                updateTime: '2024-12-09 00:00:00',
              },
              checkout: false,
              craftAbility: '化学镀镍',
              createMan: {
                userId: 1,
                userName: 'admin',
              },
              createTime: '2023-02-06 12:31:36',
              deleted: false,
              describe: null,
              endPoint: null,
              keyValue: 81,
              leaderUser: {
                userId: 541,
                userName: '崔殿龙',
              },
              limitType: 0,
              processes: '上挂、下挂、交检、化学镀镍、喷砂',
              quantity: null,
              roundCycle: null,
              saturation: 85.0,
              sign: '4',
              startPoint: null,
              team: '化学镀镍一班崔胜伟、化学镀镍一班郭家梁',
              updateTime: '2023-03-06 18:42:47',
              wcCode: '001',
              wcId: 81,
              wcName: '化学镀镍作业中心',
              whetherPlate: false,
            },
            createMan: {
              userId: 1,
              userName: 'admin',
            },
            createTime: '2023-02-06 12:30:26',
            dayPutDueTime: '00:30~01:00',
            deleted: false,
            dispatcher: {
              userId: 355,
              userName: '07188',
            },
            exChangeTime: null,
            keyValue: 61,
            planner: {
              userId: 355,
              userName: '07188',
            },
            specDayPutDueTime: null,
            special: false,
            specialTitle: '否',
            teamLeader: {
              userId: 68,
              userName: '03772',
            },
            teamMember: 'admin、10477、03772、03555、12645、10917、10711、03800、崔殿龙、张欣',
            tsCode: '001',
            tsId: 61,
            tsName: '化学镀镍一班崔胜伟',
            tsType: null,
            tsTypeTitle: null,
            updateTime: '2023-02-06 12:30:26',
          },
          bsWorkCenter: {
            area: 13000.0,
            batchNo: null,
            bigBatch: false,
            bsJfCenter: {
              createMan: {
                userId: 1,
                userName: 'admin',
              },
              createTime: '2024-12-09 00:00:00',
              deleted: false,
              jcCode: 'RBZX',
              jcId: 1,
              jcName: '热表中心',
              keyValue: 1,
              updateTime: '2024-12-09 00:00:00',
            },
            checkout: false,
            craftAbility: '化学镀镍',
            createMan: {
              userId: 1,
              userName: 'admin',
            },
            createTime: '2023-02-06 12:31:36',
            deleted: false,
            describe: null,
            endPoint: null,
            keyValue: 81,
            leaderUser: {
              userId: 541,
              userName: '崔殿龙',
            },
            limitType: 0,
            processes: '上挂、下挂、交检、化学镀镍、喷砂',
            quantity: null,
            roundCycle: null,
            saturation: 85.0,
            sign: '4',
            startPoint: null,
            team: '化学镀镍一班崔胜伟、化学镀镍一班郭家梁',
            updateTime: '2023-03-06 18:42:47',
            wcCode: '001',
            wcId: 81,
            wcName: '化学镀镍作业中心',
            whetherPlate: false,
          },
          createMan: {
            userId: 541,
            userName: '崔殿龙',
          },
          createTime: '2024-03-11 11:42:12',
          keyValue: 41,
          qatId: 41,
          qatType: 2,
          qatTypeTitle: '低层次质量问题',
          qatYear: '2024-01-01 00:00:00',
          targetValue: 57.0,
        },
        {
          bsTeamSet: {
            bsClassesSet: null,
            bsWorkCenter: null,
            createMan: {
              userId: 1,
              userName: 'admin',
            },
            createTime: '2023-02-07 11:01:50',
            dayPutDueTime: '24',
            deleted: false,
            dispatcher: {
              userId: 261,
              userName: '03886',
            },
            exChangeTime: null,
            keyValue: 70,
            planner: {
              userId: 261,
              userName: '03886',
            },
            specDayPutDueTime: null,
            special: true,
            specialTitle: '是',
            teamLeader: {
              userId: 425,
              userName: '03791',
            },
            teamMember:
              '07793、03803、07791、03791、13343、12752、11345、11344、57644、56942、0001、admin、123456、崔殿龙',
            tsCode: '008',
            tsId: 70,
            tsName: '涂色标班组',
            tsType: null,
            tsTypeTitle: null,
            updateTime: '2023-02-07 11:01:50',
          },
          bsWorkCenter: {
            area: 20000.0,
            batchNo: null,
            bigBatch: false,
            bsJfCenter: {
              createMan: {
                userId: 1,
                userName: 'admin',
              },
              createTime: '2024-12-09 00:00:00',
              deleted: false,
              jcCode: 'RBZX',
              jcId: 1,
              jcName: '热表中心',
              keyValue: 1,
              updateTime: '2024-12-09 00:00:00',
            },
            checkout: false,
            craftAbility: '涂色标、清洗',
            createMan: {
              userId: 1,
              userName: 'admin',
            },
            createTime: '2023-02-07 10:30:14',
            deleted: false,
            describe: null,
            endPoint: null,
            keyValue: 87,
            leaderUser: {
              userId: 541,
              userName: '崔殿龙',
            },
            limitType: 0,
            processes: '涂色标、涂色标（带）',
            quantity: null,
            roundCycle: null,
            saturation: 90.0,
            sign: '4',
            startPoint: null,
            team: '涂色标班组',
            updateTime: '2023-03-06 18:16:54',
            wcCode: '006',
            wcId: 87,
            wcName: '涂色标作业中心',
            whetherPlate: false,
          },
          createMan: {
            userId: 541,
            userName: '崔殿龙',
          },
          createTime: '2024-03-11 11:43:46',
          keyValue: 61,
          qatId: 61,
          qatType: 2,
          qatTypeTitle: '低层次质量问题',
          qatYear: '2024-01-01 00:00:00',
          targetValue: 54.0,
        },
        {
          bsTeamSet: {
            bsClassesSet: null,
            bsWorkCenter: {
              area: 13000.0,
              batchNo: null,
              bigBatch: false,
              bsJfCenter: {
                createMan: {
                  userId: 1,
                  userName: 'admin',
                },
                createTime: '2024-12-09 00:00:00',
                deleted: false,
                jcCode: 'RBZX',
                jcId: 1,
                jcName: '热表中心',
                keyValue: 1,
                updateTime: '2024-12-09 00:00:00',
              },
              checkout: false,
              craftAbility: '化学镀镍',
              createMan: {
                userId: 1,
                userName: 'admin',
              },
              createTime: '2023-02-06 12:31:36',
              deleted: false,
              describe: null,
              endPoint: null,
              keyValue: 81,
              leaderUser: {
                userId: 541,
                userName: '崔殿龙',
              },
              limitType: 0,
              processes: '上挂、下挂、交检、化学镀镍、喷砂',
              quantity: null,
              roundCycle: null,
              saturation: 85.0,
              sign: '4',
              startPoint: null,
              team: '化学镀镍一班崔胜伟、化学镀镍一班郭家梁',
              updateTime: '2023-03-06 18:42:47',
              wcCode: '001',
              wcId: 81,
              wcName: '化学镀镍作业中心',
              whetherPlate: false,
            },
            createMan: {
              userId: 1,
              userName: 'admin',
            },
            createTime: '2023-02-06 12:30:26',
            dayPutDueTime: '00:30~01:00',
            deleted: false,
            dispatcher: {
              userId: 355,
              userName: '07188',
            },
            exChangeTime: null,
            keyValue: 61,
            planner: {
              userId: 355,
              userName: '07188',
            },
            specDayPutDueTime: null,
            special: false,
            specialTitle: '否',
            teamLeader: {
              userId: 68,
              userName: '03772',
            },
            teamMember: 'admin、10477、03772、03555、12645、10917、10711、03800、崔殿龙、张欣',
            tsCode: '001',
            tsId: 61,
            tsName: '化学镀镍一班崔胜伟',
            tsType: null,
            tsTypeTitle: null,
            updateTime: '2023-02-06 12:30:26',
          },
          bsWorkCenter: {
            area: 13000.0,
            batchNo: null,
            bigBatch: false,
            bsJfCenter: {
              createMan: {
                userId: 1,
                userName: 'admin',
              },
              createTime: '2024-12-09 00:00:00',
              deleted: false,
              jcCode: 'RBZX',
              jcId: 1,
              jcName: '热表中心',
              keyValue: 1,
              updateTime: '2024-12-09 00:00:00',
            },
            checkout: false,
            craftAbility: '化学镀镍',
            createMan: {
              userId: 1,
              userName: 'admin',
            },
            createTime: '2023-02-06 12:31:36',
            deleted: false,
            describe: null,
            endPoint: null,
            keyValue: 81,
            leaderUser: {
              userId: 541,
              userName: '崔殿龙',
            },
            limitType: 0,
            processes: '上挂、下挂、交检、化学镀镍、喷砂',
            quantity: null,
            roundCycle: null,
            saturation: 85.0,
            sign: '4',
            startPoint: null,
            team: '化学镀镍一班崔胜伟、化学镀镍一班郭家梁',
            updateTime: '2023-03-06 18:42:47',
            wcCode: '001',
            wcId: 81,
            wcName: '化学镀镍作业中心',
            whetherPlate: false,
          },
          createMan: {
            userId: 541,
            userName: '崔殿龙',
          },
          createTime: '2024-03-11 15:52:36',
          keyValue: 62,
          qatId: 62,
          qatType: 6,
          qatTypeTitle: '外部问题率',
          qatYear: '2024-01-01 00:00:00',
          targetValue: 12.0,
        },
      ];
      this.page.total = this.data.length;
      this.loading = false;
      setTimeout(() => {
        this.selectionClear();
      }, 500);
    },
  },
};
</script>
<style lang="scss" scoped></style>
