parent
06847cd801
commit
4a4f236772
@ -0,0 +1,10 @@
|
|||||||
|
export const ChartEventMixins = {
|
||||||
|
methods: {
|
||||||
|
handleClick(event, chart) {
|
||||||
|
this.handleEvent('click', event, chart)
|
||||||
|
},
|
||||||
|
handleEvent(eventName, event, chart) {
|
||||||
|
this.$emit(eventName, event, chart)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,202 @@
|
|||||||
|
<template>
|
||||||
|
<a-upload
|
||||||
|
name="file"
|
||||||
|
listType="picture-card"
|
||||||
|
:multiple="isMultiple"
|
||||||
|
:action="uploadAction"
|
||||||
|
:headers="headers"
|
||||||
|
:data="{biz:bizPath}"
|
||||||
|
:fileList="fileList"
|
||||||
|
:beforeUpload="beforeUpload"
|
||||||
|
:disabled="disabled"
|
||||||
|
:isMultiple="isMultiple"
|
||||||
|
:showUploadList="isMultiple"
|
||||||
|
@change="handleChange"
|
||||||
|
@preview="handlePreview">
|
||||||
|
<img v-if="!isMultiple && picUrl" :src="getAvatarView()" style="height:104px;max-width:300px"/>
|
||||||
|
<div v-else >
|
||||||
|
<a-icon :type="uploadLoading ? 'loading' : 'plus'" />
|
||||||
|
<div class="ant-upload-text">{{ text }}</div>
|
||||||
|
</div>
|
||||||
|
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel()">
|
||||||
|
<img alt="example" style="width: 100%" :src="previewImage"/>
|
||||||
|
</a-modal>
|
||||||
|
</a-upload>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Vue from 'vue'
|
||||||
|
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||||
|
import { getFileAccessHttpUrl } from '@/api/manage'
|
||||||
|
|
||||||
|
const uidGenerator=()=>{
|
||||||
|
return '-'+parseInt(Math.random()*10000+1,10);
|
||||||
|
}
|
||||||
|
const getFileName=(path)=>{
|
||||||
|
if(path.lastIndexOf("\\")>=0){
|
||||||
|
let reg=new RegExp("\\\\","g");
|
||||||
|
path = path.replace(reg,"/");
|
||||||
|
}
|
||||||
|
return path.substring(path.lastIndexOf("/")+1);
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
name: 'JImageUpload',
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload",
|
||||||
|
urlView:window._CONFIG['staticDomainURL'],
|
||||||
|
uploadLoading:false,
|
||||||
|
picUrl:false,
|
||||||
|
headers:{},
|
||||||
|
fileList: [],
|
||||||
|
previewImage:"",
|
||||||
|
previewVisible: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props:{
|
||||||
|
text:{
|
||||||
|
type:String,
|
||||||
|
required:false,
|
||||||
|
default:"上传"
|
||||||
|
},
|
||||||
|
/*这个属性用于控制文件上传的业务路径*/
|
||||||
|
bizPath:{
|
||||||
|
type:String,
|
||||||
|
required:false,
|
||||||
|
default:"temp"
|
||||||
|
},
|
||||||
|
value:{
|
||||||
|
type:[String,Array],
|
||||||
|
required:false
|
||||||
|
},
|
||||||
|
disabled:{
|
||||||
|
type:Boolean,
|
||||||
|
required:false,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isMultiple:{
|
||||||
|
type:Boolean,
|
||||||
|
required:false,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch:{
|
||||||
|
value(val){
|
||||||
|
if (val instanceof Array) {
|
||||||
|
this.initFileList(val.join(','))
|
||||||
|
} else {
|
||||||
|
this.initFileList(val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created(){
|
||||||
|
const token = Vue.ls.get(ACCESS_TOKEN);
|
||||||
|
this.headers = {"X-Access-Token":token}
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
initFileList(paths){
|
||||||
|
if(!paths || paths.length==0){
|
||||||
|
this.fileList = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.picUrl = true;
|
||||||
|
let fileList = [];
|
||||||
|
let arr = paths.split(",")
|
||||||
|
for(var a=0;a<arr.length;a++){
|
||||||
|
let url = getFileAccessHttpUrl(arr[a],this.urlView,"http");
|
||||||
|
fileList.push({
|
||||||
|
uid: uidGenerator(),
|
||||||
|
name: getFileName(arr[a]),
|
||||||
|
status: 'done',
|
||||||
|
url: url,
|
||||||
|
response:{
|
||||||
|
status:"history",
|
||||||
|
message:arr[a]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.fileList = fileList
|
||||||
|
},
|
||||||
|
beforeUpload: function(file){
|
||||||
|
var fileType = file.type;
|
||||||
|
if(fileType.indexOf('image')<0){
|
||||||
|
this.$message.warning('请上传图片');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleChange(info) {
|
||||||
|
this.picUrl = false;
|
||||||
|
let fileList = info.fileList
|
||||||
|
if(info.file.status==='done'){
|
||||||
|
if(info.file.response.success){
|
||||||
|
this.picUrl = true;
|
||||||
|
fileList = fileList.map((file) => {
|
||||||
|
if (file.response) {
|
||||||
|
file.url = file.response.message;
|
||||||
|
}
|
||||||
|
return file;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//this.$message.success(`${info.file.name} 上传成功!`);
|
||||||
|
}else if (info.file.status === 'error') {
|
||||||
|
this.$message.error(`${info.file.name} 上传失败.`);
|
||||||
|
}else if(info.file.status === 'removed'){
|
||||||
|
this.handleDelete(info.file)
|
||||||
|
}
|
||||||
|
this.fileList = fileList
|
||||||
|
if(info.file.status==='done' || info.file.status === 'removed'){
|
||||||
|
this.handlePathChange()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 预览
|
||||||
|
handlePreview (file) {
|
||||||
|
this.previewImage = file.url || file.thumbUrl
|
||||||
|
this.previewVisible = true
|
||||||
|
},
|
||||||
|
getAvatarView(){
|
||||||
|
if(this.fileList.length>0){
|
||||||
|
let url = this.fileList[0].url
|
||||||
|
return getFileAccessHttpUrl(url,this.urlView,"http")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handlePathChange(){
|
||||||
|
let uploadFiles = this.fileList
|
||||||
|
let path = ''
|
||||||
|
if(!uploadFiles || uploadFiles.length==0){
|
||||||
|
path = ''
|
||||||
|
}
|
||||||
|
let arr = [];
|
||||||
|
if(!this.isMultiple){
|
||||||
|
arr.push(uploadFiles[uploadFiles.length-1].response.message)
|
||||||
|
}else{
|
||||||
|
for(var a=0;a<uploadFiles.length;a++){
|
||||||
|
arr.push(uploadFiles[a].response.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(arr.length>0){
|
||||||
|
path = arr.join(",")
|
||||||
|
}
|
||||||
|
this.$emit('change', path);
|
||||||
|
},
|
||||||
|
handleDelete(file){
|
||||||
|
//如有需要新增 删除逻辑
|
||||||
|
console.log(file)
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.close();
|
||||||
|
this.previewVisible = false;
|
||||||
|
},
|
||||||
|
close () {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
model: {
|
||||||
|
prop: 'value',
|
||||||
|
event: 'change'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -0,0 +1,209 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal
|
||||||
|
ref="modal"
|
||||||
|
class="j-modal-box"
|
||||||
|
:class="{'fullscreen':innerFullscreen,'no-title':isNoTitle,'no-footer':isNoFooter,}"
|
||||||
|
:visible="visible"
|
||||||
|
v-bind="_attrs"
|
||||||
|
v-on="$listeners"
|
||||||
|
@ok="handleOk"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
>
|
||||||
|
|
||||||
|
<slot></slot>
|
||||||
|
|
||||||
|
<template v-if="!isNoTitle" slot="title">
|
||||||
|
<a-row class="j-modal-title-row" type="flex">
|
||||||
|
<a-col class="left">
|
||||||
|
<slot name="title">{{ title }}</slot>
|
||||||
|
</a-col>
|
||||||
|
<a-col v-if="switchFullscreen" class="right" @click="toggleFullscreen">
|
||||||
|
<a-button class="ant-modal-close ant-modal-close-x" ghost type="link" :icon="fullscreenButtonIcon"/>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 处理 scopedSlots -->
|
||||||
|
<template v-for="slotName of scopedSlotsKeys" :slot="slotName">
|
||||||
|
<slot :name="slotName"></slot>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 处理 slots -->
|
||||||
|
<template v-for="slotName of slotsKeys" v-slot:[slotName]>
|
||||||
|
<slot :name="slotName"></slot>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ACol from 'ant-design-vue/es/grid/Col'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'JModal',
|
||||||
|
components: { ACol },
|
||||||
|
props: {
|
||||||
|
title: String,
|
||||||
|
// 可使用 .sync 修饰符
|
||||||
|
visible: Boolean,
|
||||||
|
// 是否在弹出时禁止 body 滚动
|
||||||
|
lockScroll: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
// 是否全屏弹窗,当全屏时无论如何都会禁止 body 滚动。可使用 .sync 修饰符
|
||||||
|
fullscreen: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
// 是否允许切换全屏(允许后右上角会出现一个按钮)
|
||||||
|
switchFullscreen: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 内部使用的 slots ,不再处理
|
||||||
|
usedSlots: ['title'],
|
||||||
|
|
||||||
|
// 缓存 body 的 overflow
|
||||||
|
bodyOverflowCache: '',
|
||||||
|
innerFullscreen: this.fullscreen,
|
||||||
|
fullscreenButtonIcon: 'fullscreen-exit',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 一些未处理的参数或特殊处理的参数绑定到 a-modal 上
|
||||||
|
_attrs() {
|
||||||
|
let attrs = { ...this.$attrs }
|
||||||
|
// 如果全屏就将宽度设为 100%
|
||||||
|
if (this.innerFullscreen) {
|
||||||
|
attrs['width'] = '100%'
|
||||||
|
}
|
||||||
|
return attrs
|
||||||
|
},
|
||||||
|
isNoTitle() {
|
||||||
|
return !this.title && !this.allSlotsKeys.includes('title')
|
||||||
|
},
|
||||||
|
isNoFooter() {
|
||||||
|
return this._attrs['footer'] === null
|
||||||
|
},
|
||||||
|
slotsKeys() {
|
||||||
|
return Object.keys(this.$slots).filter(key => !this.usedSlots.includes(key))
|
||||||
|
},
|
||||||
|
scopedSlotsKeys() {
|
||||||
|
return Object.keys(this.$scopedSlots).filter(key => !this.usedSlots.includes(key))
|
||||||
|
},
|
||||||
|
allSlotsKeys() {
|
||||||
|
return this.slotsKeys.concat(this.scopedSlotsKeys)
|
||||||
|
},
|
||||||
|
// 是否锁定body滚动
|
||||||
|
lockBodyScroll() {
|
||||||
|
return this.lockScroll || this.innerFullscreen
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
visible() {
|
||||||
|
if (this.visible) {
|
||||||
|
this.innerFullscreen = this.fullscreen
|
||||||
|
}
|
||||||
|
if (this.lockBodyScroll) {
|
||||||
|
if (this.visible) {
|
||||||
|
this.bodyOverflowCache = document.body.style.overflow
|
||||||
|
document.body.style.overflow = 'hidden'
|
||||||
|
} else {
|
||||||
|
document.body.style.overflow = this.bodyOverflowCache
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
innerFullscreen(val) {
|
||||||
|
this.$emit('update:fullscreen', val)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.$emit('update:visible', false)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleOk() {
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
|
|
||||||
|
toggleFullscreen() {
|
||||||
|
if (this.innerFullscreen) {
|
||||||
|
this.fullscreenButtonIcon = 'fullscreen'
|
||||||
|
} else {
|
||||||
|
this.fullscreenButtonIcon = 'fullscreen-exit'
|
||||||
|
}
|
||||||
|
this.innerFullscreen = !this.innerFullscreen
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.j-modal-box {
|
||||||
|
|
||||||
|
&.fullscreen {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
height: 100vh;
|
||||||
|
|
||||||
|
& .ant-modal-content {
|
||||||
|
height: 100vh;
|
||||||
|
border-radius: 0;
|
||||||
|
|
||||||
|
& .ant-modal-body {
|
||||||
|
/* title 和 footer 各占 55px */
|
||||||
|
height: calc(100% - 55px - 55px);
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.no-title, &.no-footer {
|
||||||
|
.ant-modal-body {
|
||||||
|
height: calc(100% - 55px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.no-title.no-footer {
|
||||||
|
.ant-modal-body {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.j-modal-title-row {
|
||||||
|
.left {
|
||||||
|
width: calc(100% - 56px - 56px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
width: 56px;
|
||||||
|
|
||||||
|
.ant-modal-close {
|
||||||
|
right: 56px;
|
||||||
|
color: rgba(0, 0, 0, 0.45);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: rgba(0, 0, 0, 0.75);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,5 +1,9 @@
|
|||||||
import T from './JFormContainer.vue'
|
import JModal from './JModal'
|
||||||
let install = function (Vue) {
|
import JFormContainer from './JFormContainer.vue'
|
||||||
Vue.component('JFormContainer',T);
|
|
||||||
|
export default {
|
||||||
|
install(Vue) {
|
||||||
|
Vue.component('JFormContainer', JFormContainer)
|
||||||
|
Vue.component(JModal.name, JModal)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export default { install };
|
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<component
|
||||||
|
:is="comp"
|
||||||
|
:formData="formData"
|
||||||
|
ref="compModel"
|
||||||
|
v-if="comp">
|
||||||
|
</component>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'DynamicNotice',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
compName: this.path
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
comp: function () {
|
||||||
|
if(!this.path){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return () => import(`@/views/${this.path}.vue`)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: ['path','formData'],
|
||||||
|
methods: {
|
||||||
|
detail () {
|
||||||
|
setTimeout(() => {
|
||||||
|
if(this.path){
|
||||||
|
this.$refs.compModel.view(this.formData);
|
||||||
|
}
|
||||||
|
}, 200)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -0,0 +1,111 @@
|
|||||||
|
<template>
|
||||||
|
<a-card :bordered="false" style="height: 100%">
|
||||||
|
<online-common-list
|
||||||
|
:ref="'onl_'+mainModel.currentTableName"
|
||||||
|
:code="code"
|
||||||
|
:model="mainModel"
|
||||||
|
@seleted="onSelected">
|
||||||
|
</online-common-list>
|
||||||
|
|
||||||
|
<a-tabs defaultActiveKey="0">
|
||||||
|
<a-tab-pane v-for="(item,index) in subList" :tab="item.description" :key="index+''" :forceRender="true" >
|
||||||
|
<online-common-list
|
||||||
|
:ref="item.currentTableName"
|
||||||
|
:code="item.code"
|
||||||
|
:model="item"
|
||||||
|
:main="selectedRow">
|
||||||
|
</online-common-list>
|
||||||
|
</a-tab-pane>
|
||||||
|
</a-tabs>
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getAction } from '@/api/manage'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'OnlCgformErpList',
|
||||||
|
components:{
|
||||||
|
},
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
code:'',
|
||||||
|
url: {
|
||||||
|
getColumns: '/online/cgform/api/getErpColumns/',
|
||||||
|
},
|
||||||
|
mainModel:{},
|
||||||
|
subList:[],
|
||||||
|
mainId:'',
|
||||||
|
selectedRow:{}
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'$route'() {
|
||||||
|
// 刷新参数放到这里去触发,就可以刷新相同界面了
|
||||||
|
this.initColumnConfig()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.initColumnConfig();
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
getSubIndex(index){
|
||||||
|
return index+1 + ''
|
||||||
|
},
|
||||||
|
getSubRef(item){
|
||||||
|
let ref = item.currentTableName
|
||||||
|
console.log("ref string",ref)
|
||||||
|
return ref;
|
||||||
|
},
|
||||||
|
initColumnConfig(){
|
||||||
|
if(!this.$route.params.code){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.code = this.$route.params.code
|
||||||
|
getAction(`${this.url.getColumns}${this.code}`).then((res)=>{
|
||||||
|
console.log("erp表单配置",res)
|
||||||
|
if(res.success){
|
||||||
|
this.mainModel = res.result.main
|
||||||
|
this.subList = res.result.subList
|
||||||
|
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs['onl_'+this.mainModel.currentTableName].initListByModel();
|
||||||
|
if(this.subList && this.subList.length>0){
|
||||||
|
for(let item of this.subList){
|
||||||
|
this.$refs[item.currentTableName][0].initListByModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onSelected(row){
|
||||||
|
console.log("onSelected",row)
|
||||||
|
this.selectedRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.ant-card-body .table-operator{
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
.ant-table-tbody .ant-table-row td{
|
||||||
|
padding-top:15px;
|
||||||
|
padding-bottom:15px;
|
||||||
|
}
|
||||||
|
.anty-row-operator button{margin: 0 5px}
|
||||||
|
.ant-btn-danger{background-color: #ffffff}
|
||||||
|
|
||||||
|
.anty-img-wrap{height:25px;position: relative;}
|
||||||
|
.anty-img-wrap > img{max-height:100%;}
|
||||||
|
.ant-modal-cust-warp{height: 100%}
|
||||||
|
.ant-modal-cust-warp .ant-modal-body{height:calc(100% - 110px) !important;overflow-y: auto}
|
||||||
|
.ant-modal-cust-warp .ant-modal-content{height:90% !important;overflow-y: hidden}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,178 @@
|
|||||||
|
<template>
|
||||||
|
<a-card :bordered="false">
|
||||||
|
|
||||||
|
<!-- 查询区域 -->
|
||||||
|
<div class="table-page-search-wrapper">
|
||||||
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
|
||||||
|
<a-col :md="6" :sm="8">
|
||||||
|
<a-form-item label="规则名称">
|
||||||
|
<a-input placeholder="请输入规则名称" v-model="queryParam.ruleName"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :md="6" :sm="8">
|
||||||
|
<a-form-item label="规则Code">
|
||||||
|
<a-input placeholder="请输入规则Code" v-model="queryParam.ruleCode"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<template v-if="toggleSearchStatus">
|
||||||
|
</template>
|
||||||
|
<a-col :md="6" :sm="8">
|
||||||
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||||
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||||
|
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||||
|
<a @click="handleToggleSearch" style="margin-left: 8px">
|
||||||
|
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||||
|
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 操作按钮区域 -->
|
||||||
|
<div class="table-operator">
|
||||||
|
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||||
|
<a-button type="primary" icon="download" @click="handleExportXls('编码校验规则')">导出</a-button>
|
||||||
|
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||||
|
<a-button type="primary" icon="import">导入</a-button>
|
||||||
|
</a-upload>
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<a-menu slot="overlay">
|
||||||
|
<a-menu-item key="1" @click="batchDel">
|
||||||
|
<a-icon type="delete"/>
|
||||||
|
删除
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
<a-button style="margin-left: 8px"> 批量操作
|
||||||
|
<a-icon type="down"/>
|
||||||
|
</a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- table区域-begin -->
|
||||||
|
<a-alert type="info" showIcon style="margin-bottom: 16px;">
|
||||||
|
<template slot="message">
|
||||||
|
<span>已选择</span>
|
||||||
|
<a style="font-weight: 600;padding: 0 4px;">{{ selectedRowKeys.length }}</a>
|
||||||
|
<span>项</span>
|
||||||
|
<template v-if="selectedRowKeys.length>0">
|
||||||
|
<a-divider type="vertical"/>
|
||||||
|
<a @click="onClearSelected">清空</a>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-alert>
|
||||||
|
|
||||||
|
<a-table
|
||||||
|
ref="table"
|
||||||
|
size="middle"
|
||||||
|
bordered
|
||||||
|
rowKey="id"
|
||||||
|
:columns="columns"
|
||||||
|
:dataSource="dataSource"
|
||||||
|
:pagination="ipagination"
|
||||||
|
:loading="loading"
|
||||||
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||||
|
@change="handleTableChange">
|
||||||
|
|
||||||
|
<template slot="action" slot-scope="text, record">
|
||||||
|
<a @click="handleEdit(record)">编辑</a>
|
||||||
|
<a-divider type="vertical"/>
|
||||||
|
<a @click="handleTest(record)">功能测试</a>
|
||||||
|
<a-divider type="vertical"/>
|
||||||
|
<a-dropdown>
|
||||||
|
<a class="ant-dropdown-link">
|
||||||
|
<span>更多</span>
|
||||||
|
<a-icon type="down"/>
|
||||||
|
</a>
|
||||||
|
<a-menu slot="overlay">
|
||||||
|
<a-menu-item>
|
||||||
|
<a-popconfirm title="确定删除吗?" @confirm="handleDelete(record.id)">删除</a-popconfirm>
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</a-dropdown>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</a-table>
|
||||||
|
<!-- table区域-end -->
|
||||||
|
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<sys-check-rule-modal ref="modalForm" @ok="modalFormOk"/>
|
||||||
|
|
||||||
|
<sys-check-rule-test-modal ref="testModal"/>
|
||||||
|
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
||||||
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||||
|
import SysCheckRuleModal from './modules/SysCheckRuleModal'
|
||||||
|
import SysCheckRuleTestModal from './modules/SysCheckRuleTestModal'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SysCheckRuleList',
|
||||||
|
mixins: [JeecgListMixin],
|
||||||
|
components: { SysCheckRuleModal, SysCheckRuleTestModal, JEllipsis },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
description: '编码校验规则管理页面',
|
||||||
|
// 表头
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '#',
|
||||||
|
key: 'rowIndex',
|
||||||
|
width: 60,
|
||||||
|
align: 'center',
|
||||||
|
customRender: (t, r, i) => i + 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '规则名称',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'ruleName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '规则Code',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'ruleCode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '规则描述',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'ruleDescription',
|
||||||
|
customRender: (t) => (<j-ellipsis value={t} length={48}/>)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
align: 'center',
|
||||||
|
scopedSlots: { customRender: 'action' },
|
||||||
|
}
|
||||||
|
],
|
||||||
|
url: {
|
||||||
|
list: '/sys/checkRule/list',
|
||||||
|
delete: '/sys/checkRule/delete',
|
||||||
|
deleteBatch: '/sys/checkRule/deleteBatch',
|
||||||
|
exportXlsUrl: 'sys/checkRule/exportXls',
|
||||||
|
importExcelUrl: 'sys/checkRule/importExcel',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
importExcelUrl: function () {
|
||||||
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleTest(record) {
|
||||||
|
this.$refs.testModal.open(record.ruleCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
@import '~@assets/less/common.less';
|
||||||
|
</style>
|
||||||
@ -0,0 +1,194 @@
|
|||||||
|
<template>
|
||||||
|
<a-card :bordered="false">
|
||||||
|
|
||||||
|
<!-- 查询区域 -->
|
||||||
|
<div class="table-page-search-wrapper">
|
||||||
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
|
||||||
|
<a-col :md="6" :sm="8">
|
||||||
|
<a-form-item label="数据源名称">
|
||||||
|
<a-input placeholder="请输入数据源名称" v-model="queryParam.name"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :md="6" :sm="8">
|
||||||
|
<a-form-item label="数据库类型">
|
||||||
|
<j-dict-select-tag v-model="queryParam.dbType" placeholder="请选择数据库类型" dict-code="database_type"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :md="6" :sm="8">
|
||||||
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||||
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
||||||
|
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||||
|
</span>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 操作按钮区域 -->
|
||||||
|
<div class="table-operator">
|
||||||
|
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||||
|
<a-button type="primary" icon="download" @click="handleExportXls('多数据源管理')">导出</a-button>
|
||||||
|
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||||
|
<a-button type="primary" icon="import">导入</a-button>
|
||||||
|
</a-upload>
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<a-menu slot="overlay">
|
||||||
|
<a-menu-item key="1" @click="batchDel">
|
||||||
|
<a-icon type="delete"/>
|
||||||
|
删除
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
<a-button style="margin-left: 8px"> 批量操作
|
||||||
|
<a-icon type="down"/>
|
||||||
|
</a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- table区域-begin -->
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<a-alert type="info" showIcon style="margin-bottom: 16px;">
|
||||||
|
<template slot="message">
|
||||||
|
<span>已选择</span>
|
||||||
|
<a style="font-weight: 600;padding: 0 4px;">{{ selectedRowKeys.length }}</a>
|
||||||
|
<span>项</span>
|
||||||
|
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||||
|
</template>
|
||||||
|
</a-alert>
|
||||||
|
|
||||||
|
<a-table
|
||||||
|
ref="table"
|
||||||
|
size="middle"
|
||||||
|
bordered
|
||||||
|
rowKey="id"
|
||||||
|
:columns="columns"
|
||||||
|
:dataSource="dataSource"
|
||||||
|
:pagination="ipagination"
|
||||||
|
:loading="loading"
|
||||||
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||||
|
@change="handleTableChange">
|
||||||
|
|
||||||
|
<span slot="action" slot-scope="text, record">
|
||||||
|
<a @click="handleEdit(record)">编辑</a>
|
||||||
|
|
||||||
|
<a-divider type="vertical"/>
|
||||||
|
<a-dropdown>
|
||||||
|
<a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
|
||||||
|
<a-menu slot="overlay">
|
||||||
|
<a-menu-item>
|
||||||
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||||
|
<a>删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</a-dropdown>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</a-table>
|
||||||
|
</div>
|
||||||
|
<!-- table区域-end -->
|
||||||
|
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<sys-data-source-modal ref="modalForm" @ok="modalFormOk"/>
|
||||||
|
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
||||||
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||||
|
import SysDataSourceModal from './modules/SysDataSourceModal'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SysDataSourceList',
|
||||||
|
mixins: [JeecgListMixin],
|
||||||
|
components: { JEllipsis, SysDataSourceModal },
|
||||||
|
data() {
|
||||||
|
let ellipsis = (v, l = 20) => (<j-ellipsis value={v} length={l}/>)
|
||||||
|
return {
|
||||||
|
description: '多数据源管理管理页面',
|
||||||
|
// 表头
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '#',
|
||||||
|
dataIndex: '',
|
||||||
|
key: 'rowIndex',
|
||||||
|
width: 60,
|
||||||
|
align: 'center',
|
||||||
|
customRender: (t, r, index) => index + 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据源名称',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据源编码',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'code'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'remark',
|
||||||
|
customRender: (t) => ellipsis(t)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据库类型',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dbType_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '驱动类',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dbDriver',
|
||||||
|
customRender: (t) => ellipsis(t)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据源地址',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dbUrl',
|
||||||
|
customRender: (t) => ellipsis(t)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数据库名称',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dbName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '用户名',
|
||||||
|
align: 'center',
|
||||||
|
dataIndex: 'dbUsername'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
align: 'center',
|
||||||
|
scopedSlots: { customRender: 'action' },
|
||||||
|
}
|
||||||
|
],
|
||||||
|
url: {
|
||||||
|
list: '/sys/dataSource/list',
|
||||||
|
delete: '/sys/dataSource/delete',
|
||||||
|
deleteBatch: '/sys/dataSource/deleteBatch',
|
||||||
|
exportXlsUrl: 'sys/dataSource/exportXls',
|
||||||
|
importExcelUrl: 'sys/dataSource/importExcel',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
importExcelUrl() {
|
||||||
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
@import '~@assets/less/common.less';
|
||||||
|
</style>
|
||||||
@ -0,0 +1,116 @@
|
|||||||
|
<template>
|
||||||
|
<a-drawer
|
||||||
|
title="数据规则/按钮权限配置"
|
||||||
|
width="365"
|
||||||
|
:closable="false"
|
||||||
|
@close="onClose"
|
||||||
|
:visible="visible"
|
||||||
|
>
|
||||||
|
<a-tabs defaultActiveKey="1">
|
||||||
|
<a-tab-pane tab="数据规则" key="1">
|
||||||
|
|
||||||
|
<a-checkbox-group v-model="dataruleChecked" v-if="dataruleList.length>0">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24" v-for="(item,index) in dataruleList" :key=" 'dr'+index ">
|
||||||
|
<a-checkbox :value="item.id">{{ item.ruleName }}</a-checkbox>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :span="24">
|
||||||
|
<div style="width: 100%;margin-top: 15px">
|
||||||
|
<a-button @click="saveDataruleForRole" type="primary" size="small" icon="save">点击保存</a-button>
|
||||||
|
</div>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-checkbox-group>
|
||||||
|
<div v-else><h3>无配置信息!</h3></div>
|
||||||
|
|
||||||
|
</a-tab-pane>
|
||||||
|
</a-tabs>
|
||||||
|
|
||||||
|
</a-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ARow from 'ant-design-vue/es/grid/Row'
|
||||||
|
import ACol from 'ant-design-vue/es/grid/Col'
|
||||||
|
import { getAction,postAction } from '@/api/manage'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DepartDataruleModal',
|
||||||
|
components: { ACol, ARow },
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
functionId:'',
|
||||||
|
departId:'',
|
||||||
|
visible:false,
|
||||||
|
tabList: [{
|
||||||
|
key: '1',
|
||||||
|
tab: '数据规则',
|
||||||
|
}, {
|
||||||
|
key: '2',
|
||||||
|
tab: '按钮权限',
|
||||||
|
}],
|
||||||
|
activeTabKey: '1',
|
||||||
|
url:{
|
||||||
|
datarule:"/sys/sysDepartPermission/datarule",
|
||||||
|
},
|
||||||
|
dataruleList:[],
|
||||||
|
dataruleChecked:[]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
loadData(){
|
||||||
|
getAction(`${this.url.datarule}/${this.functionId}/${this.departId}`).then(res=>{
|
||||||
|
if(res.success){
|
||||||
|
this.dataruleList = res.result.datarule
|
||||||
|
let drChecked = res.result.drChecked
|
||||||
|
if(drChecked){
|
||||||
|
this.dataruleChecked = drChecked.split(",")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
saveDataruleForRole(){
|
||||||
|
if(!this.dataruleChecked || this.dataruleChecked.length==0){
|
||||||
|
this.$message.warning("请注意,现未勾选任何数据权限!")
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
permissionId:this.functionId,
|
||||||
|
departId:this.departId,
|
||||||
|
dataRuleIds:this.dataruleChecked.join(",")
|
||||||
|
}
|
||||||
|
postAction(this.url.datarule,params).then(res=>{
|
||||||
|
if(res.success){
|
||||||
|
this.$message.success(res.message)
|
||||||
|
}else{
|
||||||
|
this.$message.error(res.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
show(functionId,departId){
|
||||||
|
this.onReset()
|
||||||
|
this.functionId = functionId
|
||||||
|
this.departId = departId
|
||||||
|
this.visible=true
|
||||||
|
this.loadData()
|
||||||
|
},
|
||||||
|
onClose(){
|
||||||
|
this.visible=false
|
||||||
|
this.onReset()
|
||||||
|
},
|
||||||
|
onTabChange (key) {
|
||||||
|
this.activeTabKey = key
|
||||||
|
},
|
||||||
|
onReset(){
|
||||||
|
this.functionId=''
|
||||||
|
this.departId=''
|
||||||
|
this.dataruleList=[]
|
||||||
|
this.dataruleChecked=[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -0,0 +1,122 @@
|
|||||||
|
<template>
|
||||||
|
<a-drawer
|
||||||
|
title="数据规则/按钮权限配置"
|
||||||
|
width="365"
|
||||||
|
:closable="false"
|
||||||
|
@close="onClose"
|
||||||
|
:visible="visible"
|
||||||
|
>
|
||||||
|
|
||||||
|
<a-tabs defaultActiveKey="1">
|
||||||
|
<a-tab-pane tab="数据规则" key="1">
|
||||||
|
|
||||||
|
<a-checkbox-group v-model="dataruleChecked" v-if="dataruleList.length>0">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24" v-for="(item,index) in dataruleList" :key=" 'dr'+index ">
|
||||||
|
<a-checkbox :value="item.id">{{ item.ruleName }}</a-checkbox>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :span="24">
|
||||||
|
<div style="width: 100%;margin-top: 15px">
|
||||||
|
<a-button @click="saveDataruleForRole" type="primary" size="small" icon="save">点击保存</a-button>
|
||||||
|
</div>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-checkbox-group>
|
||||||
|
<div v-else><h3>无配置信息!</h3></div>
|
||||||
|
|
||||||
|
</a-tab-pane>
|
||||||
|
<!--<a-tab-pane tab="按钮权限" key="2">敬请期待!!!</a-tab-pane>-->
|
||||||
|
</a-tabs>
|
||||||
|
|
||||||
|
</a-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ARow from 'ant-design-vue/es/grid/Row'
|
||||||
|
import ACol from 'ant-design-vue/es/grid/Col'
|
||||||
|
import { getAction,postAction } from '@/api/manage'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DeptRoleDataruleModal',
|
||||||
|
components: { ACol, ARow },
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
departId:'',
|
||||||
|
functionId:'',
|
||||||
|
roleId:'',
|
||||||
|
visible:false,
|
||||||
|
tabList: [{
|
||||||
|
key: '1',
|
||||||
|
tab: '数据规则',
|
||||||
|
}, {
|
||||||
|
key: '2',
|
||||||
|
tab: '按钮权限',
|
||||||
|
}],
|
||||||
|
activeTabKey: '1',
|
||||||
|
url:{
|
||||||
|
datarule:"/sys/sysDepartRole/datarule",
|
||||||
|
},
|
||||||
|
dataruleList:[],
|
||||||
|
dataruleChecked:[]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
loadData(){
|
||||||
|
getAction(`${this.url.datarule}/${this.functionId}/${this.departId}/${this.roleId}`).then(res=>{
|
||||||
|
console.log(res)
|
||||||
|
if(res.success){
|
||||||
|
this.dataruleList = res.result.datarule
|
||||||
|
let drChecked = res.result.drChecked
|
||||||
|
if(drChecked){
|
||||||
|
this.dataruleChecked = drChecked.split(",")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
saveDataruleForRole(){
|
||||||
|
if(!this.dataruleChecked || this.dataruleChecked.length==0){
|
||||||
|
this.$message.warning("请注意,现未勾选任何数据权限!")
|
||||||
|
}
|
||||||
|
let params = {
|
||||||
|
permissionId:this.functionId,
|
||||||
|
roleId:this.roleId,
|
||||||
|
dataRuleIds:this.dataruleChecked.join(",")
|
||||||
|
}
|
||||||
|
console.log("保存数据权限",params)
|
||||||
|
postAction(this.url.datarule,params).then(res=>{
|
||||||
|
if(res.success){
|
||||||
|
this.$message.success(res.message)
|
||||||
|
}else{
|
||||||
|
this.$message.error(res.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
show(functionId,departId,roleId){
|
||||||
|
this.onReset()
|
||||||
|
this.departId = departId
|
||||||
|
this.functionId = functionId
|
||||||
|
this.roleId = roleId
|
||||||
|
this.visible=true
|
||||||
|
this.loadData()
|
||||||
|
},
|
||||||
|
onClose(){
|
||||||
|
this.visible=false
|
||||||
|
this.onReset()
|
||||||
|
},
|
||||||
|
onTabChange (key) {
|
||||||
|
this.activeTabKey = key
|
||||||
|
},
|
||||||
|
onReset(){
|
||||||
|
this.functionId=''
|
||||||
|
this.roleId=''
|
||||||
|
this.dataruleList=[]
|
||||||
|
this.dataruleChecked=[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -0,0 +1,196 @@
|
|||||||
|
<template>
|
||||||
|
<a-card :bordered="false">
|
||||||
|
<!-- 查询区域 -->
|
||||||
|
<div class="table-page-search-wrapper">
|
||||||
|
<!-- 搜索区域 -->
|
||||||
|
<a-form layout="inline">
|
||||||
|
<a-row :gutter="10">
|
||||||
|
<a-col :md="10" :sm="12">
|
||||||
|
<a-form-item label="部门角色名称" style="margin-left:8px">
|
||||||
|
<a-input placeholder="请输入部门角色" v-model="queryParam.roleName"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
||||||
|
<a-col :md="6" :sm="24">
|
||||||
|
<a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 18px">查询</a-button>
|
||||||
|
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
||||||
|
</a-col>
|
||||||
|
</span>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
<!-- 操作按钮区域 -->
|
||||||
|
<div class="table-operator" :md="24" :sm="24">
|
||||||
|
<a-button @click="handleAdd" type="primary" icon="plus">部门角色录入</a-button>
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<a-menu slot="overlay">
|
||||||
|
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
</div>
|
||||||
|
<!-- table区域-begin -->
|
||||||
|
<div>
|
||||||
|
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||||
|
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">
|
||||||
|
{{selectedRowKeys.length }}</a>项
|
||||||
|
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||||
|
</div>
|
||||||
|
<a-table
|
||||||
|
ref="table"
|
||||||
|
size="middle"
|
||||||
|
bordered
|
||||||
|
rowKey="id"
|
||||||
|
:columns="columns"
|
||||||
|
:dataSource="dataSource"
|
||||||
|
:pagination="ipagination"
|
||||||
|
:loading="loading"
|
||||||
|
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||||
|
@change="handleTableChange">
|
||||||
|
<span slot="action" slot-scope="text, record">
|
||||||
|
<a @click="handleEdit(record)">编辑</a>
|
||||||
|
<a-divider type="vertical"/>
|
||||||
|
<a-dropdown>
|
||||||
|
<a class="ant-dropdown-link">
|
||||||
|
更多 <a-icon type="down"/>
|
||||||
|
</a>
|
||||||
|
<a-menu slot="overlay">
|
||||||
|
<a-menu-item>
|
||||||
|
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||||
|
<a>删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-menu-item>
|
||||||
|
<a-menu-item>
|
||||||
|
<a href="javascript:;" @click="handleDetail(record)">详情</a>
|
||||||
|
</a-menu-item>
|
||||||
|
<a-menu-item>
|
||||||
|
<a @click="handlePerssion(record)">授权</a>
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</a-dropdown>
|
||||||
|
</span>
|
||||||
|
</a-table>
|
||||||
|
</div>
|
||||||
|
<!-- table区域-end -->
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<sys-depart-role-modal ref="modalForm" @ok="modalFormOk"/>
|
||||||
|
<dept-role-auth-modal ref="modalDeptRole" />
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
|
||||||
|
import {getAction} from '@/api/manage'
|
||||||
|
import SysDepartRoleModal from './SysDepartRoleModal'
|
||||||
|
import DeptRoleAuthModal from './DeptRoleAuthModal'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DeptRoleInfo',
|
||||||
|
components: { DeptRoleAuthModal, SysDepartRoleModal },
|
||||||
|
mixins: [JeecgListMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
description: '部门角色信息',
|
||||||
|
currentDeptId: '',
|
||||||
|
// 表头
|
||||||
|
columns: [{
|
||||||
|
title: '部门角色名称',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'roleName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部门角色编码',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'roleCode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '部门',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'departId_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '备注',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'description'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
scopedSlots: {customRender: 'action'},
|
||||||
|
align: "center",
|
||||||
|
width: 170
|
||||||
|
}],
|
||||||
|
url: {
|
||||||
|
list: "/sys/sysDepartRole/list",
|
||||||
|
delete: "/sys/sysDepartRole/delete",
|
||||||
|
deleteBatch: "/sys/sysDepartRole/deleteBatch",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
searchReset() {
|
||||||
|
this.queryParam = {}
|
||||||
|
this.currentDeptId = '';
|
||||||
|
this.loadData(1);
|
||||||
|
this.$emit('clearSelectedDepartKeys')
|
||||||
|
},
|
||||||
|
loadData(arg) {
|
||||||
|
if (!this.url.list) {
|
||||||
|
this.$message.error("请设置url.list属性!")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//加载数据 若传入参数1则加载第一页的内容
|
||||||
|
if (arg === 1) {
|
||||||
|
this.ipagination.current = 1;
|
||||||
|
}
|
||||||
|
let params = this.getQueryParams();//查询条件
|
||||||
|
params.deptId = this.currentDeptId;
|
||||||
|
getAction(this.url.list, params).then((res) => {
|
||||||
|
if (res.success && res.result) {
|
||||||
|
this.dataSource = res.result.records;
|
||||||
|
this.ipagination.total = res.result.total;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
open(record) {
|
||||||
|
this.currentDeptId = record.id;
|
||||||
|
this.loadData(1);
|
||||||
|
},
|
||||||
|
clearList() {
|
||||||
|
this.currentDeptId = '';
|
||||||
|
this.dataSource = [];
|
||||||
|
},
|
||||||
|
hasSelectDept() {
|
||||||
|
if (this.currentDeptId == '') {
|
||||||
|
this.$message.error("请选择一个部门!")
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
handleEdit: function (record) {
|
||||||
|
this.$refs.modalForm.title = "编辑";
|
||||||
|
this.$refs.modalForm.departDisabled = true;
|
||||||
|
this.$refs.modalForm.disableSubmit = false;
|
||||||
|
this.$refs.modalForm.edit(record,record.departId);
|
||||||
|
},
|
||||||
|
handleAdd: function () {
|
||||||
|
if (this.currentDeptId == '') {
|
||||||
|
this.$message.error("请选择一个部门!")
|
||||||
|
} else {
|
||||||
|
this.$refs.modalForm.departDisabled = true;
|
||||||
|
this.$refs.modalForm.add(this.currentDeptId);
|
||||||
|
this.$refs.modalForm.title = "新增";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handlePerssion: function(record){
|
||||||
|
this.$refs.modalDeptRole.show(record.id,record.departId);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -0,0 +1,200 @@
|
|||||||
|
<template>
|
||||||
|
<a-drawer
|
||||||
|
:title="title"
|
||||||
|
:maskClosable="true"
|
||||||
|
width=600
|
||||||
|
placement="right"
|
||||||
|
:closable="true"
|
||||||
|
@close="close"
|
||||||
|
:visible="visible"
|
||||||
|
style="height: calc(100% - 55px);overflow: auto;padding-bottom: 53px;">
|
||||||
|
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
|
||||||
|
<a-form :form="form" v-if="designNameOption.length>0">
|
||||||
|
<a-form-item label=''>
|
||||||
|
<a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
|
||||||
|
<a-card :style="{ marginTop: '12px',height:'auto' }">
|
||||||
|
<a-checkbox-group @change="designNameChange" v-model="designNameValue" style="width: 100%">
|
||||||
|
<a-row>
|
||||||
|
<template v-for="(des) in designNameOption">
|
||||||
|
<a-col :span="6">
|
||||||
|
<a-checkbox :value="des.value">{{ des.text }}</a-checkbox>
|
||||||
|
</a-col>
|
||||||
|
</template>
|
||||||
|
</a-row>
|
||||||
|
</a-checkbox-group>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
<div v-else><h3>无可配置角色!</h3></div>
|
||||||
|
</a-spin>
|
||||||
|
<div class="drawer-bootom-button">
|
||||||
|
<a-dropdown style="float: left" :trigger="['click']" placement="topCenter">
|
||||||
|
<a-menu slot="overlay">
|
||||||
|
<a-menu-item key="1" @click="checkALL">全部勾选</a-menu-item>
|
||||||
|
<a-menu-item key="2" @click="cancelCheckALL">取消全选</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
<a-button>
|
||||||
|
操作 <a-icon type="up" />
|
||||||
|
</a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
<a-popconfirm title="确定放弃编辑?" @confirm="close" okText="确定" cancelText="取消">
|
||||||
|
<a-button style="margin-right: .8rem">取消</a-button>
|
||||||
|
</a-popconfirm>
|
||||||
|
<a-button @click="handleSubmit(true)" type="primary">保存</a-button>
|
||||||
|
</div>
|
||||||
|
</a-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {httpAction, getAction} from '@/api/manage'
|
||||||
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
||||||
|
import {initDictOptions} from '@/components/dict/JDictSelectUtil'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'DeptRoleUserModal',
|
||||||
|
components: {
|
||||||
|
JEllipsis
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
currentDeptId:"",
|
||||||
|
title: "部门角色分配",
|
||||||
|
visible: false,
|
||||||
|
model: {},
|
||||||
|
labelCol: {
|
||||||
|
xs: {span: 24},
|
||||||
|
sm: {span: 5},
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
xs: {span: 24},
|
||||||
|
sm: {span: 16},
|
||||||
|
},
|
||||||
|
confirmLoading: false,
|
||||||
|
form: this.$form.createForm(this),
|
||||||
|
validatorRules: {},
|
||||||
|
url: {
|
||||||
|
add: "/sys/sysDepartRole/deptRoleUserAdd",
|
||||||
|
getDeptRoleList:"/sys/sysDepartRole/getDeptRoleList",
|
||||||
|
getDeptRoleByUserId:"/sys/sysDepartRole/getDeptRoleByUserId"
|
||||||
|
},
|
||||||
|
designNameOption: [],
|
||||||
|
userId: "",
|
||||||
|
newRoleId:"",
|
||||||
|
oldRoleId:"",
|
||||||
|
designNameValue:[],
|
||||||
|
desformList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add(record,departId) {
|
||||||
|
this.userId = record.id;
|
||||||
|
this.currentDeptId = departId;
|
||||||
|
this.loadDesformList();
|
||||||
|
this.edit({});
|
||||||
|
},
|
||||||
|
edit(record) {
|
||||||
|
this.form.resetFields();
|
||||||
|
this.model = Object.assign({}, record);
|
||||||
|
this.visible = true;
|
||||||
|
getAction(this.url.getDeptRoleByUserId,{userId:this.userId}).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
var designName = [];
|
||||||
|
for (let value of res.result) {
|
||||||
|
designName.push(value.droleId)
|
||||||
|
}
|
||||||
|
this.oldRoleId=designName.join(",");
|
||||||
|
this.designNameValue = designName;
|
||||||
|
this.newRoleId = designName.join(",");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$emit('close');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleSubmit() {
|
||||||
|
const that = this;
|
||||||
|
// 触发表单验证
|
||||||
|
that.confirmLoading = true;
|
||||||
|
let httpurl = this.url.add;
|
||||||
|
let method = 'post';
|
||||||
|
let formData = Object.assign(this.model, {});
|
||||||
|
//时间格式化
|
||||||
|
formData.userId = this.userId;
|
||||||
|
formData.newRoleId=this.newRoleId;
|
||||||
|
formData.oldRoleId=this.oldRoleId;
|
||||||
|
httpAction(httpurl, formData, method).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
that.$message.success(res.message);
|
||||||
|
that.$emit('reload');
|
||||||
|
that.$emit('ok');
|
||||||
|
} else {
|
||||||
|
that.$message.warning(res.message);
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
that.confirmLoading = false;
|
||||||
|
that.close();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.designNameOption=[];
|
||||||
|
this.designNameValue=[];
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
|
designNameChange(selectedValue) {
|
||||||
|
this.newRoleId=selectedValue.join(",");
|
||||||
|
},
|
||||||
|
checkALL(){
|
||||||
|
var designName = [];
|
||||||
|
for (let value of this.desformList) {
|
||||||
|
designName.push(
|
||||||
|
value.id
|
||||||
|
)
|
||||||
|
}
|
||||||
|
this.designNameValue = designName;
|
||||||
|
this.newRoleId=designName.join(",");
|
||||||
|
},
|
||||||
|
cancelCheckALL(){
|
||||||
|
this.designNameValue=[];
|
||||||
|
this.newRoleId="";
|
||||||
|
},
|
||||||
|
/** 加载desform */
|
||||||
|
loadDesformList() {
|
||||||
|
getAction(this.url.getDeptRoleList, { departId: this.currentDeptId }).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
this.desformList = res.result
|
||||||
|
var designName = [];
|
||||||
|
for (let value of this.desformList) {
|
||||||
|
designName.push({
|
||||||
|
value: value.id,
|
||||||
|
text: value.roleName,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.designNameOption = designName;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.drawer-bootom-button {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
border-top: 1px solid #e8e8e8;
|
||||||
|
padding: 10px 16px;
|
||||||
|
text-align: right;
|
||||||
|
left: 0;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 0 0 2px 2px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal
|
||||||
|
title="功能测试"
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
@ok="visible=false"
|
||||||
|
@cancel="visible=false"
|
||||||
|
>
|
||||||
|
<a-form :form="form">
|
||||||
|
<a-form-item label="功能测试">
|
||||||
|
<a-input placeholder="请输入" v-decorator="['test', validatorRules.test]" @change="e=>testValue=e.target.value"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
<a-row type="flex" :gutter="8">
|
||||||
|
<a-col v-for="(str,index) of testValue">
|
||||||
|
<a-row>
|
||||||
|
<a-col>
|
||||||
|
<a-input :value="str" style="text-align: center;width: 40px;"/>
|
||||||
|
</a-col>
|
||||||
|
<a-col style="text-align: center;">{{index+1}}</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { validateCheckRule } from '@/utils/util'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SysCheckRuleModal',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '操作',
|
||||||
|
visible: false,
|
||||||
|
ruleCode: '',
|
||||||
|
testValue: '',
|
||||||
|
form: this.$form.createForm(this),
|
||||||
|
validatorRules: {
|
||||||
|
test: {
|
||||||
|
rules: [{ validator: (rule, value, callback) => validateCheckRule(this.ruleCode, value, callback) }]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(ruleCode) {
|
||||||
|
this.ruleCode = ruleCode
|
||||||
|
this.form.resetFields()
|
||||||
|
this.testValue = ''
|
||||||
|
this.visible = true
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal
|
||||||
|
:title="title"
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:confirmLoading="confirmLoading"
|
||||||
|
@ok="handleOk"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
cancelText="关闭">
|
||||||
|
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<a-form :form="form">
|
||||||
|
|
||||||
|
<a-form-item
|
||||||
|
:labelCol="labelCol"
|
||||||
|
:wrapperCol="wrapperCol"
|
||||||
|
label="部门角色名称">
|
||||||
|
<a-input placeholder="请输入部门角色名称" v-decorator="['roleName', validatorRules.roleName]" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item
|
||||||
|
:labelCol="labelCol"
|
||||||
|
:wrapperCol="wrapperCol"
|
||||||
|
label="部门角色编码">
|
||||||
|
<a-input placeholder="请输入部门角色编码" v-decorator="['roleCode', validatorRules.roleCode]" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item
|
||||||
|
:labelCol="labelCol"
|
||||||
|
:wrapperCol="wrapperCol"
|
||||||
|
label="描述">
|
||||||
|
<a-input placeholder="请输入描述" v-decorator="['description', validatorRules.description]" />
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { httpAction } from '@/api/manage'
|
||||||
|
import pick from 'lodash.pick'
|
||||||
|
import {duplicateCheck } from '@/api/api'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "SysDepartRoleModal",
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
title:"操作",
|
||||||
|
visible: false,
|
||||||
|
model: {},
|
||||||
|
labelCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 5 },
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 16 },
|
||||||
|
},
|
||||||
|
|
||||||
|
confirmLoading: false,
|
||||||
|
form: this.$form.createForm(this),
|
||||||
|
validatorRules:{
|
||||||
|
roleName:{
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: '请输入部门角色名称!' },
|
||||||
|
{ min: 2, max: 30, message: '长度在 2 到 30 个字符', trigger: 'blur' }
|
||||||
|
]},
|
||||||
|
roleCode:{
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: '请输入部门角色编码!'},
|
||||||
|
{ min: 0, max: 64, message: '长度不超过 64 个字符', trigger: 'blur' },
|
||||||
|
{ validator: this.validateRoleCode}
|
||||||
|
]},
|
||||||
|
description:{
|
||||||
|
rules: [
|
||||||
|
{ min: 0, max: 126, message: '长度不超过 126 个字符', trigger: 'blur' }
|
||||||
|
]}
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
add: "/sys/sysDepartRole/add",
|
||||||
|
edit: "/sys/sysDepartRole/edit",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
add (departId) {
|
||||||
|
this.edit({},departId);
|
||||||
|
},
|
||||||
|
edit (record,departId) {
|
||||||
|
this.departId = departId;
|
||||||
|
this.form.resetFields();
|
||||||
|
this.model = Object.assign({}, record);
|
||||||
|
this.visible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.form.setFieldsValue(pick(this.model,'roleName','roleCode','description'))
|
||||||
|
});
|
||||||
|
},
|
||||||
|
close () {
|
||||||
|
this.$emit('close');
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
handleOk () {
|
||||||
|
const that = this;
|
||||||
|
// 触发表单验证
|
||||||
|
this.form.validateFields((err, values) => {
|
||||||
|
if (!err) {
|
||||||
|
that.confirmLoading = true;
|
||||||
|
let httpurl = '';
|
||||||
|
let method = '';
|
||||||
|
if(!this.model.id){
|
||||||
|
httpurl+=this.url.add;
|
||||||
|
method = 'post';
|
||||||
|
}else{
|
||||||
|
httpurl+=this.url.edit;
|
||||||
|
method = 'put';
|
||||||
|
}
|
||||||
|
let formData = Object.assign(this.model, values);
|
||||||
|
formData.departId = this.departId;
|
||||||
|
httpAction(httpurl,formData,method).then((res)=>{
|
||||||
|
if(res.success){
|
||||||
|
that.$message.success(res.message);
|
||||||
|
that.$emit('ok');
|
||||||
|
}else{
|
||||||
|
that.$message.warning(res.message);
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
that.confirmLoading = false;
|
||||||
|
that.close();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleCancel () {
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
|
validateRoleCode(rule, value, callback){
|
||||||
|
if(/[\u4E00-\u9FA5]/g.test(value)){
|
||||||
|
callback("部门角色编码不可输入汉字!");
|
||||||
|
}else{
|
||||||
|
var params = {
|
||||||
|
tableName: "sys_depart_role",
|
||||||
|
fieldName: "role_code",
|
||||||
|
fieldVal: value,
|
||||||
|
dataId: this.model.id,
|
||||||
|
};
|
||||||
|
duplicateCheck(params).then((res)=>{
|
||||||
|
if(res.success){
|
||||||
|
callback();
|
||||||
|
}else{
|
||||||
|
callback(res.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue