<template>
  <template-page ref="pageRef" :getList="getList" :operation="operation()" :exportList="exportList"
    :columnParsing="columnParsing" :tableAttributes="tableAttributes" :tableEvents="tableEvents">
    <div class="cartographer_big">
      <el-dialog title="详情" width="100%" :modal="false" :visible.sync="formBool" :before-close="handleClose">
        <zj-page-container v-if="formBool">
          <zj-page-fill class="neibuview" v-if="formBool">
            <zj-form-container v-if="formBool" :formAttributes="{ 'label-position': 'top' }">
              <zj-form-module v-if="formBool" title="" :form-data="formData" :form-items="formItems">
              </zj-form-module>
            </zj-form-container>
          </zj-page-fill>
        </zj-page-container>
      </el-dialog>
    </div>
  </template-page>
</template>

<script>
import TemplatePage from '@/components/template/template-page-1.vue'
import import_mixin from '@/components/template/import_mixin.js'
import operation_mixin from '@/components/template/operation_mixin.js'
import { enginMaterialList, enginMaterialListExport, enginMaterialDetail } from "@/api/applicationWithoutFee.js"
import feel from "../mixins/feel.js"
export default {
  components: {
    TemplatePage,
  },
  mixins: [import_mixin, operation_mixin, feel],
  data() {
    return {
      formBool: false,
      // 表格属性
      tableAttributes: {
        // 启用勾选列
        selectColumn: false,
      },
      // 表格事件
      tableEvents: {
        'selection-change': this.selectionChange
      },
      formData: {}
    }
  },
  methods: {
    // 列表请求函数
    getList(p, cb) {
      try {
        var pam = JSON.parse(JSON.stringify(p))
        pam.params.push({ "param": "is_all_fee", "compare": "=", "value": "YES" })
        cb && cb(pam)
        return enginMaterialList(pam)
      } catch (err) {
        console.log(err)
      }
    },

    // 列表导出函数
    exportList: enginMaterialListExport,

    // 表格列解析渲染数据更改
    columnParsing(item, defaultData) {
      return defaultData
    },

    // 监听勾选变化
    selectionChange(data) {
      this.recordSelected = data
    },

    operation() {
      return this.operationBtn({
        detail: {
          click: ({ row, index, column }) => {
            console.log(row)
            enginMaterialDetail({
              id: row.orderId
            }).then(res => {
              this.formData = res.data
              this.$nextTick(() => {
                this.formBool = true
              })
            })
          }
        }
      })
    },

    handleClose() {
      this.$refs.formRef.$refs.inlineForm.clearValidate()
      this.formData = {}
      this.formBool = false
    },

  }
}
</script>

<style lang="scss" scoped>
.neibuview {
  box-sizing: border-box;
  padding-left: 16px;

  ::v-deep &>.zj-page-fill-scroll {
    box-sizing: border-box;
    padding-right: 16px;

    &>div:nth-child(1) {
      margin-top: 20px;
    }
  }
}
</style>
