<template>
  <!-- <basic-container> -->

  <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="danger" icon="el-icon-delete" @click="handleDelete">删除
      </el-button>
    </template>
    <template #menu-right>
      <!-- <el-button type="primary" icon="el-icon-printer" @click="handleDelete">打印
        </el-button> -->
      <el-button type="primary" icon="el-icon-upload" @click="handleDelete">导入
      </el-button>
    </template>
    <template #proportion="{ row }">
      <span>{{ row.proportion ? row.proportion + '%' : '0%' }}</span>
    </template>
    <template #approvalStatus="{ row }">
      <approvalStandard ref="approval" :cur-status="row.approvalStatus" :flow-code="row.flowCode" :the-id="row.trId"
        @refresh="refresh" />
    </template>
    <template #menu-form>
      <el-button type="primary" icon="el-icon-s-promotion" @click="handleDelete">发送审批
      </el-button>
    </template>
  </avue-crud>
  <!-- </basic-container> -->
</template>

<script>
import approvalStandard from '../../components/approval/index.vue'
export default {
  components: { approvalStandard },
  data() {
    return {
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      data: [],
      option: {
        height: 'auto',
        calcHeight: 32,
        tip: false,
        size: 'medium',
        simplePage: true,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        index: true,
        selection: true,
        viewBtn: false,
        delBtn: false,
        editBtn: true,
        editBtnText: '修改',
        viewBtnIcon: ' ',
        delBtnIcon: ' ',
        editBtnIcon: ' ',
        labelWidth: 120,
        menuWidth: 150,
        dialogWidth: 600,
        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',

        column: [
          {
            label: '工艺能力',
            prop: 'getCaName',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            searchLabelWidth: 90,
            rules: [
              {
                required: true,
                message: '请输入工艺能力',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '外协代码',
            prop: 'oemCustomer.ocCode',
            bind: 'oemCustomer.ocCode',
            sortable: true,
            filter: true,
            span: 24,
            search: true,
            searchLabelWidth: 90,
            display: false,

          },
          {
            label: '外协名称',
            prop: 'oemCustomer.ocName',
            bind: 'oemCustomer.ocName',
            sortable: true,
            filter: true,
            span: 24,
            search: true,
            searchLabelWidth: 100,
            rules: [
              {
                required: true,
                message: '请输入外协名称',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '外协简称',
            prop: 'oemCustomer.abbreviation',
            bind: 'oemCustomer.abbreviation',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            display: false,
            searchLabelWidth: 100,
          },
          {
            label: '比例(%)',
            prop: 'proportion',
            sortable: true,
            filter: true,
            span: 24,
            search: true,
            searchLabelWidth: 100,
            rules: [
              {
                required: true,
                message: '请输入比例',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '备注',
            prop: 'remarks',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            type: 'textarea',
            searchLabelWidth: 90,
            rows: 3,
            rules: [
              {
                required: false,
                message: '请输入备注',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '当前状态',
            prop: 'approvalStatus',
            sortable: true,
            filter: true,
            span: 24,
            search: true,
            display: false,
            searchLabelWidth: 100,
          },
        ]
      },
    }
  },
  methods: {
    onLoad() {
      this.loading = true
      this.data = [
        {
          "approvalStatus": 1,
          "businessBeanCreateDate": "2023-02-15 16:50:35",
          "businessBeanCreateMan": {
            "accountId": null,
            "card": null,
            "createTime": "2022-08-31",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 41,
            "head": 0,
            "jobName": "总工",
            "keyValue": 1,
            "ldapName": "admin",
            "mail": "13699999999@136.com",
            "mobile": "13699999999",
            "pfDepartment": {
              "appLink": null,
              "createTime": "2022-08-31",
              "deleted": false,
              "deptCode": "001",
              "deptId": 1,
              "deptName": "MES开发部",
              "deptType": 1,
              "deptTypeTitle": "厂",
              "keyValue": 1,
              "memo": null,
              "orders": "00",
              "parentDeptId": null,
              "parentPath": null,
              "ucDeptId": null,
              "updateTime": "2022-08-31 16:32:46"
            },
            "pinyinIndex": "ADMIN,ADMIN",
            "ucUserId": null,
            "updateTime": "2022-08-31 16:32:46",
            "userCode": "00",
            "userId": 1,
            "userName": "admin",
            "userSex": 1,
            "userSources": "admin",
            "userString": "1:A:admin",
            "userType": "A"
          },
          "businessBeanCurStatus": 1,
          "caId": null,
          "caIdText": null,
          "createMan": {
            "accountId": null,
            "card": null,
            "createTime": "2022-08-31",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 41,
            "head": 0,
            "jobName": "总工",
            "keyValue": 1,
            "ldapName": "admin",
            "mail": "13699999999@136.com",
            "mobile": "13699999999",
            "pfDepartment": {
              "appLink": null,
              "createTime": "2022-08-31",
              "deleted": false,
              "deptCode": "001",
              "deptId": 1,
              "deptName": "MES开发部",
              "deptType": 1,
              "deptTypeTitle": "厂",
              "keyValue": 1,
              "memo": null,
              "orders": "00",
              "parentDeptId": null,
              "parentPath": null,
              "ucDeptId": null,
              "updateTime": "2022-08-31 16:32:46"
            },
            "pinyinIndex": "ADMIN,ADMIN",
            "ucUserId": null,
            "updateTime": "2022-08-31 16:32:46",
            "userCode": "00",
            "userId": 1,
            "userName": "admin",
            "userSex": 1,
            "userSources": "admin",
            "userString": "1:A:admin",
            "userType": "A"
          },
          "createTime": "2023-02-15 16:50:35",
          "flowCode": "FLOW_OEM_001",
          "flowRecDescription": "外协招标比例的变更审批",
          "getCaName": "",
          "keyValue": 1,
          "oemCustomer": {
            "abbreviation": "L120",
            "address": "aaa",
            "codeAndName": "L120/L120",
            "contactMan": "aaa",
            "contactPhone": "aaa",
            "craftAbility": "不锈钢涂福斯润滑剂、DL零件包装、",
            "curStatus": 0,
            "curStatusText": "正常供货",
            "email": "aaa",
            "keyValue": 2,
            "limitType": 0,
            "ocCode": "L120",
            "ocId": 2,
            "ocName": "L120",
            "oemPassword": null,
            "partCodeYesOrNo": false,
            "qualification": 0,
            "qualificationTitle": "民品&普军",
            "region": "江苏省",
            "updateTime": "2023-04-14 18:33:49"
          },
          "performance": 0.0,
          "personnel": null,
          "proportion": 12.0,
          "remarks": null,
          "trId": 1,
          "type": 1
        },
        {
          "approvalStatus": -1,
          "businessBeanCreateDate": "2023-07-03 16:59:45",
          "businessBeanCreateMan": {
            "accountId": null,
            "card": null,
            "createTime": "2022-08-31",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 41,
            "head": 0,
            "jobName": "总工",
            "keyValue": 1,
            "ldapName": "admin",
            "mail": "13699999999@136.com",
            "mobile": "13699999999",
            "pfDepartment": {
              "appLink": null,
              "createTime": "2022-08-31",
              "deleted": false,
              "deptCode": "001",
              "deptId": 1,
              "deptName": "MES开发部",
              "deptType": 1,
              "deptTypeTitle": "厂",
              "keyValue": 1,
              "memo": null,
              "orders": "00",
              "parentDeptId": null,
              "parentPath": null,
              "ucDeptId": null,
              "updateTime": "2022-08-31 16:32:46"
            },
            "pinyinIndex": "ADMIN,ADMIN",
            "ucUserId": null,
            "updateTime": "2022-08-31 16:32:46",
            "userCode": "00",
            "userId": 1,
            "userName": "admin",
            "userSex": 1,
            "userSources": "admin",
            "userString": "1:A:admin",
            "userType": "A"
          },
          "businessBeanCurStatus": -1,
          "caId": "[25]",
          "caIdText": "[\"化学氧化\"]",
          "createMan": {
            "accountId": null,
            "card": null,
            "createTime": "2022-08-31",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 41,
            "head": 0,
            "jobName": "总工",
            "keyValue": 1,
            "ldapName": "admin",
            "mail": "13699999999@136.com",
            "mobile": "13699999999",
            "pfDepartment": {
              "appLink": null,
              "createTime": "2022-08-31",
              "deleted": false,
              "deptCode": "001",
              "deptId": 1,
              "deptName": "MES开发部",
              "deptType": 1,
              "deptTypeTitle": "厂",
              "keyValue": 1,
              "memo": null,
              "orders": "00",
              "parentDeptId": null,
              "parentPath": null,
              "ucDeptId": null,
              "updateTime": "2022-08-31 16:32:46"
            },
            "pinyinIndex": "ADMIN,ADMIN",
            "ucUserId": null,
            "updateTime": "2022-08-31 16:32:46",
            "userCode": "00",
            "userId": 1,
            "userName": "admin",
            "userSex": 1,
            "userSources": "admin",
            "userString": "1:A:admin",
            "userType": "A"
          },
          "createTime": "2023-07-03 16:59:45",
          "flowCode": "FLOW_OEM_001",
          "flowRecDescription": "外协招标比例的变更审批",
          "getCaName": "化学氧化",
          "keyValue": 41,
          "oemCustomer": {
            "abbreviation": "L120",
            "address": "aaa",
            "codeAndName": "L120/L120",
            "contactMan": "aaa",
            "contactPhone": "aaa",
            "craftAbility": "不锈钢涂福斯润滑剂、DL零件包装、",
            "curStatus": 0,
            "curStatusText": "正常供货",
            "email": "aaa",
            "keyValue": 2,
            "limitType": 0,
            "ocCode": "L120",
            "ocId": 2,
            "ocName": "L120",
            "oemPassword": null,
            "partCodeYesOrNo": false,
            "qualification": 0,
            "qualificationTitle": "民品&普军",
            "region": "江苏省",
            "updateTime": "2023-04-14 18:33:49"
          },
          "performance": 0.0,
          "personnel": null,
          "proportion": 12.0,
          "remarks": "12121",
          "trId": 41,
          "type": 1
        }
      ]
      this.page.total = this.data.length
      this.loading = false
      setTimeout(() => {
        this.selectionClear()
      }, 500)
    }
  }
}
</script>

<style></style>