Browse Source

20240418需求bug修复

master
xuhuajiao 10 months ago
parent
commit
b39e4e73d4
  1. 15
      .env.development
  2. 230
      package.json
  3. 32
      src/views/archivesManage/archivesList/index.vue
  4. 2
      src/views/archivesManage/archivesList/mixins/archives.js
  5. 106
      src/views/archivesManage/fileImport/dataImport/index.vue
  6. 23
      src/views/archivesManage/fileImport/importLog/index.vue
  7. 92
      src/views/archivesManage/fileImport/module/detail.vue
  8. 22
      src/views/archivesManage/outInStorage/inStorage/index.vue
  9. 1
      src/views/archivesManage/outInStorage/outInHistory/index.vue
  10. 2
      src/views/system/logManage/loginLog/index.vue
  11. 530
      src/views/system/menu/index.vue
  12. 762
      src/views/system/role/index.vue
  13. 72
      src/views/system/user/index.vue

15
.env.development

@ -3,20 +3,19 @@ ENV = 'development'
# 接口地址
#内网服务地址
VUE_APP_BASE_API = 'http://192.168.99.107:7070'
VUE_APP_WS_API = 'ws://192.168.99.107:7071'
# VUE_APP_BASE_API = 'http://192.168.99.107:7077'
# VUE_APP_WS_API = 'ws://192.168.99.107:7077'
VUE_APP_CAMERA_API = '192.168.99.107:3000'
# 刘力-本地服地址
#VUE_APP_BASE_API = 'http://192.168.99.65:7070'
#VUE_APP_WS_API = 'ws://192.168.99.65:7071'
# VUE_APP_BASE_API = 'http://192.168.99.107:7070'
# VUE_APP_WS_API = 'ws://192.168.99.107:7070'
# 许镇-本地服地址
#VUE_APP_BASE_API = 'http://192.168.99.84:7070'
#VUE_APP_WS_API = 'ws://192.168.99.84:7070'
# VUE_APP_BASE_API = 'http://192.168.99.67:7070'
# VUE_APP_WS_API = 'ws://192.168.99.67:7070'
VUE_APP_BASE_API = 'http://192.168.99.67:7070'
VUE_APP_WS_API = 'ws://192.168.99.67:7070'
# 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true

230
package.json

@ -1,115 +1,115 @@
{
"name": "yxk-storeroom-system",
"version": "1.0.0",
"description": "智能库房综合管理系统",
"author": "刘力",
"license": "",
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src",
"test:unit": "jest --clearCache && vue-cli-service test:unit",
"svgo": "svgo -f src/assets/icons/svg --config=src/assets/icons/svgo.yml",
"new": "plop"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
]
},
"dependencies": {
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
"@riophae/vue-treeselect": "^0.4.0",
"axios": "^0.21.1",
"clipboard": "2.0.4",
"codemirror": "^5.49.2",
"connect": "3.6.6",
"core-js": "^2.6.12",
"echarts": "^4.2.1",
"echarts-gl": "^1.1.1",
"echarts-wordcloud": "^1.1.3",
"element-ui": "^2.15.6",
"file-saver": "1.3.8",
"fuse.js": "3.4.4",
"highlight.js": "^11.5.1",
"html2canvas": "^1.4.1",
"js-beautify": "^1.10.2",
"js-cookie": "2.2.0",
"jsencrypt": "^3.0.0-rc.1",
"jszip": "^3.7.1",
"mavon-editor": "^2.9.1",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"print-js": "^1.6.0",
"qs": "^6.10.1",
"screenfull": "4.2.0",
"sortablejs": "1.8.4",
"vkbeautify": "^0.99.3",
"vue": "^2.6.14",
"vue-count-to": "^1.0.13",
"vue-cropper": "0.4.9",
"vue-echarts": "^5.0.0-beta.0",
"vue-highlightjs": "^1.3.3",
"vue-image-crop-upload": "^2.5.0",
"vue-router": "3.0.2",
"vue-splitpane": "1.0.4",
"vuedraggable": "2.20.0",
"vuex": "3.1.0",
"wangeditor": "^4.7.11",
"x2js": "^3.4.3",
"xlsx": "^0.17.4"
},
"devDependencies": {
"@babel/parser": "^7.7.4",
"@babel/register": "7.0.0",
"@vue/babel-plugin-transform-vue-jsx": "^1.2.1",
"@vue/cli-plugin-babel": "3.5.3",
"@vue/cli-plugin-eslint": "^3.9.1",
"@vue/cli-plugin-unit-jest": "3.5.3",
"@vue/cli-service": "3.5.3",
"@vue/test-utils": "1.0.0-beta.29",
"autoprefixer": "^9.5.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
"babel-jest": "23.6.0",
"babel-plugin-dynamic-import-node": "2.3.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"chalk": "2.4.2",
"chokidar": "2.1.5",
"connect": "3.6.6",
"eslint": "5.15.3",
"eslint-plugin-vue": "5.2.2",
"html-webpack-plugin": "3.2.0",
"http-proxy-middleware": "^0.19.1",
"husky": "1.3.1",
"lint-staged": "8.1.5",
"plop": "2.3.0",
"sass": "1.32.13",
"sass-loader": "10.2.0",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"serve-static": "^1.13.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.0",
"tasksfile": "^5.1.1",
"vue-template-compiler": "2.6.14"
},
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
{
"name": "yxk-storeroom-system",
"version": "1.0.0",
"description": "智能库房综合管理系统",
"author": "刘力",
"license": "",
"scripts": {
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
"build:stage": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src",
"test:unit": "jest --clearCache && vue-cli-service test:unit",
"svgo": "svgo -f src/assets/icons/svg --config=src/assets/icons/svgo.yml",
"new": "plop"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
]
},
"dependencies": {
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
"@riophae/vue-treeselect": "^0.4.0",
"axios": "^0.21.1",
"clipboard": "2.0.4",
"codemirror": "^5.49.2",
"connect": "3.6.6",
"core-js": "^2.6.12",
"echarts": "^4.2.1",
"echarts-gl": "^1.1.1",
"echarts-wordcloud": "^1.1.3",
"element-ui": "^2.15.6",
"file-saver": "1.3.8",
"fuse.js": "3.4.4",
"highlight.js": "^11.5.1",
"html2canvas": "^1.4.1",
"js-beautify": "^1.10.2",
"js-cookie": "2.2.0",
"jsencrypt": "^3.0.0-rc.1",
"jszip": "^3.7.1",
"mavon-editor": "^2.9.1",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"print-js": "^1.6.0",
"qs": "^6.10.1",
"screenfull": "4.2.0",
"sortablejs": "1.8.4",
"vkbeautify": "^0.99.3",
"vue": "^2.6.14",
"vue-count-to": "^1.0.13",
"vue-cropper": "0.4.9",
"vue-echarts": "^5.0.0-beta.0",
"vue-highlightjs": "^1.3.3",
"vue-image-crop-upload": "^2.5.0",
"vue-router": "3.0.2",
"vue-splitpane": "1.0.4",
"vuedraggable": "2.20.0",
"vuex": "3.1.0",
"wangeditor": "^4.7.11",
"x2js": "^3.4.3",
"xlsx": "^0.17.4"
},
"devDependencies": {
"@babel/parser": "^7.7.4",
"@babel/register": "7.0.0",
"@vue/babel-plugin-transform-vue-jsx": "^1.2.1",
"@vue/cli-plugin-babel": "3.5.3",
"@vue/cli-plugin-eslint": "^3.9.1",
"@vue/cli-plugin-unit-jest": "3.5.3",
"@vue/cli-service": "3.5.3",
"@vue/test-utils": "1.0.0-beta.29",
"autoprefixer": "^9.5.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
"babel-jest": "23.6.0",
"babel-plugin-dynamic-import-node": "2.3.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"chalk": "2.4.2",
"chokidar": "2.1.5",
"connect": "3.6.6",
"eslint": "5.15.3",
"eslint-plugin-vue": "5.2.2",
"html-webpack-plugin": "3.2.0",
"http-proxy-middleware": "^0.19.1",
"husky": "1.3.1",
"lint-staged": "8.1.5",
"plop": "2.3.0",
"sass": "1.32.13",
"sass-loader": "10.2.0",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"serve-static": "^1.13.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.0",
"tasksfile": "^5.1.1",
"vue-template-compiler": "2.6.14"
},
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}

32
src/views/archivesManage/archivesList/index.vue

@ -16,11 +16,12 @@
<div v-if="!isRecycle" class="container-left left-tree-item">
<span class="right-top-line" />
<span class="left-bottom-line" />
<div class="tree-title">智能分类</div>
<div class="tree-title">智能检索</div>
<!--智能分类树状结构-->
<!-- @node-click="handleIntellNodeClick" -->
<!-- @check="nodeCheck" -->
<div class="tree-scroll">
<!-- :default-expand-all="true" -->
<el-tree
ref="smartTree"
v-loading="intellClassifyLoading"
@ -28,7 +29,6 @@
:props="intellDefaultProps"
node-key="dicName"
:check-strictly="true"
:default-expand-all="true"
:default-checked-keys="defaultCheckedKeys"
:expand-on-click-node="false"
@node-click="handleIntellNodeClick"
@ -278,6 +278,7 @@ export default {
this.intellClassifyTree.forEach(item => {
item.disabled = item.dicPid === null
})
this.intellClassifyTree = this.sortData(this.intellClassifyTree)
}
})
},
@ -434,9 +435,7 @@ export default {
if (this.$refs.smartTree) {
this.intellClassifyLoading = true
setTimeout(() => {
if (this.intellClassifyTree[0].dicName === '年度') {
this.intellClassifyTree = this.intellClassifyTree.slice(1)
}
console.log('this.$refs[obj].yearGroup.length', this.$refs[obj].yearGroup.length)
if (this.$refs[obj].yearGroup.length !== 0) {
const newYearArr = this.$refs[obj].yearGroup.map((item, index) => {
const json = {}
@ -446,14 +445,29 @@ export default {
json.dicPid = 0
return json
})
this.intellClassifyTree.unshift({ id: 0, dicName: '年度', dicPid: null, dicCode: 'Search_year', disabled: true, childMenus: newYearArr })
console.log(this.intellClassifyTree)
const index = this.intellClassifyTree.findIndex(item => item.dicName === '年度')
if (index !== -1) {
this.intellClassifyTree.splice(index, 1)
}
this.intellClassifyTree.splice(1, 0, { id: 0, dicName: '年度', dicPid: null, dicCode: 'Search_year', disabled: true, childMenus: newYearArr })
} else {
const index = this.intellClassifyTree.findIndex(item => item.dicName === '年度')
if (index !== -1) {
this.intellClassifyTree.splice(index, 1)
}
}
console.log(this.intellClassifyTree)
this.intellClassifyLoading = false
}, 1000)
}, 2000)
}
},
sortData(data) {
//
const order = ['QZH', 'Search_year', 'Search_BGQX', 'Search_MJ', 'WZ', 'ZT']
//
return data.sort((a, b) => order.indexOf(a.dicCode) - order.indexOf(b.dicCode))
},
unique(arr) {
return Array.from(new Set(arr))
},

2
src/views/archivesManage/archivesList/mixins/archives.js

@ -109,7 +109,7 @@ export const archivesCrud = {
this.arrySort = []
this.tableDisplayFields = data
this.getTableDisplayFieldsLoading = false
const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
const orderSortArry = this.tableDisplayFields.filter(item => item.queue).sort((a, b) => a.queue - b.queue)
orderSortArry.forEach(item => {
this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
})

106
src/views/archivesManage/fileImport/dataImport/index.vue

@ -1,5 +1,9 @@
<template>
<div class="import-container">
<div
v-loading="loading1"
class="import-container"
element-loading-background="rgba(0, 0, 0, 0.8)"
>
<ul class="import-header">
<li><i class="step-img01" /><span>上传数据包</span></li>
<li :class="['dot-img', {'dot-img-active':isShow02 || isShow03}]" />
@ -7,7 +11,10 @@
<li :class="['dot-img', {'dot-img-active':isShow03}]" />
<li><i :class="['step-img03', {'step-img03-active':isShow03}]" /><span>导入数据</span></li>
</ul>
<div v-if="isShow01" class="step-content step-upload">
<div
v-if="isShow01"
class="step-content step-upload"
>
<div class="upload-container">
<input ref="fileInput" :key="key" type="file" accept=".zip" @change="handleFileChange">
<div class="upload-zip"><i class="el-icon-upload2" />选择文件</div>
@ -21,7 +28,7 @@
<div v-if="isShow01" class="step-bottom-btn">
<el-button type="primary" @click="handleStep01">下一步</el-button>
</div>
<div v-if="isShow02" class="step-content">
<div v-show="isShow02" class="step-content">
<div class="import-data-number">案卷<span>{{ ajnum }}</span> / 卷内<span>{{ danum }}</span> / 资料<span>{{ djnum }}</span> </div>
<detail ref="importTableList" :is-log-or-preview="isLogOrPreview" />
</div>
@ -99,7 +106,8 @@ export default {
isShow02: false,
isShow03: false,
timer: null,
isLogOrPreview: 'preview'
isLogOrPreview: 'preview',
loading1: false
}
},
computed: {
@ -147,27 +155,59 @@ export default {
},
//
handleStep01() {
this.loading1 = true
const notifyInstance = this.$notify.info({
title: '温馨提示',
message: '当前批量数据导入所需的时间较长,请用户耐心等待,谢谢!',
customClass: 'centered-notify',
showClose: false,
duration: 0 // 0
})
if (this.fileList.length !== 0) {
this.zipName = this.file.name.split('.')[0]
//
crudFileImport.zipUpload(this.baseApi + '/api/unzip/preview', this.file).then(res => {
if (res.data.code === 200) {
if (res.data.data) {
this.isShow01 = false
this.isShow02 = true
//
crudFileImport.FetchInitImportPreview({ page: 0, size: 10, type: 1 }).then(res => {
this.ajnum = res.ajnum
this.danum = res.danum
this.djnum = res.djnum
this.djnum = res.djnum
this.$refs.importTableList.tableData = res.list.content
this.$refs.importTableList.page.total = res.list.totalElements
this.timer = setTimeout(() => {
this.loading1 = false
notifyInstance.close()
this.isShow01 = false
this.isShow02 = true
clearTimeout(this.timer)
}, 1000)
}).catch(() => {
this.loading1 = false
notifyInstance.close()
this.isShow01 = false
this.isShow02 = true
})
} else {
this.loading1 = false
notifyInstance.close()
this.isShow01 = false
this.isShow02 = true
}
} else {
this.loading1 = false
notifyInstance.close()
}
}).catch(() => {
this.loading1 = false
notifyInstance.close()
})
} else {
this.$message.warning('请上传相关文件 !')
this.loading1 = false
notifyInstance.close()
return
}
},
@ -194,6 +234,14 @@ export default {
},
//
submitForm(formName) {
// this.loading1 = true
// const notifyInstance = this.$notify.info({
// title: '',
// message: '',
// customClass: 'centered-notify',
// showClose: false,
// duration: 0 // 0
// })
this.$refs[formName].validate((valid) => {
if (valid) {
const params = {
@ -204,17 +252,21 @@ export default {
'name': this.zipName
}
crudFileImport.FetchImportZip(params).then(res => {
if (res) {
this.$message({
type: 'success',
message: '导入成功!'
})
this.timer = setTimeout(() => {
this.$emit('step-end', '1')
clearTimeout(this.timer)
}, 1000)
}
console.log('resZip', res)
this.$message({
type: 'success',
message: '导入成功!'
})
}).catch(() => {
this.timer = setTimeout(() => {
this.$emit('step-end', '1')
clearTimeout(this.timer)
}, 1000)
})
this.timer = setTimeout(() => {
this.$emit('step-end', '1')
clearTimeout(this.timer)
}, 1000)
} else {
console.log('error submit!!')
return false
@ -224,9 +276,28 @@ export default {
}
}
</script>
<style>
.centered-notify{
top: calc(50% + 80px) !important;
left: calc(50% + 160px) !important;
right: 0 !important;
transform: translate(-50%,-50%) !important;
background-color: #031435!important;
border: 1px solid #339CFF!important;
& h2{
color: #fff!important;
}
& .el-notification__content{
color: #fff!important;
}
}
</style>
<style lang="scss" scoped>
::v-deep .el-loading-spinner{
top: 60%;
}
.import-container{
position: relative;
padding: 30px;
height: calc(100vh - 234px);
}
@ -425,4 +496,5 @@ export default {
border-color: #3a99fd;
margin-top: 20px;
}
</style>

23
src/views/archivesManage/fileImport/importLog/index.vue

@ -13,7 +13,8 @@
<el-table-column prop="name" label="导入数据包" />
<el-table-column prop="status" label="导入状态">
<template slot-scope="scope">
<div>{{ scope.row.status === 1 ? '已完成' : '' }}</div>
<div v-if="scope.row.status === 0" class="import-loading">导入中</div>
<div v-if="scope.row.status === 1">已完成</div>
</template>
</el-table-column>
<el-table-column prop="create_by" label="操作人" />
@ -80,11 +81,18 @@ export default {
//
handleDbClick(row) {
this.zipSelect = row
this.detailVisible = true
crudFileImport.FetchInitImportLogDetail({ page: 0, size: 10, zipid: row.id, type: 1 }).then(res => {
this.$refs.importTableList.tableData = res.content
this.$refs.importTableList.page.total = res.totalElements
})
if (row.status === 0) {
this.$message({
type: 'info',
message: '当前批量数据导入中,请用户耐心等待,谢谢!'
})
} else {
this.detailVisible = true
crudFileImport.FetchInitImportLogDetail({ page: 0, size: 10, zipid: row.id, type: 1 }).then(res => {
this.$refs.importTableList.tableData = res.content
this.$refs.importTableList.page.total = res.totalElements
})
}
},
handleClose() {
this.detailVisible = false
@ -106,4 +114,7 @@ export default {
}
}
}
.import-loading{
color: #fd8042;
}
</style>

92
src/views/archivesManage/fileImport/module/detail.vue

@ -27,70 +27,70 @@
</template>
</el-table-column>
<!-- 资料 -->
<el-table-column v-if=" archivesTabIndex == 2" prop="serialNo" label="序号" align="center" width="100px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="arriveDate" label="收发日期" align="center" width="100px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="arriveClass" label="收发类别" align="center" width="100px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="arriveNo" label="类别编号" align="center" width="100px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="arriveMark" label="收发标识" align="center" width="100px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="sourcePartNo" label="源份号" align="center" width="80px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="docNo" label="发文字号" align="center" width="120px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="serialNo" label="序号" align="center" width="60px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="arriveDate" label="收发日期" align="center" show-overflow-tooltip min-width="160px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="arriveClass" label="收发类别" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="arriveNo" label="类别编号" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="arriveMark" label="收发标识" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="sourcePartNo" label="源份号" align="center" show-overflow-tooltip min-width="80px" />
<el-table-column v-if=" archivesTabIndex == 2" prop="docNo" label="发文字号" align="center" show-overflow-tooltip min-width="160px" />
<!-- 案卷 / 文件 / 资料 -->
<el-table-column prop="securityClass" label="密级" align="center" width="80px" />
<el-table-column prop="securityClass" label="密级" align="center" show-overflow-tooltip min-width="80px" />
<!-- 案卷 / 文件 -->
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="mediumType" label="载体类型" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="mediumType" label="载体类型" align="center" show-overflow-tooltip min-width="100px" />
<!-- 资料 -->
<el-table-column v-if="archivesTabIndex == 2" prop="recordType" label="公文种类" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="recordType" label="公文种类" align="center" show-overflow-tooltip min-width="100px" />
<!-- 文件 -->
<el-table-column v-if=" archivesTabIndex == 1" prop="recordType" label="文种" align="center" width="80px" />
<el-table-column v-if=" archivesTabIndex == 1" prop="documentNo" label="文件编号" align="center" width="100px" />
<el-table-column v-if=" archivesTabIndex == 1" prop="recordType" label="文种" align="center" show-overflow-tooltip min-width="80px" />
<el-table-column v-if=" archivesTabIndex == 1" prop="documentNo" label="文件编号" align="center" show-overflow-tooltip min-width="100px" />
<!-- 案卷 / 文件 -->
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="microfilm" label="缩微号" align="center" width="80px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="microfilm" label="缩微号" align="center" show-overflow-tooltip min-width="80px" />
<!-- 文件 -->
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="fileNo" label="电子文件号" align="center" width="120px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="fileNo" label="电子文件号" align="center" show-overflow-tooltip min-width="120px" />
<!-- 案卷 / 文件 -->
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="archiveNo" label="档号" align="center" width="240px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="archiveNo" label="档号" align="center" show-overflow-tooltip min-width="240px" />
<!-- 文件 -->
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="maintitle" label="题名" align="center" width="80px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="maintitle" label="题名" align="center" show-overflow-tooltip min-width="240px" />
<!-- 资料 -->
<el-table-column v-if="archivesTabIndex == 2" prop="createdDate" label="成文日期" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="organizer" label="承办单位" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="undertaker" label="承办人" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="endorsementLeader" label="签批领导" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="readingLeader" label="阅文领导" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="arriveOrgan" label="发文机关" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="sendOrgan" label="主送机关" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="copyOrgan" label="抄送机关" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="createdDate" label="成文日期" align="center" show-overflow-tooltip min-width="140px" />
<el-table-column v-if="archivesTabIndex == 2" prop="organizer" label="承办单位" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="undertaker" label="承办人" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="endorsementLeader" label="签批领导" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="readingLeader" label="阅文领导" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="arriveOrgan" label="发文机关" align="center" show-overflow-tooltip min-width="180px" />
<el-table-column v-if="archivesTabIndex == 2" prop="sendOrgan" label="主送机关" align="center" show-overflow-tooltip min-width="180px" />
<el-table-column v-if="archivesTabIndex == 2" prop="copyOrgan" label="抄送机关" align="center" show-overflow-tooltip min-width="180px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="version" label="文本" align="center" width="80px" />
<el-table-column v-if="archivesTabIndex == 1" prop="responsibleby" label="责任者" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 1" prop="created_date" label="时间" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="mediumQty" label="载体数量" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="mediumUnit" label="载体单位" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="mediumSpecs" label="载体规格" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="version" label="文本" align="center" show-overflow-tooltip min-width="80px" />
<el-table-column v-if="archivesTabIndex == 1" prop="responsibleby" label="责任者" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 1" prop="created_date" label="时间" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="mediumQty" label="载体数量" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="mediumUnit" label="载体单位" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 1 || archivesTabIndex == 2" prop="mediumSpecs" label="载体规格" align="center" show-overflow-tooltip min-width="100px" />
<!-- 案卷 -->
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 2" prop="pieceQty" label="文件件数" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="tempNo" label="临时卷号" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 2" prop="pieceQty" label="文件件数" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 2" prop="tempNo" label="临时卷号" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 0" prop="maintitle" label="案卷题名" align="center" show-overflow-tooltip width="240px" />
<el-table-column v-if="archivesTabIndex == 0" prop="beginDate" label="起始时间" align="center" width="140px" />
<el-table-column v-if="archivesTabIndex == 0" prop="endDate" label="终止时间" align="center" width="140px" />
<el-table-column v-if="archivesTabIndex == 0" prop="maintitle" label="案卷题名" align="center" show-overflow-tooltip min-width="240px" />
<el-table-column v-if="archivesTabIndex == 0" prop="beginDate" label="起始时间" align="center" show-overflow-tooltip min-width="140px" />
<el-table-column v-if="archivesTabIndex == 0" prop="endDate" label="终止时间" align="center" show-overflow-tooltip min-width="140px" />
<!-- 案卷 / 文件 -->
<el-table-column prop="archiveCtgNo" label="分类号" align="center" width="140px" />
<el-table-column prop="keyword" label="主题词" align="center" width="140px" />
<el-table-column prop="remarks" label="附注" align="center" width="120px" />
<el-table-column prop="archiveCtgNo" label="分类号" align="center" show-overflow-tooltip min-width="140px" />
<el-table-column prop="keyword" label="主题词" align="center" show-overflow-tooltip min-width="140px" />
<el-table-column prop="remarks" label="附注" align="center" show-overflow-tooltip min-width="120px" />
<!-- 资料 -->
<el-table-column v-if=" archivesTabIndex ==2" prop="dividedQty" label="已分份数" align="center" width="120px" />
<el-table-column v-if=" archivesTabIndex ==2" prop="dividedQty" label="已分份数" align="center" show-overflow-tooltip min-width="120px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="retention" label="保管期限" align="center" width="120px" />
<el-table-column prop="archiveYear" label="年度" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="fondsNo" label="全宗" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="recordNo" label="卷号" align="center" width="100px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="retention" label="保管期限" align="center" show-overflow-tooltip min-width="120px" />
<el-table-column prop="archiveYear" label="年度" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="fondsNo" label="全宗" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if="archivesTabIndex == 0 || archivesTabIndex == 1" prop="recordNo" label="卷号" align="center" show-overflow-tooltip min-width="100px" />
<!-- 文件 -->
<el-table-column v-if=" archivesTabIndex ==1" prop="pieceNo" label="件号" align="center" width="100px" />
<el-table-column v-if=" archivesTabIndex ==1" prop="pieceNo" label="件号" align="center" show-overflow-tooltip min-width="100px" />
<!-- 资料 -->
<el-table-column v-if=" archivesTabIndex ==2" prop="fileQty" label="归档份数" align="center" width="100px" />
<el-table-column v-if=" archivesTabIndex ==2" prop="classSerialNo" label="类别序号" align="center" width="100px" />
<el-table-column v-if=" archivesTabIndex ==2" prop="fileQty" label="归档份数" align="center" show-overflow-tooltip min-width="100px" />
<el-table-column v-if=" archivesTabIndex ==2" prop="classSerialNo" label="类别序号" align="center" show-overflow-tooltip min-width="100px" />
</el-table>
<!--分页组件-->
<el-pagination

22
src/views/archivesManage/outInStorage/inStorage/index.vue

@ -110,7 +110,8 @@ import pagination from '@crud/Pagination'
import detailDialog from '../module/detailDialog.vue'
import inDialog from './module/inDialog.vue'
import handDialog from './module/handDialog.vue'
import { initCasesByArchives, readyCollectConfirm, collectConfirm, initStorageDetailes } from '@/api/archivesManage/outInStorage'
// initCasesByArchives
import { readyCollectConfirm, collectConfirm, initStorageDetailes } from '@/api/archivesManage/outInStorage'
// import { getDetail } from '../module/outIn'
export default {
name: 'InStorage',
@ -192,16 +193,21 @@ export default {
},
//
handleIn() {
const caseIds = this.selections.map(item => { return item.id })
// const caseIds = this.selections.map(item => { return item.id })
const index = this.selections.every((item) => item.storageType === 0)
if (index) {
const params = {
caseIds: caseIds
}
initCasesByArchives(params).then(res => {
this.$refs.inDialogDom.childData = res
})
this.$refs.inDialogDom.childData = this.selections
this.$refs.inDialogDom.dialogVisible = true
// const params = {
// caseIds: caseIds
// }
// initCasesByArchives(params).then(res => {
// this.$refs.inDialogDom.childData = res
// console.log('this.$refs.inDialogDom.childData', this.$refs.inDialogDom.childData)
// if (this.$refs.inDialogDom.childData) {
// this.$refs.inDialogDom.dialogVisible = true
// }
// })
} else {
this.msgVisible = true
}

1
src/views/archivesManage/outInStorage/outInHistory/index.vue

@ -70,6 +70,7 @@
</div>
</template>
</el-table-column>
<el-table-column prop="create_by" label="操作人" align="center" min-width="100" />
<el-table-column align="center" prop="update_time" label="操作时间" width="200">
<template slot-scope="scope">
<div>{{ scope.row.update_time | parseTime }}</div>

2
src/views/system/logManage/loginLog/index.vue

@ -79,7 +79,7 @@ export default {
cruds() {
return CRUD({
url: 'api/loginlogs/list',
// sort: ['update_time,desc'],
sort: ['createTime,desc'],
// crudMethod: caseCrudMethod,
optShow: {
add: false,

530
src/views/system/menu/index.vue

@ -1,265 +1,265 @@
<template>
<div>
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle" class="head-search">
<!-- 搜索 -->
<el-input v-model="query.blurry" clearable size="small" placeholder="模糊搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<date-range-picker v-model="query.createTime" class="date-item" />
<rrOperation />
</div>
<crudOperation :permission="permission" />
</div>
<!--表单渲染-->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="菜单类型" prop="type">
<el-radio-group v-model="form.type" size="mini" style="width: 178px">
<el-radio-button label="0">目录</el-radio-button>
<el-radio-button label="1">菜单</el-radio-button>
<el-radio-button label="2">按钮</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="菜单图标" prop="icon">
<el-popover
placement="bottom-start"
width="450"
trigger="click"
@show="$refs['iconSelect'].reset()"
>
<IconSelect ref="iconSelect" @selected="selected" />
<el-input slot="reference" v-model="form.icon" style="width: 450px;" placeholder="点击选择图标" readonly>
<svg-icon v-if="form.icon" slot="prefix" :icon-class="form.icon" class="el-input__icon" style="height: 30px;width: 16px;" />
<i v-else slot="prefix" class="el-icon-search el-input__icon" />
</el-input>
</el-popover>
</el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="外链菜单" prop="iFrame">
<el-radio-group v-model="form.iFrame" size="mini">
<el-radio-button label="true"></el-radio-button>
<el-radio-button label="false"></el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.type.toString() === '1'" label="菜单缓存" prop="cache">
<el-radio-group v-model="form.cache" size="mini">
<el-radio-button label="true"></el-radio-button>
<el-radio-button label="false"></el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="菜单可见" prop="hidden">
<el-radio-group v-model="form.hidden" size="mini">
<el-radio-button label="false"></el-radio-button>
<el-radio-button label="true"></el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" label="菜单标题" prop="title">
<el-input v-model="form.title" :style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 178px'" placeholder="菜单标题" />
</el-form-item>
<el-form-item v-if="form.type.toString() === '2'" label="按钮名称" prop="title">
<el-input v-model="form.title" placeholder="按钮名称" style="width: 178px;" />
</el-form-item>
<el-form-item v-show="form.type.toString() !== '0'" label="权限标识" prop="permission">
<el-input v-model="form.permission" :disabled="form.iFrame.toString() === 'true'" placeholder="权限标识" style="width: 178px;" />
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" label="路由地址" prop="path">
<el-input v-model="form.path" placeholder="路由地址" style="width: 178px;" />
</el-form-item>
<el-form-item label="菜单排序" prop="menuSort">
<el-input-number v-model.number="form.menuSort" :min="0" :max="999" controls-position="right" style="width: 178px;" />
</el-form-item>
<el-form-item v-show="form.iFrame.toString() !== 'true' && form.type.toString() === '1'" label="组件名称" prop="componentName">
<el-input v-model="form.componentName" style="width: 178px;" placeholder="匹配组件内Name字段" />
</el-form-item>
<el-form-item v-show="form.iFrame.toString() !== 'true' && form.type.toString() === '1'" label="组件路径" prop="component">
<el-input v-model="form.component" style="width: 178px;" placeholder="组件路径" />
</el-form-item>
<el-form-item label="上级类目" prop="pid">
<treeselect
v-model="form.pid"
:options="menus"
:load-options="loadMenus"
style="width: 450px;"
placeholder="选择上级类目"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</div>
</el-dialog>
<!--表格渲染-->
<div class="app-container container-wrap" style="margin-top:0;min-height: calc(100vh - 292px);">
<span class="right-top-line" />
<span class="left-bottom-line" />
<el-table
ref="table"
v-loading="crud.loading"
lazy
:load="getMenus"
:data="crud.data"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="id"
@select="crud.selectChange"
@select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" align="center" width="55" />
<el-table-column :show-overflow-tooltip="true" label="菜单标题" width="125px" prop="title" />
<el-table-column prop="icon" label="图标" align="center" width="60px">
<template slot-scope="scope">
<svg-icon :icon-class="scope.row.icon ? scope.row.icon : ''" />
</template>
</el-table-column>
<el-table-column prop="menuSort" align="center" label="排序">
<template slot-scope="scope">
{{ scope.row.menuSort }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="permission" label="权限标识" />
<el-table-column :show-overflow-tooltip="true" prop="component" label="组件路径" />
<el-table-column prop="iFrame" label="外链" width="75px">
<template slot-scope="scope">
<span v-if="scope.row.iFrame"></span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column prop="cache" label="缓存" width="75px">
<template slot-scope="scope">
<span v-if="scope.row.cache"></span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column prop="hidden" label="可见" width="75px">
<template slot-scope="scope">
<span v-if="scope.row.hidden"></span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建日期" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.createTime | parseTime }}</div>
</template>
</el-table-column>
<el-table-column v-if="checkPer(['admin','menu:edit','menu:del'])" label="操作" width="130px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
msg="确定删除吗,如果存在下级节点则一并删除,此操作不能撤销!"
/>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import crudMenu from '@/api/system/menu'
import IconSelect from '@/components/IconSelect'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import DateRangePicker from '@/components/DateRangePicker'
// crudpresenter
const defaultForm = { id: null, title: null, menuSort: 999, path: null, component: null, componentName: null, iFrame: false, roles: [], pid: 0, icon: null, cache: false, hidden: false, type: 0, permission: null }
export default {
name: 'Menu',
components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation, DateRangePicker },
cruds() {
return CRUD({ title: '菜单', url: 'api/menus', crudMethod: { ...crudMenu }})
},
mixins: [presenter(), header(), form(defaultForm), crud()],
data() {
return {
menus: [],
permission: {
add: ['admin', 'menu:add'],
edit: ['admin', 'menu:edit'],
del: ['admin', 'menu:del']
},
rules: {
title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
path: [
{ required: true, message: '请输入地址', trigger: 'blur' }
]
}
}
},
methods: {
//
[CRUD.HOOK.afterToCU](crud, form) {
this.menus = []
if (form.id != null) {
if (form.pid === null) {
form.pid = 0
}
this.getSupDepts(form.id)
} else {
this.menus.push({ id: 0, label: '顶级类目', children: null })
}
},
getMenus(tree, treeNode, resolve) {
const params = { pid: tree.id }
setTimeout(() => {
crudMenu.getMenus(params).then(res => {
resolve(res.content)
})
}, 100)
},
getSupDepts(id) {
crudMenu.getMenuSuperior(id).then(res => {
const children = res.map(function(obj) {
if (!obj.leaf && !obj.children) {
obj.children = null
}
return obj
})
this.menus = [{ id: 0, label: '顶级类目', children: children }]
})
},
loadMenus({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudMenu.getMenusTree(parentNode.id).then(res => {
parentNode.children = res.map(function(obj) {
if (!obj.leaf) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 100)
})
}
},
//
selected(name) {
this.form.icon = name
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner {
text-align: left;
}
// ::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value {
// height: 30px;
// line-height: 30px;
// }
</style>
<template>
<div>
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle" class="head-search">
<!-- 搜索 -->
<el-input v-model="query.blurry" clearable size="small" placeholder="模糊搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<date-range-picker v-model="query.createTime" class="date-item" />
<rrOperation />
</div>
<crudOperation :permission="permission" />
</div>
<!--表单渲染-->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="菜单类型" prop="type">
<el-radio-group v-model="form.type" size="mini" style="width: 178px">
<el-radio-button label="0">目录</el-radio-button>
<el-radio-button label="1">菜单</el-radio-button>
<el-radio-button label="2">按钮</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="菜单图标" prop="icon">
<el-popover
placement="bottom-start"
width="450"
trigger="click"
@show="$refs['iconSelect'].reset()"
>
<IconSelect ref="iconSelect" @selected="selected" />
<el-input slot="reference" v-model="form.icon" style="width: 450px;" placeholder="点击选择图标" readonly>
<svg-icon v-if="form.icon" slot="prefix" :icon-class="form.icon" class="el-input__icon" style="height: 30px;width: 16px;" />
<i v-else slot="prefix" class="el-icon-search el-input__icon" />
</el-input>
</el-popover>
</el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="外链菜单" prop="iFrame">
<el-radio-group v-model="form.iFrame" size="mini">
<el-radio-button label="true"></el-radio-button>
<el-radio-button label="false"></el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.type.toString() === '1'" label="菜单缓存" prop="cache">
<el-radio-group v-model="form.cache" size="mini">
<el-radio-button label="true"></el-radio-button>
<el-radio-button label="false"></el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="菜单可见" prop="hidden">
<el-radio-group v-model="form.hidden" size="mini">
<el-radio-button label="false"></el-radio-button>
<el-radio-button label="true"></el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" label="菜单标题" prop="title">
<el-input v-model="form.title" :style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 178px'" placeholder="菜单标题" />
</el-form-item>
<el-form-item v-if="form.type.toString() === '2'" label="按钮名称" prop="title">
<el-input v-model="form.title" placeholder="按钮名称" style="width: 178px;" />
</el-form-item>
<el-form-item v-show="form.type.toString() !== '0'" label="权限标识" prop="permission">
<el-input v-model="form.permission" :disabled="form.iFrame.toString() === 'true'" placeholder="权限标识" style="width: 178px;" />
</el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" label="路由地址" prop="path">
<el-input v-model="form.path" placeholder="路由地址" style="width: 178px;" />
</el-form-item>
<el-form-item label="菜单排序" prop="menuSort">
<el-input-number v-model.number="form.menuSort" :min="0" :max="999" controls-position="right" style="width: 178px;" />
</el-form-item>
<el-form-item v-show="form.iFrame.toString() !== 'true' && form.type.toString() === '1'" label="组件名称" prop="componentName">
<el-input v-model="form.componentName" style="width: 178px;" placeholder="匹配组件内Name字段" />
</el-form-item>
<el-form-item v-show="form.iFrame.toString() !== 'true' && form.type.toString() === '1'" label="组件路径" prop="component">
<el-input v-model="form.component" style="width: 178px;" placeholder="组件路径" />
</el-form-item>
<el-form-item label="上级类目" prop="pid">
<treeselect
v-model="form.pid"
:options="menus"
:load-options="loadMenus"
style="width: 450px;"
placeholder="选择上级类目"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</div>
</el-dialog>
<!--表格渲染-->
<div class="app-container container-wrap" style="margin-top:0;min-height: calc(100vh - 292px);">
<span class="right-top-line" />
<span class="left-bottom-line" />
<el-table
ref="table"
v-loading="crud.loading"
lazy
:load="getMenus"
:data="crud.data"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="id"
@select="crud.selectChange"
@select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" align="center" width="55" />
<el-table-column :show-overflow-tooltip="true" label="菜单标题" min-width="100px" prop="title" />
<el-table-column prop="icon" label="图标" align="center" width="60px">
<template slot-scope="scope">
<svg-icon :icon-class="scope.row.icon ? scope.row.icon : ''" />
</template>
</el-table-column>
<el-table-column prop="menuSort" align="center" label="排序" width="60px">
<template slot-scope="scope">
{{ scope.row.menuSort }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="permission" label="权限标识" />
<el-table-column :show-overflow-tooltip="true" prop="component" label="组件路径" />
<el-table-column prop="iFrame" label="外链" width="75px">
<template slot-scope="scope">
<span v-if="scope.row.iFrame"></span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column prop="cache" label="缓存" width="75px">
<template slot-scope="scope">
<span v-if="scope.row.cache"></span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column prop="hidden" label="可见" width="75px">
<template slot-scope="scope">
<span v-if="scope.row.hidden"></span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建日期" width="150px">
<template slot-scope="scope">
<div>{{ scope.row.createTime | parseTime }}</div>
</template>
</el-table-column>
<el-table-column v-if="checkPer(['admin','menu:edit','menu:del'])" label="操作" width="130px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
msg="确定删除吗,如果存在下级节点则一并删除,此操作不能撤销!"
/>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import crudMenu from '@/api/system/menu'
import IconSelect from '@/components/IconSelect'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import DateRangePicker from '@/components/DateRangePicker'
// crudpresenter
const defaultForm = { id: null, title: null, menuSort: 999, path: null, component: null, componentName: null, iFrame: false, roles: [], pid: 0, icon: null, cache: false, hidden: false, type: 0, permission: null }
export default {
name: 'Menu',
components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation, DateRangePicker },
cruds() {
return CRUD({ title: '菜单', url: 'api/menus', crudMethod: { ...crudMenu }})
},
mixins: [presenter(), header(), form(defaultForm), crud()],
data() {
return {
menus: [],
permission: {
add: ['admin', 'menu:add'],
edit: ['admin', 'menu:edit'],
del: ['admin', 'menu:del']
},
rules: {
title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
path: [
{ required: true, message: '请输入地址', trigger: 'blur' }
]
}
}
},
methods: {
//
[CRUD.HOOK.afterToCU](crud, form) {
this.menus = []
if (form.id != null) {
if (form.pid === null) {
form.pid = 0
}
this.getSupDepts(form.id)
} else {
this.menus.push({ id: 0, label: '顶级类目', children: null })
}
},
getMenus(tree, treeNode, resolve) {
const params = { pid: tree.id }
setTimeout(() => {
crudMenu.getMenus(params).then(res => {
resolve(res.content)
})
}, 100)
},
getSupDepts(id) {
crudMenu.getMenuSuperior(id).then(res => {
const children = res.map(function(obj) {
if (!obj.leaf && !obj.children) {
obj.children = null
}
return obj
})
this.menus = [{ id: 0, label: '顶级类目', children: children }]
})
},
loadMenus({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudMenu.getMenusTree(parentNode.id).then(res => {
parentNode.children = res.map(function(obj) {
if (!obj.leaf) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 100)
})
}
},
//
selected(name) {
this.form.icon = name
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner {
text-align: left;
}
// ::v-deep .vue-treeselect__control,::v-deep .vue-treeselect__placeholder,::v-deep .vue-treeselect__single-value {
// height: 30px;
// line-height: 30px;
// }
</style>

762
src/views/system/role/index.vue

@ -1,381 +1,381 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle" class="head-search">
<!-- 搜索 -->
<el-input v-model="query.blurry" size="small" clearable placeholder="输入名称或者描述搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<date-range-picker v-model="query.createTime" class="date-item" />
<rrOperation />
</div>
<crudOperation :permission="permission" />
</div>
<!-- 表单渲染 -->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="角色名称" prop="name">
<el-input v-model="form.name" style="width: 380px;" />
</el-form-item>
<el-form-item label="角色级别" prop="level">
<el-input-number v-model.number="form.level" :min="1" controls-position="right" style="width: 145px;" />
</el-form-item>
<el-form-item label="数据范围" prop="dataScope">
<el-select v-model="form.dataScope" style="width: 140px" placeholder="请选择数据范围" @change="changeScope">
<el-option
v-for="item in dateScopes"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
<el-form-item v-if="form.dataScope === '自定义'" label="数据权限" prop="depts">
<treeselect
v-model="deptDatas"
:load-options="loadDepts"
:options="depts"
multiple
style="width: 380px"
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="描述信息" prop="description">
<el-input v-model="form.description" style="width: 380px;" rows="5" type="textarea" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</div>
</el-dialog>
<el-row :gutter="15">
<!--角色管理-->
<el-col :xs="15" :sm="17" :md="18" :lg="19" :xl="19">
<el-card class="box-card" shadow="never">
<span class="right-top-line" />
<span class="left-bottom-line" />
<div slot="header" class="clearfix">
<span class="role-span">角色列表</span>
</div>
<el-table ref="table" v-loading="crud.loading" highlight-current-row style="width: 100%;" height="calc(100vh - 400px)" :data="crud.data" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange">
<el-table-column :selectable="checkboxT" type="selection" align="center" width="55" />
<el-table-column prop="name" label="名称" />
<el-table-column prop="dataScope" label="数据权限" />
<el-table-column prop="level" label="角色级别" />
<el-table-column :show-overflow-tooltip="true" prop="description" label="描述" />
<el-table-column :show-overflow-tooltip="true" width="135px" prop="createTime" label="创建日期">
<template slot-scope="scope">
<div>{{ scope.row.createTime | parseTime }}</div>
</template>
</el-table-column>
<el-table-column v-if="checkPer(['admin','roles:edit','roles:del'])" label="操作" width="130px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
v-if="scope.row.level >= level"
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</el-card>
</el-col>
<!-- 菜单授权 -->
<el-col :xs="9" :sm="7" :md="6" :lg="5" :xl="5">
<el-card class="box-card" shadow="never" style="min-height:calc(100vh - 292px)">
<span class="right-top-line" />
<span class="left-bottom-line" />
<div slot="header" class="clearfix">
<el-tooltip class="item" effect="dark" content="选择指定角色分配菜单" placement="top">
<span class="role-span">菜单分配</span>
</el-tooltip>
<el-button
v-permission="['admin','roles:edit']"
:disabled="!showButton"
:loading="menuLoading"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
@click="saveMenu"
>保存</el-button>
</div>
<el-tree
ref="menu"
lazy
:data="menus"
:default-checked-keys="menuIds"
:load="getMenuDatas"
:props="defaultProps"
check-strictly
accordion
show-checkbox
node-key="id"
@check="menuChange"
/>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import crudRoles from '@/api/system/role'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { getMenusTree, getChild } from '@/api/system/menu'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import DateRangePicker from '@/components/DateRangePicker'
const defaultForm = { id: null, name: null, depts: [], description: null, dataScope: '全部', level: 3 }
export default {
name: 'Role',
components: { Treeselect, pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
cruds() {
return CRUD({ title: '角色', url: 'api/roles', sort: 'level,asc', crudMethod: { ...crudRoles }})
},
mixins: [presenter(), header(), form(defaultForm), crud()],
data() {
return {
defaultProps: { children: 'children', label: 'label', isLeaf: 'leaf' },
dateScopes: ['全部', '本级', '自定义'], level: 3,
currentId: 0, menuLoading: false, showButton: false,
menus: [], menuIds: [], depts: [], deptDatas: [], // 使
permission: {
add: ['admin', 'roles:add'],
edit: ['admin', 'roles:edit'],
del: ['admin', 'roles:del']
},
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
permission: [
{ required: true, message: '请输入权限', trigger: 'blur' }
]
}
}
},
created() {
crudRoles.getLevel().then(data => {
this.level = data.level
})
},
methods: {
getMenuDatas(node, resolve) {
setTimeout(() => {
getMenusTree(node.data.id ? node.data.id : 0).then(res => {
resolve(res)
})
}, 100)
},
[CRUD.HOOK.afterRefresh]() {
this.$refs.menu.setCheckedKeys([])
},
//
[CRUD.HOOK.beforeToAdd](crud, form) {
this.deptDatas = []
form.menus = null
},
//
[CRUD.HOOK.beforeToEdit](crud, form) {
this.deptDatas = []
if (form.dataScope === '自定义') {
this.getSupDepts(form.depts)
}
const _this = this
form.depts.forEach(function(dept) {
_this.deptDatas.push(dept.id)
})
//
form.menus = null
},
//
[CRUD.HOOK.afterValidateCU](crud) {
if (crud.form.dataScope === '自定义' && this.deptDatas.length === 0) {
this.$message({
message: '自定义数据权限不能为空',
type: 'warning'
})
return false
} else if (crud.form.dataScope === '自定义') {
const depts = []
this.deptDatas.forEach(function(data) {
const dept = { id: data }
depts.push(dept)
})
crud.form.depts = depts
} else {
crud.form.depts = []
}
return true
},
//
handleCurrentChange(val) {
if (val) {
const _this = this
//
this.$refs.menu.setCheckedKeys([])
// id
this.currentId = val.id
// key
this.menuIds = []
val.menus.forEach(function(data) {
_this.menuIds.push(data.id)
})
this.showButton = true
}
},
menuChange(menu) {
// id
getChild(menu.id).then(childIds => {
// menuIds
if (this.menuIds.indexOf(menu.id) !== -1) {
for (let i = 0; i < childIds.length; i++) {
const index = this.menuIds.indexOf(childIds[i])
if (index !== -1) {
this.menuIds.splice(index, 1)
}
}
} else {
for (let i = 0; i < childIds.length; i++) {
const index = this.menuIds.indexOf(childIds[i])
if (index === -1) {
this.menuIds.push(childIds[i])
}
}
}
this.$refs.menu.setCheckedKeys(this.menuIds)
})
},
//
saveMenu() {
this.menuLoading = true
const role = { id: this.currentId, menus: [] }
// key
this.menuIds.forEach(function(id) {
const menu = { id: id }
role.menus.push(menu)
})
crudRoles.editMenu(role).then(() => {
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.menuLoading = false
this.update()
}).catch(err => {
this.menuLoading = false
console.log(err.response.data.message)
})
},
//
update() {
//
crudRoles.get(this.currentId).then(res => {
for (let i = 0; i < this.crud.data.length; i++) {
if (res.id === this.crud.data[i].id) {
this.crud.data[i] = res
break
}
}
})
},
//
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
getSupDepts(depts) {
const ids = []
depts.forEach(dept => {
ids.push(dept.id)
})
getDeptSuperior(ids).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
},
//
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 200)
})
}
},
//
changeScope() {
if (this.form.dataScope === '自定义') {
this.getDepts()
}
},
checkboxT(row) {
return row.level >= this.level
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss">
.role-span {
font-weight: bold;color: #303133;
font-size: 15px;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
.head-container{
padding: 0 0 20px 0;
}
::v-deep .el-input-number .el-input__inner {
text-align: left;
}
::v-deep .vue-treeselect__multi-value{
margin-bottom: 0;
}
::v-deep .vue-treeselect__multi-value-item{
border: 0;
padding: 0;
}
::v-deep .el-table__body tr.current-row > td{
color: #fff;
background-color: #13439E;
}
::v-deep .el-table__header{
border-top: 1px solid #113D72;
}
</style>
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle" class="head-search">
<!-- 搜索 -->
<el-input v-model="query.blurry" size="small" clearable placeholder="输入名称或者描述搜索" prefix-icon="el-icon-search" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<date-range-picker v-model="query.createTime" class="date-item" />
<rrOperation />
</div>
<crudOperation :permission="permission" />
</div>
<!-- 表单渲染 -->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="角色名称" prop="name">
<el-input v-model="form.name" style="width: 380px;" />
</el-form-item>
<!-- <el-form-item label="角色级别" prop="level">
<el-input-number v-model.number="form.level" :min="1" controls-position="right" style="width: 145px;" />
</el-form-item>
<el-form-item label="数据范围" prop="dataScope">
<el-select v-model="form.dataScope" style="width: 140px" placeholder="请选择数据范围" @change="changeScope">
<el-option
v-for="item in dateScopes"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item> -->
<el-form-item v-if="form.dataScope === '自定义'" label="数据权限" prop="depts">
<treeselect
v-model="deptDatas"
:load-options="loadDepts"
:options="depts"
multiple
style="width: 380px"
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="描述信息" prop="description">
<el-input v-model="form.description" style="width: 380px;" rows="5" type="textarea" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</div>
</el-dialog>
<el-row :gutter="15">
<!--角色管理-->
<el-col :xs="15" :sm="17" :md="18" :lg="19" :xl="19">
<el-card class="box-card" shadow="never">
<span class="right-top-line" />
<span class="left-bottom-line" />
<div slot="header" class="clearfix">
<span class="role-span">角色列表</span>
</div>
<el-table ref="table" v-loading="crud.loading" highlight-current-row style="width: 100%;" height="calc(100vh - 400px)" :data="crud.data" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange">
<el-table-column :selectable="checkboxT" type="selection" align="center" width="55" />
<el-table-column prop="name" label="名称" />
<el-table-column prop="dataScope" label="数据权限" />
<el-table-column prop="level" label="角色级别" />
<el-table-column :show-overflow-tooltip="true" prop="description" label="描述" />
<el-table-column :show-overflow-tooltip="true" width="135px" prop="createTime" label="创建日期">
<template slot-scope="scope">
<div>{{ scope.row.createTime | parseTime }}</div>
</template>
</el-table-column>
<el-table-column v-if="checkPer(['admin','roles:edit','roles:del'])" label="操作" width="130px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
v-if="scope.row.level >= level"
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</el-card>
</el-col>
<!-- 菜单授权 -->
<el-col :xs="9" :sm="7" :md="6" :lg="5" :xl="5">
<el-card class="box-card" shadow="never" style="min-height:calc(100vh - 292px)">
<span class="right-top-line" />
<span class="left-bottom-line" />
<div slot="header" class="clearfix">
<el-tooltip class="item" effect="dark" content="选择指定角色分配菜单" placement="top">
<span class="role-span">菜单分配</span>
</el-tooltip>
<el-button
v-permission="['admin','roles:edit']"
:disabled="!showButton"
:loading="menuLoading"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
@click="saveMenu"
>保存</el-button>
</div>
<el-tree
ref="menu"
lazy
:data="menus"
:default-checked-keys="menuIds"
:load="getMenuDatas"
:props="defaultProps"
check-strictly
accordion
show-checkbox
node-key="id"
@check="menuChange"
/>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import crudRoles from '@/api/system/role'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { getMenusTree, getChild } from '@/api/system/menu'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import DateRangePicker from '@/components/DateRangePicker'
const defaultForm = { id: null, name: null, depts: [], description: null, dataScope: '全部', level: 3 }
export default {
name: 'Role',
components: { Treeselect, pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
cruds() {
return CRUD({ title: '角色', url: 'api/roles', sort: 'level,asc', crudMethod: { ...crudRoles }})
},
mixins: [presenter(), header(), form(defaultForm), crud()],
data() {
return {
defaultProps: { children: 'children', label: 'label', isLeaf: 'leaf' },
dateScopes: ['全部', '本级', '自定义'], level: 3,
currentId: 0, menuLoading: false, showButton: false,
menus: [], menuIds: [], depts: [], deptDatas: [], // 使
permission: {
add: ['admin', 'roles:add'],
edit: ['admin', 'roles:edit'],
del: ['admin', 'roles:del']
},
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
permission: [
{ required: true, message: '请输入权限', trigger: 'blur' }
]
}
}
},
created() {
crudRoles.getLevel().then(data => {
this.level = data.level
})
},
methods: {
getMenuDatas(node, resolve) {
setTimeout(() => {
getMenusTree(node.data.id ? node.data.id : 0).then(res => {
resolve(res)
})
}, 100)
},
[CRUD.HOOK.afterRefresh]() {
this.$refs.menu.setCheckedKeys([])
},
//
[CRUD.HOOK.beforeToAdd](crud, form) {
this.deptDatas = []
form.menus = null
},
//
[CRUD.HOOK.beforeToEdit](crud, form) {
this.deptDatas = []
if (form.dataScope === '自定义') {
this.getSupDepts(form.depts)
}
const _this = this
form.depts.forEach(function(dept) {
_this.deptDatas.push(dept.id)
})
//
form.menus = null
},
//
[CRUD.HOOK.afterValidateCU](crud) {
if (crud.form.dataScope === '自定义' && this.deptDatas.length === 0) {
this.$message({
message: '自定义数据权限不能为空',
type: 'warning'
})
return false
} else if (crud.form.dataScope === '自定义') {
const depts = []
this.deptDatas.forEach(function(data) {
const dept = { id: data }
depts.push(dept)
})
crud.form.depts = depts
} else {
crud.form.depts = []
}
return true
},
//
handleCurrentChange(val) {
if (val) {
const _this = this
//
this.$refs.menu.setCheckedKeys([])
// id
this.currentId = val.id
// key
this.menuIds = []
val.menus.forEach(function(data) {
_this.menuIds.push(data.id)
})
this.showButton = true
}
},
menuChange(menu) {
// id
getChild(menu.id).then(childIds => {
// menuIds
if (this.menuIds.indexOf(menu.id) !== -1) {
for (let i = 0; i < childIds.length; i++) {
const index = this.menuIds.indexOf(childIds[i])
if (index !== -1) {
this.menuIds.splice(index, 1)
}
}
} else {
for (let i = 0; i < childIds.length; i++) {
const index = this.menuIds.indexOf(childIds[i])
if (index === -1) {
this.menuIds.push(childIds[i])
}
}
}
this.$refs.menu.setCheckedKeys(this.menuIds)
})
},
//
saveMenu() {
this.menuLoading = true
const role = { id: this.currentId, menus: [] }
// key
this.menuIds.forEach(function(id) {
const menu = { id: id }
role.menus.push(menu)
})
crudRoles.editMenu(role).then(() => {
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.menuLoading = false
this.update()
}).catch(err => {
this.menuLoading = false
console.log(err.response.data.message)
})
},
//
update() {
//
crudRoles.get(this.currentId).then(res => {
for (let i = 0; i < this.crud.data.length; i++) {
if (res.id === this.crud.data[i].id) {
this.crud.data[i] = res
break
}
}
})
},
//
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
getSupDepts(depts) {
const ids = []
depts.forEach(dept => {
ids.push(dept.id)
})
getDeptSuperior(ids).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
},
//
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 200)
})
}
},
//
changeScope() {
if (this.form.dataScope === '自定义') {
this.getDepts()
}
},
checkboxT(row) {
return row.level >= this.level
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss">
.role-span {
font-weight: bold;color: #303133;
font-size: 15px;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
.head-container{
padding: 0 0 20px 0;
}
::v-deep .el-input-number .el-input__inner {
text-align: left;
}
::v-deep .vue-treeselect__multi-value{
margin-bottom: 0;
}
::v-deep .vue-treeselect__multi-value-item{
border: 0;
padding: 0;
}
::v-deep .el-table__body tr.current-row > td{
color: #fff;
background-color: #13439E;
}
::v-deep .el-table__header{
border-top: 1px solid #113D72;
}
</style>

72
src/views/system/user/index.vue

@ -55,7 +55,8 @@
<el-form-item label="部门" prop="dept.id">
<treeselect v-model="form.dept.id" :options="depts" :load-options="loadDepts" style="width: 184px" placeholder="选择部门" />
</el-form-item>
<el-form-item label="岗位" prop="jobs" class="is-required">
<!-- class="is-required" -->
<el-form-item label="岗位" prop="jobs">
<el-select v-model="jobDatas" style="width: 184px" multiple placeholder="请选择" @remove-tag="deleteTag" @change="changeJob">
<el-option v-for="item in jobs" :key="item.name" :label="item.name" :value="item.id" />
</el-select>
@ -134,7 +135,7 @@
<script>
import { getToken } from '@/utils/auth'
import crudUser, { resetpassword } from '@/api/system/user'
import { isvalidPhone } from '@/utils/validate'
// import { isvalidPhone } from '@/utils/validate'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { getAll, getLevel } from '@/api/system/role'
import { getAllJob } from '@/api/system/job'
@ -162,15 +163,15 @@ export default {
dicts: ['user_status'],
data() {
//
const validPhone = (rule, value, callback) => {
if (!value) {
callback(new Error('请输入电话号码'))
} else if (!isvalidPhone(value)) {
callback(new Error('请输入正确的11位手机号码'))
} else {
callback()
}
}
// const validPhone = (rule, value, callback) => {
// if (!value) {
// callback(new Error(''))
// } else if (!isvalidPhone(value)) {
// callback(new Error('11'))
// } else {
// callback()
// }
// }
// var validateJob = (rule, value, callback) => {
// console.log(value)
// if (this.jobDatas.length > 0) {
@ -207,17 +208,16 @@ export default {
{ required: true, message: '请输入用户昵称', trigger: 'blur' },
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' }
],
email: [
{ required: true, message: '请输入邮箱地址', trigger: 'blur' },
{ type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur' }
],
phone: [
{ required: true, trigger: 'blur', validator: validPhone }
],
// email: [
// { required: true, message: '', trigger: 'blur' },
// { type: 'email', message: '', trigger: 'blur' }
// ],
// phone: [
// { required: true, trigger: 'blur', validator: validPhone }
// ],
'dept.id': [
{ required: true, trigger: 'blur', message: '请选择部门' }
]
// ,
// jobs: [
// { trigger: 'blur', validator: validateJob }
// ]
@ -328,19 +328,27 @@ export default {
},
//
[CRUD.HOOK.afterValidateCU](crud) {
if (!crud.form.dept.id) {
this.$message({
message: '部门不能为空',
type: 'warning'
})
return false
} else if (this.jobDatas.length === 0) {
this.$message({
message: '岗位不能为空',
type: 'warning'
})
return false
} else if (this.roleDatas.length === 0) {
// if (!crud.form.dept.id) {
// this.$message({
// message: '',
// type: 'warning'
// })
// return false
// } else if (this.jobDatas.length === 0) {
// this.$message({
// message: '',
// type: 'warning'
// })
// return false
// } else if (this.roleDatas.length === 0) {
// this.$message({
// message: '',
// type: 'warning'
// })
// return false
// }
if (this.roleDatas.length === 0) {
this.$message({
message: '角色不能为空',
type: 'warning'

Loading…
Cancel
Save