<template>
  <basic-container>
    <!-- 成本统计 -->
    <el-form :inline="true" :model="searchForm">
      <el-form-item label="月份">
        <el-date-picker v-model="searchForm.monthDate" type="month" placeholder="选择月">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary">分派</el-button>
        <el-button type="primary">保存</el-button>
      </el-form-item>
    </el-form>
    <avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud"
      @row-update="rowUpdate" @row-save="rowSave" @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">成本计算</el-button>
        <el-button type="primary" @click="isLockClick">锁定/解锁</el-button>
        <el-button type="danger" @click="handleDelete">删除</el-button>
        <el-button type="success">导出</el-button>
      </template>

      <template #wcCode="{ row }">{{ row.saCostConfig.bsWorkCenter.wcCode }}</template>
      <template #wcName="{ row }">{{ row.saCostConfig.bsWorkCenter.wcName }}</template>
    </avue-crud>
  </basic-container>
</template>

<script>
export default {
  data() {
    return {
      searchForm: {},
      loading: false,
      data: [],
      form: {},
      selectionList: [],
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      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,
        addBtn: false,
        editBtn: false,
        editBtnText: '修改',
        viewBtnIcon: ' ',
        delBtnIcon: ' ',
        editBtnIcon: ' ',
        viewBtnText: '详情',
        labelWidth: 120,
        searchLabelWidth: 120,
        menu:false,
        menuWidth: 220,
        dialogWidth: 1200,
        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: ' ',

        column: [
          {
            label: '作业中心编码',
            prop: 'wcCode',
            search: false,
            sortable: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: '请输入作业中心编码',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '作业中心',
            prop: 'wcName',
            search: false,
            sortable: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: '请输入作业中心',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '月份',
            prop: 'month',
            search: false,
            sortable: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: '请输入月份',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '制造费用(元)',
            prop: 'drainCosts',
            search: false,
            sortable: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: '请输入制造费用(元)',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '作业中心材料费用(元)',
            prop: 'materialCosts',
            search: false,
            sortable: true,
            overHidden: true,
            width: 200,
            rules: [
              {
                required: true,
                message: '请输入作业中心材料费用(元)',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '辅助人员材料费用(元)',
            prop: 'materialCosts1',
            search: false,
            width: 200,
            sortable: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: '请输入辅助人员材料费用(元)',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '单位成本(元)',
            prop: 'unitCost',
            search: false,
            sortable: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: '请输入单位成本(元)',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '月度产出(dm²)',
            prop: 'monthlyOutput',
            search: false,
            width: 150,
            sortable: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: '请输入月度产出(dm²)',
                trigger: 'blur',
              },
            ],
          },
          {
            label: '月度产出(v)',
            prop: 'volumeOutput',
            search: false,
            sortable: true,
            overHidden: true,
            rules: [
              {
                required: true,
                message: '请输入月度产出(v)',
                trigger: 'blur',
              },
            ],
          },
        ]
      }
    }
  },
  mounted() {

  },
  methods: {
    selectionChange(val) {
      this.selectionList = val
    },
    isLockClick() {
      if (this.selectionList.length == 0) {
        this.$message.error('请先选择数据')
        return
      }
    },
    handleDelete() {
      if (this.selectionList.length == 0) {
        this.$message.error('请先选择数据')
        return
      }
      this.$confirm('确定将选择数据删除?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {

      })
    }
  }
}
</script>

<style></style>