dengjunjie
2025-02-17 2bdad959bc30a7c24bf08ca81fb52fff63e79f52
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSClient/src/extension/basic/roadwayInfo.js
@@ -17,19 +17,125 @@
  methods: {
    //下面这些方法可以保留也可以删除
    onInit() {
      let params = {
        // MethodName: null,
        // Remark: null,
        Extra: null,
        DelKeys: null
      }
      let enableStatusBtn = this.buttons.find(x => x.value == 'enableStatus');
      if (enableStatusBtn) {
        enableStatusBtn.data = [
          {
            name: '正常',
            icon: 'el-icon-circle-check',
            onClick: () => {
              params.Extra = 0
              this.enableStatus(params, "正常")
            }
          },
          {
            name: '只入',
            icon: 'el-icon-circle-plus-outline',
            onClick: () => {
              params.Extra = 1
              this.enableStatus(params, "只入")
            }
          },
          {
            name: '只出',
            icon: 'el-icon-remove-outline',
            onClick: () => {
              // this.$message.info('只出');
              params.Extra = 2
              this.enableStatus(params, "只出")
            }
          },
          {
            name: '禁用',
            icon: 'el-icon-circle-close',
            onClick: () => {
              params.Extra = 3
              this.enableStatus(params, "禁用")
            }
          }
        ]
      }
      //设置编辑表单标签宽度
      this.boxOptions.labelWidth = 160;
      //查询表单标签宽度
      this.labelWidth = 160;
      let enableBtn = this.buttons.find(x => x.value == 'Enable');
      if (enableBtn) {
        enableBtn.onClick = function () {
          this.$message.success('自定义按钮点击事件');
          let rows = this.$refs.table.getSelected();
          if (rows.length == 0) return this.$error("请选择巷道!");
          let keys = rows.map(x => {
            return x[this.table.key];
          });
          if (!keys || keys.Length == 0) return this.$error("未获取到巷道信息!");
          this.$confirm("是否确认要启用巷道?", "提示", {
            confirmButtonText: "确认",//确认按钮文字更换
            cancelButtonText: "取消",//取消按钮文字更换
            showClose: true,//是否显示右上角关闭按钮
            type: "warning",//提示类型 success:成功/info:信息/warning:警告/error:报错
          }).then(() => {
            this.http.post("api/RoadwayInfo/RoadwayEnableStatus", keys, "正在启用巷道....").then(x => {
              if (!x.status) return this.$error(x.message);
              this.$success("启用巷道成功!");
              this.refresh();
            });
          })
        }
      }
      let disableBtn = this.buttons.find(x => x.value == 'Disable');
      if (disableBtn) {
        disableBtn.onClick = function () {
          this.$message.success('自定义按钮点击事件');
          let rows = this.$refs.table.getSelected();
          if (rows.length == 0) return this.$error("请选择巷道!");
          let keys = rows.map(x => {
            return x[this.table.key];
          });
          if (!keys || keys.Length == 0) return this.$error("未获取到巷道信息!");
          this.$confirm("是否确认要禁用巷道?", "提示", {
            confirmButtonText: "确认",//确认按钮文字更换
            cancelButtonText: "取消",//取消按钮文字更换
            showClose: true,//是否显示右上角关闭按钮
            type: "warning",//提示类型 success:成功/info:信息/warning:警告/error:报错
          }).then(() => {
            this.http.post("api/RoadwayInfo/RoadwayDisableStatus", keys, "正在禁用巷道....").then(x => {
              if (!x.status) return this.$error(x.message);
              this.$success("禁用巷道成功!");
              this.refresh();
            });
          })
        }
      }
    },
    enableStatus(params, Remark) {
      let rows = this.$refs.table.getSelected();
      if (rows.length == 0) return this.$error("请选择巷道!");
      params.DelKeys = rows.map(x => {
        return x[this.table.key];
      });
      if (!params.DelKeys || params.DelKeys.Length == 0) return this.$error("未获取到巷道信息!");
      this.$confirm("是否确认要将巷道【禁用状态】设置为" + Remark + "?", "提示", {
        confirmButtonText: "确认",//确认按钮文字更换
        cancelButtonText: "取消",//取消按钮文字更换
        showClose: true,//是否显示右上角关闭按钮
        type: "warning",//提示类型 success:成功/info:信息/warning:警告/error:报错
      }).then(() => {
        this.http.post("api/RoadwayInfo/UpdateEnableStatus", params, "正在设置巷道....").then(x => {
          if (!x.status) return this.$error(x.message);
          this.$success("巷道【禁用状态】设置为" + Remark + "成功!");
          this.refresh();
        });
      })
    },
    onInited() {
      //框架初始化配置后
      //如果要配置明细表,在此方法操作