Browse Source

/department/getById

master
xiaobai 3 years ago
parent
commit
7192d933ef
  1. 7
      src/api/certificate.js
  2. 10
      src/api/common.js
  3. 2
      src/api/dic_muti_level_directory.js
  4. 39
      src/api/document_archives.js
  5. 8
      src/api/export_document.js
  6. 14
      src/components/Crud/Edit/index.vue
  7. 7
      src/components/Crud/crud.js
  8. 5
      src/layout/components/Navbar.vue
  9. 2
      src/main.js
  10. 50
      src/utils/formatter.js
  11. 95
      src/utils/index.js
  12. 19
      src/utils/permission.js
  13. 6
      src/views/archive/archive_scan.vue
  14. 47
      src/views/borrow/borrow-history.vue
  15. 126
      src/views/borrow/borrow.vue
  16. 65
      src/views/borrow/returned.vue
  17. 18
      src/views/certificate/index.vue
  18. 13
      src/views/certificate/show.vue
  19. 3
      src/views/device_management/index.vue
  20. 5
      src/views/dic/dic_type.vue
  21. 166
      src/views/document/index.vue
  22. 57
      src/views/user/user.vue

7
src/api/certificate.js

@ -1,5 +1,6 @@
import api from '@/utils/api' import api from '@/utils/api'
import qs from 'qs' import qs from 'qs'
import preview from '@/utils/preview'
export function add(data) { export function add(data) {
return api({ return api({
@ -35,9 +36,9 @@ export function getList(params) {
}) })
} }
export function exportExcel(params, exportOptions) { export function exportExcel(exportOptions) {
return api({ return preview({
url: '/certificate/exportExcel' + '?' + qs.stringify(params, { indices: false }), url: '/download/certificate',
method: 'get', method: 'get',
params: { params: {
exportOptions: exportOptions exportOptions: exportOptions

10
src/api/common.js

@ -189,3 +189,13 @@ export function getAssetTreeFn() {
method: 'get' method: 'get'
}) })
} }
export function addBorrowFn(params) {
return api({
url: '/borrowing',
method: 'post',
data: params,
paramsSerializer: function(data) {
return require('qs').stringify(data, { indices: false })
}
})
}

2
src/api/dic_muti_level_directory.js

@ -39,7 +39,7 @@ export function get(params) {
export function getTreeList(params) { export function getTreeList(params) {
return api({ return api({
url: rootUrl + '/getTreeList', url: rootUrl + '/tree',
method: 'get', method: 'get',
params params
}) })

39
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 }

8
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 })
}

14
src/components/Crud/Edit/index.vue

@ -1,5 +1,8 @@
<template> <template>
<el-button type="text" :disabled="disabledEdit" icon="edit" @click="crud.toEdit(data)"> <el-button v-if="!flag" type="text" :disabled="disabledEdit" icon="edit" @click="crud.toEdit(data)">
修改
</el-button>
<el-button v-else type="text" :disabled="disabledEdit" icon="edit" @click="editFn(data)">
修改 修改
</el-button> </el-button>
</template> </template>
@ -15,6 +18,15 @@ export default {
disabledEdit: { disabledEdit: {
type: Boolean, type: Boolean,
default: false default: false
},
flag: {
type: Boolean,
defalut: false
}
},
methods: {
editFn() {
this.$emit('editFn', this.data)
} }
} }
} }

7
src/components/Crud/crud.js

@ -24,8 +24,8 @@ function CRUD(options) {
form: {}, form: {},
// 重置表单 // 重置表单
defaultForm: () => {}, defaultForm: () => {},
// 排序规则,默认 id 降序, 支持多字段排序 ['id,desc', 'createTime,asc'] // 排序规则,默认 id 降序, 支持多字段排序 ['id desc', 'createTime asc']
orderBy: ['id,desc'], orderBy: ['id desc'],
// 等待时间 // 等待时间
time: 50, time: 50,
// CRUD Method // CRUD Method
@ -250,10 +250,13 @@ function CRUD(options) {
* 执行编辑 * 执行编辑
*/ */
doEdit() { doEdit() {
console.log(581222)
if (!callVmHook(crud, CRUD.HOOK.beforeSubmit)) { if (!callVmHook(crud, CRUD.HOOK.beforeSubmit)) {
return return
} }
console.log(crud.crudMethod, crud.form)
crud.status.edit = CRUD.STATUS.PROCESSING crud.status.edit = CRUD.STATUS.PROCESSING
crud.crudMethod.edit(crud.form).then(() => { crud.crudMethod.edit(crud.form).then(() => {
crud.status.edit = CRUD.STATUS.NORMAL crud.status.edit = CRUD.STATUS.NORMAL
crud.getDataStatus(crud.form.id).edit = CRUD.STATUS.NORMAL crud.getDataStatus(crud.form.id).edit = CRUD.STATUS.NORMAL

5
src/layout/components/Navbar.vue

@ -37,6 +37,11 @@
个人中心 个人中心
</el-dropdown-item> </el-dropdown-item>
</router-link> </router-link>
<router-link :to="'/certificate/show'">
<el-dropdown-item divided>
证书信息
</el-dropdown-item>
</router-link>
<el-dropdown-item divided> <el-dropdown-item divided>
<span style="display:block;" @click="dialogAboutVisible = true">关于我们</span> <span style="display:block;" @click="dialogAboutVisible = true">关于我们</span>
</el-dropdown-item> </el-dropdown-item>

2
src/main.js

@ -30,6 +30,7 @@ import permission from './directive/permission'
import adaptive from './directive/el-table' import adaptive from './directive/el-table'
import vueqr from 'vue-qr' import vueqr from 'vue-qr'
import JSONView from 'vue-json-viewer' import JSONView from 'vue-json-viewer'
import { checkPermission } from './utils/permission'
Vue.use(JSONView) Vue.use(JSONView)
Vue.use(permission) Vue.use(permission)
@ -51,6 +52,7 @@ Vue.use(Col)
Vue.use(ElementUI, { locale }) Vue.use(ElementUI, { locale })
// 全局的常量 // 全局的常量
Vue.prototype.checkPermission = checkPermission
Vue.prototype.api = api Vue.prototype.api = api
Vue.prototype.apibjd = apibjd Vue.prototype.apibjd = apibjd
Vue.prototype.apisjse = apisjse Vue.prototype.apisjse = apisjse

50
src/utils/formatter.js

@ -38,18 +38,32 @@ export default {
return null 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 * 对Date的扩展 Date 转化为指定格式的String
* (M)(d)小时(h)(m)(s)季度(q) 可以用 1-2 个占位符 * (M)(d)小时(h)(m)(s)季度(q) 可以用 1-2 个占位符
* (y)可以用 1-4 个占位符毫秒(S)只能用 1 个占位符( 1-3 位的数字) * (y)可以用 1-4 个占位符毫秒(S)只能用 1 个占位符( 1-3 位的数字)
* 例子 * 例子
* dateFormat("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 * 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 * dateFormat("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
* @param fmt * @param fmt
* @param date * @param date
* @returns {*} * @returns {*}
*/ */
dateFormat(fmt, date) { dateFormat(fmt, date) {
if (!date) { if (!date) {
date = new Date() date = new Date()
@ -81,23 +95,23 @@ export default {
// 格式化 // 格式化
let name = '' let name = ''
switch (cellValue) { switch (cellValue) {
case '3000' : case '3000':
name = '电梯' name = '电梯'
break break
case '4000' : case '4000':
case '5000' : case '5000':
name = '起重' name = '起重'
break break
case '1000' : case '1000':
name = jylb === 'ZJ' ? '锅炉监检' : '锅炉定检' name = jylb === 'ZJ' ? '锅炉监检' : '锅炉定检'
break break
case '2000' : case '2000':
name = jylb === 'ZJ' ? '容器监检' : '容器定检' name = jylb === 'ZJ' ? '容器监检' : '容器定检'
break break
case '8000' : case '8000':
name = '压力管道' name = '压力管道'
break break
case '7000' : case '7000':
name = '安全阀' name = '安全阀'
break break
} }

95
src/utils/index.js

@ -1,3 +1,5 @@
import store from '../store'
/* eslint-disable one-var */ /* eslint-disable one-var */
/** /**
* Created by jiachenpan on 16/11/18. * Created by jiachenpan on 16/11/18.
@ -48,7 +50,27 @@ export function parseTime(time, cFormat) {
}) })
return time_str 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) { export function formatTime(time, option) {
time = +time * 1000 time = +time * 1000
const d = new Date(time) const d = new Date(time)
@ -118,7 +140,7 @@ export function param(json) {
return cleanArray(Object.keys(json).map(key => { return cleanArray(Object.keys(json).map(key => {
if (json[key] === undefined) return '' if (json[key] === undefined) return ''
return encodeURIComponent(key) + '=' + return encodeURIComponent(key) + '=' +
encodeURIComponent(json[key]) encodeURIComponent(json[key])
})).join('&') })).join('&')
} }
@ -138,7 +160,7 @@ export function html2Text(val) {
export function objectMerge(target, source) { export function objectMerge(target, source) {
/* Merges two objects, /* Merges two objects,
giving the last one precedence */ giving the last one precedence */
if (typeof target !== 'object') { if (typeof target !== 'object') {
target = {} target = {}
@ -184,40 +206,39 @@ export function toggleClass(element, className) {
element.className = classString element.className = classString
} }
export const pickerOptions = [ export const pickerOptions = [{
{ text: '今天',
text: '今天', onClick(picker) {
onClick(picker) { const end = new Date()
const end = new Date() const start = new Date(new Date().toDateString())
const start = new Date(new Date().toDateString()) end.setTime(start.getTime())
end.setTime(start.getTime()) picker.$emit('pick', [start, end])
picker.$emit('pick', [start, end]) }
} }, {
}, { text: '最近一周',
text: '最近一周', onClick(picker) {
onClick(picker) { const end = new Date(new Date().toDateString())
const end = new Date(new Date().toDateString()) const start = new Date()
const start = new Date() start.setTime(end.getTime() - 3600 * 1000 * 24 * 7)
start.setTime(end.getTime() - 3600 * 1000 * 24 * 7) picker.$emit('pick', [start, end])
picker.$emit('pick', [start, end]) }
} }, {
}, { text: '最近一个月',
text: '最近一个月', onClick(picker) {
onClick(picker) { const end = new Date(new Date().toDateString())
const end = new Date(new Date().toDateString()) const start = new Date()
const start = new Date() start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) picker.$emit('pick', [start, end])
picker.$emit('pick', [start, end]) }
} }, {
}, { text: '最近三个月',
text: '最近三个月', onClick(picker) {
onClick(picker) { const end = new Date(new Date().toDateString())
const end = new Date(new Date().toDateString()) const start = new Date()
const start = new Date() start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) picker.$emit('pick', [start, end])
picker.$emit('pick', [start, end]) }
} }]
}]
export function getTime(type) { export function getTime(type) {
if (type === 'start') { if (type === 'start') {

19
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
}
}

6
src/views/archive/archive_scan.vue

@ -117,8 +117,8 @@ export default {
*/ */
getYsjlByBgbh() { getYsjlByBgbh() {
// 18 // 18
this.server({ this.api({
url: '/archive/ysjl/getYsjlByBgbh/' + this.baogaobianhao, url: '/archive/getYsjlByBgbh?bgbh=' + this.baogaobianhao,
method: 'get' method: 'get'
}).then(data => { }).then(data => {
if (data != null && data !== '') { if (data != null && data !== '') {
@ -159,7 +159,7 @@ export default {
this.archive.archiveUser = this.$store.getters.nickname this.archive.archiveUser = this.$store.getters.nickname
this.archive.archiveCount = this.paramList.length this.archive.archiveCount = this.paramList.length
this.server({ this.api({
url: '/archive', url: '/archive',
method: 'post', method: 'post',
data: { data: {

47
src/views/borrow/borrowing-history.vue → src/views/borrow/borrow-history.vue

@ -9,20 +9,6 @@
placeholder="选择借阅日期" placeholder="选择借阅日期"
@change="crud.toQuery" @change="crud.toQuery"
/> />
<el-select
v-model="query.state"
placeholder="请选择借阅状态"
style="width: 150px"
class="filter-item"
clearable
>
<el-option
v-for="item in ifOverdueList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select <el-select
v-model="query.jieyueren" v-model="query.jieyueren"
placeholder="请选择借阅人" placeholder="请选择借阅人"
@ -32,8 +18,8 @@
> >
<el-option <el-option
v-for="item in useStateList" v-for="item in useStateList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.nickname"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
@ -51,13 +37,13 @@
:row-class-name="getTableRowClassName" :row-class-name="getTableRowClassName"
> >
<el-table-column slot="operation" align="center" width="100" label="操作"> <el-table-column slot="operation" align="center" width="100" label="操作">
<template slot-scope="scope"> <!-- <template slot-scope="scope">
<Edit <Edit
:permission="permission" :permission="permission"
:data="scope.row" :data="scope.row"
:disabled-edit="false" :disabled-edit="false"
/> />
</template> </template> -->
</el-table-column> </el-table-column>
</CustomTable> </CustomTable>
<pagination /> <pagination />
@ -67,16 +53,17 @@
<script> <script>
import CRUD, { form, header, presenter } from '@/components/Crud/crud' import CRUD, { form, header, presenter } from '@/components/Crud/crud'
// import Crud from '@/components/Crud' // import Crud from '@/components/Crud'
import Edit from '@/components/Crud/Edit'
import CustomTable from '@/components/Crud/Table' import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination' import Pagination from '@/components/Crud/Pagination'
// crudpresenter // crudpresenter
const defaultCrud = presenter( const defaultCrud = presenter(
CRUD({ CRUD({
title: '借阅记录', title: '借阅记录',
url: '/borrowing/list', url: '/borrowing/list',
orderBy: ['id asc'] orderBy: ['id asc'],
query: {
state: false
}
}) })
) )
@ -121,17 +108,17 @@ const defaultForm = form({
export default { export default {
name: 'InstrumentList', name: 'InstrumentList',
components: { Pagination, CustomTable, Edit }, components: { Pagination, CustomTable },
mixins: [defaultCrud, defaultForm, header()], mixins: [defaultCrud, defaultForm, header()],
data() { data() {
return { return {
colConfigs: [ colConfigs: [
{ prop: 'baogaobianhao', label: '报告编号', align: 'center' }, { prop: 'baogaobianhao', label: '报告编号', align: 'center' },
{ prop: 'createBy', label: '创建人', align: 'center' }, { prop: 'createBy', label: '创建人', align: 'center', formatter: this.formatter.getChineseName },
{ prop: 'createTime', label: '创建时间', align: 'center' }, { prop: 'createTime', label: '创建时间', align: 'center' },
{ prop: 'guihuanTime', label: '归还时间', align: 'center' }, { prop: 'guihuanTime', label: '归还时间', align: 'center' },
{ prop: 'jieyueTime', label: '借阅时间', align: 'center' }, { prop: 'jieyueTime', label: '借阅时间', align: 'center' },
{ prop: 'jieyueren', label: '借阅人', align: 'center' }, { prop: 'jieyueren', label: '借阅人', align: 'center', formatter: this.formatter.getChineseName },
{ prop: 'state', label: '借阅状态', align: 'center' }, { prop: 'state', label: '借阅状态', align: 'center' },
{ prop: 'updateBy', label: '修改人', align: 'center' }, { prop: 'updateBy', label: '修改人', align: 'center' },
{ {
@ -139,8 +126,7 @@ export default {
label: '更新时间', label: '更新时间',
align: 'center', align: 'center',
formatter: this.formatter.formatterDepartmentName formatter: this.formatter.formatterDepartmentName
}, }
{ slot: 'operation' }
], ],
permission: { permission: {
add: ['instrument:add'], add: ['instrument:add'],
@ -213,8 +199,17 @@ export default {
}, },
mounted() { mounted() {
// this.initDicDataList() // this.initDicDataList()
this.getAllUser()
}, },
methods: { methods: {
getAllUser() {
this.api({
url: '/user/all',
method: 'get'
}).then(res => {
this.useStateList = res
})
},
// //
[CRUD.HOOK.afterResetQuery]() { [CRUD.HOOK.afterResetQuery]() {
if (this.$refs.queryTreeSelect) { if (this.$refs.queryTreeSelect) {

126
src/views/borrow/borrow.vue

@ -56,11 +56,41 @@
:permission="permission" :permission="permission"
:data="scope.row" :data="scope.row"
:disabled-edit="false" :disabled-edit="false"
:flag="true"
@editFn="editFn"
/> />
</template> </template>
</el-table-column> </el-table-column>
</CustomTable> </CustomTable>
<pagination /> <pagination />
<el-dialog :before-close="crud.cancelCU" :visible="visible" :title="crud.status.title">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" inline>
<el-form-item label="报告编号:" prop="baogaobianhao">
<el-input v-model="form.baogaobianhao" placeholder="请输入报告编号" clearable type="text" />
</el-form-item>
<el-form-item label="借阅时间:" prop="jieyueTime">
<el-date-picker v-model="form.jieyueTime" style="width: 215px;" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择借阅时间" clearable type="datetime" />
</el-form-item>
<el-form-item label="借阅人:" prop="jieyueren">
<el-select v-model="form.jieyueren" placeholder="请选择借阅人">
<el-option
v-for="item in options"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="crud.cancelCU">
</el-button>
<el-button type="primary" @click="borrowFn">
</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -70,53 +100,24 @@ import CRUD, { form, header, presenter } from '@/components/Crud/crud'
import Edit from '@/components/Crud/Edit' import Edit from '@/components/Crud/Edit'
import CustomTable from '@/components/Crud/Table' import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination' import Pagination from '@/components/Crud/Pagination'
import { addBorrowFn } from '@/api/common'
// crudpresenter // crudpresenter
const defaultCrud = presenter( const defaultCrud = presenter(
CRUD({ CRUD({
title: '借阅记录', title: '借阅记录',
url: '/borrowing/list', url: '/borrowing/getCanBorrowYsjl',
orderBy: ['id asc'] orderBy: []
// orderBy: ['y.id desc'],
}) })
) )
// form // form
const defaultForm = form({ const defaultForm = form({
baogaobianhao: null, baogaobianhao: '',
assetNum: '', jieyueTime: '',
equipmentNum: '', jieyueren: '',
customName: '', state: true,
equipmentName: '', ysjlId: ''
classCode: '',
brand: '',
specifications: '',
factoryNum: '',
location: '',
achieveDate: '',
commissioningDate: '',
remark: '',
quantity: '',
unitPrice: '',
totalPrice: '',
valueType: '',
assetSource: '',
fundingSource: '',
procurementType: '',
discount: '',
netWorth: '',
depreciationState: '',
bookedState: '',
departmentId: '',
principal: '',
propertyUnit: '',
useState: '',
useDirection: '',
useYear: '',
usePurpose: '',
measureState: '',
earlyWarningCycle: '',
checkLastDate: '',
checkDate: ''
}) })
export default { export default {
@ -125,21 +126,15 @@ export default {
mixins: [defaultCrud, defaultForm, header()], mixins: [defaultCrud, defaultForm, header()],
data() { data() {
return { return {
visible: false,
colConfigs: [ colConfigs: [
{ prop: 'baogaobianhao', label: '报告编号', align: 'center' }, { prop: 'baogaobianhao', label: '报告编号', align: 'center' },
{ prop: 'createBy', label: '创建人', align: 'center' }, { prop: 'shiyongdanwei', label: '使用单位', align: 'center' },
{ prop: 'createTime', label: '创建时间', align: 'center' }, { prop: 'shigongdanwei', label: '施工单位', align: 'center' },
{ prop: 'guihuanTime', label: '归还时间', align: 'center' }, { prop: 'zhizaodanwei', label: '制造单位', align: 'center' },
{ prop: 'jieyueTime', label: '借阅时间', align: 'center' }, { prop: 'jianyanrenyuan', label: '检验人员', align: 'center' },
{ prop: 'jieyueren', label: '借阅人', align: 'center' }, { prop: 'zhucedaima', label: '注册代码', align: 'center' },
{ prop: 'state', label: '借阅状态', align: 'center' }, { prop: 'shiyongdengjibianhao', label: '使用登记证编号', align: 'center' },
{ prop: 'updateBy', label: '修改人', align: 'center' },
{
prop: 'updateTime',
label: '更新时间',
align: 'center',
formatter: this.formatter.formatterDepartmentName
},
{ slot: 'operation' } { slot: 'operation' }
], ],
permission: { permission: {
@ -147,6 +142,14 @@ export default {
edit: ['instrument:update'], edit: ['instrument:update'],
del: ['instrument:delete'] del: ['instrument:delete']
}, },
options: [],
form: {
baogaobianhao: '',
jieyueTime: '',
jieyueren: '',
state: false,
ysjlId: ''
},
dicAssetTree: [], dicAssetTree: [],
parentId: [], parentId: [],
activeName: 'first', activeName: 'first',
@ -213,6 +216,7 @@ export default {
}, },
mounted() { mounted() {
// this.initDicDataList() // this.initDicDataList()
this.getAllUser()
}, },
methods: { methods: {
// //
@ -235,6 +239,26 @@ export default {
this.departmentId = 0 this.departmentId = 0
this.ifMeasure = false this.ifMeasure = false
}, },
getAllUser() {
this.api({
url: '/user/all',
method: 'get'
}).then(res => {
this.options = res
})
},
editFn(data) {
this.visible = true
this.form.baogaobianhao = data.baogaobianhao
this.form.ysjlId = data.id
},
borrowFn() {
addBorrowFn(this.form).then(res => {
this.$message({ message: '借阅成功', type: 'success' })
this.visible = false
// crud.refresh()
})
},
// EXCEL // EXCEL
beforeUpload(file) { beforeUpload(file) {
const isExcel = const isExcel =

65
src/views/borrow/returned.vue

@ -21,7 +21,9 @@
<CustomTable ref="customTable" :col-configs="colConfigs" :columns="columns" :crud="crud" :row-class-name="getTableRowClassName"> <CustomTable ref="customTable" :col-configs="colConfigs" :columns="columns" :crud="crud" :row-class-name="getTableRowClassName">
<el-table-column slot="operation" align="center" width="100" label="操作"> <el-table-column slot="operation" align="center" width="100" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<Edit :permission="permission" :data="scope.row" :disabled-edit="false" /> <el-button type="text" @click="returnFn(scope.row)">
归还
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</CustomTable> </CustomTable>
@ -30,9 +32,8 @@
</template> </template>
<script> <script>
import CRUD, { form, header, presenter } from '@/components/Crud/crud' import CRUD, { form, header, presenter, crud } from '@/components/Crud/crud'
// import Crud from '@/components/Crud' // import Crud from '@/components/Crud'
import Edit from '@/components/Crud/Edit'
import CustomTable from '@/components/Crud/Table' import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination' import Pagination from '@/components/Crud/Pagination'
@ -40,29 +41,45 @@ import Pagination from '@/components/Crud/Pagination'
const defaultCrud = presenter(CRUD({ const defaultCrud = presenter(CRUD({
title: '借阅记录', title: '借阅记录',
url: '/borrowing/list', url: '/borrowing/list',
orderBy: ['id asc'] orderBy: ['id asc'],
query: {
state: true
}
})) }))
// form // form
const defaultForm = form({ const defaultForm = form({
}) })
//
const PrefixPlusText = {
props: ['value', 'functions'],
template: `
<el-tag v-if="functions(value) === '未归还'" type="danger" effect="dark"><span v-html="functions(value)"></span></el-tag>
<el-tag v-else type="success" effect="dark"><span v-html="functions(value)"></span></el-tag>
`
}
export default { export default {
name: 'InstrumentList', name: 'InstrumentList',
components: { Pagination, CustomTable, Edit }, components: { Pagination, CustomTable },
mixins: [defaultCrud, defaultForm, header()], mixins: [defaultCrud, defaultForm, header(), crud()],
data() { data() {
return { return {
colConfigs: [ colConfigs: [
{ prop: 'equipmentNum', label: '设备编号', align: 'center' }, { prop: 'baogaobianhao', label: '报告编号', align: 'center' },
{ prop: 'customName', label: '新名称', align: 'center' }, { prop: 'createBy', label: '创建人', align: 'center', formatter: this.formatter.getChineseName },
{ prop: 'brand', label: '品牌', align: 'center' }, { prop: 'createTime', label: '创建时间', align: 'center' },
{ prop: 'factoryNum', label: '出厂编号', align: 'center' }, { prop: 'guihuanTime', label: '归还时间', align: 'center' },
{ prop: 'achieveDate', label: '购置时间', align: 'center' }, { prop: 'jieyueTime', label: '借阅时间', align: 'center' },
{ prop: 'quantity', label: '数量', align: 'center' }, { prop: 'jieyueren', label: '借阅人', align: 'center', formatter: this.formatter.getChineseName },
{ prop: 'unitPrice', label: '单价', align: 'center' }, { prop: 'state', label: '借阅状态', align: 'center', component: PrefixPlusText },
{ prop: 'totalPrice', label: '总价', align: 'center' }, { prop: 'updateBy', label: '修改人', align: 'center' },
{
prop: 'updateTime',
label: '更新时间',
align: 'center',
formatter: this.formatter.formatterDepartmentName
},
{ slot: 'operation' } { slot: 'operation' }
], ],
permission: { permission: {
@ -172,7 +189,23 @@ export default {
// this.crud.toQuery() // this.crud.toQuery()
// }) // })
}, },
returnFn(row) {
console.log(row)
const currentTime = this.formatter.getNowTime()
const data = {
guihuanTime: currentTime,
id: row.id,
state: true
}
this.api({
url: '/borrowing',
method: 'put',
data: data
}).then(res => {
this.$message({ message: '归还成功', type: 'success' })
this.crud.refresh()
})
},
// //
resetChecks() { resetChecks() {
this.moveDialogVisible = false this.moveDialogVisible = false

18
src/views/certificate/index.vue

@ -34,7 +34,7 @@
</el-form-item> </el-form-item>
<el-form-item label="学历:" prop="education"> <el-form-item label="学历:" prop="education">
<el-select v-model="form.education" placeholder="填写学历"> <el-select v-model="form.education" placeholder="填写学历">
<el-option v-for="item in educationDicList" :key="item.id" :label="item.label" :value="item.value" /> <el-option v-for="item in educationDicList" :key="item.id" :label="item.name" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="专业:" prop="major"> <el-form-item label="专业:" prop="major">
@ -42,7 +42,7 @@
</el-form-item> </el-form-item>
<el-form-item label="职称:" prop="certificateName"> <el-form-item label="职称:" prop="certificateName">
<el-select v-model="form.certificateName" placeholder="填写职称"> <el-select v-model="form.certificateName" placeholder="填写职称">
<el-option v-for="item in certificateNameDicList" :key="item.id" :label="item.label" :value="item.value" /> <el-option v-for="item in certificateNameDicList" :key="item.id" :label="item.name" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="级别/项目/代号:" prop="levelList"> <el-form-item label="级别/项目/代号:" prop="levelList">
@ -59,7 +59,7 @@
</el-form-item> </el-form-item>
<el-form-item label="备注:" prop="remarks"> <el-form-item label="备注:" prop="remarks">
<el-select v-model="form.remarks" placeholder="填写备注"> <el-select v-model="form.remarks" placeholder="填写备注">
<el-option v-for="item in remarksDicList" :key="item.id" :label="item.label" :value="item.value" /> <el-option v-for="item in remarksDicList" :key="item.id" :label="item.name" :value="item.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -103,8 +103,8 @@ import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination' import Pagination from '@/components/Crud/Pagination'
import CrudCertificate, { exportExcel } from '@/api/certificate' import CrudCertificate, { exportExcel } from '@/api/certificate'
import { getTreeList } from '@/api/dic_muti_level_directory' import { getTreeList } from '@/api/dic_muti_level_directory'
import { getDicDataListByTypeName, getLastDayByDate, parseTime, downloadFile } from '@/utils' import { getLastDayByDate, parseTime, downloadFile } from '@/utils'
import { getDicDataListByTypeName } from '@/api/dic_data'
// crudpresenter // crudpresenter
const defaultCrud = presenter(CRUD({ const defaultCrud = presenter(CRUD({
title: '证书', title: '证书',
@ -218,9 +218,9 @@ export default {
* 初始化字典相关列表 * 初始化字典相关列表
*/ */
initDicDataList() { initDicDataList() {
this.educationDicList = getDicDataListByTypeName('education') getDicDataListByTypeName({ typeCode: 'education' }).then(data => { this.educationDicList = data })
this.certificateNameDicList = getDicDataListByTypeName('certificate_name') getDicDataListByTypeName({ typeCode: 'certificate_name' }).then(data => { this.certificateNameDicList = data })
this.remarksDicList = getDicDataListByTypeName('certificate_remarks') getDicDataListByTypeName({ typeCode: 'certificate_remarks' }).then(data => { this.remarksDicList = data })
}, },
[CRUD.HOOK.afterToAdd]() { [CRUD.HOOK.afterToAdd]() {
// //
@ -308,7 +308,7 @@ export default {
} }
}) })
}) })
exportExcel(this.crud.query, sortOptions).then(data => { exportExcel(sortOptions).then(data => {
this.dialogVisible = false this.dialogVisible = false
downloadFile(data, parseTime(new Date()) + '-' + this.crud.title + '数据', 'xlsx') downloadFile(data, parseTime(new Date()) + '-' + this.crud.title + '数据', 'xlsx')
}) })

13
src/views/certificate/show.vue

@ -1,8 +1,5 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="head-container">
<crud :permission="{}" />
</div>
<!--表格内容--> <!--表格内容-->
<CustomTable ref="customTable" :col-configs="colConfigs" :columns="columns" :crud="crud" :row-class-name="getTableRowClassName" /> <CustomTable ref="customTable" :col-configs="colConfigs" :columns="columns" :crud="crud" :row-class-name="getTableRowClassName" />
<pagination /> <pagination />
@ -14,19 +11,21 @@ import CRUD, { header, presenter } from '@/components/Crud/crud'
import CustomTable from '@/components/Crud/Table' import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination' import Pagination from '@/components/Crud/Pagination'
import CrudCertificate from '@/api/certificate' import CrudCertificate from '@/api/certificate'
import Crud from '@/components/Crud'
// crudpresenter // crudpresenter
const defaultCrud = presenter(CRUD({ const defaultCrud = presenter(CRUD({
title: '证书', title: '证书',
url: '/certificate', url: '/certificate/getByIdentificationNum',
orderBy: ['id asc'], orderBy: ['id asc'],
query: {
identificationNum: ''
},
crudMethod: { ...CrudCertificate } crudMethod: { ...CrudCertificate }
})) }))
export default { export default {
name: 'CertificateList', name: 'CertificateList',
components: { Pagination, CustomTable, Crud }, components: { Pagination, CustomTable },
mixins: [defaultCrud, header()], mixins: [defaultCrud, header()],
data() { data() {
return { return {
@ -57,6 +56,8 @@ export default {
edit: false, edit: false,
del: false del: false
} }
this.query.identificationNum = this.$store.state.user.identificationNum
console.log(this.$store.state.user)
}, },
methods: { methods: {
[CRUD.HOOK.beforeRefresh]() { [CRUD.HOOK.beforeRefresh]() {

3
src/views/device_management/index.vue

@ -392,6 +392,9 @@ export default {
], ],
principal: [ principal: [
{ required: true, message: '请选择使用人', trigger: 'blur' } { required: true, message: '请选择使用人', trigger: 'blur' }
],
propertyUnit: [
{ required: true, message: '请输入产权单位', trigger: 'blur' }
] ]
}, },
instrumentId: 0, instrumentId: 0,

5
src/views/dic/dic_type.vue

@ -440,11 +440,12 @@ export default {
this.multipleSelection.forEach((dicType) => { this.multipleSelection.forEach((dicType) => {
pks.push(dicType.id) pks.push(dicType.id)
}) })
console.log(pks)
this.api({ this.api({
url: '/dicType/delDicType', url: '/dicType',
method: 'delete', method: 'delete',
params: { params: {
pks: pks ids: pks
}, },
paramsSerializer: function(params) { paramsSerializer: function(params) {
return qs.stringify(params, { indices: false }) return qs.stringify(params, { indices: false })

166
src/views/document/index.vue

@ -0,0 +1,166 @@
<template>
<div class="app-container">
<!--头部选项-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<el-input v-model="query.filename" placeholder="请输入文件名称" style="width: 200px;" class="filter-item" clearable @keyup.enter.native="crud.toQuery" />
<query :crud="crud" />
</div>
<crud :permission="permission">
<el-button slot="right" class="filter-item" icon="el-icon-download" type="warning" @click="exportExcel">
上传文件
</el-button>
</crud>
</div>
<!--表格内容-->
<CustomTable ref="customTable" :col-configs="colConfigs" :columns="columns" :crud="crud">
<el-table-column v-if="checkPermission(permission.edit)" slot="operation" align="center" width="100" label="操作">
<template slot-scope="scope">
<Edit :permission="permission" :data="scope.row" :disabled-edit="false" />
</template>
</el-table-column>
</CustomTable>
<pagination />
</div>
</template>
<script>
import CRUD, { form, header, presenter } from '@/components/Crud/crud'
import Crud from '@/components/Crud'
import Query from '@/components/Crud/Query'
import Edit from '@/components/Crud/Edit'
import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination'
import CrudDocumentArchives from '@/api/document_archives'
import { getDicDataListByTypeName } from '@/api/dic_data'
import { parseTime, downloadFile, downloadFileUrl } from '@/utils'
import { exportReport } from '@/api/export_document'
// crudpresenter
const defaultCrud = presenter(CRUD({
title: '检验机构体系文件管理',
url: '/documentArchives',
orderBy: ['id desc'],
crudMethod: { ...CrudDocumentArchives }
}))
// form
const defaultForm = form({
id: null,
documentName: '',
examiningUnit: '',
borrower: '',
borrowedDate: '',
returnDate: '',
borrowedState: '',
remark: ''
})
//
const PrefixPlusText = {
props: ['value', 'functions'],
template: `
<el-tag v-if="functions(value) === '未归还'" type="danger" effect="dark"><span v-html="functions(value)"></span></el-tag>
<el-tag v-else type="success" effect="dark"><span v-html="functions(value)"></span></el-tag>
`
}
export default {
name: 'DocumentArchivesList',
components: { Pagination, Query, Crud, CustomTable, Edit },
mixins: [defaultCrud, defaultForm, header()],
data() {
return {
colConfigs: [
{ prop: 'filename', label: '文件名', align: 'center' },
{ prop: 'updateBy', label: '修改人', align: 'center', formatter: this.formatter.getChineseName },
{ prop: 'createBy', label: '创建人', align: 'center' },
{ prop: 'createTime ', label: '创建时间', align: 'center' },
{ prop: 'jieyueTime', label: '借阅时间', align: 'center' },
{ prop: 'suffix ', label: '文件名后缀', align: 'center', formatter: this.formatter.getChineseName },
{ prop: 'zfState', label: '作废状态', align: 'center', component: PrefixPlusText },
{ prop: 'updateBy', label: '修改人', align: 'center' },
{
prop: 'updateTime',
label: '更新时间',
align: 'center',
formatter: this.formatter.formatterDepartmentName
},
{ slot: 'operation' }
],
permission: {
add: ['documentArchives:add'],
edit: ['documentArchives:update'],
del: ['documentArchives:delete']
},
rules: {
documentName: [
{ required: true, message: '请填写报告编号', trigger: 'blur' }
],
borrower: [
{ required: true, message: '请填写借阅人', trigger: 'blur' }
],
borrowedDate: [
{ required: true, message: '请选择借阅时间', trigger: 'blur' }
],
agreedReturnDate: [
{ required: true, message: '请选择归还时间', trigger: 'blur' }
],
borrowedState: [
{ required: true, message: '请选择借阅状态', trigger: 'change' }
]
},
reportRules: {
year: [
{ required: true, message: '请选择年度信息', trigger: 'blur' }
],
equipmentTypeCode: [
{ required: true, message: '请选择设备种类', trigger: 'change' }
],
category: [
{ required: true, message: '请选择检验类别', trigger: 'change' }
]
},
borrowedStateList: [],
dialogVisible: false,
reportForm: {},
categoryList: [],
sedirectoryList: []
}
},
mounted() {
this.initDicDataList()
},
methods: {
initDicDataList() {
//
getDicDataListByTypeName('borrowed_state').then(data => { this.borrowedStateList = data })
//
getDicDataListByTypeName('sedirectory_code').then(data => { this.sedirectoryList = data })
//
getDicDataListByTypeName('inspection_category').then(data => { this.categoryList = data })
},
exportExcel() {
CrudDocumentArchives.exportExcel(this.crud.query).then(data => {
downloadFile(data, parseTime(new Date()) + '-' + this.crud.title + '数据', 'xlsx')
})
},
exportReport() {
this.$refs['reportForm'].validate((valid) => {
if (valid) {
exportReport(this.reportForm).then(data => {
downloadFileUrl(data.data, parseTime(new Date()) + '报告导出数据', 'xlsx')
this.dialogVisible = false
})
} else {
return false
}
})
},
closeReportDialog() {
this.$refs['reportForm'].resetFields()
}
}
}
</script>

57
src/views/user/user.vue

@ -88,6 +88,14 @@
> >
<el-input v-model="tempUser.username" type="text" /> <el-input v-model="tempUser.username" type="text" />
</el-form-item> </el-form-item>
<el-form-item
v-if="dialogStatus === 'create'"
label="身份证号"
prop="identificationNum"
required
>
<el-input v-model="tempUser.identificationNum" type="text" />
</el-form-item>
<el-form-item <el-form-item
v-if="dialogStatus === 'create'" v-if="dialogStatus === 'create'"
label="昵称" label="昵称"
@ -205,6 +213,46 @@ export default {
components: { Pagination, CustomTable, Edit, Delete }, components: { Pagination, CustomTable, Edit, Delete },
mixins: [defaultCrud, defaultForm, header()], mixins: [defaultCrud, defaultForm, header()],
data() { data() {
const idCardValidity = (rule, code, callback) => {
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 { return {
defaultProps: { defaultProps: {
children: 'children', children: 'children',
@ -241,7 +289,9 @@ export default {
{ required: true, message: '请填写用户名', trigger: 'blur' } { required: true, message: '请填写用户名', trigger: 'blur' }
], ],
password: [{ 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: [], fileList: [],
depts: [], depts: [],
@ -351,7 +401,6 @@ export default {
// //
this.tempUser = {} this.tempUser = {}
this.dialogStatus = 'create' this.dialogStatus = 'create'
console.log(this.crud.status.editor, '哈哈哈')
this.dialogFormVisible = true this.dialogFormVisible = true
this.roleIds.length = 0 this.roleIds.length = 0
}, },
@ -387,7 +436,7 @@ export default {
this.$message.warning('密码长度不能低于8位') this.$message.warning('密码长度不能低于8位')
return false return false
} }
this.tempUser.deleteStatus = 1 this.tempUser.state = true
this.api({ this.api({
url: '/user', url: '/user',
method: 'post', method: 'post',
@ -449,7 +498,7 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
const user = _vue.list[$index] const user = _vue.list[$index]
user.deleteStatus = '0' user.state = false
_vue _vue
.api({ .api({
url: '/user', url: '/user',

Loading…
Cancel
Save