Forráskód Böngészése

Merge branch 'master' of http://112.74.164.79:3000/chenying/X-web

damon227 3 éve
szülő
commit
2eaf5d32f4

+ 1 - 0
package.json

@@ -33,6 +33,7 @@
     "svg-sprite-loader": "3.7.3",
     "vue": "2.5.16",
     "vue-cookie": "1.1.4",
+    "vue-notification": "^1.3.20",
     "vue-print-nb": "^1.7.5",
     "vue-router": "3.0.1",
     "vuedraggable": "^2.24.3",

+ 0 - 1
src/element-ui/index.js

@@ -141,7 +141,6 @@ Vue.use(Header)
 Vue.use(Aside)
 Vue.use(Main)
 Vue.use(Footer)
-
 Vue.use(Loading.directive)
 
 Vue.prototype.$loading = Loading.service

+ 21 - 1
src/store/modules/common.js

@@ -16,7 +16,27 @@ export default {
     contentIsNeedRefresh: false,
     // 主入口标签页
     mainTabs: [],
-    mainTabsActiveName: ''
+    mainTabsActiveName: '',
+    approveStates: [
+      {
+        code: null, value: '全部'
+      },
+      {
+        code: '0', value: '待提交'
+      },
+      {
+        code: '1', value: '待审批'
+      },
+      {
+        code: '2', value: '审批中'
+      },
+      {
+        code: '3', value: '审批完成'
+      },
+      {
+        code: '4', value: '审批不通过'
+      }
+    ]
   },
   mutations: {
     updateDocumentClientHeight (state, height) {

+ 28 - 22
src/views/common/msg.vue

@@ -1,22 +1,5 @@
 <template>
   <div>
-    <el-dialog
-      title="查看消息"
-      width="70%"
-      :close-on-click-modal="false"
-      :visible.sync="visible">
-      <el-form :model="dataForm" ref="dataForm" label-width="auto">
-        <el-form-item label="消息类型" prop="type">
-          <el-input v-model="dataForm.type"/>
-        </el-form-item>
-        <el-form-item label="标题" prop="title">
-          <el-input v-model="dataForm.title"/>
-        </el-form-item>
-        <el-form-item label="内容" prop="content">
-          <el-input v-model="dataForm.content"/>
-        </el-form-item>
-      </el-form>
-    </el-dialog>
   </div>
 </template>
 
@@ -32,20 +15,43 @@
     },
     mounted () {
       const that = this
+      const h = this.$createElement
       this.$nextTick(() => {
         this.$store.state.websocket.webSocket.onmessage = async function (event) {
           if (!event || !event.data) {
             return
           }
-          that.dataForm = JSON.parse(event.data)
-          // if (!that.visible) {
-          //   that.visible = true
-          // }
+          let json = JSON.parse(event.data)
+          console.log('json = ' + JSON.stringify(json))
+          if (json) {
+            that.$emit('noticeAdded', json.length)
+            json.forEach((item) => {
+              that.$notify({
+                title: item.title,
+                // dangerouslyUseHTMLString: true,
+                // message: h('i', {style: 'color: teal'}, item.content),
+                message: h('div', {}, [
+                  h('p', {}, '消息类别:' + that.getMsgType(item.type)),
+                  h('p', {}, '消息内容:' + item.content)
+                ]),
+                duration: 0
+              })
+            })
+          }
         }
       })
     },
     methods: {
-      // todo
+      getMsgType (type) {
+        if (!type) return '未知消息类型'
+        if (type === 1) {
+          return '公告消息'
+        } else if (type === 2) {
+          return '审批消息'
+        } else {
+          return '未知消息类型'
+        }
+      }
     }
   }
 </script>

+ 8 - 3
src/views/main-navbar.vue

@@ -19,7 +19,7 @@
         mode="horizontal">
         <el-menu-item index="0" @click="$router.push({ name: 'msgCenter' })">
           <template slot="title">
-            <el-badge value="1">
+            <el-badge :value="cnt">
               <icon-svg name="lingdang" class="el-icon-lingdang"></icon-svg>
             </el-badge>
           </template>
@@ -46,7 +46,7 @@
     </div>
     <!-- 弹窗, 修改密码 -->
     <update-password v-if="updatePasswordVisible" ref="updatePassowrd"></update-password>
-    <Msg ref="msgDialog"/>
+    <Msg ref="msgDialog" @noticeAdded="noticeAdded"/>
   </nav>
 </template>
 
@@ -57,7 +57,8 @@
   export default {
     data () {
       return {
-        updatePasswordVisible: false
+        updatePasswordVisible: false,
+        cnt: 0
       }
     },
     components: {
@@ -108,6 +109,10 @@
           //   }
           // })
         }).catch(() => {})
+      },
+      // 通知数量变化
+      noticeAdded (num) {
+        this.cnt += num
       }
     }
   }

+ 2 - 17
src/views/modules/cus/contract.vue

@@ -134,26 +134,11 @@
         totalPage: 0,
         dataListLoading: false,
         dataListSelections: [],
-        optionsState: [
-          {
-            code: '0', value: '待提交'
-          },
-          {
-            code: '1', value: '待审批'
-          },
-          {
-            code: '2', value: '审批中'
-          },
-          {
-            code: '3', value: '审批完成'
-          },
-          {
-            code: '4', value: '审批不通过'
-          }
-        ]
+        optionsState: []
       }
     },
     created () {
+      this.optionsState = this.$store.state.common.approveStates
       this.getTypeList()
       // this.getStateList()
       this.getDataList()

+ 2 - 20
src/views/modules/msg-center/announcement.vue

@@ -120,6 +120,7 @@
       Detail
     },
     created () {
+      this.optionsState = this.$store.state.common.approveStates
       this.queryData()
     },
     data () {
@@ -133,26 +134,7 @@
         downloadUrl: downloadUrl,
         dataListLoading: false,
         dataListSelections: [],
-        optionsState: [
-          {
-            code: null, value: '全部'
-          },
-          {
-            code: '0', value: '待提交'
-          },
-          {
-            code: '1', value: '待审批'
-          },
-          {
-            code: '2', value: '审批中'
-          },
-          {
-            code: '3', value: '审批完成'
-          },
-          {
-            code: '4', value: '审批不通过'
-          }
-        ],
+        optionsState: [],
         optionsCustomer: []
       }
     },

+ 2 - 20
src/views/modules/msg-center/approve.vue

@@ -138,6 +138,7 @@
       AddOrUpdate
     },
     created () {
+      this.optionsState = this.$store.state.common.approveStates
       this.queryData()
     },
     data () {
@@ -150,26 +151,7 @@
         totalPage: 0,
         dataListLoading: false,
         dataListSelections: [],
-        optionsState: [
-          {
-            code: null, value: '全部'
-          },
-          {
-            code: '0', value: '待提交'
-          },
-          {
-            code: '1', value: '待审批'
-          },
-          {
-            code: '2', value: '审批中'
-          },
-          {
-            code: '3', value: '审批完成'
-          },
-          {
-            code: '4', value: '审批不通过'
-          }
-        ],
+        optionsState: [],
         optionsType: [
           {
             code: null, value: '全部'

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

@@ -43,7 +43,10 @@
           </el-form-item>
         </el-row>
         <el-row>
-          <el-form-item label="接收对象" prop="receivers">
+          <el-form-item prop="receivers">
+            <span slot="label">
+              <span style="color: red">*</span>&nbsp;接收对象
+            </span>
             <el-input v-if="display" :disabled="true" v-model="dataForm.receiverList"/>
             <user-components v-else v-model="dataForm.receivers" :user-ids="dataForm.receivers" @change='receiverChange' :disabled="display"/>
           </el-form-item>
@@ -129,9 +132,6 @@
                   url: fList[i].url
                 })
               }
-            } else {
-              this.$message.error('清选择公告附件')
-              return
             }
             if (!this.dataForm.receivers || this.dataForm.receivers.length === 0) {
               this.$message.error('清选择接收对象')

+ 2 - 20
src/views/modules/order/order.vue

@@ -148,6 +148,7 @@
       AddOrUpdate, Detail
     },
     created () {
+      this.optionsState = this.$store.state.common.approveStates
       this.queryData()
     },
     data () {
@@ -161,26 +162,7 @@
         totalPage: 0,
         dataListLoading: false,
         dataListSelections: [],
-        optionsState: [
-          {
-            code: null, value: '全部'
-          },
-          {
-            code: '0', value: '待提交'
-          },
-          {
-            code: '1', value: '待审批'
-          },
-          {
-            code: '2', value: '审批中'
-          },
-          {
-            code: '3', value: '审批完成'
-          },
-          {
-            code: '4', value: '审批不通过'
-          }
-        ],
+        optionsState: [],
         optionsCustomer: []
       }
     },

+ 2 - 22
src/views/modules/sale/purchase.vue

@@ -166,31 +166,11 @@
         dataListSelections: [],
         optionsType: [],
         // 审批状态:0 待提交 1 待审批 2 审批中 3 审批完成 4 审批不通过
-        optionsState: [
-          {
-            code: '0',
-            value: '待提交'
-          },
-          {
-            code: '1',
-            value: '待审批'
-          },
-          {
-            code: '2',
-            value: '审批中'
-          },
-          {
-            code: '3',
-            value: '审批完成'
-          },
-          {
-            code: '4',
-            value: '审批不通过'
-          }
-        ]
+        optionsState: []
       }
     },
     created () {
+      this.optionsState = this.$store.state.common.approveStates
       this.getTypeList()
       this.getDataList()
     },

+ 2 - 22
src/views/modules/warehouse/stock-order.vue

@@ -145,6 +145,7 @@
     name: 'stock-order',
     components: {StockOrderInbound, UserComponent, StockOrderOutbound, Detail},
     created () {
+      this.optionsState = this.$store.state.common.approveStates
       this.queryData()
     },
     data () {
@@ -157,28 +158,7 @@
           date: '',
           recordType: '0'
         },
-        optionsState: [
-          {
-            code: '0',
-            value: '待提交'
-          },
-          {
-            code: '1',
-            value: '待审批'
-          },
-          {
-            code: '2',
-            value: '审批中'
-          },
-          {
-            code: '3',
-            value: '审批完成'
-          },
-          {
-            code: '4',
-            value: '审批不通过'
-          }
-        ],
+        optionsState: [],
         recordTypeOptions: [
           {
             value: null,

+ 5 - 0
yarn.lock

@@ -11666,6 +11666,11 @@ vue-loader@13.3.0:
     vue-style-loader "^3.0.0"
     vue-template-es2015-compiler "^1.6.0"
 
+vue-notification@^1.3.20:
+  version "1.3.20"
+  resolved "https://registry.nlark.com/vue-notification/download/vue-notification-1.3.20.tgz#d85618127763b46f3e25b8962b857947d5a97cbe"
+  integrity sha1-2FYYEndjtG8+JbiWK4V5R9WpfL4=
+
 vue-print-nb@^1.7.5:
   version "1.7.5"
   resolved "https://registry.nlark.com/vue-print-nb/download/vue-print-nb-1.7.5.tgz#0eaaf9317c233028458e8dbe8aa76603fef63b95"