GaoYuPeng 3 vuotta sitten
vanhempi
commit
0bceb2fc2c

+ 1 - 1
.env

@@ -4,7 +4,7 @@
4 4
 VUE_APP_TITLE=D2Admin
5 5
 
6 6
 # 网络请求公用地址
7
-VUE_APP_API=/api/
7
+VUE_APP_API=http://101.36.160.140:21023/api/
8 8
 
9 9
 # 仓库地址
10 10
 VUE_APP_REPO=https://github.com/d2-projects/d2-admin-start-kit

+ 3 - 0
.env.development

@@ -3,3 +3,6 @@
3 3
 # 页面 title 前缀
4 4
 VUE_APP_TITLE=数量监测智能眼系统
5 5
 
6
+
7
+# 网络请求公用地址
8
+VUE_APP_API=http://101.36.160.140:21023/api/

+ 2 - 2
src/App.vue

@@ -25,7 +25,7 @@ export default {
25 25
 
26 26
 <style lang="scss">
27 27
 @import '~@/assets/style/public-class.scss';
28
-//分页整体样式
28
+/* //分页整体样式
29 29
 .el-pagination{
30 30
   margin-top: 20px;
31 31
   display:flex;
@@ -47,6 +47,6 @@ justify-content: flex-end;
47 47
 //树形节点鼠标移上去的颜色
48 48
 .el-tree-node__content:hover {
49 49
      background-color:#91a8bc !important;
50
-}
50
+} */
51 51
 
52 52
 </style>

+ 15 - 0
src/api/modules/system/announcementManagement/index.api.js

@@ -0,0 +1,15 @@
1
+export default ({ service, request, serviceForMock, requestForMock, mock, faker, tools }) => ({
2
+  /**
3
+   * @description 登录
4
+   * @param {Object} data 登录携带的信息
5
+   */
6
+   getOrgAnnouncementPage(data) {
7
+    return request({
8
+      url: '/orgAnnouncement/authority/getOrgAnnouncementPage',
9
+      method: 'post',
10
+      data
11
+    })
12
+  },
13
+
14
+})
15
+

+ 426 - 0
src/utils/index.js

@@ -0,0 +1,426 @@
1
+
2
+
3
+/**
4
+ * Parse the time to string
5
+ * @param {(Object|string|number)} time
6
+ * @param {string} cFormat
7
+ * @returns {string | null}
8
+ */
9
+ export function parseTime(time, cFormat) {
10
+  if (arguments.length === 0 || !time) {
11
+    return null
12
+  }
13
+  const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
14
+  let date
15
+  if (typeof time === 'object') {
16
+    date = time
17
+  } else {
18
+    if ((typeof time === 'string')) {
19
+      if ((/^[0-9]+$/.test(time))) {
20
+        // support "1548221490638"
21
+        time = parseInt(time)
22
+      } else {
23
+        // support safari
24
+        // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
25
+        time = time.replace(new RegExp(/-/gm), '/')
26
+      }
27
+    }
28
+
29
+    if ((typeof time === 'number') && (time.toString().length === 10)) {
30
+      time = time * 1000
31
+    }
32
+    date = new Date(time)
33
+  }
34
+  const formatObj = {
35
+    y: date.getFullYear(),
36
+    m: date.getMonth() + 1,
37
+    d: date.getDate(),
38
+    h: date.getHours(),
39
+    i: date.getMinutes(),
40
+    s: date.getSeconds(),
41
+    a: date.getDay()
42
+  }
43
+  const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
44
+    const value = formatObj[key]
45
+    // Note: getDay() returns 0 on Sunday
46
+    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
47
+    return value.toString().padStart(2, '0')
48
+  })
49
+  return time_str
50
+}
51
+
52
+/**
53
+ * @param {number} time
54
+ * @param {string} option
55
+ * @returns {string}
56
+ */
57
+export function formatTime(time, option) {
58
+  if (('' + time).length === 10) {
59
+    time = parseInt(time) * 1000
60
+  } else {
61
+    time = +time
62
+  }
63
+  const d = new Date(time)
64
+  const now = Date.now()
65
+
66
+  const diff = (now - d) / 1000
67
+
68
+  if (diff < 30) {
69
+    return '刚刚'
70
+  } else if (diff < 3600) {
71
+    // less 1 hour
72
+    return Math.ceil(diff / 60) + '分钟前'
73
+  } else if (diff < 3600 * 24) {
74
+    return Math.ceil(diff / 3600) + '小时前'
75
+  } else if (diff < 3600 * 24 * 2) {
76
+    return '1天前'
77
+  }
78
+  if (option) {
79
+    return parseTime(time, option)
80
+  } else {
81
+    return (
82
+      d.getMonth() +
83
+      1 +
84
+      '月' +
85
+      d.getDate() +
86
+      '日' +
87
+      d.getHours() +
88
+      '时' +
89
+      d.getMinutes() +
90
+      '分'
91
+    )
92
+  }
93
+}
94
+
95
+/**
96
+ * @param {string} url
97
+ * @returns {Object}
98
+ */
99
+export function getQueryObject(url) {
100
+  url = url == null ? window.location.href : url
101
+  const search = url.substring(url.lastIndexOf('?') + 1)
102
+  const obj = {}
103
+  const reg = /([^?&=]+)=([^?&=]*)/g
104
+  search.replace(reg, (rs, $1, $2) => {
105
+    const name = decodeURIComponent($1)
106
+    let val = decodeURIComponent($2)
107
+    val = String(val)
108
+    obj[name] = val
109
+    return rs
110
+  })
111
+  return obj
112
+}
113
+
114
+/**
115
+ * @param {string} input value
116
+ * @returns {number} output value
117
+ */
118
+export function byteLength(str) {
119
+  // returns the byte length of an utf8 string
120
+  let s = str.length
121
+  for (var i = str.length - 1; i >= 0; i--) {
122
+    const code = str.charCodeAt(i)
123
+    if (code > 0x7f && code <= 0x7ff) s++
124
+    else if (code > 0x7ff && code <= 0xffff) s += 2
125
+    if (code >= 0xDC00 && code <= 0xDFFF) i--
126
+  }
127
+  return s
128
+}
129
+
130
+/**
131
+ * @param {Array} actual
132
+ * @returns {Array}
133
+ */
134
+export function cleanArray(actual) {
135
+  const newArray = []
136
+  for (let i = 0; i < actual.length; i++) {
137
+    if (actual[i]) {
138
+      newArray.push(actual[i])
139
+    }
140
+  }
141
+  return newArray
142
+}
143
+
144
+/**
145
+ * @param {Object} json
146
+ * @returns {Array}
147
+ */
148
+export function param(json) {
149
+  if (!json) return ''
150
+  return cleanArray(
151
+    Object.keys(json).map(key => {
152
+      if (json[key] === undefined) return ''
153
+      return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
154
+    })
155
+  ).join('&')
156
+}
157
+
158
+/**
159
+ * @param {string} url
160
+ * @returns {Object}
161
+ */
162
+export function param2Obj(url) {
163
+  const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
164
+  if (!search) {
165
+    return {}
166
+  }
167
+  const obj = {}
168
+  const searchArr = search.split('&')
169
+  searchArr.forEach(v => {
170
+    const index = v.indexOf('=')
171
+    if (index !== -1) {
172
+      const name = v.substring(0, index)
173
+      const val = v.substring(index + 1, v.length)
174
+      obj[name] = val
175
+    }
176
+  })
177
+  return obj
178
+}
179
+
180
+/**
181
+ * @param {string} val
182
+ * @returns {string}
183
+ */
184
+export function html2Text(val) {
185
+  const div = document.createElement('div')
186
+  div.innerHTML = val
187
+  return div.textContent || div.innerText
188
+}
189
+
190
+/**
191
+ * Merges two objects, giving the last one precedence
192
+ * @param {Object} target
193
+ * @param {(Object|Array)} source
194
+ * @returns {Object}
195
+ */
196
+export function objectMerge(target, source) {
197
+  if (typeof target !== 'object') {
198
+    target = {}
199
+  }
200
+  if (Array.isArray(source)) {
201
+    return source.slice()
202
+  }
203
+  Object.keys(source).forEach(property => {
204
+    const sourceProperty = source[property]
205
+    if (typeof sourceProperty === 'object') {
206
+      target[property] = objectMerge(target[property], sourceProperty)
207
+    } else {
208
+      target[property] = sourceProperty
209
+    }
210
+  })
211
+  return target
212
+}
213
+
214
+/**
215
+ * @param {HTMLElement} element
216
+ * @param {string} className
217
+ */
218
+export function toggleClass(element, className) {
219
+  if (!element || !className) {
220
+    return
221
+  }
222
+  let classString = element.className
223
+  const nameIndex = classString.indexOf(className)
224
+  if (nameIndex === -1) {
225
+    classString += '' + className
226
+  } else {
227
+    classString =
228
+      classString.substr(0, nameIndex) +
229
+      classString.substr(nameIndex + className.length)
230
+  }
231
+  element.className = classString
232
+}
233
+
234
+/**
235
+ * @param {string} type
236
+ * @returns {Date}
237
+ */
238
+export function getTime(type) {
239
+  if (type === 'start') {
240
+    return new Date().getTime() - 3600 * 1000 * 24 * 90
241
+  } else {
242
+    return new Date(new Date().toDateString())
243
+  }
244
+}
245
+
246
+/**
247
+ * @param {Function} func
248
+ * @param {number} wait
249
+ * @param {boolean} immediate
250
+ * @return {*}
251
+ */
252
+export function debounce(func, wait, immediate) {
253
+  let timeout, args, context, timestamp, result
254
+
255
+  const later = function() {
256
+    // 据上一次触发时间间隔
257
+    const last = +new Date() - timestamp
258
+
259
+    // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
260
+    if (last < wait && last > 0) {
261
+      timeout = setTimeout(later, wait - last)
262
+    } else {
263
+      timeout = null
264
+      // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
265
+      if (!immediate) {
266
+        result = func.apply(context, args)
267
+        if (!timeout) context = args = null
268
+      }
269
+    }
270
+  }
271
+
272
+  return function(...args) {
273
+    context = this
274
+    timestamp = +new Date()
275
+    const callNow = immediate && !timeout
276
+    // 如果延时不存在,重新设定延时
277
+    if (!timeout) timeout = setTimeout(later, wait)
278
+    if (callNow) {
279
+      result = func.apply(context, args)
280
+      context = args = null
281
+    }
282
+
283
+    return result
284
+  }
285
+}
286
+
287
+/**
288
+ * This is just a simple version of deep copy
289
+ * Has a lot of edge cases bug
290
+ * If you want to use a perfect deep copy, use lodash's _.cloneDeep
291
+ * @param {Object} source
292
+ * @returns {Object}
293
+ */
294
+export function deepClone(source) {
295
+  if (!source && typeof source !== 'object') {
296
+    throw new Error('error arguments', 'deepClone')
297
+  }
298
+  const targetObj = source.constructor === Array ? [] : {}
299
+  Object.keys(source).forEach(keys => {
300
+    if (source[keys] && typeof source[keys] === 'object') {
301
+      targetObj[keys] = deepClone(source[keys])
302
+    } else {
303
+      targetObj[keys] = source[keys]
304
+    }
305
+  })
306
+  return targetObj
307
+}
308
+
309
+/**
310
+ * @param {Array} arr
311
+ * @returns {Array}
312
+ */
313
+export function uniqueArr(arr) {
314
+  return Array.from(new Set(arr))
315
+}
316
+
317
+/**
318
+ * @returns {string}
319
+ */
320
+export function createUniqueString() {
321
+  const timestamp = +new Date() + ''
322
+  const randomNum = parseInt((1 + Math.random()) * 65536) + ''
323
+  return (+(randomNum + timestamp)).toString(32)
324
+}
325
+
326
+/**
327
+ * Check if an element has a class
328
+ * @param {HTMLElement} elm
329
+ * @param {string} cls
330
+ * @returns {boolean}
331
+ */
332
+export function hasClass(ele, cls) {
333
+  return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
334
+}
335
+
336
+/**
337
+ * Add class to element
338
+ * @param {HTMLElement} elm
339
+ * @param {string} cls
340
+ */
341
+export function addClass(ele, cls) {
342
+  if (!hasClass(ele, cls)) ele.className += ' ' + cls
343
+}
344
+
345
+/**
346
+ * Remove class from element
347
+ * @param {HTMLElement} elm
348
+ * @param {string} cls
349
+ */
350
+export function removeClass(ele, cls) {
351
+  if (hasClass(ele, cls)) {
352
+    const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
353
+    ele.className = ele.className.replace(reg, ' ')
354
+  }
355
+}
356
+
357
+
358
+//时间格式化
359
+export function getNowFormatDate() {
360
+  var date = new Date()
361
+  var seperator1 = "-"
362
+
363
+  var year = date.getFullYear()
364
+  var month = date.getMonth() + 1
365
+  var hour = date.getHours()
366
+  var minutes = date.getMinutes()
367
+  // var seconds = date.getSeconds();
368
+  var strDate = date.getDate()
369
+
370
+  if (month >= 1 && month <= 9) {
371
+    month = "0" + month
372
+  }
373
+  if (strDate >= 0 && strDate <= 9) {
374
+    strDate = "0" + strDate
375
+  }
376
+  if (minutes >= 0 && minutes <= 9) {
377
+    minutes = "0" + minutes
378
+  }
379
+  // var currentdate = year + seperator1 + month + seperator1 + strDate+"  "+hour+":" +minutes+":" +seconds;
380
+
381
+  var currentdate =year+seperator1+month+seperator1+strDate+" "+hour+":"+minutes
382
+
383
+  return currentdate
384
+}
385
+//时间格式化
386
+export function getNowFormatDateone() {
387
+  var date = new Date()
388
+  var seperator1 = "-"
389
+
390
+  var year = date.getFullYear()
391
+  var month = date.getMonth() + 1
392
+  var hour = date.getHours()
393
+  var minutes = date.getMinutes()
394
+  var seconds = date.getSeconds();
395
+  var strDate = date.getDate()
396
+
397
+  if (month >= 1 && month <= 9) {
398
+    month = "0" + month
399
+  }
400
+  if (strDate >= 0 && strDate <= 9) {
401
+    strDate = "0" + strDate
402
+  }
403
+  if (minutes >= 0 && minutes <= 9) {
404
+    minutes = "0" + minutes
405
+  }
406
+  if (seconds >= 0 && seconds <= 9) {
407
+    seconds = "0" + seconds
408
+  }
409
+  // var currentdate = year + seperator1 + month + seperator1 + strDate+"  "+hour+":" +minutes+":" +seconds;
410
+
411
+  var currentdate =
412
+    year +
413
+    seperator1 +
414
+    month+
415
+    seperator1 +
416
+    strDate 
417
+    +
418
+    "  " +
419
+    hour +
420
+    ":" +
421
+    minutes
422
+    // ":"+
423
+    // seconds
424
+
425
+  return currentdate
426
+}

+ 336 - 9
src/views/demo/system/announcementManagement/index.vue

@@ -1,14 +1,341 @@
1 1
 <template>
2
-    <div>
3
-         <d2-container>
4
-    <template slot="header">系统管理/公告管理</template>
5
- 公告管理
6
-  </d2-container>
7
-      
8
-    </div>
2
+  <div>
3
+    <d2-container>
4
+      <template slot="header">
5
+        <div class="nav">当前所在位置:系统管理>公告管理</div>
6
+      </template>
7
+      <div>
8
+        <div class="right_main">
9
+          <div class="right_title">
10
+            <i class="fa fa-university" aria-hidden="true" style="padding-right: 5px"></i>公告管理
11
+          </div>
12
+          <div class="right_table">
13
+            <el-form :inline="true" :model="formInline" class="demo-form-inline float-left" id="formLabel">
14
+              <!-- <el-form-item label="仓房名称:">
15
+                <el-cascader :options="options"></el-cascader>
16
+              </el-form-item> -->
17
+              <el-form-item label="发布时间">
18
+                <el-date-picker v-model="value2" type="datetimerange" :picker-options="pickerOptions" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" align="right" value-format="yyyy-MM-dd hh:mm">
19
+                </el-date-picker>
20
+              </el-form-item>
21
+              <el-form-item>
22
+                <el-button type="primary" icon="el-icon-search" @click="gettime">查询</el-button>
23
+              </el-form-item>
24
+
25
+              <el-form-item>
26
+                <el-button type="primary" icon="el-icon-refresh-left" @click="reset">重置</el-button>
27
+              </el-form-item>
28
+            </el-form>
29
+            <div class="float-right">
30
+              <el-button type="primary" icon="fa fa-volume-up" @click="dialogFormVisible = true">发布公告</el-button>
31
+            </div>
32
+
33
+            <el-table :data="cfInfoList" border style="width: 100%" :header-cell-style="{ background: '#0064b9', color: '#c9f5fa' }">
34
+              <el-table-column type="index" width="50">
35
+              </el-table-column>
36
+              <el-table-column prop="title" label="公告标题" align="center">
37
+              </el-table-column>
38
+              <el-table-column prop="details" label="公告详情" align="center">
39
+              </el-table-column>
40
+              <el-table-column prop="state" label="发布状态" align="center">
41
+              </el-table-column>
42
+              <el-table-column prop="publisher" label="发布人" align="center">
43
+              </el-table-column>
44
+              <el-table-column prop="time" label="发布时间" align="center">
45
+              </el-table-column>
46
+
47
+              <el-table-column align="center" label="操作" width="180">
48
+                <template slot-scope="scope">
49
+                  <el-button @click="handleCheck(scope.row)" type="text" size="small" icon="el-icon-circle-check">查看</el-button>
50
+                  <el-button type="text" size="small" icon="el-icon-edit">编辑</el-button>
51
+                  <el-button type="text" size="small" icon="el-icon-delete">删除</el-button>
52
+                </template>
53
+              </el-table-column>
54
+            </el-table>
55
+            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="1" :page-sizes="[10, 20, 30, 40]" :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total">
56
+            </el-pagination>
57
+            <!-- <pagination
58
+        
59
+          :total="total"
60
+          :page.sync="listQuery.page"
61
+          :limit.sync="listQuery.limit"
62
+          @pagination="getList"
63
+        /> -->
64
+          </div>
65
+        </div>
66
+      </div>
67
+
68
+      <el-dialog title="发布公告" :visible.sync="dialogFormVisible">
69
+        <el-form :model="diaform" :rules="rules" ref="ruleForm">
70
+          <el-form-item label="公告标题" prop="title" :label-width="formLabelWidth">
71
+            <el-input v-model="diaform.title" style="width:500px"></el-input>
72
+          </el-form-item>
73
+          <el-form-item label="公告详情" prop="details" :label-width="formLabelWidth">
74
+            <el-input type="textarea" v-model="diaform.details" rows="10" style="width:500px"></el-input>
75
+          </el-form-item>
76
+          <el-form-item label="发布人" prop="publisher" :label-width="formLabelWidth">
77
+            <el-input v-model="diaform.publisher" style="width:500px" :disabled="true"></el-input>
78
+          </el-form-item>
79
+          <el-form-item label="发布时间" prop="time" :label-width="formLabelWidth">
80
+            <el-input v-model="diaform.time" style="width:500px" :disabled="true"></el-input>
81
+          </el-form-item>
82
+          <el-form-item>
83
+            <el-button type="primary" @click="submitForm('diaform')">立即创建</el-button>
84
+            <el-button @click="resetForm('ruleForm')">重置</el-button>
85
+            <el-button @click="dialogFormVisible = false">取 消</el-button>
86
+            <el-button type="primary" @click="dialogFormVisible = false">保存为草稿</el-button>
87
+            <el-button type="primary" @click="issue">正式发布</el-button>
88
+          </el-form-item>
89
+        </el-form>
90
+        <!-- <div slot="footer" class="dialog-footer">
91
+          <el-button @click="dialogFormVisible = false">取 消</el-button>
92
+          <el-button type="primary" @click="dialogFormVisible = false">保存为草稿</el-button>
93
+          <el-button type="primary" @click="issue">正式发布</el-button>
94
+        </div> -->
95
+      </el-dialog>
96
+    </d2-container>
97
+  </div>
9 98
 </template>
10 99
 <script>
100
+// 引入分页
101
+import Pagination from '@/components/pagination'
102
+import { parseTime } from "@/utils/index"
103
+import api from '@api'
11 104
 export default {
12
-  name:"announcementManagement"
105
+
106
+  name: "announcementManagement",
107
+  components: { Pagination },
108
+  data () {
109
+    return {
110
+      //options
111
+      options: [
112
+        {
113
+          value: 'zhinan',
114
+          label: '指南',
115
+
116
+          children:
117
+            [{
118
+              value: 'shejiyuanze',
119
+              label: '设计原则',
120
+              children: [
121
+                {
122
+                  value: 'yizhi',
123
+                  label: '一致'
124
+                },
125
+                {
126
+                  value: 'fankui',
127
+                  label: '反馈'
128
+                },
129
+                {
130
+                  value: 'xiaolv',
131
+                  label: '效率'
132
+                },
133
+                {
134
+                  value: 'kekong',
135
+                  label: '可控'
136
+                }
137
+              ],
138
+            }]
139
+        }],
140
+
141
+      //头部查询条件
142
+      formInline: {
143
+        // cfName: "",
144
+        issueTime: "",
145
+      },
146
+      //表格字段
147
+      cfInfoList: [
148
+        {
149
+          title: '关于数量监测系统正式使用通知', //公告标题
150
+          details: '关于数量监测系统正式使用通知...',//公告详情
151
+          state: '已发布',
152
+          publisher: '孟莹',//发布人 
153
+          time: '2021-10-20 17:43:11'//发布时间
154
+        },
155
+        {
156
+          title: '关于数量监测系统正式使用通知', //公告标题
157
+          details: '关于数量监测系统正式使用通知...',//公告详情
158
+          state: '已发布',
159
+          publisher: '孟莹',//发布人 
160
+          time: '2021-10-20 17:43:11'//发布时间
161
+        },
162
+        {
163
+          title: '关于数量监测系统正式使用通知', //公告标题
164
+          details: '关于数量监测系统正式使用通知...',//公告详情
165
+          state: '已发布',
166
+          publisher: '孟莹',//发布人 
167
+          time: '2021-10-20 17:43:11'//发布时间
168
+        },
169
+        {
170
+          title: '关于数量监测系统正式使用通知', //公告标题
171
+          details: '关于数量监测系统正式使用通知...',//公告详情
172
+          state: '已发布',
173
+          publisher: '孟莹',//发布人 
174
+          time: '2021-10-20 17:43:11'//发布时间
175
+        },
176
+        {
177
+          title: '关于数量监测系统正式使用通知', //公告标题
178
+          details: '关于数量监测系统正式使用通知...',//公告详情
179
+          state: '已发布',
180
+          publisher: '孟莹',//发布人 
181
+          time: '2021-10-20 17:43:11'//发布时间
182
+        },
183
+        {
184
+          title: '关于数量监测系统正式使用通知', //公告标题
185
+          details: '关于数量监测系统正式使用通知...',//公告详情
186
+          state: '已发布',
187
+          publisher: '孟莹',//发布人 
188
+          time: '2021-10-20 17:43:11'//发布时间
189
+        }
190
+
191
+      ],
192
+      // 日期插件
193
+
194
+      pickerOptions: {
195
+        shortcuts: [{
196
+          text: '最近一周',
197
+          onClick (picker) {
198
+            const end = new Date();
199
+            const start = new Date();
200
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
201
+            picker.$emit('pick', [start, end]);
202
+          }
203
+        }, {
204
+          text: '最近一个月',
205
+          onClick (picker) {
206
+            const end = new Date();
207
+            const start = new Date();
208
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
209
+            picker.$emit('pick', [start, end]);
210
+          }
211
+        }, {
212
+          text: '最近三个月',
213
+          onClick (picker) {
214
+            const end = new Date();
215
+            const start = new Date();
216
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
217
+            picker.$emit('pick', [start, end]);
218
+          }
219
+        }]
220
+      },
221
+      value2: '', //日期
222
+      //弹窗
223
+      dialogTableVisible: false,
224
+      dialogFormVisible: false,
225
+      formLabelWidth: '120px',
226
+
227
+      //分页
228
+      total: 30,
229
+      listQuery: {
230
+        page: 1,
231
+        limit: 10,
232
+        importance: undefined,
233
+        title: undefined,
234
+        type: undefined,
235
+        sort: '+id'
236
+      },
237
+      //弹窗表单
238
+      diaform: {
239
+        title: '', //公告标题
240
+        details: '',//公告详情
241
+        publisher: '',//发布人
242
+        time: ''//发布时间
243
+      },
244
+      rules: {
245
+        title: [
246
+          { required: true, message: '请输入公告标题', trigger: 'blur' },
247
+          { min: 3, message: '长度在 3 字符以上', trigger: 'blur' }
248
+        ],
249
+        details: [
250
+          { required: true, message: '请填写公告详情', trigger: 'blur' }
251
+        ],
252
+      },
253
+      pagination: {
254
+        // 每页显示的条数
255
+        pageSize: 10,
256
+        // 当前页
257
+        curPage: 1,
258
+        // 总数
259
+        total: 20
260
+      },
261
+
262
+    };
263
+  },
264
+  created: function () {
265
+    this.diaform.publisher = '孟莹'
266
+    this.diaform.time = parseTime(new Date())
267
+    // this.dateFormat(new Date('yyyy-MM-dd hh:mm'))
268
+    this.getpageinfo()
269
+  },
270
+  mounted () { },
271
+  methods: {
272
+    search () { },
273
+    reset () { },
274
+    getList () { },
275
+    //查看
276
+    handleCheck () {
277
+      this.$router.push(
278
+        {
279
+          path: "/warehouseInfo-check"
280
+        }
281
+      )
282
+    },
283
+    gettime () {
284
+      console.log(this.value2, 'value2')
285
+      console.log(this.value2[0], '开始时间')
286
+      console.log(this.value2[1], '结束时间')
287
+    },
288
+    //重置时间
289
+    reset () {
290
+      this.value2 = ''
291
+    },
292
+    // 保存为草稿
293
+    // 正式发布
294
+    issue () {
295
+      console.log(this.diaform, 'diaform')
296
+      this.dialogFormVisible = false
297
+    },
298
+    submitForm (formName) {
299
+      this.$refs[formName].validate((valid) => {
300
+        if (valid) {
301
+          alert('submit!');
302
+        } else {
303
+          console.log('error submit!!');
304
+          return false;
305
+        }
306
+      });
307
+    },
308
+
309
+    getpageinfo (data) {
310
+      data = {
311
+        "pageIndex": 1,
312
+        "pageSize": 10,
313
+        "createTimeStart": "2021-10-01",
314
+        "createTimeEnd": "2021-12-01"
315
+      }
316
+
317
+      api.getOrgAnnouncementPage(data).then(res => {
318
+        console.log(res, 'res')
319
+      }).catch(err => {
320
+        console.log(err, 'err')
321
+      })
322
+    }
323
+
324
+  },
325
+
326
+};
327
+</script>
328
+<style lang="scss" scoped>
329
+.nav {
330
+  color: #fff;
331
+  font-size: 14px;
332
+
333
+  background: #004a93;
13 334
 }
14
-</script>
335
+.float-left {
336
+  float: left;
337
+}
338
+.float-right {
339
+  float: right;
340
+}
341
+</style>

+ 139 - 35
src/views/demo/system/organization/index.vue

@@ -33,8 +33,8 @@
33 33
                 </div>
34 34
                 <div class="float-right">
35 35
                   <el-form-item>
36
-                   
37
-                    <el-button type="primary" icon="el-icon-plus" @click="dialogFormVisible = true" >新建机构</el-button>
36
+
37
+                    <el-button type="primary" icon="el-icon-plus" @click="dialogFormVisible = true">新建机构</el-button>
38 38
                   </el-form-item>
39 39
                   <el-form-item>
40 40
                     <el-button @click="toggleRowExpansion(true)">全部展开</el-button>
@@ -44,15 +44,15 @@
44 44
                   </el-form-item>
45 45
                 </div>
46 46
               </el-form>
47
-              <el-table :data="tableData" ref='dataTreeList' style="width: 100%" :header-cell-style="{ background: '#0064b9', color: '#c9f5fa' }" row-key="id" border :tree-props="{children: 'children',hasChildren: 'hasChildren',}">
48
-                <el-table-column prop="OrganizationName" label="组织机构名称" align="center">
47
+              <el-table :data="tableData1" ref='dataTreeList' style="width: 100%" :header-cell-style="{ background: '#0064b9', color: '#c9f5fa' }" row-key="id" border :tree-props="{children: 'children',hasChildren: 'hasChildren',}">
48
+                <el-table-column prop="orgName" label="组织机构名称" align="center">
49 49
                 </el-table-column>
50
-                <el-table-column prop="storeType" label="仓库类型" align="center">
50
+                <el-table-column prop="storeTypeName" label="仓库类型" align="center">
51 51
                 </el-table-column>
52 52
 
53
-                <el-table-column prop="state" label="机构状态" align="center">
53
+                <el-table-column prop="orgState" label="机构状态" align="center">
54 54
                 </el-table-column>
55
-                <el-table-column prop="CreateDate" label="创建时间" align="center">
55
+                <el-table-column prop="buildTime" label="创建时间" align="center">
56 56
                 </el-table-column>
57 57
                 <el-table-column fixed="right" label="操作" width="200">
58 58
                   <template slot-scope="scope">
@@ -68,23 +68,38 @@
68 68
           </div>
69 69
         </div>
70 70
       </div>
71
-      <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
72
-  <el-form :model="form">
73
-    <el-form-item label="活动名称" :label-width="formLabelWidth">
74
-      <el-input v-model="form.name" autocomplete="off" style="width:223px"></el-input>
75
-    </el-form-item>
76
-    <el-form-item label="活动区域" :label-width="formLabelWidth">
77
-      <el-select v-model="form.region" placeholder="请选择活动区域">
78
-        <el-option label="区域一" value="shanghai"></el-option>
79
-        <el-option label="区域二" value="beijing"></el-option>
80
-      </el-select>
81
-    </el-form-item>
82
-  </el-form>
83
-  <div slot="footer" class="dialog-footer">
84
-    <el-button @click="dialogFormVisible = false">取 消</el-button>
85
-    <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
86
-  </div>
87
-</el-dialog>
71
+      <el-dialog title="新建机构" :visible.sync="dialogFormVisible">
72
+        <el-form :model="ruleForm" :rules="rules" ref="ruleForm">
73
+          <el-form-item label="机构名称" prop="name" :label-width="formLabelWidth">
74
+            <el-input v-model="ruleForm.name" style="width:500px"></el-input>
75
+          </el-form-item>
76
+          <el-form-item label="上级机构" prop="superior" :label-width="formLabelWidth">
77
+            <!-- <el-input type="textarea" v-model="ruleForm.superior" rows="10" style="width:500px"></el-input> -->
78
+            <el-select v-model="superior" multiple filterable remote reserve-keyword placeholder="请输入关键词" :remote-method="remoteMethod" :loading="loading">
79
+              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" style="width:500px">
80
+              </el-option>
81
+            </el-select>
82
+          </el-form-item>
83
+          <el-form-item label="机构状态" prop="status" :label-width="formLabelWidth">
84
+            <!-- <el-radio v-model="ruleForm.status" label="1" border>备选项1</el-radio>
85
+            <el-radio v-model="ruleForm.status" label="2" border>备选项2</el-radio> -->
86
+            <el-radio-group v-model="ruleForm.status" size="small">
87
+              <el-radio label="1" border>备选项1</el-radio>
88
+              <el-radio label="2" border >备选项2</el-radio>
89
+            </el-radio-group>
90
+            <!-- <el-input v-model="ruleForm.status" style="width:500px" :disabled="true"></el-input> -->
91
+          </el-form-item>
92
+
93
+          <el-form-item>
94
+            <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
95
+            <el-button @click="resetForm('ruleForm')">重置</el-button>
96
+          </el-form-item>
97
+        </el-form>
98
+        <div slot="footer" class="dialog-footer">
99
+          <el-button @click="dialogFormVisible = false">取 消</el-button>
100
+          <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
101
+        </div>
102
+      </el-dialog>
88 103
     </d2-container>
89 104
   </div>
90 105
 </template>
@@ -112,7 +127,7 @@ export default {
112 127
           cfState: ''
113 128
         }
114 129
       ],
115
-      tableData: [{
130
+      /* tableData: [{
116 131
         id: 1,
117 132
         CreateDate: '2016-05-02',
118 133
         OrganizationName: '王小虎',
@@ -149,13 +164,91 @@ export default {
149 164
         OrganizationName: '王小虎',
150 165
         storeType: '直属库',
151 166
         state: '启用',
152
-      }],
167
+      }], */
168
+      tableData:[
169
+        {
170
+            "id": 1,
171
+            "orgName": "中储粮河南分公司",
172
+            "storeTypeName": "直属库",
173
+            "storeTypeCode": 1,
174
+            "orgState": "1",
175
+            "parentId": 0,
176
+            "buildTime": "2021-10-20 19:37:08",
177
+            "children": [
178
+                {
179
+                    "id": 2,
180
+                    "orgName": "商丘直属库",
181
+                    "storeTypeName": "直属库",
182
+                    "storeTypeCode": 1,
183
+                    "orgState": "1",
184
+                    "parentId": 1,
185
+                    "buildTime": "2021-10-20 19:38:38",
186
+                    "children": [
187
+                        {
188
+                            "id": 3,
189
+                            "orgName": "宁陵粮油储备公司",
190
+                            "storeTypeName": "直属库",
191
+                            "storeTypeCode": 1,
192
+                            "orgState": "1",
193
+                            "parentId": 2,
194
+                            "buildTime": "2021-10-20 19:39:02",
195
+                            "children": [
196
+                                {
197
+                                    "id": 4,
198
+                                    "orgName": "1号仓",
199
+                                    "storeTypeName": "直属库",
200
+                                    "storeTypeCode": 1,
201
+                                    "orgState": "1",
202
+                                    "parentId": 3,
203
+                                    "buildTime": "2021-10-20 19:39:49",
204
+                                    "children": []
205
+                                },
206
+                                {
207
+                                    "id": 5,
208
+                                    "orgName": "2号仓",
209
+                                    "storeTypeName": "直属库",
210
+                                    "storeTypeCode": 1,
211
+                                    "orgState": "1",
212
+                                    "parentId": 3,
213
+                                    "buildTime": "2021-10-20 19:39:49",
214
+                                    "children": []
215
+                                },
216
+                                {
217
+                                    "id": 6,
218
+                                    "orgName": "3号仓",
219
+                                    "storeTypeName": "直属库",
220
+                                    "storeTypeCode": 1,
221
+                                    "orgState": "1",
222
+                                    "parentId": 3,
223
+                                    "buildTime": "2021-10-20 19:39:49",
224
+                                    "children": []
225
+                                }
226
+                            ]
227
+                        }
228
+                    ]
229
+                }
230
+            ]
231
+        }
232
+    ],
233
+      tableData1:[],
153 234
       dialogTableVisible: false,
154 235
       dialogFormVisible: false,
155 236
       formLabelWidth: '120px',
156
-      form:{
157
-        name:'',
158
-        region:''
237
+      form: {
238
+        name: '',
239
+        region: ''
240
+      },
241
+      ruleForm: {
242
+        name: '', //公告标题
243
+        superior: '',//上级机构
244
+        radio1: '1',
245
+        status: ''//机构状态
246
+      },
247
+      rules: {
248
+        name: [
249
+          { required: true, message: '请输入机构名称', trigger: 'blur' },
250
+        ],
251
+
159 252
       },
160 253
       pagination: {
161 254
         // 每页显示的条数
@@ -172,8 +265,13 @@ export default {
172 265
       this.$refs.tree.filter(val)
173 266
     }
174 267
   },
268
+  created () {
269
+this.tableData1[0]=JSON.parse(JSON.stringify(this.tableData[0])) 
270
+      console.log(this.tableData1,'tableData1')
271
+  },
175 272
   mounted () {
176 273
     this.restaurants = this.loadAll();
274
+    
177 275
   },
178 276
   methods: {
179 277
     filterNode (value, data) {
@@ -263,11 +361,15 @@ export default {
263 361
       console.log(ev);
264 362
     },
265 363
     // 全部展开
266
-  toggleRowExpansion(isExpansion){
267
-    this.tableData.forEach(item=>{
268
-        this.$refs.dataTreeList.toggleRowExpansion(item,isExpansion);
269
-    })
270
-  },
364
+    toggleRowExpansion (isExpansion) {
365
+      this.tableData.forEach(item => {
366
+        this.$refs.dataTreeList.toggleRowExpansion(item, isExpansion);
367
+      })
368
+    },
369
+    reset (){
370
+      this.tableData1[0]=JSON.parse(JSON.stringify(this.tableData[0])) 
371
+      console.log(this.tableData1,'tableData1')
372
+    }
271 373
 
272 374
   }
273 375
 }
@@ -339,5 +441,7 @@ export default {
339 441
 .float-right {
340 442
   float: right;
341 443
 }
342
-
444
+.el-form-item__label {
445
+  color: #fff;
446
+}
343 447
 </style>

BIN
src/views/system/login/image/logo.png


+ 40 - 54
src/views/system/login/page.vue

@@ -5,48 +5,31 @@
5 5
         <li v-for="n in 10" :key="n"></li>
6 6
       </ul>
7 7
     </div>
8
-    <div
9
-      class="page-login--layer page-login--layer-time"
10
-      flex="main:center cross:center">
8
+    <div class="page-login--layer page-login--layer-time" flex="main:center cross:center">
11 9
       {{time}}
12 10
     </div>
13 11
     <div class="page-login--layer">
14
-      <div
15
-        class="page-login--content"
16
-        flex="dir:top main:justify cross:stretch box:justify">
12
+      <div class="page-login--content" flex="dir:top main:justify cross:stretch box:justify">
17 13
         <div class="page-login--content-header">
18
-          <p class="page-login--content-header-motto" >
19
-            时间是一切财富中最宝贵的财富
14
+          <p class="page-login--content-header-motto">
15
+            <!-- 时间是一切财富中最宝贵的财富 -->
20 16
             {{ tips }}
21 17
           </p>
22 18
         </div>
23
-        <div
24
-          class="page-login--content-main"
25
-          flex="dir:top main:center cross:center">
19
+        <div class="page-login--content-main" flex="dir:top main:center cross:center">
26 20
           <!-- logo -->
27 21
           <img class="page-login--logo" src="./image/logo.png">
28 22
           <!-- form -->
29 23
           <div class="page-login--form">
30 24
             <el-card shadow="never">
31
-              <el-form
32
-                ref="loginForm"
33
-                label-position="top"
34
-                :rules="rules"
35
-                :model="formLogin"
36
-                size="default">
25
+              <el-form ref="loginForm" label-position="top" :rules="rules" :model="formLogin" size="default">
37 26
                 <el-form-item prop="username">
38
-                  <el-input
39
-                    type="text"
40
-                    v-model="formLogin.username"
41
-                    placeholder="用户名">
27
+                  <el-input type="text" v-model="formLogin.username" placeholder="用户名">
42 28
                     <i slot="prepend" class="fa fa-user-circle-o"></i>
43 29
                   </el-input>
44 30
                 </el-form-item>
45 31
                 <el-form-item prop="password">
46
-                  <el-input
47
-                    type="password"
48
-                    v-model="formLogin.password"
49
-                    placeholder="密码">
32
+                  <el-input type="password" v-model="formLogin.password" placeholder="密码">
50 33
                     <i slot="prepend" class="fa fa-keyboard-o"></i>
51 34
                   </el-input>
52 35
                 </el-form-item>
@@ -60,29 +43,32 @@
60 43
                     </template>
61 44
                   </el-input>
62 45
                 </el-form-item> -->
63
-                <el-button
64
-                  size="default"
65
-                  @click="submit"
66
-                  type="primary"
67
-                  class="button-login">
46
+                <el-button size="default" @click="submit" type="primary" class="button-login">
68 47
                   登录
69 48
                 </el-button>
49
+                <p class="page-login--options" flex="main:justify cross:center">
50
+                  <span>
51
+                    <d2-icon name="question-circle" /> 忘记密码
52
+                  </span>
53
+                  <span>注册用户</span>
54
+                </p>
70 55
               </el-form>
71 56
             </el-card>
72
-            <p
73
-              class="page-login--options"
74
-              flex="main:justify cross:center">
75
-              <span><d2-icon name="question-circle"/> 忘记密码</span>
57
+            <p class="page-login--options" flex="main:justify cross:center">
58
+              <span>
59
+                <d2-icon name="question-circle" /> 忘记密码
60
+              </span>
76 61
               <span>注册用户</span>
77 62
             </p>
78 63
             <!-- quick login -->
79 64
             <el-button class="page-login--quick" size="default" type="info" @click="dialogVisible = true">
80
-              快速选择用户<!-- (测试功能) -->
65
+              快速选择用户
66
+              <!-- (测试功能) -->
81 67
             </el-button>
82 68
           </div>
83 69
         </div>
84 70
         <div class="page-login--content-footer">
85
-         <!--  <p class="page-login--content-footer-locales">
71
+          <!-- <p class="page-login--content-footer-locales">
86 72
             <a
87 73
               v-for="language in $languages"
88 74
               :key="language.value"
@@ -92,8 +78,8 @@
92 78
           </p> -->
93 79
           <p class="page-login--content-footer-copyright">
94 80
             Copyright
95
-            <d2-icon name="copyright"/>
96
-            紫光软件 
81
+            <d2-icon name="copyright" />
82
+            紫光软件
97 83
             <a href="https://github.com/FairyEver">
98 84
               All&nbsp;Rights&nbsp;Reserved
99 85
             </a>
@@ -106,14 +92,11 @@
106 92
         </div>
107 93
       </div>
108 94
     </div>
109
-    <el-dialog
110
-      title="快速选择用户"
111
-      :visible.sync="dialogVisible"
112
-      width="400px">
95
+    <el-dialog title="快速选择用户" :visible.sync="dialogVisible" width="400px">
113 96
       <el-row :gutter="10" style="margin: -20px 0px -10px 0px;">
114 97
         <el-col v-for="(user, index) in users" :key="index" :span="8">
115 98
           <div class="page-login--quick-user" @click="handleUserBtnClick(user)">
116
-            <d2-icon name="user-circle-o"/>
99
+            <d2-icon name="user-circle-o" />
117 100
             <span>{{user.name}}</span>
118 101
           </div>
119 102
         </el-col>
@@ -190,7 +173,7 @@ export default {
190 173
         '对生活充满热情,对未来充满信心。',
191 174
         '功夫在平时,成功源于积累。',
192 175
         '时间是一切财富中最宝贵的财富。',
193
-        
176
+
194 177
       ]
195 178
     }
196 179
   },
@@ -198,9 +181,9 @@ export default {
198 181
     // eslint-disable-next-line no-unused-expressions
199 182
     this.timeInterval = setInterval(() => {
200 183
       this.refreshTime()
201
-    // eslint-disable-next-line no-sequences
184
+      // eslint-disable-next-line no-sequences
202 185
     }, 1000),
203
-    this.tipsrandom()
186
+      this.tipsrandom()
204 187
   },
205 188
   beforeDestroy () {
206 189
     clearInterval(this.timeInterval)
@@ -258,11 +241,11 @@ export default {
258 241
 <style lang="scss">
259 242
 .page-login {
260 243
   @extend %unable-select;
261
-  $backgroundColor: #F0F2F5;
244
+  $backgroundColor: #f0f2f5;
262 245
   // ---
263 246
   background-color: $backgroundColor;
264
-  background: url('./image/bg.png') center no-repeat ;
265
-  background-size:100% 100%;
247
+  background: url("./image/bg.png") center no-repeat;
248
+  background-size: 100% 100%;
266 249
   height: 100%;
267 250
   position: relative;
268 251
   // 层
@@ -304,7 +287,8 @@ export default {
304 287
   }
305 288
   // 登录表单
306 289
   .page-login--form {
307
-    width: 280px;
290
+    width: 380px;
291
+
308 292
     // 卡片
309 293
     .el-card {
310 294
       margin-bottom: 15px;
@@ -327,6 +311,7 @@ export default {
327 311
     // 登陆选项
328 312
     .page-login--options {
329 313
       margin: 0px;
314
+      margin-top: 18px;
330 315
       padding: 0px;
331 316
       font-size: 14px;
332 317
       color: $color-primary;
@@ -335,6 +320,7 @@ export default {
335 320
     }
336 321
     .page-login--quick {
337 322
       width: 100%;
323
+
338 324
     }
339 325
   }
340 326
   // 快速选择用户面板
@@ -374,7 +360,7 @@ export default {
374 360
       color: $color-text-normal;
375 361
       a {
376 362
         color: $color-text-normal;
377
-        margin: 0 .5em;
363
+        margin: 0 0.5em;
378 364
         &:hover {
379 365
           color: $color-text-main;
380 366
         }
@@ -420,16 +406,16 @@ export default {
420 406
       list-style: none;
421 407
       width: 20px;
422 408
       height: 20px;
423
-      background: #FFF;
409
+      background: #fff;
424 410
       animation: animate 25s linear infinite;
425 411
       bottom: -200px;
426 412
       @keyframes animate {
427
-        0%{
413
+        0% {
428 414
           transform: translateY(0) rotate(0deg);
429 415
           opacity: 1;
430 416
           border-radius: 0;
431 417
         }
432
-        100%{
418
+        100% {
433 419
           transform: translateY(-1000px) rotate(720deg);
434 420
           opacity: 0;
435 421
           border-radius: 50%;