Ver código fonte

对接公告管理(未完,因附件名称问题,暂时延后处理)

chenrui 4 anos atrás
pai
commit
b5b0139436

+ 38 - 0
src/api/notice.js

@@ -0,0 +1,38 @@
+import { axios } from '@/utils/request'
+
+//  公告 列表  有分页
+export const noticeList = (params) => {
+  const url = `/notice/queryLike/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  公告 保存
+export const noticeSave = (params) => {
+  return axios({
+    url: '/notice/save',
+    data: params,
+    method: 'post'
+  })
+}
+//  公告 删除
+export const noticeDel = (params) => {
+  const url = `/notice/delete/${params.id}`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  公告 详情
+export const noticeDetail = (params) => {
+  const url = `/notice/findById/${params.id}`
+  return axios({
+    url: url,
+    method: 'get'
+  })
+}

+ 0 - 136
src/views/setting/announcementManagement/detailModal.vue

@@ -1,136 +0,0 @@
-<template>
-  <a-modal
-    centered
-    class="announcementDetail-modal"
-    :footer="null"
-    :maskClosable="false"
-    title="公告详情"
-    v-model="isShow"
-    @cancle="isShow=false"
-    width="80%">
-    <!-- 表单 -->
-    <div>
-      <a-descriptions bordered size="small" :column="2">
-        <a-descriptions-item label="类型">UserName</a-descriptions-item>
-        <a-descriptions-item label="可见性">UserName</a-descriptions-item>
-        <a-descriptions-item label="公告标题">UserName</a-descriptions-item>
-        <a-descriptions-item label="发布时间">UserName</a-descriptions-item>
-        <a-descriptions-item label="公告内容" :span="2">
-          <!-- <div v-html=""></div> -->
-        </a-descriptions-item>
-        <a-descriptions-item label="图片" :span="2">
-          <img
-            v-for="(item,index) in fileList"
-            :key="index"
-            :src="item.url"
-            title="点击查看大图"
-            class="productPic"
-            @click="getPreview(item.url)" />
-        </a-descriptions-item>
-        <a-descriptions-item label="附件" :span="2">UserName</a-descriptions-item>
-      </a-descriptions>
-      <div class="btn-cont">
-        <a-button id="announcementDetail-back" @click="isShow = false" style="margin-left: 15px;">关闭</a-button>
-      </div>
-    </div>
-    <a-modal :visible="previewVisible" :footer="null" @cancel="previewVisible=false">
-      <img alt="example" style="width: 100%" :src="previewImage" />
-    </a-modal>
-  </a-modal>
-</template>
-
-<script>
-// import { dealerProductBrandSave } from '@/api/dealerProductBrand'
-export default {
-  name: 'AnnouncementDetailModal',
-  props: {
-    openModal: { //  弹框显示状态
-      type: Boolean,
-      default: false
-    },
-    itemSn: {
-      type: [Number, String],
-      default: ''
-    }
-  },
-  data () {
-    return {
-      isShow: this.openModal, //  是否打开弹框
-      detailsData: null, //  详情数据
-      previewVisible: false,
-      previewImage: '',
-      fileList: [
-        {
-          uid: '-1',
-          name: 'image.png',
-          status: 'done',
-          url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
-        },
-        {
-          uid: '-2',
-          name: 'image.png',
-          status: 'done',
-          url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
-        },
-        {
-          uid: '-3',
-          name: 'image.png',
-          status: 'done',
-          url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
-        }
-      ]
-    }
-  },
-  methods: {
-    //  获取详情
-    getDetail () {
-      // productSnDetail({ sn: this.itemSn }).then(res => {
-      //   if (res.status == 200) {
-      //     this.detailsData = res.data
-      //   } else {
-      //     this.detailsData = null
-      //   }
-      // })
-    },
-    // 查看大图
-    getPreview (url) {
-      this.previewImage = url
-      this.previewVisible = true
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
-    },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-      }
-    },
-    itemId (newValue, oldValue) {
-      if (this.isShow && newValue) {
-        this.getDetail()
-      }
-    }
-  }
-}
-</script>
-
-<style lang="less">
-  .announcementDetail-modal{
-    .ant-modal-body {
-    	padding: 40px 40px 24px;
-    }
-    .productPic{
-      cursor: pointer;
-      width: 100px;
-      margin-right: 10px;
-    }
-    .btn-cont {
-      text-align: center;
-      margin: 35px 0 10px;
-    }
-  }
-</style>

+ 0 - 194
src/views/setting/announcementManagement/list.vue

@@ -1,194 +0,0 @@
-<template>
-  <a-card size="small" :bordered="false" class="announcementList-wrap">
-    <!-- 搜索条件 -->
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="标题">
-              <a-input id="announcementList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入标题"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="类别">
-              <a-select
-                placeholder="请选择类别"
-                id="announcementList-productBrandSn"
-                allowClear
-                v-model="queryParam.productBrandSn">
-                <a-select-option v-for="item in productBrandList" :key="item.productBrandSn" :value="item.productBrandSn">{{ item.productBrandName }}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="发布状态">
-              <v-select code="ENABLED_FLAG" id="announcementList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择发布状态"></v-select>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="announcementList-refresh">查询</a-button>
-            <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="announcementList-reset">重置</a-button>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 总计 -->
-    <a-alert type="info" showIcon style="margin-bottom:15px">
-      <div slot="message">合计:<strong>300</strong>条</div>
-    </a-alert>
-    <!-- 列表 -->
-    <s-table
-      class="sTable"
-      ref="table"
-      size="default"
-      :rowKey="(record) => record.id"
-      :columns="columns"
-      :data="loadData"
-      :scroll="{ x: 1230, y: tableHeight }"
-      bordered>
-      <!-- 操作 -->
-      <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="link" class="button-info" @click="handleEdit(record)" id="announcementList-edit-btn">编辑</a-button>
-        <a-button size="small" type="link" class="button-success" @click="handleDetail(record)" id="announcementList-detail-btn">详情</a-button>
-        <a-button
-          size="small"
-          type="link"
-          class="button-error"
-          @click="handleDel(record)"
-          id="announcementList-del-btn">删除</a-button>
-      </template>
-    </s-table>
-    <!-- 编辑 -->
-    <announcement-edit-modal :openModal="openModal" :itemId="itemId" @close="closeModal" />
-    <!-- 详情 -->
-    <announcement-detail-modal :openModal="openDetailModal" :itemId="itemId" @close="closeDetailModal" />
-  </a-card>
-</template>
-
-<script>
-// import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
-// import { dealerProductTypeQuery } from '@/api/dealerProductType'
-import { STable, VSelect } from '@/components'
-import AnnouncementEditModal from './editModal.vue'
-import AnnouncementDetailModal from './detailModal.vue'
-export default {
-  components: { STable, VSelect, AnnouncementEditModal, AnnouncementDetailModal },
-  data () {
-    return {
-      advanced: false, // 高级搜索 展开/关闭
-      tableHeight: 0,
-      queryParam: { //  查询条件
-        productName: '', //  产品名称
-        productCode: '', //  产品编码/原厂编码
-        productBrandSn: undefined, //  品牌
-        productTypeSn1: '', //  产品一级分类
-        productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '', //  产品三级分类
-        enabledFlag: undefined //  定价状态
-      },
-      disabled: false, //  查询、重置按钮是否可操作
-      columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
-        { title: '类别', dataIndex: 'productCode', width: 200, align: 'center' },
-        { title: '标题', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '可见性', dataIndex: 'origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '发布时间', dataIndex: 'productBrandName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '发布状态', dataIndex: 'sterminaldsdPrice', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        if (this.tableHeight == 0) {
-          this.tableHeight = window.innerHeight - 380
-        }
-        // return dealerProductList(Object.assign(parameter, this.queryParam)).then(res => {
-        //   const data = res.data
-        //   const no = (data.pageNo - 1) * data.pageSize
-        //   for (var i = 0; i < data.list.length; i++) {
-        //     data.list[i].no = no + i + 1
-        //     const productTypeName1 = data.list[i].productTypeName1 ? data.list[i].productTypeName1 : ''
-        //     const productTypeName2 = data.list[i].productTypeName2 ? ' > ' + data.list[i].productTypeName2 : ''
-        //     const productTypeName3 = data.list[i].productTypeName3 ? ' > ' + data.list[i].productTypeName3 : ''
-        //     data.list[i].productTypeName = productTypeName1 + productTypeName2 + productTypeName3
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [
-              { id: '1', productNum: 'jgqp11111111111', productName: '产品1', productPic: ['https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', 'https://qn.antdv.com/vue.png'], productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
-            ]
-          }
-          const no = (data.pageNo - 1) * data.pageSize
-          for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = no + i + 1
-          }
-          _this.disabled = false
-          resolve(data)
-        })
-      },
-      openModal: false, //  编辑  弹框
-      openDetailModal: false, //  详情  弹框
-      itemId: '', //  当前产品id
-      productBrandList: [], //  品牌下拉数据
-      productTypeList: [] //  分类下拉数据
-    }
-  },
-  methods: {
-    //  重置
-    resetSearchForm () {
-      this.queryParam.productCode = ''
-      this.queryParam.productName = ''
-      this.queryParam.productBrandSn = undefined
-      this.queryParam.productTypeSn1 = ''
-      this.queryParam.productTypeSn2 = ''
-      this.queryParam.productTypeSn3 = ''
-      this.queryParam.enabledFlag = undefined
-      this.$refs.table.refresh(true)
-    },
-    // 详情
-    handleDetail (row) {
-      this.itemId = row.id
-      this.openDetailModal = true
-    },
-    //  编辑
-    handleEdit (row) {
-      this.itemId = row.id
-      this.openModal = true
-    },
-    //  关闭弹框
-    closeModal () {
-      this.itemId = ''
-      this.openModal = false
-    },
-    //  关闭详情弹框
-    closeDetailModal () {
-      this.itemId = ''
-      this.openDetailModal = false
-    },
-    // 删除
-    handleDel (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要删除吗?',
-        centered: true,
-        onOk () {
-          // productDel({ sn: row.productSn }).then(res => {
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
-        }
-      })
-    }
-  }
-}
-</script>

+ 168 - 0
src/views/setting/noticeManagement/detailModal.vue

@@ -0,0 +1,168 @@
+<template>
+  <a-modal
+    centered
+    class="announcementDetail-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="公告详情"
+    v-model="isShow"
+    @cancle="isShow=false"
+    width="80%">
+    <!-- 表单 -->
+    <div v-if="detailsData">
+      <a-descriptions bordered size="small" :column="2">
+        <a-descriptions-item label="类别">{{ typeDictValue }}</a-descriptions-item>
+        <a-descriptions-item label="可见性">{{ toAppNameDictValue }}</a-descriptions-item>
+        <a-descriptions-item label="公告标题">{{ detailsData.title||'--' }}</a-descriptions-item>
+        <a-descriptions-item label="发布时间">{{ detailsData.releaseDate||'--' }}</a-descriptions-item>
+        <a-descriptions-item label="公告内容" :span="2">
+          <div v-html="detailsData.content" class="editor-box"></div>
+        </a-descriptions-item>
+        <a-descriptions-item label="图片" :span="2">
+          <img
+            v-for="(item,index) in imgPathsArr"
+            :key="index"
+            :src="item"
+            title="点击查看大图"
+            class="productPic"
+            @click="getPreview(item)" />
+          <span v-if="imgPathsArr.length == 0">--</span>
+        </a-descriptions-item>
+        <a-descriptions-item label="附件" :span="2">
+          <a v-for="(item,index) in attachPathsArr" :key="index" :href="item" style="display: block;"></a>
+          <span v-if="attachPathsArr.length == 0">--</span>
+        </a-descriptions-item>
+      </a-descriptions>
+      <div class="btn-cont">
+        <a-button id="announcementDetail-back" @click="isShow = false" style="margin-left: 15px;">关闭</a-button>
+      </div>
+    </div>
+    <a-modal :visible="previewVisible" :footer="null" @cancel="previewVisible=false">
+      <img alt="example" style="width: 100%" :src="previewImage" />
+    </a-modal>
+  </a-modal>
+</template>
+
+<script>
+import { noticeDetail } from '@/api/notice'
+export default {
+  name: 'AnnouncementDetailModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemId: {
+      type: [Number, String],
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      detailsData: null, //  详情数据
+      previewVisible: false,
+      previewImage: '',
+    }
+  },
+  computed: {
+    typeDictValue () { //  类别  数据字典name
+      let str = ''
+      if (this.detailsData.type == 'notity') {
+        str = '公告'
+      } else if (this.detailsData.type == 'news_company') {
+        str = '企业新闻'
+      } else if (this.detailsData.type == 'news_trade') {
+        str = '行业咨询'
+      } else {
+        str = '--'
+      }
+      return str
+    },
+    toAppNameDictValue () { //  可见性  数据字典name
+      let str = ''
+      if (this.detailsData.toAppName == '1,2') {
+        str = '所有'
+      } else if (this.detailsData.toAppName == '2') {
+        str = '经销商'
+      } else if (this.detailsData.toAppName == '1') {
+        str = '总部'
+      } else {
+        str = '--'
+      }
+      return str
+    },
+    imgPathsArr () {  //  图片数组
+      return this.detailsData.imgPaths ? this.detailsData.imgPaths.split(',') : []
+    },
+    attachPathsArr () {  //  附件数组
+      return this.detailsData.attachPaths ? this.detailsData.attachPaths.split(',') : []
+    }
+  },
+  methods: {
+    //  获取详情
+    getDetail () {
+      noticeDetail({ id: this.itemId }).then(res => {
+        if (res.status == 200) {
+          this.detailsData = res.data
+        } else {
+          this.detailsData = null
+        }
+      })
+    },
+    // 查看大图
+    getPreview (url) {
+      this.previewImage = url
+      this.previewVisible = true
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    },
+    itemId (newValue, oldValue) {
+      if (this.isShow && newValue) {
+        this.getDetail()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .announcementDetail-modal{
+    .ant-modal-body {
+    	padding: 40px 40px 24px;
+    }
+    .productPic{
+      cursor: pointer;
+      width: 200px;
+      margin-right: 10px;
+    }
+    .editor-box{  //  编辑器基本样式初始化
+      p{
+        margin: 0;
+        padding: 0;
+        ul, li{
+          list-style: none;
+          padding: 0;
+          margin: 0;
+        }
+        img{
+          max-width: 100%;
+        }
+      }
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+  }
+</style>

+ 81 - 48
src/views/setting/announcementManagement/editModal.vue → src/views/setting/noticeManagement/editModal.vue

@@ -1,7 +1,7 @@
 <template>
   <a-modal
     centered
-    class="announcementEdit-modal"
+    class="noticeEdit-modal"
     :footer="null"
     :maskClosable="false"
     :title="modalTit"
@@ -11,64 +11,63 @@
     <!-- 表单 -->
     <div>
       <a-form-model
-        id="announcementEdit-form"
+        id="noticeEdit-form"
         ref="ruleForm"
         :model="form"
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol"
       >
-        <a-form-model-item label="类型" prop="productBrandName">
-          <a-select placeholder="请选择类型" id="announcementEdit-level" allowClear v-model="form.level">
-            <a-select-option v-for="item in productBrandList" :key="item.productBrandSn" :value="item.productBrandSn">{{ item.productBrandName }}</a-select-option>
-          </a-select>
+        <a-form-model-item label="类别" prop="type">
+          <v-select code="NOTITY_BIZ_TYPE" id="noticeEdit-type" v-model="form.type" allowClear placeholder="请选择类别"></v-select>
         </a-form-model-item>
-        <a-form-model-item label="可见性" prop="productBrandName">
-          <a-select placeholder="请选择可见性" id="announcementEdit-level" allowClear v-model="form.level">
-            <a-select-option v-for="item in productBrandList" :key="item.productBrandSn" :value="item.productBrandSn">{{ item.productBrandName }}</a-select-option>
-          </a-select>
+        <a-form-model-item label="可见性" prop="toAppName">
+          <v-select code="NOTITY_APP_TYPE" id="noticeEdit-toAppName" v-model="form.toAppName" allowClear placeholder="请选择可见性"></v-select>
         </a-form-model-item>
-        <a-form-model-item label="公告标题" prop="productBrandName">
+        <a-form-model-item label="公告标题" prop="title">
           <a-input
-            id="announcementEdit-productBrandName"
+            id="noticeEdit-title"
             :maxLength="30"
-            v-model="form.productBrandName"
+            v-model="form.title"
             placeholder="请输入公告标题(最多30个字符)"
             allowClear />
         </a-form-model-item>
-        <a-form-model-item label="发布时间" prop="productBrandName">
+        <a-form-model-item label="发布时间" prop="releaseDate">
           <a-date-picker
-            :show-time="{ format: 'HH:mm' }"
-            id="announcementEdit-productBrandName"
-            format="YYYY-MM-DD HH:mm"
-            placeholder="年/月/日 时/分"
-            :disabled-date="disabledDate" />
+            show-time
+            id="noticeEdit-releaseDate"
+            format="YYYY-MM-DD HH:mm:ss"
+            placeholder="年/月/日 时/分/秒"
+            :disabled-date="disabledDate"
+            v-model="form.releaseDate"/>
         </a-form-model-item>
-        <a-form-model-item label="图片上传" prop="productBrandName">
+        <a-form-model-item label="图片上传" prop="imgPaths">
           <Upload
             class="upload"
-            id="announcementEdit-image"
-            v-model="form.image"
-            ref="image"
+            id="noticeEdit-imgPaths"
+            v-model="form.imgPaths"
+            ref="imgPaths"
             :fileSize="10"
             :maxNums="5"
-            @change="changeHomeImage"
-            listType="picture-card" ></Upload>
+            @change="changeImage"
+            listType="picture-card"
+            :uploadParams="uploadParams"></Upload>
           <span class="upload-desc">说明:单张大小小于10Mb,最多5张。</span>
         </a-form-model-item>
-        <a-form-model-item label="附件上传" prop="productBrandName">
+        <a-form-model-item label="附件上传" prop="attachPaths">
           <Upload
-            id="announcementEdit-image"
-            v-model="form.image"
+            id="noticeEdit-attachPaths"
+            v-model="form.attachPaths"
             ref="enclosure"
             :fileSize="10"
             :maxNums="3"
             fileType="*"
-            @change="changeHomeImage" ></Upload>
+            @change="changeAttach"
+            :uploadParams="uploadParams"></Upload>
           <span class="upload-desc">说明:单个文件小于10Mb,最多3个附件。</span>
         </a-form-model-item>
-        <a-form-model-item label="公告内容" prop="desc">
-          <editor id="announcementEdit-editor" ref="editor" class="announcementEdit-editor" @on-change="editorChange" :cache="false"></editor>
+        <a-form-model-item label="公告内容" prop="content">
+          <editor id="noticeEdit-editor" ref="editor" class="noticeEdit-editor" @on-change="editorChange" :cache="false"></editor>
         </a-form-model-item>
       </a-form-model>
       <div class="btn-cont">
@@ -81,12 +80,12 @@
 
 <script>
 import moment from 'moment'
-import { STable, Upload } from '@/components'
+import { VSelect, Upload } from '@/components'
 import Editor from '@/components/WEeditor'
-// import { dealerProductBrandSave } from '@/api/dealerProductBrand'
+import { noticeSave, noticeDetail } from '@/api/notice'
 export default {
   name: 'ProductBrandEditModal',
-  components: { STable, Upload, Editor },
+  components: { VSelect, Upload, Editor },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -114,16 +113,31 @@ export default {
         wrapperCol: { span: 20 }
       },
       form: {
-        productBrandName: '', // 产品品牌名称
-        image: '',
-        desc: ''
+        type: undefined,
+        toAppName: undefined,
+        title: '',
+        releaseDate: null,
+        imgPaths: '',
+        attachPaths: '',
+        content: ''
       },
       rules: {
-        productBrandName: [
-          { required: true, message: '请输入产品品牌名称', trigger: 'blur' }
+        type: [
+          { required: true, message: '请选择类别', trigger: 'change' }
+        ],
+        toAppName: [
+          { required: true, message: '请选择可见性', trigger: 'change' }
+        ],
+        title: [
+          { required: true, message: '请输入公告标题', trigger: 'blur' }
+        ],
+        releaseDate: [
+          { required: true, message: '请选择发布时间', trigger: 'change' }
         ]
       },
-      productBrandList: []
+      uploadParams: {
+        savePathType: 'web'
+      }
     }
   },
   methods: {
@@ -131,14 +145,26 @@ export default {
       // Can not select days before today and today
       return current && current < moment().subtract(1, 'days')
     },
+    //  详情
+    getDetail () {
+      noticeDetail({ id: this.itemId }).then(res => {
+        if (res.status == 200) {
+          this.form = Object.assign(this.form, res.data)
+          this.$refs.imgPaths.setFileList(res.data.imgPaths)
+          this.$refs.attachPaths.setFileList(res.data.attachPaths)
+          this.$refs.editor.setHtml(this.formData.content)
+        }
+      })
+    },
     //  保存
     handleSave () {
       const _this = this
       _this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const formData = JSON.parse(JSON.stringify(_this.form))
+          formData.releaseDate = moment(formData.releaseDate).format('YYYY-MM-DD HH:mm:ss')
           formData.id = _this.itemId ? _this.itemId : undefined
-          dealerProductBrandSave(formData).then(res => {
+          noticeSave(formData).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$emit('ok')
@@ -151,12 +177,16 @@ export default {
       })
     },
     //  图片上传
-    changeHomeImage (file) {
-      this.form.image = file
+    changeImage (file) {
+      this.form.imgPaths = file
+    },
+    //  附件上传
+    changeAttach (file) {
+      this.form.attachPaths = file
     },
     //  文本编辑器
     editorChange (html, text) {
-      this.form.desc = html
+      this.form.content = html
     }
   },
   watch: {
@@ -168,8 +198,11 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-      } else {
-        this.form.productBrandName = this.nowData && this.nowData.productBrandName ? this.nowData.productBrandName : ''
+      }
+    },
+    itemId (newValue, oldValue) {
+      if (this.isShow && newValue) {
+        this.getDetail()
       }
     }
   }
@@ -177,7 +210,7 @@ export default {
 </script>
 
 <style lang="less">
-  .announcementEdit-modal{
+  .noticeEdit-modal{
     .ant-modal-body {
     	padding: 40px 40px 24px;
     }
@@ -190,7 +223,7 @@ export default {
       color: #808695;
     }
     //  文本编辑器  工具栏样式换行
-    .announcementEdit-editor{
+    .noticeEdit-editor{
       .w-e-toolbar{
         flex-wrap: wrap;
       }

+ 183 - 0
src/views/setting/noticeManagement/list.vue

@@ -0,0 +1,183 @@
+<template>
+  <a-card size="small" :bordered="false" class="noticeList-wrap">
+    <!-- 搜索条件 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="15">
+          <a-col :md="6" :sm="24">
+            <a-form-item label="标题">
+              <a-input id="noticeList-title" v-model.trim="queryParam.title" allowClear placeholder="请输入标题"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="类别">
+              <v-select code="NOTITY_BIZ_TYPE" id="noticeList-type" v-model="queryParam.type" allowClear placeholder="请选择类别"></v-select>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="发布状态">
+              <v-select code="NOTITY_SEND_STATUS" id="noticeList-sendStatus" v-model="queryParam.sendStatus" allowClear placeholder="请选择发布状态"></v-select>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="noticeList-refresh">查询</a-button>
+            <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="noticeList-reset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 操作按钮 -->
+    <div class="table-operator">
+      <a-button id="noticeList-add" type="primary" class="button-error" @click="handleAdd">新增</a-button>
+    </div>
+    <!-- 总计 -->
+    <a-alert type="info" showIcon style="margin-bottom:15px">
+      <div slot="message">合计:<strong>{{ total || 0 }}</strong>条</div>
+    </a-alert>
+    <!-- 列表 -->
+    <s-table
+      class="sTable"
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      :scroll="{ x: 1230, y: tableHeight }"
+      bordered>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-button
+          size="small"
+          type="link"
+          class="button-info"
+          v-if="record.sendStatus=='0'"
+          @click="handleEdit(record)"
+          id="noticeList-edit-btn">编辑</a-button>
+        <a-button
+          size="small"
+          type="link"
+          class="button-success"
+          v-if="record.sendStatus=='1'"
+          @click="handleDetail(record)"
+          id="noticeList-detail-btn">详情</a-button>
+        <a-button
+          size="small"
+          type="link"
+          class="button-error"
+          v-if="record.sendStatus=='0'"
+          @click="handleDel(record)"
+          id="noticeList-del-btn">删除</a-button>
+      </template>
+    </s-table>
+    <!-- 编辑 -->
+    <notice-edit-modal :openModal="openModal" :itemId="itemId" @close="closeModal" @ok="$refs.table.refresh()" />
+    <!-- 详情 -->
+    <notice-detail-modal :openModal="openDetailModal" :itemId="itemId" @close="closeDetailModal" />
+  </a-card>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import noticeEditModal from './editModal.vue'
+import noticeDetailModal from './detailModal.vue'
+import { noticeList, noticeDel } from '@/api/notice'
+export default {
+  components: { STable, VSelect, noticeEditModal, noticeDetailModal },
+  data () {
+    return {
+      tableHeight: 0,
+      queryParam: { //  查询条件
+        title: '',
+        type: undefined,
+        sendStatus: undefined
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
+        { title: '类别', dataIndex: 'typeDictValue', width: 200, align: 'center' },
+        { title: '标题', dataIndex: 'title', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '可见性', dataIndex: 'toAppNameDictValue', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '发布时间', dataIndex: 'releaseDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '发布状态', dataIndex: 'sendStatusDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        if (this.tableHeight == 0) {
+          this.tableHeight = window.innerHeight - 380
+        }
+        return noticeList(Object.assign(parameter, this.queryParam)).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+            data.list[i].typeDictValue = data.list[i].type == 'notity' ? '公告' : data.list[i].type == 'news_company' ? '企业新闻' : data.list[i].type == 'news_trade' ? '行业咨询' : '--'
+            data.list[i].sendStatusDictValue = data.list[i].sendStatus == 1 ? '已发布' : data.list[i].sendStatus == 0 ? '未发布' : '--'
+            data.list[i].toAppNameDictValue = data.list[i].toAppName == '1,2' ? '所有' : data.list[i].toAppName == '2' ? '经销商' : data.list[i].toAppName == '1' ? '总部' : '--'
+          }
+          this.total = data.count
+          this.disabled = false
+          return data
+        })
+      },
+      total: 0, // 合计
+      openModal: false, //  编辑  弹框
+      openDetailModal: false, //  详情  弹框
+      itemId: '' //  当前产品id
+    }
+  },
+  methods: {
+    //  重置
+    resetSearchForm () {
+      this.queryParam.title = ''
+      this.queryParam.type = undefined
+      this.queryParam.sendStatus = undefined
+      this.$refs.table.refresh(true)
+    },
+    // 详情
+    handleDetail (row) {
+      this.itemId = row.id
+      this.openDetailModal = true
+    },
+    // 新增
+    handleAdd () {
+      this.itemId = ''
+      this.openModal = true
+    },
+    //  编辑
+    handleEdit (row) {
+      this.itemId = row.id
+      this.openModal = true
+    },
+    //  关闭弹框
+    closeModal () {
+      this.itemId = ''
+      this.openModal = false
+    },
+    //  关闭详情弹框
+    closeDetailModal () {
+      this.itemId = ''
+      this.openDetailModal = false
+    },
+    // 删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确认要删除吗?',
+        centered: true,
+        onOk () {
+          noticeDel({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
+        }
+      })
+    }
+  }
+}
+</script>