zhongrj
2024-03-29 5ce38eed96e6bb19725094d2d32ca765c5ec940e
src/views/article/article.vue
@@ -29,10 +29,8 @@
        </el-button>
      </template>
      <template slot-scope="{ row }" slot="publish">
        <el-tag>{{
                    row.publish == "1" ? "已发布" : row.publish == "0" ? "未发布" : "未发布"
                }}
      <template slot-scope="{ row, size }" slot="publish">
        <el-tag :size="size" :type="showPublish(row.publish).type" v-text="showPublish(row.publish).text">
        </el-tag>
      </template>
@@ -122,14 +120,17 @@
        datetime: "",
        selectionList: [],
        option: {
          labelWidth: 96,
          searchLabelWidth: 96,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 280,
          height: "auto",
          calcHeight: 54,
          dialogWidth: 950,
          tip: false,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 240,
          border: false,
          border: true,
          //stripe:true,
          index: true,
          viewBtn: true,
@@ -137,12 +138,14 @@
          excelBtn: true,
          dialogClickModal: false,
          column: [{
              overHidden: true,
              label: "文章标题",
              prop: "title",
              span: 24,
              row: true,
              searchSpan: 4,
              search: true,
              searchLabelWidth: 76,
              rules: [{
                required: true,
                message: "请输入文章标题",
@@ -150,10 +153,10 @@
              }, ],
            },
            {
              width: 110,
              label: "文章封面",
              prop: "url",
              // align:'center',
              width: 80,
              type: "upload",
              listType: "picture-img",
              action: "/api/blade-resource/oss/endpoint/put-file",
@@ -165,6 +168,7 @@
              span: 24,
            },
            {
              width: 100,
              label: "文章来源",
              prop: "sourceName",
              search: true,
@@ -175,14 +179,16 @@
                message: "请输入文章类型",
                trigger: "blur",
              }, ],
            }, {
            },
            {
              label: "文章范围",
              prop: "articleList",
              span: 12,
              minRows: 2,
              type: "cascader",
              type: "tree",
              multiple: true,
              tags: true,
              // search: true,
              dicData: [],
              props: {
                label: "name",
@@ -191,12 +197,13 @@
              hide: true,
            },
            {
              width: 100,
              label: "文章类型",
              prop: "articleType",
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              searchSpan: 3,
              searchSpan: 4,
              checkStrictly: true,
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=articleType",
              props: {
@@ -211,37 +218,42 @@
                trigger: "blur",
              }, ],
            },
            // {
            //   label: "发布时间",
            //   prop: "dateTime",
            //   type: "daterange",
            //   format: "yyyy-MM-dd",
            //   valueFormat: "yyyy-MM-dd",
            //   searchSpan: 6,
            //   searchRange: true,
            //   hide: true,
            //   addDisplay: false,
            //   editDisplay: false,
            //   viewDisplay: false,
            //   search: true,
            //   rules: [{
            //     required: true,
            //     message: "请选择发布时间",
            //     trigger: "blur",
            //   }, ],
            // },
            {
              label: "发布时间",
              prop: "dateTime",
              type: "datetime",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              searchSpan: 5,
              searchRange: true,
              hide: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
              search: true,
              rules: [{
                required: true,
                message: "请选择发布时间",
                trigger: "blur",
              }, ],
            },
            {
              width: 100,
              label: "发布时间",
              prop: "createTime",
              type: "date",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd HH:mm:ss",
              search: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
            },
            {
              width: 100,
              label: "发布状态",
              prop: "publish",
              searchSpan: 3,
              width: 80,
              searchSpan: 4,
              value: "0",
              slot: true,
              search: true,
@@ -262,13 +274,14 @@
              ],
            },
            {
              width: 100,
              label: "评论区",
              prop: "iscomment",
              width: 80,
              slot: true,
              type: "switch",
              activeColor: "#13ce66",
              inactiveColor: "#ccc",
              value: '1',
              dicData: [{
                  label: "关闭",
                  value: "0",
@@ -464,6 +477,22 @@
          ids.push(ele.id)
        })
        return ids.join(",")
      },
      showPublish() {
        return (data) => {
          if (data == 0) {
            return {
              text: '未发布',
              type: 'info'
            }
          } else if (data == 1) {
            return {
              text: '已发布',
              type: 'success'
            }
          }
        }
      }
    },
    methods: {
@@ -631,7 +660,6 @@
        if (["edit", "view"].includes(type)) {
          getNotice(this.form.id).then((res) => {
            let data = res.data.data
            // data.forEach(item=>{
            if (data.url.length > 0) {
              var urls = []
              var names = data.url.split(",")
@@ -640,11 +668,10 @@
              })
              data.url = urls.join(",")
            }
            // })
            data.articleList = JSON.parse(data.articleRange)
            this.form = data
          })
        }
        // con
        done()
      },
      currentChange(currentPage) {
@@ -777,8 +804,16 @@
  }
</script>
<style>
<style lang="scss" scoped>
  .avue-upload__icon {
    line-height: 6;
  }
</style>
  :deep(.avue-form__menu--center) {
    text-align: left;
  }
  :deep(.avue-form__menu--center .el-button) {
    margin: 0 5px 0 0;
  }
</style>