index.js 2.96 KB
import {
  allDictData, // 获取全部字典
} from "@/api/destinationFlight";
export default {
  computed: {
    // 获取路由参数
    getRouter() {
      if (this.$route.query.dataStatus == "view") {
        return true;
      } else if (this.$route.query.dataStatus == "edit") {
        return false;
      } else {
        return false;
      }
    },
  },
  methods: {
    // 获取所有数据字典
    getAllDictData() {
      allDictData()
        .then((res) => {
          if (res.code != 200) {
            this.msgError(res.msg);
            return;
          }
          // 给checkBox表单赋值做展示信息
          const { data } = res;
          this.cargoType = data.cargoType; // 申报类别
          this.cargoStatus = data.cargoStatus; // 货物类型
          this.puporpux = data.puporpux; // 取件扫描号
          this.serviceCode = data.serviceCode; // Service Code
          this.handlingCode = data.handlingCode; // Handling Code
          this.subCategory = data.subCategory; // Sub Category
        })
        .catch(() => {});
    },
    // 判断对象是否存在某个属性,并且把这个属性值使用分号分隔
    hasOwnProperty(item, key) {
      if (item.hasOwnProperty(key)) {
        if (item[key]) {
          item[key] = item[key].split(";");
        } else {
          item[key] = [];
        }
      }
    },
    // 设置属性值
    setattrVal(item) {
      if (item.location) {
        // 始发站
        item.isLocation = "1";
      }
      if (item.notLocation) {
        item.isLocation = "2";
      }
      if (item.location == null && item.notLocation == null) {
        item.isLocation = "1";
      }
      if (item.destinationSite) {
        // 目的站
        item.isDestinationSite = "1";
      }
      if (item.notDestinationSite) {
        item.isDestinationSite = "2";
      }
      if (item.destinationSite == null && item.notDestinationSite == null) {
        item.isDestinationSite = "1";
      }
    },
    // 失焦事件
    blurEvent({ originOfFlightNo }) {
      this.queryForm.originOfFlightNo = this.upCase(originOfFlightNo);
    },
    // 当前激活面板改变时触发
    collapseChange(name) {
      // console.log(name);
    },
    // 始发站
    changeLocation(val) {
      console.log("始发站:", val);
    },
    // 目的站
    changeDestinationSite(val) {
      console.log("目的站:", val);
    },
    // 申报类别
    changeCargoType(arr) {
      console.log("申报类别:", arr);
    },
    // 货物类型
    changeCargoStatus(arr) {
      console.log("货物类型:", arr);
    },
    // 取件扫描号
    changePuporpux(arr) {
      console.log("取件扫描号:", arr);
    },
    // Service Code
    changeServiceCode(arr) {
      console.log("Service Code:", arr);
    },
    // Handling Code
    changeHandlingCode(arr) {
      console.log("Handling Code:", arr);
    },
    // Sub Category
    changeSubCategory(arr) {
      console.log("Sub Category:", arr);
    },
  },
};