xiazhengtongxue
2026-01-25 a7bd6e538027d876b3122f21c3b1d34663fb2f07
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSClient/src/extension/basic/locationInfo.js
@@ -1,28 +1,31 @@
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
import gridBody from './extend/GetLocationStatus.vue'
import gridBody from "./extend/GetLocationStatus.vue";
import { h } from "vue";
import RoadwaySelector from "../../components/basic/RoadwaySelector.vue";
let extension = {
  components: {
    //查询界面扩展组件
    gridHeader: '',
    gridHeader: "",
    gridBody: gridBody,
    gridFooter: '',
    gridFooter: "",
    //新建、编辑弹出框扩展组件
    modelHeader: '',
    modelBody: '',
    modelFooter: ''
    modelHeader: "",
    modelBody: "",
    modelFooter: "",
  },
  tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
  tableAction: "", //指定某张表的权限(这里填写表名,默认不用填写)
  buttons: { view: [], box: [], detail: [] }, //扩展的按钮
  methods: {
    //下面这些方法可以保留也可以删除
    onInit() {
      let EnableBtn = this.buttons.find(x => x.value == 'Enable');
      let EnableBtn = this.buttons.find((x) => x.value == "Enable");
      if (EnableBtn) {
        EnableBtn.onClick = function () {
          let rows = this.$refs.table.getSelected();
          if (rows.length == 0) return this.$error("请选择数据!");
          var keys = rows.map(x => { return x.id });
          var keys = rows.map((x) => {
            return x.id;
          });
          this.http
            .post("api/LocationInfo/LocationEnableStatus", keys, "数据处理中")
            .then((x) => {
@@ -30,14 +33,16 @@
              this.$message.success("操作成功");
              this.refresh();
            });
        }
        };
      }
      let DisableBtn = this.buttons.find(x => x.value == 'Disable');
      let DisableBtn = this.buttons.find((x) => x.value == "Disable");
      if (DisableBtn) {
        DisableBtn.onClick = function () {
          let rows = this.$refs.table.getSelected();
          if (rows.length == 0) return this.$error("请选择数据!");
          var keys = rows.map(x => { return x.id });
          var keys = rows.map((x) => {
            return x.id;
          });
          this.http
            .post("api/LocationInfo/LocationDisableStatus", keys, "数据处理中")
            .then((x) => {
@@ -45,36 +50,57 @@
              this.$message.success("操作成功");
              this.refresh();
            });
        }
        };
      }
      let EnableRoadwayBtn = this.buttons.find(
let EnableRoadwayBtn = this.buttons.find(
        (x) => x.value == "EnableRoadway",
      );
      if (EnableRoadwayBtn) {
        EnableRoadwayBtn.onClick = function () {
          this.$prompt("请选择巷道 (1-5)", "提示", {
          this.$msgbox({
            title: "请选择巷道", // åˆ é™¤"提示"两个字
            message: `
        <div>
          <select id="roadwaySelect" style="width: 400px; height: 30px;">
            <option value="1">巷道 1</option>
            <option value="2">巷道 2</option>
            <option value="3">巷道 3</option>
            <option value="4">巷道 4</option>
            <option value="5">巷道 5</option>
          </select>
        </div>
      `,
            showCancelButton: true,
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            inputPattern: /^[1-5]$/,
            inputErrorMessage: "请输入1-5之间的数字",
          })
            .then(({ value }) => {
              this.http
                .post(
                  `api/LocationInfo/EnableAllLocationsInRoadway?roadwayNo=${value}`,
                  null,
                  "数据处理中",
                )
                .then((x) => {
                  console.log(x);
                  if (!x.status) return this.$message.error(x.message);
                  this.$message.success(x.message || "操作成功");
                  this.refresh();
                });
            })
            .catch(() => {
              this.$message.info("已取消操作");
            });
            dangerouslyUseHTMLString: true,
            beforeClose: (action, instance, done) => {
              if (action === "confirm") {
                const select = document.getElementById("roadwaySelect");
                const value = select ? select.value : "1";
                this.http
                  .post(
                    `api/LocationInfo/EnableAllLocationsInRoadway?roadwayNo=${value}`,
                    null,
                    "数据处理中",
                  )
                  .then((x) => {
                    console.log(x);
                    if (!x.status) return this.$message.error(x.message);
                    this.$message.success(x.message || "操作成功");
                    this.refresh();
                    done();
                  })
                  .catch(() => {
                    done();
                  });
              } else {
                this.$message.info("已取消操作");
                done();
              }
            },
          });
        };
      }
@@ -83,45 +109,66 @@
      );
      if (DisableRoadwayBtn) {
        DisableRoadwayBtn.onClick = function () {
          this.$prompt("请选择巷道 (1-5)", "提示", {
          this.$msgbox({
            title: "请选择巷道", // åˆ é™¤"提示"两个字
            message: `
        <div>
          <select id="roadwaySelect" style="width: 400px; height: 30px;">
            <option value="1">巷道 1</option>
            <option value="2">巷道 2</option>
            <option value="3">巷道 3</option>
            <option value="4">巷道 4</option>
            <option value="5">巷道 5</option>
          </select>
        </div>
      `,
            showCancelButton: true,
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            inputPattern: /^[1-5]$/,
            inputErrorMessage: "请输入1-5之间的数字",
          })
            .then(({ value }) => {
              this.http
                .post(
                  `api/LocationInfo/DisableAllLocationsInRoadway?roadwayNo=${value}`,
                  null,
                  "数据处理中",
                )
                .then((x) => {
                  if (!x.status) return this.$message.error(x.message);
                  this.$message.success(x.message || "操作成功");
                  this.refresh();
                });
            })
            .catch(() => {
              this.$message.info("已取消操作");
            });
            dangerouslyUseHTMLString: true,
            beforeClose: (action, instance, done) => {
              if (action === "confirm") {
                const select = document.getElementById("roadwaySelect");
                const value = select ? select.value : "1";
                this.http
                  .post(
                    `api/LocationInfo/DisableAllLocationsInRoadway?roadwayNo=${value}`,
                    null,
                    "数据处理中",
                  )
                  .then((x) => {
                    if (!x.status) return this.$message.error(x.message);
                    this.$message.success(x.message || "操作成功");
                    this.refresh();
                    done();
                  })
                  .catch(() => {
                    done();
                  });
              } else {
                this.$message.info("已取消操作");
                done();
              }
            },
          });
        };
      }
      this.columns.push({
        field: '操作',
        title: '操作',
        width: 90,
        fixed: 'right',
        align: 'center',
        formatter: (row) => {
          return (
            '<i style="cursor: pointer;color: #2d8cf0;"class="el-icon-view">查看明细</i>'
          );
        },
        click: (row) => {
          this.$refs.gridBody.open(row);
        }
      });
      // this.columns.push({
      //   field: '操作',
      //   title: '操作',
      //   width: 90,
      //   fixed: 'right',
      //   align: 'center',
      //   formatter: (row) => {
      //     return (
      //       '<i style="cursor: pointer;color: #2d8cf0;"class="el-icon-view">查看明细</i>'
      //     );
      //   },
      //   click: (row) => {
      //     this.$refs.gridBody.open(row);
      //   }
      // });
    },
    onInited() {
      //框架初始化配置后
@@ -156,7 +203,7 @@
      //(3)this.editFormFields.字段='xxx';
      //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
      //看不懂就把输出看:console.log(this.editFormOptions)
    }
  }
    },
  },
};
export default extension;