<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog
        :close-on-click-modal="false"
        :before-close="crud.cancelCU"
        :visible.sync="crud.status.cu > 0"
        :title="crud.status.title"
        width="500px"
      >
        <el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
          <el-form-item label="请求名字">
            <el-input v-model="form.request_name" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="生成任务的请求参数">
            <el-input v-model="form.request_param" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="下发任务的请求参数">
            <el-input v-model="form.response_param" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="链路标识">
            <el-input v-model="form.acs_trace_id" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="请求描述">
            <el-input v-model="form.request_desc" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="请求类型">
            <el-input v-model="form.request_type" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="备注">
            <el-input v-model="form.remark" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="是否处理完成">
            <el-input v-model="form.is_finish" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="车间编码">
            <el-input v-model="form.workshop_code" style="width: 370px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table
        ref="table"
        v-loading="crud.loading"
        :data="crud.data"
        size="mini"
        style="width: 100%;"
        @selection-change="crud.selectionChangeHandler"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column
          prop="request_name"
          label="请求名字"
          :min-width="flexWidth('request_name',crud.data,'请求名字')"
        />
        <el-table-column
          prop="request_param"
          label="生成任务的请求参数"
          :min-width="flexWidth('request_param',crud.data,'生成任务的请求参数')"
        />
        <el-table-column
          prop="response_param"
          label="下发任务的请求参数"
          :min-width="flexWidth('response_param',crud.data,'下发任务的请求参数')"
        />
        <el-table-column
          prop="acs_trace_id"
          label="链路标识"
          :min-width="flexWidth('acs_trace_id',crud.data,'链路标识')"
        />
        <el-table-column
          prop="request_desc"
          label="请求描述"
          :min-width="flexWidth('request_desc',crud.data,'请求描述')"
        />
        <el-table-column
          prop="request_type"
          label="请求类型"
          :min-width="flexWidth('request_type',crud.data,'请求类型')"
        />
        <el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
        <el-table-column
          prop="is_finish"
          label="是否处理完成"
          :min-width="flexWidth('is_finish',crud.data,'是否处理完成')"
        />
        <el-table-column
          prop="workshop_code"
          label="车间编码"
          :min-width="flexWidth('workshop_code',crud.data,'车间编码')"
        />
        <el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
        <el-table-column
          prop="create_time"
          label="创建时间"
          :min-width="flexWidth('create_time',crud.data,'创建时间')"
        />
        <el-table-column prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
        <el-table-column
          prop="update_time"
          label="修改时间"
          :min-width="flexWidth('update_time',crud.data,'修改时间')"
        />
        <el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudSchBaseAcsandlmsinteractivelog from './schBaseAcsandlmsinteractivelog'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = {
  log_id: null,
  request_name: null,
  request_param: null,
  response_param: null,
  acs_trace_id: null,
  request_desc: null,
  request_type: null,
  remark: null,
  is_finish: null,
  workshop_code: null,
  create_id: null,
  create_name: null,
  create_time: null,
  update_id: null,
  update_name: null,
  update_time: null
}
export default {
  name: 'InteractiveLog',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({
      title: 'ACS和LMS交互日志表',
      url: 'api/schBaseAcsandlmsinteractivelog',
      idField: 'log_id',
      sort: 'log_id,desc',
      crudMethod: { ...crudSchBaseAcsandlmsinteractivelog }
    })
  },
  data() {
    return {
      permission: {},
      rules: {}
    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
