Browse Source

公告管理

chris 3 years ago
parent
commit
0ea93d9948

+ 18 - 0
src/api/notice.js

@@ -0,0 +1,18 @@
+import request from '@/utils/httpRequest'
+
+// 获取公告详情
+export function getNoticeDetail (id) {
+  return request({
+    url: request.adornUrl(`/biz-service/notice/info/${id}`),
+    method: 'get'
+  })
+}
+
+// 发布公告
+export function publishNotice (data) {
+  return request({
+    url: request.adornUrl(`/biz-service/notice/save`),
+    method: 'post',
+    data
+  })
+}

+ 73 - 75
src/views/modules/common/vue-super-flow/GraphLink.js

@@ -16,58 +16,58 @@ import {
 
 export default class GraphLink {
   static distance = 15
-  
-  constructor(options, graph) {
+
+  constructor (options, graph) {
     const {
       id = uuid('link'),
       start,
       end = null,
       startAt = [0, 0],
       endAt = [0, 0],
-      meta = null,
+      meta = null
     } = options
-    
+
     this.key = uuid('link')
-    
+
     this.id = id
     this.graph = graph
     this.start = start
     this.meta = meta
-    
+
     this.end = end
     this.startDirection = directionVector[direction.top]
     this.endDirection = directionVector[direction.top]
     this.startAt = startAt
     this.endAt = endAt
   }
-  
-  get end() {
+
+  get end () {
     return this._end
   }
-  
-  set end(node) {
+
+  set end (node) {
     if (this.start === node) {
       return false
     } else {
       this._end = node
     }
   }
-  
-  get startAt() {
+
+  get startAt () {
     return this._startAt
   }
-  
-  set startAt(offset) {
+
+  set startAt (offset) {
     const relative = this.start.relative(offset)
     this._startAt = relative.position
     this.startDirection = relative.direction
   }
-  
-  get endAt() {
+
+  get endAt () {
     return this._endAt
   }
-  
-  set endAt(offset) {
+
+  set endAt (offset) {
     if (this.end) {
       const relative = this.end.relative(offset)
       this._endAt = relative.position
@@ -76,38 +76,38 @@ export default class GraphLink {
       this._endAt = offset
     }
   }
-  
-  get movePosition() {
+
+  get movePosition () {
     return this._movePosition
   }
-  
-  set movePosition(offset) {
+
+  set movePosition (offset) {
     this._movePosition = offset
-    
+
     if (this.end) return
-    
+
     const relative = this.start.relative(
       vector(offset)
         .minus(this.graph.origin)
         .minus(this.start.coordinate)
         .end
     )
-    
+
     this.endDirection = vector(relative.direction)
       .multiply(-1)
       .end
   }
-  
-  get pathPointList() {
-    const pointList = this.coordinateList()
-      , xList = []
-      , yList = []
-    
+
+  get pathPointList () {
+    const pointList = this.coordinateList(),
+      xList = [],
+      yList = []
+
     pointList.forEach(item => {
       xList.push(item[0])
       yList.push(item[1])
     })
-    
+
     return {
       pointList,
       xList,
@@ -118,14 +118,14 @@ export default class GraphLink {
       maxY: Math.max(...yList)
     }
   }
-  
-  startCoordinate() {
+
+  startCoordinate () {
     return vector(this.start.position)
       .add(this.startAt)
       .end
   }
-  
-  endCoordinate() {
+
+  endCoordinate () {
     if (this.end) {
       return vector(this.end.position)
         .add(this.endAt)
@@ -134,35 +134,35 @@ export default class GraphLink {
       return this.movePosition
     }
   }
-  
-  coordinateList(turnRatio = 0.5) {
+
+  coordinateList (turnRatio = 0.5) {
     const entryPoint = this.startCoordinate()
     const exitPoint = this.endCoordinate()
-    
+
     const entryDirection = this.startDirection
     let exitDirection = this.endDirection
-    
+
     // 路径起点
     const startPoint = vector(entryDirection)
       .multiply(GraphLink.distance)
       .add(entryPoint)
       .end
-    
+
     // 路径终点
     const endPoint = vector(exitDirection)
       .multiply(GraphLink.distance)
       .add(exitPoint)
       .end
-    
+
     // 入口方向取反
     exitDirection = vector(exitDirection)
       .multiply(-1)
       .end
-    
+
     // 终点 - 起点  垂直 水平向量
     const pathHorizontalVec = [endPoint[0] - startPoint[0], 0]
     const pathVerticalVec = [0, endPoint[1] - startPoint[1]]
-    
+
     const startDirection = this.pathDirection(
       pathVerticalVec,
       pathHorizontalVec,
@@ -173,54 +173,52 @@ export default class GraphLink {
       pathHorizontalVec,
       exitDirection
     )
-    
+
     const splitNum = vector(startDirection)
       .dotProduct(endDirection)
       .end > 0 ? 2 : 1
-    
+
     const pathMiddle = endDirection === pathHorizontalVec
       ? pathVerticalVec
       : pathHorizontalVec
-    
+
     let points = []
-    
+
     points.push(entryPoint, startPoint)
-    
+
     if (splitNum === 1) {
-      
       const point1 = vector(startPoint)
         .add(startDirection)
         .end
-      
+
       const point2 = vector(point1)
         .add(endDirection)
         .end
       points.push(point1, point2)
-      
     } else {
       const point1 = vector(startDirection)
         .multiply(turnRatio)
         .add(startPoint)
         .end
-      
+
       const point2 = vector(point1)
         .add(pathMiddle)
         .end
-      
+
       const point3 = vector(endDirection)
         .multiply(1 - turnRatio)
         .add(point2)
         .end
-      
+
       points.push(point1, point2, point3)
     }
-    
+
     points.push(exitPoint)
-    
+
     return points
   }
-  
-  pathDirection(vertical, horizontal, direction) {
+
+  pathDirection (vertical, horizontal, direction) {
     if (
       vector(horizontal)
         .parallel(direction)
@@ -247,8 +245,8 @@ export default class GraphLink {
       }
     }
   }
-  
-  isPointInLink(position, pathPointList) {
+
+  isPointInLink (position, pathPointList) {
     const {
       pointList,
       minX,
@@ -256,41 +254,41 @@ export default class GraphLink {
       maxX,
       maxY
     } = pathPointList || this.pathPointList
-    
+
     const n = 5
-    
+
     if (
-      position[0] < minX - n
-      || position[0] > maxX + n
-      || position[1] < minY - n
-      || position[1] > maxY + n
+      position[0] < minX - n ||
+      position[0] > maxX + n ||
+      position[1] < minY - n ||
+      position[1] > maxY + n
     ) {
       return false
     }
-    
+
     for (let i = 0; i < pointList.length - 2; i++) {
       const prev = pointList[i]
       const current = pointList[i + 1]
-      
+
       const top = Math.min(prev[1], current[1]) - n
       const right = Math.max(prev[0], current[0]) + n
       const bottom = Math.max(prev[1], current[1]) + n
       const left = Math.min(prev[0], current[0]) - n
-      
+
       const [x, y] = position
-      
+
       if (x > left && x < right && y > top && y < bottom) {
         return true
       }
     }
     return false
   }
-  
-  remove() {
+
+  remove () {
     return this.graph.removeLink(this)
   }
-  
-  toJSON() {
+
+  toJSON () {
     return {
       id: this.id,
       startId: this.start.id,

+ 41 - 41
src/views/modules/common/vue-super-flow/GraphNode.js

@@ -16,7 +16,7 @@ import {
 } from './types'
 
 export default class GraphNode {
-  constructor(props, graph) {
+  constructor (props, graph) {
     const {
       id = uuid('node'),
       width = 180,
@@ -24,90 +24,90 @@ export default class GraphNode {
       coordinate = [0, 0],
       meta = null
     } = props
-    
+
     this.key = uuid('node')
     this.graph = graph
-    
+
     this.id = id
     this.coordinate = [...coordinate]
     this.meta = meta
-    
+
     this.width = width
     this.height = height
   }
-  
-  get position() {
+
+  get position () {
     return vector(this.coordinate)
       .add(this.graph.origin)
       .end
   }
-  
-  set position(position) {
+
+  set position (position) {
     this.coordinate = vector(position)
       .minus(this.graph.origin)
       .end
   }
-  
-  get center() {
+
+  get center () {
     return vector(this.coordinate)
       .add([this.width / 2, this.height / 2])
       .end
   }
-  
-  set center(position) {
+
+  set center (position) {
     this.coordinate = vector(position)
       .minus([this.width / 2, this.height / 2])
       .end
   }
-  
-  get width() {
+
+  get width () {
     return this._width
   }
-  
-  set width(w) {
+
+  set width (w) {
     w = Math.floor(w)
     this._width = w > 50 ? w : 50
     this.angle()
   }
-  
-  get height() {
+
+  get height () {
     return this._height
   }
-  
-  set height(h) {
+
+  set height (h) {
     h = Math.floor(h)
     this._height = h > 20 ? h : 20
     this.angle()
   }
-  
-  angle() {
+
+  angle () {
     const
-      w = this.width / 2
-      , h = this.height / 2
-      , center = [0, 0]
-    
+      w = this.width / 2,
+      h = this.height / 2,
+      center = [0, 0]
+
     const topLeft = vector(center)
       .minus([w, h])
       .angle()
       .end
-    
+
     const topRight = vector(center)
       .add([w, 0])
       .minus([0, h])
       .angle()
       .end
-    
+
     const bottomRight = vector(center)
       .add([w, h])
       .angle()
       .end
-    
+
     const bottomLeft = vector(center)
       .add([0, h])
       .minus([w, 0])
       .angle()
       .end
-    
+
     this.angleList = [
       topLeft,
       topRight,
@@ -115,8 +115,8 @@ export default class GraphNode {
       bottomLeft
     ]
   }
-  
-  relative(offset) {
+
+  relative (offset) {
     const angle = vector(offset)
       .minus([this.width / 2, this.height / 2])
       .angle()
@@ -128,23 +128,23 @@ export default class GraphNode {
       direction.bottom,
       direction.left
     ]
-    
+
     let dir = direction.left
-    
+
     angleList.reduce((prev, current, idx) => {
       if (angle >= prev && angle < current) {
         dir = directionList[idx - 1]
       }
       return current
     })
-    
+
     return {
       position: this.fixOffset(offset, dir),
       direction: directionVector[dir]
     }
   }
-  
-  fixOffset(offset, dir) {
+
+  fixOffset (offset, dir) {
     switch (dir) {
       case direction.top:
         offset[0] = this.width / 2
@@ -166,12 +166,12 @@ export default class GraphNode {
     }
     return offset
   }
-  
-  remove() {
+
+  remove () {
     return this.graph.removeNode(this)
   }
-  
-  toJSON() {
+
+  toJSON () {
     return {
       id: this.id,
       width: this.width,

+ 20 - 20
src/views/modules/common/vue-super-flow/link.vue

@@ -30,7 +30,7 @@
       graph: Object,
       link: Object
     },
-    data() {
+    data () {
       return {
         top: 0,
         right: 0,
@@ -40,7 +40,7 @@
         currentPathPointList: null
       }
     },
-    mounted() {
+    mounted () {
       this.ctx = this.$el.getContext('2d')
       this.draw()
       this.graph.add('mousemove', this.rootMousemove)
@@ -49,7 +49,7 @@
       })
     },
     computed: {
-      styles() {
+      styles () {
         return Object.assign({
           hover: '#FF0000',
           color: '#666666',
@@ -62,10 +62,10 @@
         }, this.linkBaseStyle)
       },
       inPath: {
-        get() {
+        get () {
           return this.graph.mouseonLink === this.link
         },
-        set(bol) {
+        set (bol) {
           if (bol && !this.graph.mouseonNode) {
             this.graph.mouseonLink = this.link
             this.$el.style.zIndex = '1'
@@ -78,7 +78,7 @@
       }
     },
     methods: {
-      draw() {
+      draw () {
         const {
           pointList,
           minX,
@@ -103,14 +103,14 @@
         this.initLine()
       },
 
-      changeStyle() {
+      changeStyle () {
         this.$el.width = this.right - this.left
         this.$el.height = this.bottom - this.top
         this.$el.style.top = this.top + 'px'
         this.$el.style.left = this.left + 'px'
       },
 
-      initLine() {
+      initLine () {
         this.ctx.clearRect(0, 0, this.$el.width, this.$el.height)
         if (this.linkStyle) {
           const style = this.linkStyle(this.link)
@@ -133,7 +133,7 @@
         }
       },
 
-      drawLine(strokeStyle) {
+      drawLine (strokeStyle) {
         const lineWidth = 2
         const ctx = this.ctx
 
@@ -156,7 +156,7 @@
         ctx.save()
       },
 
-      drawDesc(color) {
+      drawDesc (color) {
         const ctx = this.ctx
         let desc
         if (isFun(this.linkDesc)) {
@@ -185,7 +185,7 @@
         }
       },
 
-      descPosition() {
+      descPosition () {
         let lineLen = 0
         let contrastLen = 0
         let descPosition = null
@@ -234,7 +234,7 @@
         return descPosition
       },
 
-      descIntercept(str) {
+      descIntercept (str) {
         const ctx = this.ctx
         let strWidth = ctx.measureText(str).width
 
@@ -259,7 +259,7 @@
         }
       },
 
-      drawArrow(fillStyle) {
+      drawArrow (fillStyle) {
         const size = 4
         const len = this.currentPointList.length
 
@@ -292,7 +292,7 @@
         ctx.restore()
       },
 
-      getCoordinates(evt) {
+      getCoordinates (evt) {
         const {
           clientX,
           clientY
@@ -306,7 +306,7 @@
         return [clientX - left, clientY - top]
       },
 
-      isPointInStroke(evt) {
+      isPointInStroke (evt) {
         const [x, y] = this.getCoordinates(evt)
         return this.link.isPointInLink(
           [
@@ -317,27 +317,27 @@
         )
       },
 
-      rootMousemove({evt}) {
+      rootMousemove ({evt}) {
         this.inPath = this.isPointInStroke(evt)
         return this.inPath
       }
     },
     watch: {
-      'link.pathPointList'() {
+      'link.pathPointList' () {
         this.draw()
       },
-      inPath() {
+      inPath () {
         this.initLine()
       },
       'link.meta': {
         deep: true,
-        handler() {
+        handler () {
           this.draw()
         }
       },
       'linkBaseStyle': {
         deep: true,
-        handler() {
+        handler () {
           this.draw()
         }
       }

+ 3 - 3
src/views/modules/common/vue-super-flow/markLine.vue

@@ -24,13 +24,13 @@
       markLine: Array,
       markColor: String
     },
-    mounted() {
+    mounted () {
       this.$refs.markLine.height = this.height
       this.$refs.markLine.width = this.width
       this.draw()
     },
     methods: {
-      draw() {
+      draw () {
         const ctx = this.$el.getContext('2d')
         ctx.clearRect(0, 0, this.width, this.height)
         ctx.strokeStyle = this.markColor
@@ -45,7 +45,7 @@
       }
     },
     watch: {
-      markLine() {
+      markLine () {
         this.draw()
       }
     }

+ 4 - 4
src/views/modules/common/vue-super-flow/menu.vue

@@ -63,7 +63,7 @@
       }
     },
     computed: {
-      style() {
+      style () {
         return {
           left: this.position[0] + 'px',
           top: this.position[1] + 'px'
@@ -71,7 +71,7 @@
       }
     },
     methods: {
-      select(subItem) {
+      select (subItem) {
         if (subItem.disable) return
         this.$emit('update:visible', false)
 
@@ -82,12 +82,12 @@
             .end
         )
       },
-      close(evt) {
+      close (evt) {
         this.$emit('update:visible', false)
       }
     },
     watch: {
-      visible() {
+      visible () {
         if (this.visible) {
           this.$nextTick(() => this.$el.focus())
         }

+ 166 - 103
src/views/modules/notice/notice-add-or-update.vue

@@ -1,139 +1,199 @@
 <template>
-  <el-dialog
-    :title="!id ? '发布': display ? '详情' : '修改'"
-    width="70%"
-    :close-on-click-modal="false"
-    :visible.sync="visible">
-    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
-      <el-row class="my-row">
-        <el-col :span="12">
-          <el-form-item label="公告主题名称">
-            <el-input v-model="dataForm.title" :disabled="display" placeholder="请输入公告主题名称"></el-input>
+  <div>
+    <el-dialog
+      :title="!id ? '发布': display ? '详情' : '修改'"
+      width="70%"
+      :close-on-click-modal="false"
+      :visible.sync="visible">
+      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+        <el-row class="my-row">
+          <el-col :span="12">
+            <el-form-item label="公告主题名称" prop="title">
+              <el-input v-model="dataForm.title" :disabled="display" placeholder="请输入公告主题名称"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12" style="padding-left: 20px">
+            <el-form-item label="级别" prop="level">
+              <el-input v-if="display" v-model="dataForm.levelDesc" :disabled="true"/>
+              <el-select v-else
+                v-model="dataForm.level"
+                :disabled="display"
+                placeholder="请选择">
+                <el-option
+                  v-for="item in optionsLevel"
+                  :key="item.code"
+                  :label="item.value"
+                  :value="item.code">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row class="my-row">
+          <el-form-item label="公告内容" prop="content">
+            <el-input v-model="dataForm.content" :disabled="display" placeholder="公告内容"></el-input>
           </el-form-item>
-        </el-col>
-        <el-col :span="12" style="padding-left: 20px">
-          <el-form-item label="级别" prop="level">
-            <el-select
-              v-model="dataForm.level"
-              :disabled="display"
-              remote
-              placeholder="请选择">
-              <el-option
-                v-for="item in optionLevel"
-                :key="item.code"
-                :label="item.value"
-                :value="item.code">
-              </el-option>
-            </el-select>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row class="my-row">
-        <el-col :span="12">
-          <el-form-item label="客户名称" prop="name">
-            <el-input v-model="dataForm.name" disabled placeholder="客户名称"></el-input>
+        </el-row>
+        <el-row class="my-row">
+          <div class="title"><span style="color: red">*</span> 公告附件</div>
+          <el-upload
+            class="upload-demo"
+            ref="upload"
+            :multiple="true"
+            action="#"
+            accept="image/jpeg,image/gif,image/png"
+            :on-preview="handlePreview"
+            :on-remove="handleRemove"
+            :on-change="handleChange"
+            :file-list="fileList"
+            :limit="5"
+            :on-exceed="handleExceed"
+            :auto-upload="false">
+            <el-button v-show="!display" slot="trigger" size="small" type="primary">选取文件</el-button>
+            <el-button v-show="!display" style="margin-left: 10px;" size="small" type="success" @click="submitUpload">开始上传</el-button>
+            <div v-show="!display" slot="tip" class="el-upload__tip">只能上传jpg/png文件,最多5张图片,且每张图片不超过10M</div>
+          </el-upload>
+        </el-row>
+        <el-row class="my-row" style="margin-top: 10px">
+          <el-form-item label="备注说明" prop="notes">
+            <el-input v-model="dataForm.notes" :disabled="display" placeholder="备注说明"></el-input>
           </el-form-item>
-        </el-col>
-        <el-col :span="12" style="padding-left: 20px">
-          <el-form-item label="联系人" prop="cellName">
-            <el-input v-model="dataForm.cellName" disabled placeholder="联系人"></el-input>
+        </el-row>
+        <el-row>
+          <el-form-item label="接收对象" prop="receivers">
+            <user-components v-model="dataForm.receivers" :user-ids="dataForm.receivers" @change='receiverChange' :disabled="display"/>
           </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row class="my-row">
-        <el-form-item label="备注说明">
-            <el-input v-model="dataForm.notes" :disabled="display" placeholder="备注说明"></el-input>
-        </el-form-item>
-      </el-row>
-      <el-row class="my-row">
-        <div class="title">沟通信息表附件</div>
-      </el-row>
-      <el-row class="my-row">
-        <div class="title"><span style="color: red">*</span> 合同评审表</div>
-        <el-upload
-          v-show="!display"
-          class="upload-demo"
-          ref="upload"
-          action="https://jsonplaceholder.typicode.com/posts/"
-          :on-preview="handlePreview"
-          :on-remove="handleRemove"
-          :file-list="fileList"
-          :auto-upload="false">
-          <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
-          <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">开始上传</el-button>
-        </el-upload>
-      </el-row>
-    </el-form>
-    <span slot="footer" class="dialog-footer">
-      <el-button @click="visible = false">取消</el-button>
-      <el-button v-if="!display" type="primary" @click="dataFormSubmit()">确定</el-button>
-    </span>
-  </el-dialog>
+        </el-row>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="visible = false">取消</el-button>
+        <el-button v-if="!display" type="primary" @click="dataFormSubmit()">确定</el-button>
+      </span>
+    </el-dialog>
+    <!-- 图片预览 -->
+    <el-dialog title="图片预览" :visible.sync="previewVisible" width="50%">
+      <img :src="previewPath" :alt="previewName" style="width:100%;height:100%" />
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-  // import { getcoCode, getReviewType, getreDetail } from '@/api/cus'
+  import { getNoticeDetail, publishNotice } from '@/api/notice'
+  import UserComponents from '../common/user-components'
+  import { uploadUrl, downloadUrl, uploadFiles } from '@/api/file'
+  import { getDictList } from '@/api/dict'
   export default {
     name: 'notice-add-or-update',
+    components: {UserComponents},
     data () {
       return {
         visible: false,
-        dictType: 'material_type',
-        options: [],
-        options1: [],
+        optionsLevel: [],
         dataList: [],
         fileList: [],
         id: 0,
-        dataForm: {
-          coCode: '',
-          name: '',
-          cellName: '',
-          reType: '',
-          notes: '',
-          attachList: []
-        },
+        dataForm: {},
         dataRule: {
-          coCode: [{ required: true, message: '沟通编码不能为空', trigger: 'change' }],
-          reType: [{ required: true, message: '评审类别不能为空', trigger: 'change' }],
-          name: [{ required: true, message: '客户名称不能为空', trigger: 'blur' }],
-          cellName: [{ required: true, message: '联系人不能为空', trigger: 'blur' }]
+          title: [{ required: true, message: '公告主题名称不能为空', trigger: 'blur' }],
+          level: [{ required: true, message: '清选择级别', trigger: 'change' }],
+          content: [{ required: true, message: '公告内容不能为空', trigger: 'blur' }]
         },
-        display: false
-      }
-    },
-    watch: {
-      'dataForm.coCode' (value) {
-        this.options1.forEach(v => {
-          if (v.customerId === value) {
-            this.dataForm.name = v.customerName
-            this.dataForm.cellName = v.contact
-          }
-        })
+        display: false,
+        uploadUrl: uploadUrl,
+        previewPath: '',
+        previewName: '',
+        previewVisible: false
       }
     },
     methods: {
-      async init (id, disabled) {
+      async init (id, display) {
+        this.dataForm = {}
+        this.fileList = []
         this.visible = true
         this.id = id || 0
+        this.display = display
+        // 获取沟通类别
+        await getDictList({type: 'announcement_level'}).then(({data}) => {
+          if (data) {
+            this.optionsLevel = data
+          }
+        })
+        if (!id) return
+        await getNoticeDetail(this.id).then(({data}) => {
+          if (data && data.code === '200') {
+            this.dataForm = data.data
+            // 附件显示
+            this.fileList = []
+            data.data.attaches.forEach((item) => {
+              this.fileList.push({
+                name: item.fileName,
+                url: item.url,
+                id: item.url
+              })
+            })
+          }
+        })
       },
       submitUpload () {
-        this.$refs.upload.submit()
+        if (this.fileList.length === 0) {
+          return this.$message.warning('请选取文件后再上传')
+        }
+        const formData = new FormData()
+        this.fileList.forEach((file) => {
+          formData.append('file', file.raw)
+        })
+        uploadFiles(formData).then(({data}) => {
+          if (data && data.code === '200') {
+            data.data.forEach((item) => {
+              let fileData = this.fileList.find((file) => file.name === item.originFileName)
+              fileData.url = item.fileUrl
+            })
+            this.$message.success('上传成功')
+          } else {
+            this.$message.error('上传失败')
+          }
+        })
       },
       handleRemove (file, fileList) {
-        console.log(file, fileList)
+        this.fileList = fileList
       },
       handlePreview (file) {
-        console.log(file)
+        if (file && file.url) {
+          // 获取文件路径
+          this.previewPath = downloadUrl + file.url
+          this.previewName = file.name
+          this.previewVisible = true
+        }
+      },
+      handleChange (file, fileList) {
+        this.fileList = fileList
+      },
+      handleExceed (files, fileList) {
+        this.$message.warning(`当前限制选择 5 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
       },
       // 表单提交
       dataFormSubmit () {
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
-            this.$http({
-              url: this.$http.adornUrl(`/biz-service/flow/cusContractReview/submit`),
-              method: 'post',
-              data: this.$http.adornData(this.dataForm)
-            }).then(({data}) => {
+            // 添加附件
+            let fList = this.fileList
+            if (fList.length > 0) {
+              this.dataForm.attaches = []
+              for (let i = 0; i < fList.length; i++) {
+                this.dataForm.attaches.push({
+                  fileName: fList[i].name,
+                  url: fList[i].url
+                })
+              }
+            } else {
+              this.$message.error('清选择公告附件')
+              return
+            }
+            if (!this.dataForm.receivers || this.dataForm.receivers.length === 0) {
+              this.$message.error('清选择接收对象')
+              return
+            }
+            publishNotice(this.dataForm).then(({data}) => {
               if (data && data.code === '200') {
                 this.$message({
                   message: '操作成功',
@@ -153,6 +213,9 @@
       },
       validateField (type) {
         this.$refs.dataForm.validateField(type)
+      },
+      receiverChange (val) {
+        this.dataForm.receivers = val
       }
     }
   }