import lodash from 'lodash'

const prompt = {
  data() {
    return {
      expands: [],
      queryParams: {
        current: 1,
        size: 10
      },
      total: 0,
      open: false,
      loading: false,
      detailList: {},
      companyList: [],
      dialogFormVisible: false,
      title: '',
      dialogType: ''
    }
  },
  methods: {
    resetClick(queryParams) {
      this.queryParams.current = 1
      this.$refs[queryParams].resetFields()
      this.getList()
    },
    searchClick() {
      this.queryParams.current = 1
      this.getList()
    },
   	handleDetail(row) {
      this.detailList = row
      this.open = true
    },
    addClick() {
      this.title = '新增'
      this.dialogType = 'add'
      this.dialogFormVisible = true
    },
    editClick(row) {
      this.ruleForm = lodash.clone(row)
      this.title = '修改'
      this.dialogType = 'update'
      this.dialogFormVisible = true
    },
    resetForm(ruleForm) {
      this.reset()
      this.$refs[ruleForm].resetFields()
      this.dialogFormVisible = false
    },
    // 每页显示多少条
    handleSizeChange(val) {
      this.queryParams.size = val
      this.getList()
    },
    // 点击当前页
    handleCurrentChange(val) {
      //			Object.keys(this.queryParams).forEach(key => {
      //				if (this.queryParams[key] == 10 || this.queryParams[key] == 20 || this.queryParams[key] == 50 || this.queryParams[key] == 100 || this.queryParams[key] == 200) {
      //
      //				}else {
      //					this.queryParams[key] = ''
      //				}
      //			});
      this.queryParams.current = val
      this.getList()
    }
  }
}

export default prompt
