{
  template: '${tmpl}',
    data: function() {
      return {
        multipleSelection: [],
        isSingleSelect: false,
      }
    },
  mounted: function() {

  },
  created: function() {
  },
  methods: {
    onColFormater(row, column, cellvalue, index){
      if (column.property == "created_at") {
        var date = new Date(row["created_at"]);
        var time = date.toLocaleDateString();
        return time;
      }
      return cellvalue;
    },
    handleSelectionChange: function(val) {
      this.multipleSelection = val;
      console.log(val);
    },
    btnvisbleMethod(row, btn){
      if (btn.key == "mydetail" || btn.key == "wts" || btn.key == "yyzz" || btn.key == "ty" || btn.key == "sfz") {
        if (row.sveItemType == "ip" && (row.sveItemCode == "zzsbzc" || row.sveItemCode == "dlrfzzc" || row.sveItemCode == "dbsbzc")) {
          if(btn.key == "sfz" && row.customerinfo && row.customerinfo.customerType=="ent"){
            return false;
          }else{
            return true;
          }
        } else {
          return false;
        }
      }
      if (btn.key == "cancelaudit") {
        if (row.orderStatus == '5' && row.orderFlowStatus == '3') {
          return true;
        } else {
          return false;
        }
      }
    },
    toolbarclick(key, b, selectedRows){
      if (key == "flowaudit") {
        if (!selectedRows) {
          this.$message({
            type: 'warning',
            message: '请至少选择一行数据!'
          });
          return;
        }
        var tmpFilter = selectedRows.findIndex(f => f.orderStatus != "3");
        if (tmpFilter > -1) {
          this.$message({
            type: 'warning',
            message: '不能审核订单状态不是【待审核】的订单'
          });
          return;
        }
        var otherOrderFilter = selectedRows.findIndex(f => f.sveItemCode != "dlrfzzc" && f.sveItemCode != "zzsbzc" && f.sveItemCode != "dbsbzc");
        console.log(otherOrderFilter,"otherOrderFilter.........................");
        if (otherOrderFilter > -1) {
          this.$message({
            type: 'warning',
            message: '目前只能对服务项目含有【商标注册】的订单进行审核'
          });
          return;
        }
        if (selectedRows && selectedRows.length > 0) {
          this.$confirm('该订单的交官材料是否准确无误？', '提示', {
            confirmButtonText: '材料通过审核',
            cancelButtonText: '材料不通过',
            cancelButtonClass:'el-button--primary',
            type: 'warning',
            showCancelButton: true,
            showClose: true,
            closeOnClickModal: false,
            distinguishCancelAndClose: true,
            center: true
          }).then(() => {
            this.$root.postReq("/web/orderCtl/blukupdate", { "selectedRows": selectedRows, "value": "同意", "type": 1 }).then(d => {
              if (d.status == 0) {
                this.$message({
                  type: 'success',
                  message: '审核通过完成'
                });
              } else {
                this.$message({
                  type: 'false',
                  message: d.msg
                });
              }
              this.$refs.grid.fetchData();
            });
          }).catch(action => {
            console.log(action);
            if (action == "close") {

            } else {
              this.$prompt('请输入不通过理由', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                center: true,
                inputPattern: /\S/,
                inputErrorMessage: '不通过理由不能为空'
              }).then(({ value }) => {
                this.$root.postReq("/web/orderCtl/blukupdate", { "selectedRows": selectedRows, "value": value, "type": 0 }).then(d => {
                  if (d.status == 0) {
                    this.$message({
                      type: 'success',
                      message: '否决成功'
                    });
                  } else {
                    this.$message({
                      type: 'false',
                      message: d.msg
                    });
                  }
                  this.$refs.grid.fetchData();
                });
              }).catch(() => {

              });
            }

          });
        }
      }
    },
    onRowClick(row, key, e){
      if (key == "cancelaudit") {
        if (row.orderStatus != '5') {
          this.$message.warning("该订单状态为" + row.orderStatusName + ",不能执行撤销操作");
          return;
        }
        if (row.orderFlowStatus != '3') {
          this.$message.warning("该订单流程状态为" + row.orderFlowStatusName + ",不能执行撤销操作");
          return;
        }
        this.$confirm('此操作将撤销审核, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$root.postReq("/web/orderCtl/cancelAudit", { code: row.code }).then(d => {
            if (d && d.code == 1) {
              this.$message.success("撤销成功");
              this.$refs.grid.fetchData();
            } else {
              this.$message.warning("操作失败");
            }
          }).catch(e => {
            console.log(e);
            this.$message.warning("操作失败");
          })
        }).catch((e) => {
          console.log(e);
        });
      }
      if (key == "mydetail") {
        if (row.sveItemType == "ip" && (row.sveItemCode == "zzsbzc" || row.sveItemCode == "dlrfzzc" || row.sveItemCode == "dbsbzc")) {
          this.$root.pushx({
            title: "订单详情",
            name: "/tmOrderDetail",
            params: {
              orderNum: row.code
            }
          });
        }
      }
      if (key == "wts") {
        this.$root.postReq("/web/tmstuffCtl/findOne", { code: row.code, stuffType: 'gzwts' }).then(d => {
          if (d.status == 0) {
            if (d.data.stuffUrl) {
              window.open(d.data.stuffUrl)
            }
            else {
              this.$message({
                type: 'false',
                message: '暂无该文件'
              });
            }
          }
          else {
            this.$message({
              type: 'false',
              message: '操作失败'
            });
          }
        });
      }
      if (key == "ty") {
        this.$root.postReq("/web/tmstuffCtl/findOne", { code: row.code, stuffType: 'ty' }).then(d => {
          if (d.status == 0) {
            if (d.data.stuffUrl) {
              window.open(d.data.stuffUrl)
            }
            else {
              this.$message({
                type: 'false',
                message: '暂无该文件'
              });
            }
          }
          else {
            this.$message({
              type: 'false',
              message: '操作失败'
            });
          }
        });
      }
      if (key == "yyzz") {
        this.$root.postReq("/web/customerinfoCtl/findOne", { id: row.customerinfo_id }).then(d => {
          if (d.status == 0) {
            if (d.data.businessLicensePic) {
              window.open(d.data.businessLicensePic)
            }
            else {
              this.$message({
                type: 'false',
                message: '暂无该文件'
              });
            }
          }
          else {
            this.$message({
              type: 'false',
              message: '操作失败'
            });
          }
        });
      }
      if (key == "sfz") {
        this.$root.postReq("/web/customerinfoCtl/findOne", { id: row.customerinfo_id }).then(d => {
          if (d.status == 0) {
            if (d.data.identityCardPic) {
              window.open(d.data.identityCardPic)
            }
            else {
              this.$message({
                type: 'false',
                message: '暂无该文件'
              });
            }
          }
          else {
            this.$message({
              type: 'false',
              message: '操作失败'
            });
          }

        });
      }
    }

  },
  computed: Vuex.mapState({
    count: state => state.count,
    headStyle: function () {
      return { "background-color": "white" };
    }
  }),
    vname: "gsb_order"
}
