1
dengjunjie
2025-03-18 9f225bb1f1e26d25c1652d3e1ec2a8f239f69615
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSClient/src/extension/basic/locationInfo.js
@@ -1,11 +1,11 @@
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
import gridBody from './extend/LocationStatus.vue'
let extension = {
  components: {
    //查询界面扩展组件
    gridHeader: '',
    gridBody: '',
    gridBody: gridBody,
    gridFooter: '',
    //新建、编辑弹出框扩展组件
    modelHeader: '',
@@ -17,34 +17,143 @@
  methods: {
    //下面这些方法可以保留也可以删除
    onInit() {
      //第二个按钮后面添加按钮组
      // this.buttons.splice(2, 1, {
      //   name: '禁用状态',
      //   type: 'primary',
      //   value:"",
      //   plain: true,
      //   data: [
      //     {
      //       name: '正常',
      //       icon: 'el-icon-plus',
      //       onClick: () => {
      //         this.$message.info('正常');
      //       }
      //     },
      //     {
      //       name: '只入',
      //       icon: 'el-icon-zoom-out',
      //       onClick: () => {
      //         this.$message.info('只入');
      //       }
      //     }
      //   ]
      // });
      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: () => {
              // this.$message.info('正常');
              // params.Remark = "正常";
              params.Extra = 0
              // this.$message.info(params.Remark);
              this.enableStatus(params, "正常")
            }
          },
          {
            name: '只入',
            icon: 'el-icon-circle-plus-outline',
            onClick: () => {
              // let params = {
              //   MethodName: "LocationDisableStatus",
              //   Remark: "禁用",
              // }
              // this.enableStatus(params)
              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, "禁用")
            }
          }
        ]
      }
      let enableBtn = this.buttons.find(x => x.value == 'Enable');
      if (enableBtn) {
        enableBtn.onClick = function () {
          this.$message.success('自定义按钮点击事件');
          // let params = {
          //   MethodName: "LocationEnableStatus",
          //   Remark: "启用",
          //   keys: null
          // }
          // this.enableStatus(params)
        }
      }
      let disableBtn = this.buttons.find(x => x.value == 'Disable');
      if (disableBtn) {
        disableBtn.onClick = function () {
          this.$message.success('自定义按钮点击事件');
          // let params = {
          //   MethodName: "LocationDisableStatus",
          //   Remark: "禁用",
          //   keys: null
          // }
          // this.enableStatus(params)
        }
      }
      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.$message.success('自定义按钮点击事件');
      //     this.$refs.gridBody.open(row);
      //   }
      // });
    },
    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 + "?", "提示", {
        // iconClass:"el-icon-success",//el-icon-remove自定义图标样式
        confirmButtonText: "确认",//确认按钮文字更换
        cancelButtonText: "取消",//取消按钮文字更换
        // cancelBtn:"取消",//取消按钮文字更换
        showClose: true,//是否显示右上角关闭按钮
        type: "warning",//提示类型 success:成功/info:信息/warning:警告/error:报错
      }).then(() => {
        this.http.post("api/LocationInfo/UpdateEnableStatus", params, "正在设置货位....").then(x => {
          if (!x.status) return this.$error(x.message);
          this.$success("货位【禁用状态】设置为" + Remark + "成功!");
          this.refresh();
        });
      })
    },
    onInited() {
      //框架初始化配置后