保安服务单位许可和备案申请系统
liuyg
2022-02-17 fa2872c51e7a8f6ff9ebb52cdf0fcb188610b3da
src/components/attach/attach.vue
@@ -85,7 +85,7 @@
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        total: 0
      },
      attachBox: false,
      selectionList: [],
@@ -110,23 +110,23 @@
          {
            label: "附件名称",
            prop: "originalname",
            overHidden: true,
            overHidden: true
          },
          {
            label: "附件状态",
            prop: "type",
            width: 110,
            slot: true,
            overHidden: true,
            overHidden: true
          },
          {
            label: "示范模板",
            prop: "downtemplate",
            width: 110,
            // overHidden: true,
            slot: true,
          },
        ],
            slot: true
          }
        ]
      },
      data: [],
      attachForm: {},
@@ -141,17 +141,18 @@
            span: 12,
            drag: true,
            propsHttp: {
              res: "data",
              res: "data"
            },
            tip: "支持上传jpg/png/doc/docx/xls/xlsx文件,图片不超过500Kb,文档不超过3Mb",
            tip:
              "支持上传jpg/png/doc/docx/xls/xlsx文件,图片不超过500Kb,文档不超过3Mb",
            action:
              // "/api/blade-resource/oss/endpoint/put-file-attach",
              "/api/blade-resource/oss/endpoint/put-file-attach?deptid=&type=" +
              type +
              "&cardid=" +
              cardid,
          },
        ],
              cardid
          }
        ]
      },
      imgSee: false,
      imgUrl: "",
@@ -159,7 +160,7 @@
      saveIds: [],
      saveLinks: [],
      onceIds: "",
      onceLinks: "",
      onceLinks: ""
    };
  },
  computed: {
@@ -169,16 +170,16 @@
        addBtn: false,
        editBtn: false,
        viewBtn: false,
        delBtn: this.vaildData(this.permission.attach_delete, false),
        delBtn: this.vaildData(this.permission.attach_delete, false)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    }
  },
  mounted() {
    // console.log(this.enclosure, "enclosure");
@@ -200,8 +201,8 @@
  },
  methods: {
    upData(val) {
      console.log(val);
      this.onceIds = +val.id - 1 + "";
      // console.log(val);
      this.onceIds = +val.id + "";
      this.attachBox = true;
    },
    dowmData(val) {
@@ -221,13 +222,15 @@
      this.attachBox = true;
    },
    uploadAfter(res, done, loading, column) {
      window.console.log(res.link);
      // window.console.log(res.link);
      var test = /^http:\/\/.*/;
      if (!test.test(res.link)) {
        this.$message.error("上传失败");
        return;
      }
      this.onceLinks = res.link;
      // console.log(res);
      // return;
      var haveit = null;
      for (let k in this.saveIds) {
        if (this.saveIds[k] == this.onceIds) {
@@ -242,21 +245,24 @@
        this.saveIds.push(this.onceIds);
        this.saveLinks.push(this.onceLinks);
      }
      console.log(this.saveIds);
      console.log(this.saveLinks);
      // console.log(this.saveIds);
      // console.log(this.saveLinks);
      //  console.log(this.$store.getters.userInfo.Id);
      var params = {
        userid: this.$store.getters.userInfo.Id,
        ptype: this.ptype,
        templateid: this.saveIds.join(","),
        links: this.saveLinks.join(","),
        links: this.saveLinks.join(",")
      };
      addUseInfor(params).then((res) => {
      // console.log(params);
      // loading();
      // return;
      addUseInfor(params).then(res => {
        // console.log(res);
        this.$message({
          type: "success",
          message: "操作成功!",
          message: "操作成功!"
        });
      });
      this.refreshChange();
@@ -270,7 +276,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
@@ -279,7 +285,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -291,7 +297,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
@@ -300,14 +306,14 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then((res) => {
        getDetail(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
@@ -345,11 +351,11 @@
      // console.log(this.$store.getters.userInfo.Id);
      // this.data = this.enclosure;
      params["ptype"] = this.ptype;
      getTemplate(params, 1, 50).then((res) => {
      getTemplate(params, 1, 50).then(res => {
        data = res.data.data.records;
        // console.log(data, "::template");
        params["userid"] = this.$store.getters.userInfo.Id;
        getUseInfor(params).then((res) => {
        getUseInfor(params).then(res => {
          var userInfo = res.data.data.records;
          // console.log(userInfo, "::userInfo");
          if (userInfo.length == 0) {
@@ -364,7 +370,7 @@
            this.saveLinks = userInfo[0].links.split(",");
            for (let k in data) {
              for (let i in this.saveIds) {
                if (+data[k].id - 1 == this.saveIds[i]) {
                if (+data[k].id == this.saveIds[i]) {
                  data[k]["type"] = 2;
                  data[k]["down"] = this.saveLinks[i];
                }
@@ -400,11 +406,11 @@
          "webp",
          "psd",
          "svg",
          "tiff",
          "tiff"
        ].indexOf(ext.toLowerCase()) == -1
      );
    },
  },
    }
  }
};
</script>