<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>
        <el-button type="primary" plain icon="el-icon-folder-checked" @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 #menu-form>
        <el-button type="primary" icon="el-icon-s-promotion" @click="handleDelete">发送审批
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      data: [],
      option: {
        index: true,
        addRowBtn: true,
        addRowBtnText: '插入一行',
        height: 'auto',
        calcHeight: 32,
        tip: false,
        size: 'medium',
        simplePage: true,
        searchShow: true,
        searchMenuSpan: 6,
        searchIcon: true,
        searchIndex: 3,
        tree: false,
        border: true,
        selection: true,
        viewBtn: false,
        addBtn: 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,
        showOverflowTooltip: true,
        menu: false,
        searchLabelPosition:'left',
searchLabelPosition:'left',
 searchGutter:24,
  searchSpan:6,
menuAlign: 'left',
gridBtn:false,
searchMenuPosition:'right',
        column: [
          {
            label: '供应商',
            prop: 'bsOemCustomer.ocCode',
            bind: 'bsOemCustomer.ocCode',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            cell: true,
            type: 'select',
            dicData: [
              {
                value: 1,
                label: '供应商一'
              }, {
                value: 2,
                label: '供应商二'
              }
            ],
            rules: [
              { required: true, message: '请输入供应商', trigger: 'blur' }
            ]
          },
          {
            label: '工艺能力',
            prop: 'caId',
            bind: 'bsCraftAbility.caId',
            sortable: true,
            filter: true,
            span: 24,
            search: true,
            cell: true,
            type: 'select',
            dicData: [
              {
                value: 1,
                label: '工艺能力一'
              }, {
                value: 2,
                label: '工艺能力二'
              }
            ],
            rules: [
              { required: true, message: '请输入工艺能力', trigger: 'blur' }
            ]
          },
          {
            label: '零件',
            prop: 'dsPart.partId',
            bind: 'dsPart.partId',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            cell: true,
            type: 'select',
            dicData: [
              {
                value: 1,
                label: '零件一'
              }, {
                value: 2,
                label: '零件二'
              }
            ],
            rules: [
              { required: true, message: '请输入零件', trigger: 'blur' }
            ]
          },
          {
            label: '分派比例(%)',
            prop: 'assignScale',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            display: false,
            cell: true,
            rules: [
              { required: true, message: '请输入分派比例', trigger: 'blur' }
            ]
          },
          {
            label: '日分派量(d㎡)',
            prop: 'assign',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
          },
          {
            label: '厂家周累计分派量(dm²)',
            prop: 'weekAssign',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            width: 200,
          },
          {
            label: '分类周累计分派量(dm²)',
            prop: 'classifyAssign',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            width: 200,
          },
          {
            label: '比例偏差因子',
            prop: 'factor',
            sortable: true,
            filter: true,
            span: 24,
            search: false,
            width: 150,
          },
        ]
      },
    }
  },
  methods: {
    onLoad() {
      this.loading = true
      this.data = [
        {
          $cellEdit: true,
          sex:1,
          "assign": 25.348650651,
          "assignScale": 0.0,
          "bsCraftAbility": {
            "bsWorkType": null,
            "caCode": "E386",
            caId: '1',
            "caName": "化学镀镍",
            "keyValue": 36,
            "updateTime": "2023-04-11 15:31:25"
          },
          "bsOemCustomer": {
            "abbreviation": "L411",
            "address": "aaa",
            "codeAndName": "L411/L411",
            "contactMan": "aaa",
            "contactPhone": "aaa",
            "craftAbility": "上挂（化学镍）、化学镀镍、下挂（化学镍）、交检、涂色标、试键位、干喷砂、复合镍、",
            "curStatus": 0,
            "curStatusText": "正常供货",
            "email": "aaa",
            "keyValue": 41,
            "limitType": 0,
            "ocCode": "L411",
            "ocId": 1,
            "ocName": "L411",
            "oemPassword": "L411411",
            "partCodeYesOrNo": false,
            "qualification": 10,
            "qualificationTitle": null,
            "region": "河南省",
            "updateTime": "2023-04-14 18:33:49"
          },
          "classifyAssign": 0.0,
          "dsPart": null,
          "factor": 0.0,
          "keyValue": 1,
          "maintainMan": {
            "accountId": 90,
            "card": null,
            "createTime": "2023-02-08",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 41,
            "head": 1,
            "jobName": "生产调度员",
            "keyValue": 90,
            "ldapName": "03891",
            "mail": null,
            "mobile": null,
            "pfDepartment": {
              "appLink": null,
              "createTime": "2023-02-08",
              "deleted": false,
              "deptCode": "06",
              "deptId": 47,
              "deptName": "经营管理室",
              "deptType": 1,
              "deptTypeTitle": "厂",
              "keyValue": 47,
              "memo": null,
              "orders": "6",
              "parentDeptId": 41,
              "parentPath": null,
              "ucDeptId": null,
              "updateTime": "2023-02-08 13:23:30"
            },
            "pinyinIndex": "03891,03891",
            "ucUserId": null,
            "updateTime": "2023-02-08 13:20:39",
            "userCode": "03891",
            "userId": 90,
            "userName": "03891",
            "userSex": 1,
            "userSources": "03891",
            "userString": "90:A:03891",
            "userType": "A"
          },
          "maintainTime": "2024-05-29 16:37:03",
          "pasId": 1,
          "weekAssign": 69.142489024
        },
        {
          $cellEdit: true,
          "assign": 0.0,
          "assignScale": 0.0,
          "bsCraftAbility": {
            "bsWorkType": null,
            "caCode": "E386",
            "caId": 2,
            "caName": "化学镀镍",
            "keyValue": 36,
            "updateTime": "2023-04-11 15:31:25"
          },
          "bsOemCustomer": {
            "abbreviation": "L234",
            "address": "aaa",
            "codeAndName": "L234/L234",
            "contactMan": "aaa",
            "contactPhone": "aaa",
            "craftAbility": "上挂（化学镍）、化学镀镍、下挂（化学镍）、涂色标、试键位、干喷砂、复合镍、DL零件包装、",
            "curStatus": 0,
            "curStatusText": "正常供货",
            "email": "aaa",
            "keyValue": 27,
            "limitType": 0,
            "ocCode": "L234",
            "ocId": 2,
            "ocName": "L234",
            "oemPassword": "L234234",
            "partCodeYesOrNo": false,
            "qualification": 10,
            "qualificationTitle": null,
            "region": "河南省",
            "updateTime": "2023-04-14 18:33:49"
          },
          "classifyAssign": 0.0,
          "dsPart": null,
          "factor": 0.0,
          "keyValue": 2,
          "maintainMan": {
            "accountId": 90,
            "card": null,
            "createTime": "2023-02-08",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 41,
            "head": 1,
            "jobName": "生产调度员",
            "keyValue": 90,
            "ldapName": "03891",
            "mail": null,
            "mobile": null,
            "pfDepartment": {
              "appLink": null,
              "createTime": "2023-02-08",
              "deleted": false,
              "deptCode": "06",
              "deptId": 47,
              "deptName": "经营管理室",
              "deptType": 1,
              "deptTypeTitle": "厂",
              "keyValue": 47,
              "memo": null,
              "orders": "6",
              "parentDeptId": 41,
              "parentPath": null,
              "ucDeptId": null,
              "updateTime": "2023-02-08 13:23:30"
            },
            "pinyinIndex": "03891,03891",
            "ucUserId": null,
            "updateTime": "2023-02-08 13:20:39",
            "userCode": "03891",
            "userId": 90,
            "userName": "03891",
            "userSex": 1,
            "userSources": "03891",
            "userString": "90:A:03891",
            "userType": "A"
          },
          "maintainTime": "2024-05-29 16:35:29",
          "pasId": 2,
          "weekAssign": 0.0
        },
        {
          $cellEdit: true,
          "assign": 971.5333014634,
          "assignScale": 20.0,
          "bsCraftAbility": {
            "bsWorkType": null,
            "caCode": "E386",
            "caId": 1,
            "caName": "化学镀镍",
            "keyValue": 36,
            "updateTime": "2023-04-11 15:31:25"
          },
          "bsOemCustomer": {
            "abbreviation": "L235",
            "address": "aaa",
            "codeAndName": "L235/L235",
            "contactMan": "aaa",
            "contactPhone": "aaa",
            "craftAbility": "上挂（化学镍）、化学镀镍、下挂（化学镍）、涂色标、试键位、干喷砂、复合镍、DL零件包装、",
            "curStatus": 0,
            "curStatusText": "正常供货",
            "email": "aaa",
            "keyValue": 28,
            "limitType": 0,
            "ocCode": "L235",
            "ocId": 2,
            "ocName": "L235",
            "oemPassword": "L235235",
            "partCodeYesOrNo": false,
            "qualification": 10,
            "qualificationTitle": null,
            "region": "河南省",
            "updateTime": "2023-04-14 18:33:49"
          },
          "classifyAssign": 0.0,
          "dsPart": null,
          "factor": 0.0,
          "keyValue": 3,
          "maintainMan": {
            "accountId": 90,
            "card": null,
            "createTime": "2023-02-08",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 41,
            "head": 1,
            "jobName": "生产调度员",
            "keyValue": 90,
            "ldapName": "03891",
            "mail": null,
            "mobile": null,
            "pfDepartment": {
              "appLink": null,
              "createTime": "2023-02-08",
              "deleted": false,
              "deptCode": "06",
              "deptId": 47,
              "deptName": "经营管理室",
              "deptType": 1,
              "deptTypeTitle": "厂",
              "keyValue": 47,
              "memo": null,
              "orders": "6",
              "parentDeptId": 41,
              "parentPath": null,
              "ucDeptId": null,
              "updateTime": "2023-02-08 13:23:30"
            },
            "pinyinIndex": "03891,03891",
            "ucUserId": null,
            "updateTime": "2023-02-08 13:20:39",
            "userCode": "03891",
            "userId": 90,
            "userName": "03891",
            "userSex": 1,
            "userSources": "03891",
            "userString": "90:A:03891",
            "userType": "A"
          },
          "maintainTime": "2024-05-29 16:38:11",
          "pasId": 3,
          "weekAssign": 187.7276718782
        },
        {
          $cellEdit: true,
          "assign": 0.0,
          "assignScale": 100.0,
          "bsCraftAbility": {
            "bsWorkType": null,
            "caCode": "E10080",
            "caId": 2,
            "caName": "喷砂",
            "keyValue": 277,
            "updateTime": "2023-03-10 16:23:33"
          },
          "bsOemCustomer": {
            "abbreviation": "L369",
            "address": "aaa",
            "codeAndName": "L369/L369",
            "contactMan": "aaa",
            "contactPhone": "aaa",
            "craftAbility": "喷砂、",
            "curStatus": 0,
            "curStatusText": "正常供货",
            "email": "aaa",
            "keyValue": 35,
            "limitType": 0,
            "ocCode": "L369",
            "ocId": 1,
            "ocName": "L369",
            "oemPassword": null,
            "partCodeYesOrNo": false,
            "qualification": 10,
            "qualificationTitle": null,
            "region": "河南省",
            "updateTime": "2023-04-14 18:33:49"
          },
          "classifyAssign": 0.0,
          "dsPart": null,
          "factor": 10000.0,
          "keyValue": 4,
          "maintainMan": {
            "accountId": 90,
            "card": null,
            "createTime": "2023-02-08",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 41,
            "head": 1,
            "jobName": "生产调度员",
            "keyValue": 90,
            "ldapName": "03891",
            "mail": null,
            "mobile": null,
            "pfDepartment": {
              "appLink": null,
              "createTime": "2023-02-08",
              "deleted": false,
              "deptCode": "06",
              "deptId": 47,
              "deptName": "经营管理室",
              "deptType": 1,
              "deptTypeTitle": "厂",
              "keyValue": 47,
              "memo": null,
              "orders": "6",
              "parentDeptId": 41,
              "parentPath": null,
              "ucDeptId": null,
              "updateTime": "2023-02-08 13:23:30"
            },
            "pinyinIndex": "03891,03891",
            "ucUserId": null,
            "updateTime": "2023-02-08 13:20:39",
            "userCode": "03891",
            "userId": 90,
            "userName": "03891",
            "userSex": 1,
            "userSources": "03891",
            "userString": "90:A:03891",
            "userType": "A"
          },
          "maintainTime": "2024-05-28 18:13:17",
          "pasId": 4,
          "weekAssign": 0.0
        },
        {
          $cellEdit: true,
          "assign": 0.0,
          "assignScale": 100.0,
          "bsCraftAbility": {
            "bsWorkType": null,
            "caCode": "E3229",
            "caId": 1,
            "caName": "涂干膜润滑剂",
            "keyValue": 266,
            "updateTime": "2023-03-10 16:17:14"
          },
          "bsOemCustomer": {
            "abbreviation": "L386",
            "address": "aaa",
            "codeAndName": "L386/L386",
            "contactMan": "aaa",
            "contactPhone": "aaa",
            "craftAbility": "涂干膜润滑剂、喷漆、",
            "curStatus": 0,
            "curStatusText": "正常供货",
            "email": "aaa",
            "keyValue": 38,
            "limitType": 0,
            "ocCode": "L386",
            "ocId": 2,
            "ocName": "L386",
            "oemPassword": null,
            "partCodeYesOrNo": false,
            "qualification": 10,
            "qualificationTitle": null,
            "region": "河南省",
            "updateTime": "2023-04-14 18:33:49"
          },
          "classifyAssign": 0.0,
          "dsPart": null,
          "factor": 10000.0,
          "keyValue": 5,
          "maintainMan": {
            "accountId": 90,
            "card": null,
            "createTime": "2023-02-08",
            "curStatus": 1,
            "deleted": false,
            "deptName": null,
            "dimissionTime": null,
            "factoryId": 41,
            "head": 1,
            "jobName": "生产调度员",
            "keyValue": 90,
            "ldapName": "03891",
            "mail": null,
            "mobile": null,
            "pfDepartment": {
              "appLink": null,
              "createTime": "2023-02-08",
              "deleted": false,
              "deptCode": "06",
              "deptId": 47,
              "deptName": "经营管理室",
              "deptType": 1,
              "deptTypeTitle": "厂",
              "keyValue": 47,
              "memo": null,
              "orders": "6",
              "parentDeptId": 41,
              "parentPath": null,
              "ucDeptId": null,
              "updateTime": "2023-02-08 13:23:30"
            },
            "pinyinIndex": "03891,03891",
            "ucUserId": null,
            "updateTime": "2023-02-08 13:20:39",
            "userCode": "03891",
            "userId": 90,
            "userName": "03891",
            "userSex": 1,
            "userSources": "03891",
            "userString": "90:A:03891",
            "userType": "A"
          },
          "maintainTime": "2024-05-28 18:21:02",
          "pasId": 5,
          "weekAssign": 0.0
        }
      ]
      this.page.total = this.data.length
      this.loading = false
      setTimeout(() => {
        this.selectionClear()
      }, 500)
    }
  }
}
</script>

<style></style>