{
  template: '${tmpl}',
  data: function () {
    return {
      multipleSelection: [],
      isSingleSelect: false,
      dialogVisible: false,
      auditIds:[],
    }
  },
  mounted: function () {},
  created: function () {},
  methods: {
    onColFormater(row, column, cellvalue, index) {
      var self = this;
      if (column.property == "isEnabled") {
        if (row["isEnabled"]) {
          return "正常";
        } else {
          return "停用";
        }
      }

      if(typeof(cellvalue) == 'number') {
        return cellvalue || 0;
      }
      return cellvalue || "---";
    },
    handleSelectionChange: function (val) {
      this.multipleSelection = val;
      console.log(val);
    },
    fetchData: function () {

    },
    toolbarclick(key, title, items){
      console.log(key, title, items, "-------------------------------- ");
      if(key == 'audit') {
        if(!items || items.length == 0) {
          this.$message({
            type: 'warning',
            message: '请勾选合伙人'
          });
          return;
        }
        this.auditIds = [];
        for(var item of items) {
          this.auditIds.push(item.id);
        }
        console.log(this.auditIds);
        this.dialogVisible = true;
      }
    },
    onRowClick(row, key, e) {
      console.log("................////////////////////////////");
      var self = this;
      if (key == "stop") {
        this.modelName = "epartneraudit";
        var url = this.getUrl("update");
        row.isEnabled = !row.isEnabled;
        this.$root.postReq(url, row).then(rd => {
          console.log("................////////////////////////////");
          if (rd.status == 0) {
            self.$refs.epartnertoauditGrid.fetchData();
          }
        });
      }
      console.log(key);

      if(key == 'cancel') {
        window.history.back(-1);
      }

      if (key == "audit") {
        if (row.auditStatus != '0') {
          self.$message.warning(`该申请已审核完成, 不可重复审核`);
          return false;
        }
        this.auditIds = [row.id];
        this.dialogVisible = true;
        return;
      }
      console.log($(e.target).text());
    },
    reject() {
      var self = this;
      this.$confirm('合伙人审核驳回后不可撤回，请确定。', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$root.postReq("/web/epartnerCtl/reject", {
          ids: self.auditIds,
        }).then(function (d) {
          self.dialogVisible = false;
          if (d.status == 0) {
            self.$message.success(`审核成功`);
            self.$refs.epartnertoauditGrid.fetchData();
          } else {
            self.$message.warning(d.msg || `审核失败，请刷新页面后重新操作`);
          }
        });
      });
    },
    pass() {
      var self = this;
      this.$confirm('合伙人审核通过后不可撤回，请确定。', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$root.postReq("/web/epartnerCtl/pass", {
          ids: self.auditIds,
        }).then(function (d) {
          self.dialogVisible = false;
          if (d.status == 0) {
            self.$message.success(`审核成功`);
            self.$refs.epartnertoauditGrid.fetchData();
          } else {
            self.$message.warning(d.msg || `审核失败，请刷新页面后重新操作`);
          }
        });
      });
    },
    formateTime(inputTime) {
      if(!inputTime) {
        return "";
      }
      var date = new Date(inputTime);
      var y = date.getFullYear();
      var m = date.getMonth() + 1;
      m = m < 10 ? ('0' + m) : m;
      var d = date.getDate();
      d = d < 10 ? ('0' + d) : d;
      var h = date.getHours();
      h = h < 10 ? ('0' + h) : h;
      var minute = date.getMinutes();
      minute = minute < 10 ? ('0' + minute) : minute;
      return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
    },
  },
  computed: Vuex.mapState({
    count: state => state.count,
    headStyle: function () {
      return {
        "background-color": "white"
      };
    }
  }),
  vname: "gsb-epartneraudit"
}