<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 { enginMaterialListAll, enginMaterialListAllExport, 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" })
        if (this.$route.query.rpProjectRepairId) {
          pam.params.push({ "param": "rp_project_repair_id", "compare": "=", "value": this.$route.query.rpProjectRepairId })
        }
        cb && cb(pam)
        return enginMaterialListAll(pam)
      } catch (err) {
        console.log(err)
      }
    },

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

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

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

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

    handleClose() {
      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>
