diff --git a/src/api/certificate.js b/src/api/certificate.js
index cbc1e4e..1c8ab18 100644
--- a/src/api/certificate.js
+++ b/src/api/certificate.js
@@ -1,5 +1,6 @@
import api from '@/utils/api'
import qs from 'qs'
+import preview from '@/utils/preview'
export function add(data) {
return api({
@@ -35,9 +36,9 @@ export function getList(params) {
})
}
-export function exportExcel(params, exportOptions) {
- return api({
- url: '/certificate/exportExcel' + '?' + qs.stringify(params, { indices: false }),
+export function exportExcel(exportOptions) {
+ return preview({
+ url: '/download/certificate',
method: 'get',
params: {
exportOptions: exportOptions
diff --git a/src/api/common.js b/src/api/common.js
index 0dfb026..ce4dd91 100644
--- a/src/api/common.js
+++ b/src/api/common.js
@@ -188,4 +188,14 @@ export function getAssetTreeFn() {
url: '/asset/tree',
method: 'get'
})
+}
+export function addBorrowFn(params) {
+ return api({
+ url: '/borrowing',
+ method: 'post',
+ data: params,
+ paramsSerializer: function(data) {
+ return require('qs').stringify(data, { indices: false })
+ }
+ })
}
diff --git a/src/api/dic_muti_level_directory.js b/src/api/dic_muti_level_directory.js
index eca8a6f..4686628 100644
--- a/src/api/dic_muti_level_directory.js
+++ b/src/api/dic_muti_level_directory.js
@@ -39,7 +39,7 @@ export function get(params) {
export function getTreeList(params) {
return api({
- url: rootUrl + '/getTreeList',
+ url: rootUrl + '/tree',
method: 'get',
params
})
diff --git a/src/api/document_archives.js b/src/api/document_archives.js
new file mode 100644
index 0000000..0d02350
--- /dev/null
+++ b/src/api/document_archives.js
@@ -0,0 +1,39 @@
+import api from '@/utils/api'
+import qs from 'qs'
+
+export function add(data) {
+ return api({
+ url: '/documentArchives',
+ method: 'post',
+ data
+ })
+}
+
+export function edit(data) {
+ return api({
+ url: '/documentArchives',
+ method: 'put',
+ data
+ })
+}
+
+export function del(params) {
+ return api({
+ url: '/documentArchives',
+ method: 'delete',
+ params,
+ paramsSerializer: function(params) {
+ return qs.stringify(params, { indices: false })
+ }
+ })
+}
+
+export function exportExcel(params) {
+ return api({
+ url: '/documentArchives/exportExcel' + '?' + qs.stringify(params, { indices: false }),
+ method: 'get',
+ responseType: 'blob'
+ })
+}
+
+export default { add, edit, del, exportExcel }
diff --git a/src/api/export_document.js b/src/api/export_document.js
new file mode 100644
index 0000000..49b3000
--- /dev/null
+++ b/src/api/export_document.js
@@ -0,0 +1,8 @@
+import axios from 'axios'
+import qs from 'qs'
+
+export function exportReport(params) {
+ return axios
+ .get(process.env.VUE_APP_EXPORT_REPORT_API + '?' + qs.stringify(params, { indices: false }))
+ .then(response => { return response.data })
+}
diff --git a/src/components/Crud/Edit/index.vue b/src/components/Crud/Edit/index.vue
index 7892b1a..9c80023 100644
--- a/src/components/Crud/Edit/index.vue
+++ b/src/components/Crud/Edit/index.vue
@@ -1,5 +1,8 @@
-
+
+ 修改
+
+
修改
@@ -15,6 +18,15 @@ export default {
disabledEdit: {
type: Boolean,
default: false
+ },
+ flag: {
+ type: Boolean,
+ defalut: false
+ }
+ },
+ methods: {
+ editFn() {
+ this.$emit('editFn', this.data)
}
}
}
diff --git a/src/components/Crud/crud.js b/src/components/Crud/crud.js
index 474d8cb..a4407a3 100644
--- a/src/components/Crud/crud.js
+++ b/src/components/Crud/crud.js
@@ -24,8 +24,8 @@ function CRUD(options) {
form: {},
// 重置表单
defaultForm: () => {},
- // 排序规则,默认 id 降序, 支持多字段排序 ['id,desc', 'createTime,asc']
- orderBy: ['id,desc'],
+ // 排序规则,默认 id 降序, 支持多字段排序 ['id desc', 'createTime asc']
+ orderBy: ['id desc'],
// 等待时间
time: 50,
// CRUD Method
@@ -250,10 +250,13 @@ function CRUD(options) {
* 执行编辑
*/
doEdit() {
+ console.log(581222)
if (!callVmHook(crud, CRUD.HOOK.beforeSubmit)) {
return
}
+ console.log(crud.crudMethod, crud.form)
crud.status.edit = CRUD.STATUS.PROCESSING
+
crud.crudMethod.edit(crud.form).then(() => {
crud.status.edit = CRUD.STATUS.NORMAL
crud.getDataStatus(crud.form.id).edit = CRUD.STATUS.NORMAL
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 55791b0..8f67003 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -37,6 +37,11 @@
个人中心
+
+
+ 证书信息
+
+
关于我们
diff --git a/src/main.js b/src/main.js
index e3c9db6..90906f1 100644
--- a/src/main.js
+++ b/src/main.js
@@ -30,6 +30,7 @@ import permission from './directive/permission'
import adaptive from './directive/el-table'
import vueqr from 'vue-qr'
import JSONView from 'vue-json-viewer'
+import { checkPermission } from './utils/permission'
Vue.use(JSONView)
Vue.use(permission)
@@ -51,6 +52,7 @@ Vue.use(Col)
Vue.use(ElementUI, { locale })
// 全局的常量
+Vue.prototype.checkPermission = checkPermission
Vue.prototype.api = api
Vue.prototype.apibjd = apibjd
Vue.prototype.apisjse = apisjse
diff --git a/src/utils/formatter.js b/src/utils/formatter.js
index 7ba949c..8ed3430 100644
--- a/src/utils/formatter.js
+++ b/src/utils/formatter.js
@@ -38,18 +38,32 @@ export default {
return null
}
},
+ getNowTime() {
+ let dateTime = ''
+ const yy = new Date().getFullYear()
+ const mm = new Date().getMonth() + 1 < 10 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1
+ const dd = new Date().getDate() < 10 ? '0' + new Date().getDate()
+ : new Date().getDate()
+ const hh = new Date().getHours()
+ const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes()
+ : new Date().getMinutes()
+ const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds()
+ : new Date().getSeconds()
+ dateTime = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
+ return dateTime
+ },
/**
- * 格式化日期
- * 对Date的扩展,将 Date 转化为指定格式的String
- * 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
- * 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
- * 例子:
- * dateFormat("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
- * dateFormat("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
- * @param fmt
- * @param date
- * @returns {*}
- */
+ * 格式化日期
+ * 对Date的扩展,将 Date 转化为指定格式的String
+ * 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
+ * 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
+ * 例子:
+ * dateFormat("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
+ * dateFormat("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
+ * @param fmt
+ * @param date
+ * @returns {*}
+ */
dateFormat(fmt, date) {
if (!date) {
date = new Date()
@@ -81,23 +95,23 @@ export default {
// 格式化
let name = ''
switch (cellValue) {
- case '3000' :
+ case '3000':
name = '电梯'
break
- case '4000' :
- case '5000' :
+ case '4000':
+ case '5000':
name = '起重'
break
- case '1000' :
+ case '1000':
name = jylb === 'ZJ' ? '锅炉监检' : '锅炉定检'
break
- case '2000' :
+ case '2000':
name = jylb === 'ZJ' ? '容器监检' : '容器定检'
break
- case '8000' :
+ case '8000':
name = '压力管道'
break
- case '7000' :
+ case '7000':
name = '安全阀'
break
}
diff --git a/src/utils/index.js b/src/utils/index.js
index 8e6c2e0..2ad4b6c 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -1,3 +1,5 @@
+import store from '../store'
+
/* eslint-disable one-var */
/**
* Created by jiachenpan on 16/11/18.
@@ -48,7 +50,27 @@ export function parseTime(time, cFormat) {
})
return time_str
}
-
+// 根据字典类型名称获取字典数据列表
+export function getDicDataListByTypeName(typeName) {
+ // 所有字典类型信息
+ const allDicTypeList = store.getters.dicTypeList
+ // 所有字典数据信息
+ const allDicDataList = store.getters.dicDataList
+ let data = []
+ allDicTypeList.filter(dicType => dicType.typeName === typeName).filter(dicType => {
+ data = allDicDataList.filter(dicData => dicType.id === dicData.typeId)
+ })
+ return data
+}
+/**
+ * 根据年月获取当前月的最后一天
+ * @param date 例如:2020-01
+ * @returns {*}
+ */
+export function getLastDayByDate(date) {
+ date = date.split('-')
+ return date.join('-') + '-' + new Date(date[0], date[1], 0).getDate()
+}
export function formatTime(time, option) {
time = +time * 1000
const d = new Date(time)
@@ -118,7 +140,7 @@ export function param(json) {
return cleanArray(Object.keys(json).map(key => {
if (json[key] === undefined) return ''
return encodeURIComponent(key) + '=' +
- encodeURIComponent(json[key])
+ encodeURIComponent(json[key])
})).join('&')
}
@@ -138,7 +160,7 @@ export function html2Text(val) {
export function objectMerge(target, source) {
/* Merges two objects,
- giving the last one precedence */
+ giving the last one precedence */
if (typeof target !== 'object') {
target = {}
@@ -184,40 +206,39 @@ export function toggleClass(element, className) {
element.className = classString
}
-export const pickerOptions = [
- {
- text: '今天',
- onClick(picker) {
- const end = new Date()
- const start = new Date(new Date().toDateString())
- end.setTime(start.getTime())
- picker.$emit('pick', [start, end])
- }
- }, {
- text: '最近一周',
- onClick(picker) {
- const end = new Date(new Date().toDateString())
- const start = new Date()
- start.setTime(end.getTime() - 3600 * 1000 * 24 * 7)
- picker.$emit('pick', [start, end])
- }
- }, {
- text: '最近一个月',
- onClick(picker) {
- const end = new Date(new Date().toDateString())
- const start = new Date()
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
- picker.$emit('pick', [start, end])
- }
- }, {
- text: '最近三个月',
- onClick(picker) {
- const end = new Date(new Date().toDateString())
- const start = new Date()
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
- picker.$emit('pick', [start, end])
- }
- }]
+export const pickerOptions = [{
+ text: '今天',
+ onClick(picker) {
+ const end = new Date()
+ const start = new Date(new Date().toDateString())
+ end.setTime(start.getTime())
+ picker.$emit('pick', [start, end])
+ }
+}, {
+ text: '最近一周',
+ onClick(picker) {
+ const end = new Date(new Date().toDateString())
+ const start = new Date()
+ start.setTime(end.getTime() - 3600 * 1000 * 24 * 7)
+ picker.$emit('pick', [start, end])
+ }
+}, {
+ text: '最近一个月',
+ onClick(picker) {
+ const end = new Date(new Date().toDateString())
+ const start = new Date()
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
+ picker.$emit('pick', [start, end])
+ }
+}, {
+ text: '最近三个月',
+ onClick(picker) {
+ const end = new Date(new Date().toDateString())
+ const start = new Date()
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
+ picker.$emit('pick', [start, end])
+ }
+}]
export function getTime(type) {
if (type === 'start') {
diff --git a/src/utils/permission.js b/src/utils/permission.js
new file mode 100644
index 0000000..419ad3a
--- /dev/null
+++ b/src/utils/permission.js
@@ -0,0 +1,19 @@
+import store from '@/store'
+
+/**
+ * @param {Array} value
+ * @returns {Boolean}
+ * @example see @/views/permission/directive.vue
+ */
+export function checkPermission(value) {
+ if (value && value instanceof Array && value.length > 0) {
+ const roles = store.getters && store.getters.permissions
+ const permissionRoles = value
+ return roles.some(role => {
+ return permissionRoles.includes(role)
+ })
+ } else {
+ console.error(`need roles! Like v-permission="['admin','editor']"`)
+ return false
+ }
+}
diff --git a/src/views/archive/archive_scan.vue b/src/views/archive/archive_scan.vue
index 2f8e543..c714e43 100644
--- a/src/views/archive/archive_scan.vue
+++ b/src/views/archive/archive_scan.vue
@@ -117,8 +117,8 @@ export default {
*/
getYsjlByBgbh() {
// 先去18版承压类进行查询
- this.server({
- url: '/archive/ysjl/getYsjlByBgbh/' + this.baogaobianhao,
+ this.api({
+ url: '/archive/getYsjlByBgbh?bgbh=' + this.baogaobianhao,
method: 'get'
}).then(data => {
if (data != null && data !== '') {
@@ -159,7 +159,7 @@ export default {
this.archive.archiveUser = this.$store.getters.nickname
this.archive.archiveCount = this.paramList.length
- this.server({
+ this.api({
url: '/archive',
method: 'post',
data: {
diff --git a/src/views/borrow/borrowing-history.vue b/src/views/borrow/borrow-history.vue
similarity index 87%
rename from src/views/borrow/borrowing-history.vue
rename to src/views/borrow/borrow-history.vue
index 0dbfd20..f758aef 100644
--- a/src/views/borrow/borrowing-history.vue
+++ b/src/views/borrow/borrow-history.vue
@@ -9,20 +9,6 @@
placeholder="选择借阅日期"
@change="crud.toQuery"
/>
-
-
-
@@ -51,13 +37,13 @@
:row-class-name="getTableRowClassName"
>
-
+
@@ -67,16 +53,17 @@
diff --git a/src/views/user/user.vue b/src/views/user/user.vue
index e1fdcd2..83e041c 100644
--- a/src/views/user/user.vue
+++ b/src/views/user/user.vue
@@ -88,6 +88,14 @@
>
+
+
+
{
+ var city = { 11: '北京', 12: '天津', 13: '河北', 14: '山西', 15: '内蒙古', 21: '辽宁', 22: '吉林', 23: '黑龙江 ', 31: '上海', 32: '江苏', 33: '浙江', 34: '安徽', 35: '福建', 36: '江西', 37: '山东', 41: '河南', 42: '湖北 ', 43: '湖南', 44: '广东', 45: '广西', 46: '海南', 50: '重庆', 51: '四川', 52: '贵州', 53: '云南', 54: '西藏 ', 61: '陕西', 62: '甘肃', 63: '青海', 64: '宁夏', 65: '新疆', 71: '台湾', 81: '香港', 82: '澳门', 91: '国外 ' }
+ var tip = ''
+ var pass = true
+
+ if (!code || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(code)) {
+ tip = '身份证号格式错误'
+ pass = false
+ } else if (!city[code.substr(0, 2)]) {
+ tip = '地址编码错误'
+ pass = false
+ } else {
+ // 18位身份证需要验证最后一位校验位
+ if (code.length === 18) {
+ code = code.split('')
+ // ∑(ai×Wi)(mod 11)
+ // 加权因子
+ var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
+ // 校验位
+ var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]
+ var sum = 0
+ var ai = 0
+ var wi = 0
+ for (var i = 0; i < 17; i++) {
+ ai = code[i]
+ wi = factor[i]
+ sum += ai * wi
+ }
+ if (parity[sum % 11] !== code[17]) {
+ tip = '校验位错误'
+ pass = false
+ }
+ }
+ }
+ if (!pass) {
+ callback(new Error(tip))
+ } else {
+ callback()
+ }
+ }
return {
defaultProps: {
children: 'children',
@@ -241,7 +289,9 @@ export default {
{ required: true, message: '请填写用户名', trigger: 'blur' }
],
password: [{ required: true, message: '请填写密码', trigger: 'blur' }],
- nickname: [{ required: true, message: '请填写昵称', trigger: 'blur' }]
+ nickname: [{ required: true, message: '请填写昵称', trigger: 'blur' }],
+ identificationNum: [{ required: true, message: '请填写身份证号码', trigger: 'blur' },
+ { validator: idCardValidity, trigger: 'blur' }]
},
fileList: [],
depts: [],
@@ -351,7 +401,6 @@ export default {
// 显示新增对话框
this.tempUser = {}
this.dialogStatus = 'create'
- console.log(this.crud.status.editor, '哈哈哈')
this.dialogFormVisible = true
this.roleIds.length = 0
},
@@ -387,7 +436,7 @@ export default {
this.$message.warning('密码长度不能低于8位')
return false
}
- this.tempUser.deleteStatus = 1
+ this.tempUser.state = true
this.api({
url: '/user',
method: 'post',
@@ -449,7 +498,7 @@ export default {
type: 'warning'
}).then(() => {
const user = _vue.list[$index]
- user.deleteStatus = '0'
+ user.state = false
_vue
.api({
url: '/user',