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. 28
      src/utils/formatter.js
  11. 35
      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 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

10
src/api/common.js

@ -189,3 +189,13 @@ export function getAssetTreeFn() {
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) {
return api({
url: rootUrl + '/getTreeList',
url: rootUrl + '/tree',
method: 'get',
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>
<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>
</template>
@ -15,6 +18,15 @@ export default {
disabledEdit: {
type: Boolean,
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: {},
// 重置表单
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

5
src/layout/components/Navbar.vue

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

2
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

28
src/utils/formatter.js

@ -38,6 +38,20 @@ 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
@ -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
}

35
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)
@ -184,8 +206,7 @@ export function toggleClass(element, className) {
element.className = classString
}
export const pickerOptions = [
{
export const pickerOptions = [{
text: '今天',
onClick(picker) {
const end = new Date()
@ -193,7 +214,7 @@ export const pickerOptions = [
end.setTime(start.getTime())
picker.$emit('pick', [start, end])
}
}, {
}, {
text: '最近一周',
onClick(picker) {
const end = new Date(new Date().toDateString())
@ -201,7 +222,7 @@ export const pickerOptions = [
start.setTime(end.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date(new Date().toDateString())
@ -209,7 +230,7 @@ export const pickerOptions = [
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}, {
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date(new Date().toDateString())
@ -217,7 +238,7 @@ export const pickerOptions = [
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}]
}]
export function getTime(type) {
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() {
// 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: {

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

@ -9,20 +9,6 @@
placeholder="选择借阅日期"
@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
v-model="query.jieyueren"
placeholder="请选择借阅人"
@ -32,8 +18,8 @@
>
<el-option
v-for="item in useStateList"
:key="item.value"
:label="item.label"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
</el-select>
@ -51,13 +37,13 @@
:row-class-name="getTableRowClassName"
>
<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"
/>
</template>
</template> -->
</el-table-column>
</CustomTable>
<pagination />
@ -67,16 +53,17 @@
<script>
import CRUD, { form, header, presenter } from '@/components/Crud/crud'
// import Crud from '@/components/Crud'
import Edit from '@/components/Crud/Edit'
import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination'
// crudpresenter
const defaultCrud = presenter(
CRUD({
title: '借阅记录',
url: '/borrowing/list',
orderBy: ['id asc']
orderBy: ['id asc'],
query: {
state: false
}
})
)
@ -121,17 +108,17 @@ const defaultForm = form({
export default {
name: 'InstrumentList',
components: { Pagination, CustomTable, Edit },
components: { Pagination, CustomTable },
mixins: [defaultCrud, defaultForm, header()],
data() {
return {
colConfigs: [
{ 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: 'guihuanTime', 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: 'updateBy', label: '修改人', align: 'center' },
{
@ -139,8 +126,7 @@ export default {
label: '更新时间',
align: 'center',
formatter: this.formatter.formatterDepartmentName
},
{ slot: 'operation' }
}
],
permission: {
add: ['instrument:add'],
@ -213,8 +199,17 @@ export default {
},
mounted() {
// this.initDicDataList()
this.getAllUser()
},
methods: {
getAllUser() {
this.api({
url: '/user/all',
method: 'get'
}).then(res => {
this.useStateList = res
})
},
//
[CRUD.HOOK.afterResetQuery]() {
if (this.$refs.queryTreeSelect) {

126
src/views/borrow/borrow.vue

@ -56,11 +56,41 @@
:permission="permission"
:data="scope.row"
:disabled-edit="false"
:flag="true"
@editFn="editFn"
/>
</template>
</el-table-column>
</CustomTable>
<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>
</template>
@ -70,53 +100,24 @@ import CRUD, { form, header, presenter } from '@/components/Crud/crud'
import Edit from '@/components/Crud/Edit'
import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination'
import { addBorrowFn } from '@/api/common'
// crudpresenter
const defaultCrud = presenter(
CRUD({
title: '借阅记录',
url: '/borrowing/list',
orderBy: ['id asc']
url: '/borrowing/getCanBorrowYsjl',
orderBy: []
// orderBy: ['y.id desc'],
})
)
// form
const defaultForm = form({
baogaobianhao: null,
assetNum: '',
equipmentNum: '',
customName: '',
equipmentName: '',
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: ''
baogaobianhao: '',
jieyueTime: '',
jieyueren: '',
state: true,
ysjlId: ''
})
export default {
@ -125,21 +126,15 @@ export default {
mixins: [defaultCrud, defaultForm, header()],
data() {
return {
visible: false,
colConfigs: [
{ prop: 'baogaobianhao', label: '报告编号', align: 'center' },
{ prop: 'createBy', label: '创建人', align: 'center' },
{ prop: 'createTime', label: '创建时间', align: 'center' },
{ prop: 'guihuanTime', label: '归还时间', align: 'center' },
{ prop: 'jieyueTime', label: '借阅时间', align: 'center' },
{ prop: 'jieyueren', label: '借阅人', align: 'center' },
{ prop: 'state', label: '借阅状态', align: 'center' },
{ prop: 'updateBy', label: '修改人', align: 'center' },
{
prop: 'updateTime',
label: '更新时间',
align: 'center',
formatter: this.formatter.formatterDepartmentName
},
{ prop: 'shiyongdanwei', label: '使用单位', align: 'center' },
{ prop: 'shigongdanwei', label: '施工单位', align: 'center' },
{ prop: 'zhizaodanwei', label: '制造单位', align: 'center' },
{ prop: 'jianyanrenyuan', label: '检验人员', align: 'center' },
{ prop: 'zhucedaima', label: '注册代码', align: 'center' },
{ prop: 'shiyongdengjibianhao', label: '使用登记证编号', align: 'center' },
{ slot: 'operation' }
],
permission: {
@ -147,6 +142,14 @@ export default {
edit: ['instrument:update'],
del: ['instrument:delete']
},
options: [],
form: {
baogaobianhao: '',
jieyueTime: '',
jieyueren: '',
state: false,
ysjlId: ''
},
dicAssetTree: [],
parentId: [],
activeName: 'first',
@ -213,6 +216,7 @@ export default {
},
mounted() {
// this.initDicDataList()
this.getAllUser()
},
methods: {
//
@ -235,6 +239,26 @@ export default {
this.departmentId = 0
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
beforeUpload(file) {
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">
<el-table-column slot="operation" align="center" width="100" label="操作">
<template slot-scope="scope">
<Edit :permission="permission" :data="scope.row" :disabled-edit="false" />
<el-button type="text" @click="returnFn(scope.row)">
归还
</el-button>
</template>
</el-table-column>
</CustomTable>
@ -30,9 +32,8 @@
</template>
<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 Edit from '@/components/Crud/Edit'
import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination'
@ -40,29 +41,45 @@ import Pagination from '@/components/Crud/Pagination'
const defaultCrud = presenter(CRUD({
title: '借阅记录',
url: '/borrowing/list',
orderBy: ['id asc']
orderBy: ['id asc'],
query: {
state: true
}
}))
// 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 {
name: 'InstrumentList',
components: { Pagination, CustomTable, Edit },
mixins: [defaultCrud, defaultForm, header()],
components: { Pagination, CustomTable },
mixins: [defaultCrud, defaultForm, header(), crud()],
data() {
return {
colConfigs: [
{ prop: 'equipmentNum', label: '设备编号', align: 'center' },
{ prop: 'customName', label: '新名称', align: 'center' },
{ prop: 'brand', label: '品牌', align: 'center' },
{ prop: 'factoryNum', label: '出厂编号', align: 'center' },
{ prop: 'achieveDate', label: '购置时间', align: 'center' },
{ prop: 'quantity', label: '数量', align: 'center' },
{ prop: 'unitPrice', label: '单价', align: 'center' },
{ prop: 'totalPrice', label: '总价', align: 'center' },
{ prop: 'baogaobianhao', label: '报告编号', align: 'center' },
{ prop: 'createBy', label: '创建人', align: 'center', formatter: this.formatter.getChineseName },
{ prop: 'createTime', label: '创建时间', align: 'center' },
{ prop: 'guihuanTime', label: '归还时间', align: 'center' },
{ prop: 'jieyueTime', label: '借阅时间', align: 'center' },
{ prop: 'jieyueren', label: '借阅人', align: 'center', formatter: this.formatter.getChineseName },
{ prop: 'state', label: '借阅状态', align: 'center', component: PrefixPlusText },
{ prop: 'updateBy', label: '修改人', align: 'center' },
{
prop: 'updateTime',
label: '更新时间',
align: 'center',
formatter: this.formatter.formatterDepartmentName
},
{ slot: 'operation' }
],
permission: {
@ -172,7 +189,23 @@ export default {
// 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() {
this.moveDialogVisible = false

18
src/views/certificate/index.vue

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

13
src/views/certificate/show.vue

@ -1,8 +1,5 @@
<template>
<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" />
<pagination />
@ -14,19 +11,21 @@ import CRUD, { header, presenter } from '@/components/Crud/crud'
import CustomTable from '@/components/Crud/Table'
import Pagination from '@/components/Crud/Pagination'
import CrudCertificate from '@/api/certificate'
import Crud from '@/components/Crud'
// crudpresenter
const defaultCrud = presenter(CRUD({
title: '证书',
url: '/certificate',
url: '/certificate/getByIdentificationNum',
orderBy: ['id asc'],
query: {
identificationNum: ''
},
crudMethod: { ...CrudCertificate }
}))
export default {
name: 'CertificateList',
components: { Pagination, CustomTable, Crud },
components: { Pagination, CustomTable },
mixins: [defaultCrud, header()],
data() {
return {
@ -57,6 +56,8 @@ export default {
edit: false,
del: false
}
this.query.identificationNum = this.$store.state.user.identificationNum
console.log(this.$store.state.user)
},
methods: {
[CRUD.HOOK.beforeRefresh]() {

3
src/views/device_management/index.vue

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

5
src/views/dic/dic_type.vue

@ -440,11 +440,12 @@ export default {
this.multipleSelection.forEach((dicType) => {
pks.push(dicType.id)
})
console.log(pks)
this.api({
url: '/dicType/delDicType',
url: '/dicType',
method: 'delete',
params: {
pks: pks
ids: pks
},
paramsSerializer: function(params) {
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-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
v-if="dialogStatus === 'create'"
label="昵称"
@ -205,6 +213,46 @@ export default {
components: { Pagination, CustomTable, Edit, Delete },
mixins: [defaultCrud, defaultForm, header()],
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 {
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',

Loading…
Cancel
Save