<template>
  <div class="app-container">
      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
        <el-form-item prop="phonenumber">
          <el-input
            v-model="queryParams.povertyAreaName"
            placeholder="请输入类别名称"
            clearable
            size="small"
            style="width: 240px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item prop="status">
          <el-select
            v-model="queryParams.status"
            placeholder="状态"
            clearable
            size="small"
            style="width: 240px"
          >
            <el-option
              v-for="dict in statusOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            />
          </el-select>
        </el-form-item> -->
       <!-- <el-form-item>
          <el-date-picker
            v-model="queryParams.dateRange"
            size="small"
            placeholder="时间"
            style="width: 240px"
            value-format="yyyy-MM-dd"
            type="date"
          ></el-date-picker>
        </el-form-item> -->
        <el-form-item>
          <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            icon="el-icon-plus"
            size="mini"
            @click="handleAdd"
            v-hasPermi="['system:user:add']"
          >新增方案</el-button>
        </el-col>
        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
      </el-row>
      <el-table v-loading="loading" :data="list">
        <el-table-column label="序号" type="index" width="50" align="center" />
        <el-table-column label="产品类别" align="center" prop="typeName" />
        <el-table-column label="类别说明" align="center" prop="desc" :show-overflow-tooltip="true" />
        <el-table-column label="修改时间" align="center" prop="time" width="160">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.time) }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          width="280"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-view"
            >查看</el-button>
            <el-button
              size="mini"
              type="success"
              icon="el-icon-edit"
            >编辑</el-button>
            <el-button
              size="mini"
              type="danger"
              icon="el-icon-delete"
            >删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />

      <add-mobiel
      			v-if="modal.visibleModal"
      			:title="modal.title"
      			:action="modal.action"
      			:visible="modal.visibleModal"
      			:selectRow="modal.selectRow"
      			@closeModal="closeModal">
      		</add-mobiel>
  </div>
</template>
56757
<script>
import { listProductType } from "@/api/baseManage/productType";
import addMobiel from './modal/addMobiel'
export default {
  name: "productType",
  components: {
    addMobiel
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 表格数据
      list: null,
      // 状态数据字典
      statusOptions: [],
      // 表单参数
      form: {},
      //弹出层
      modal:{
        action:'',
        title:'',
        visibleModal:false,
        selectRow:null
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        phonenumber: undefined,
        status: undefined,
        deptId: undefined
      }
    };
  },
  created() {
    // this.getDicts("sys_normal_disable").then(response => {
    //   this.statusOptions = response.data;
    // });
    this.getList();
  },
  methods: {
    /** 查询产婆类别列表 */
    getList() {
      this.loading = false;
      this.list = [
        {
          id:"1",
          typeName:'test1',
          desc:'说明说明',
          time:'2015.10.11',
        },
        {
          id:"2",
          typeName:'test1',
          desc:'说明说明',
          time:'2015.10.11',
        },
        {
          id:"3",
          typeName:'test1',
          desc:'说明说明',
          time:'2015.10.11',
        },
        {
          id:"3",
          typeName:'test1',
          desc:'说明说明',
          time:'2015.10.11',
        }
      ]
      // listProductType(this.queryParams).then(response => {
      //     this.userList = response.rows;
      //     this.total = response.total;
      //     this.loading = false;
      //   }
      // );
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        userId: undefined,
        deptId: undefined,
        userName: undefined,
        nickName: undefined,
        password: undefined,
        phonenumber: undefined,
        email: undefined,
        sex: undefined,
        status: "0",
        remark: undefined,
        postIds: [],
        roleIds: []
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
        this.modal.visibleModal = true
        this.modal.title = '新建方案'
        this.modal.action = 'add'
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const userIds = row.userId || this.ids;
      this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delUser(userIds);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(function() {});
    },
    //窗口关闭
    closeModal(flag = false){
      this.modal.visibleModal = false
      flag && this.getList()
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/user/export', {
        ...this.queryParams
      }, `user_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
