linwe
2023-12-04 d852b992bf21ffeb91a5c2f4984f0cbecc042bc4
src/views/article/article.vue
@@ -92,6 +92,14 @@
    getNoticePd,
    upcommentPd
  } from "@/api/discuss/publicDiscuss";
  import website from '@/config/website';
  import {
    getDistrictTree
  } from "@/api/district/index";
  import {
    mapGetters
  } from "vuex";
@@ -182,6 +190,20 @@
                message: "请输入资讯类型",
                trigger: "blur",
              }, ],
            }, {
              label: "资讯范围",
              prop: "articleList",
              span: 12,
              minRows: 2,
              type: "cascader",
              multiple: true,
              tags: true,
              dicData: [],
              props: {
                label: "name",
                value: 'id'
              },
              hide: true,
            },
            {
              label: "资讯类型",
@@ -527,6 +549,7 @@
            // },
          ]
        },
        districtTree: [],
      };
    },
    watch: {
@@ -616,6 +639,16 @@
          row.videoUrl = "";
        }
        row.userid = this.userInfo.user_id;
        row.articleRange = JSON.stringify(row.articleList)
        if (row.url.length > 0) {
          var urls = []
          var split = row.url.split(",");
          split.forEach(url => {
            var names = url.split("jczz/");
            urls.push(names[1])
          })
          row.url = urls.join(",")
        }
        add(row).then(
          () => {
            this.onLoad(this.page);
@@ -632,6 +665,17 @@
        );
      },
      rowUpdate(row, index, done, loading) {
        row.articleRange = JSON.stringify(row.articleList)
        if (row.url.length > 0) {
          var urls = []
          var split = row.url.split(",");
          split.forEach(url => {
            var names = url.split("jczz/");
            urls.push(names[1])
          })
          row.url = urls.join(",")
        }
        update(row).then(
          () => {
            this.onLoad(this.page);
@@ -706,7 +750,18 @@
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getNotice(this.form.id).then((res) => {
            this.form = res.data.data;
            let data = res.data.data
            // data.forEach(item=>{
              if(data.url.length>0){
                var urls = []
                var names = data.url.split(",");
                names.forEach(name=>{
                  urls.push(website.minioUrl + name)
                })
                data.url = urls.join(",")
              }
            // })
            this.form = data;
          });
        }
        // con
@@ -742,9 +797,26 @@
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.data.forEach(item => {
            if (item.url.length > 0) {
              var urls = []
              var names = item.url.split(",");
              names.forEach(name => {
                urls.push(website.minioUrl + name)
              })
              item.url = urls.join(",")
            }
          })
          this.loading = false;
          this.selectionClear();
        });
        getDistrictTree(params = {}).then((res) => {
          const data = res.data.data;
          this.districtTree = data;
          const column = this.findObject(this.option.column, "articleList");
          column.dicData = res.data.data;
          this.loading = false;
        });
      },
      updateFb(row) {
        if (row.publish == "0") {