<template>
  <ele-modal
    :before-close="cancel"
    :close-on-click-modal="false"
    :maxable="true"
    title="首件两检项请托"
    :visible.sync="visible"
    v-if="visible"
    append-to-body
    custom-class="ele-dialog-form"
    width="60vw"
  >
    <el-form
      ref="form"
      :model="form"
      :rules="rules"
      label-position="right"
      label-width="110px"
    >
      <headerTitle style="margin-top: 15px" title="请托信息" />
      <el-row :gutter="10" class="basic">
        <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
          <el-form-item label="请托单号：">
            <el-input v-model="form.order" disabled></el-input>
          </el-form-item>
        </el-col>

        <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
          <el-form-item label="请托名称：">
            <el-input v-model="form.order" disabled></el-input>
          </el-form-item>
        </el-col>

        <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
          <el-form-item label="执行部门：">
            <el-input v-model="form.order" disabled></el-input>
          </el-form-item>
        </el-col>

        <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
          <el-form-item label="执行人员：">
            <el-input v-model="form.order" disabled></el-input>
          </el-form-item>
        </el-col>

        <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
          <el-form-item label="要求完成日期：">
            <el-input v-model="form.order" disabled></el-input>
          </el-form-item>
        </el-col>

        <el-col :lg="8" :md="12" :sm="12" :xl="8" :xs="12">
          <el-form-item label="紧急程度：">
            <el-input v-model="form.order" disabled></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <headerTitle style="margin-top: 15px" title="检查项信息" />
      <ele-pro-table
        ref="table"
        row-key="id"
        :columns="columns"
        :datasource="list"
        cache-key="mes-selfInspectionRequest-20251201"
        autoAmendPage
        :need-page="false"
        @refresh="getData"
        :selection.sync="selection"
      >
      </ele-pro-table>
    </el-form>

    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取 消</el-button>
      <el-button type="primary" @click="submitSelf">提交</el-button>
      <el-button type="primary" @click="saveSelf">保存</el-button>
    </span>
  </ele-modal>
</template>

<script>
  import { listOrganizations, getUserPage } from '@/api/system/organization';
  export default {
    data() {
      return {
        form: {
          order: ''
        },
        rules: {},
        visible: false,
        groupList: [],
        leaderList: [],
        list: [],
        selection: []
      };
    },

    computed: {
      columns() {
        return [
          {
            width: 45,
            type: 'selection',
            columnKey: 'selection',
            align: 'center',
            fixed: 'left',
            reserveSelection: true
          },
          {
            width: 50,
            type: 'index',
            columnKey: 'index',
            label: '序号',
            align: 'center'
          },
          {
            prop: 'preType',
            slot: 'preType',
            align: 'center',
            label: '工艺参数'
          },
          {
            prop: 'preType',
            slot: 'preType',
            align: 'center',
            label: '是否请托'
          },
          {
            prop: 'preType',
            slot: 'preType',
            align: 'center',
            label: '状态'
          }
        ];
      }
    },

    methods: {
      open() {
        this.visible = true;
        this.getGs();
      },

      cancel() {
        this.visible = false;
      },

      async getGs() {
        await listOrganizations().then((list) => {
          this.groupList = this.$util.toTreeData({
            data: list,
            idField: 'id',
            parentIdField: 'parentId'
          });
        });
      },

      async getUserPage() {
        // if (!this.form.executeGroupId) return (this.leaderList = []);
        // let par = {
        //   groupId: this.form.executeGroupId,
        //   size: 999
        // };
        let par = {};
        await getUserPage(par).then((res) => {
          this.leaderList = res.list;
        });
      },

      getData() {},

      submitSelf() {},

      saveSelf() {}
    }
  };
</script>

<style></style>
