Browse Source

1、登录及路由优化,2、用户信息维护页面功能开发,3、主表格组件权限到操作列按钮封装

master
安虹睿 1 year ago
parent
commit
bb0f50502e
  1. 9
      Code/Fe/src/api/wms-auth.js
  2. 3
      Code/Fe/src/components/tablePagination/index.vue
  3. 44
      Code/Fe/src/components/umyTable/index.vue
  4. 15
      Code/Fe/src/mixins/TableHeaderMixins.js
  5. 20
      Code/Fe/src/mixins/TableMixins.js
  6. 38
      Code/Fe/src/permission.js
  7. 2
      Code/Fe/src/store/modules/permission.js
  8. 4
      Code/Fe/src/utils/defaultButtons.js
  9. 7
      Code/Fe/src/views/login/index.vue
  10. 4
      Code/Fe/src/views/menuList/AbpIdentityMarkRoles.vue
  11. 637
      Code/Fe/src/views/menuList/AbpIdentityMarkUsers.vue
  12. 612
      Code/Fe/src/views/menuList/ExportCustomUserSetting.vue

9
Code/Fe/src/api/wms-auth.js

@ -195,10 +195,11 @@ export function getusersID(data) {
}) })
} }
//重置密码 //修改登录用户的密码-强密码规则
export function resetPassword(id) { export function postLoginUserInfo(data, id) {
return request({ return request({
url: authApi + '/identity/users/reset-password/' + id, url: authApi + '/identity/users/change-password/' + id,
method: 'post' method: 'post',
data
}) })
} }

3
Code/Fe/src/components/tablePagination/index.vue

@ -307,7 +307,8 @@ export default {
_list.push(item) _list.push(item)
}else{ }else{
if(this.noUsePermissionBtn.indexOf(item.name) < 0){ if(this.noUsePermissionBtn.indexOf(item.name) < 0){
item.permission = [this.$route.name+'.'+item.name] let _scope = item.clientScope || localStorage.getItem('appClientScope')
item.permission = [_scope + '.' +this.$route.name+'.'+item.name]
}else{ }else{
item.permission = [] item.permission = []
} }

44
Code/Fe/src/components/umyTable/index.vue

@ -12,6 +12,7 @@
:border="tableBorder" :border="tableBorder"
style="width: 100%" style="width: 100%"
:cell-style="cellStyle" :cell-style="cellStyle"
:cell-class-name="cellClassName"
use-virtual use-virtual
:height="uTableHeight" :height="uTableHeight"
header-row-class-name="uTableHeader" header-row-class-name="uTableHeader"
@ -93,7 +94,7 @@
size="mini" size="mini"
> >
<el-option <el-option
v-for="item in getItemEnums(item)" v-for="item in item.enums_list"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
@ -166,6 +167,7 @@
:key="indexButton" :key="indexButton"
type="text" type="text"
size="mini" size="mini"
v-permission="itemButton.permission"
:style="{color:itemButton.color || '#409EFF'}" :style="{color:itemButton.color || '#409EFF'}"
@click="buttonOperationClick_right(scope.row, itemButton, indexButton)" @click="buttonOperationClick_right(scope.row, itemButton, indexButton)"
>{{itemButton.label}}</el-button> >{{itemButton.label}}</el-button>
@ -211,8 +213,10 @@ import { formatTimeStrToStr } from "@/utils/formatTime";
import _ from "lodash"; import _ from "lodash";
import { getMatchRegConformValue } from "@/utils/index" import { getMatchRegConformValue } from "@/utils/index"
import showCopyJsonPop from "@/components/showCopyJsonPop" import showCopyJsonPop from "@/components/showCopyJsonPop"
import permission from "@/directive/permission/index"
export default { export default {
name: "currenTable", name: "currenTable",
directives: { permission },
components:{ showCopyJsonPop }, components:{ showCopyJsonPop },
filters: { filters: {
formatDate(time) { formatDate(time) {
@ -316,6 +320,12 @@ export default {
return Function; return Function;
} }
}, },
cellClassName: {
type: Function,
default: () => {
return Function;
}
},
// app-main100% // app-main100%
setUTableHeight: { setUTableHeight: {
type: Number, type: Number,
@ -388,6 +398,12 @@ export default {
this.setTableHeightHandle() this.setTableHeightHandle()
}, },
methods: { methods: {
//
doFreshLayout(){
if (this.$refs.multipleTable && this.$refs.multipleTable.doLayout) {
this.$refs.multipleTable.doLayout()
}
},
// //
setTableHeightHandle(height){ setTableHeightHandle(height){
let _height = height || this.setUTableHeight let _height = height || this.setUTableHeight
@ -640,9 +656,11 @@ export default {
// //
initApiEnumList(item,data){ initApiEnumList(item,data){
let _item_enumList = {} let _item_enumList = {}
item.enums_list.forEach((item,key)=>{ if(item.enums_list){
_item_enumList[item.value] = item.label item.enums_list.forEach((item,key)=>{
}) _item_enumList[item.value] = item.label
})
}
return _item_enumList[data] || '未定义' return _item_enumList[data] || '未定义'
}, },
// | | json // | | json
@ -666,24 +684,6 @@ export default {
if(type == 'detail')this.showDetailInfo(row) if(type == 'detail')this.showDetailInfo(row)
if(type == 'json')this.showJsonTable(row) if(type == 'json')this.showJsonTable(row)
}, },
//
getItemEnums(item){
let _option = []
//
if(item.apiBaseType == 'boolean'){
_option = [{
value: true,
label: '是'
},{
value: false,
label: '否'
},]
}
if(item.isEnums){
_option = item.enums_list
}
return _option
},
// //
changeValue(prop,item,val) { changeValue(prop,item,val) {
this.$emit("changeValue", prop, item, val) this.$emit("changeValue", prop, item, val)

15
Code/Fe/src/mixins/TableHeaderMixins.js

@ -50,12 +50,13 @@ export const TableHeaderMixins = {
// 全部导出处理 // 全部导出处理
if(type && type == 'all'){ _data.MaxResultCount = this.totalCount} if(type && type == 'all'){ _data.MaxResultCount = this.totalCount}
this.closeExportDrop() this.closeExportDrop()
this.Loading.appMainLoading = true this.Loading.tableLoading = true
postExport(_params,_data, _exportUrl, _special).then(res => { postExport(_params,_data, _exportUrl, _special).then(res => {
this.blob(res, name)//使用前端导出名称 this.blob(res, name)//使用前端导出名称
this.Loading.appMainLoading = false this.Loading.tableLoading = false
}).catch(err => { }).catch(err => {
this.Loading.appMainLoading = false this.Loading.tableLoading = false
this.$errorMsg('导出失败,请重试!')
}) })
}, },
// 点击常用按钮 // 点击常用按钮
@ -66,11 +67,11 @@ export const TableHeaderMixins = {
this.paging() this.paging()
// this.$store.dispatch("app/appMainLoading", true) // this.$store.dispatch("app/appMainLoading", true)
} }
// 新增(原始前端写死配置方式) // 新增(原始前端写死配置)
else if (val == 'newly') { else if (val == 'Create') {
this.formTitle = "新增" + this.$route.meta.title; this.formTitle = "新增" + this.$route.meta.title;
this.formReveal = true this.formReveal = true
this.theEvent = "newly" this.theEvent = "Create"
this.displayDialog.newDialog = true; this.displayDialog.newDialog = true;
} }
// Api新增(参数配置从api获取) // Api新增(参数配置从api获取)
@ -289,7 +290,7 @@ export const TableHeaderMixins = {
* list_api: 表头来自api的列表 detail_api: 表头来自api列表的明细 detailPage_api表头来自api的明细页面列表 * list_api: 表头来自api的列表 detail_api: 表头来自api列表的明细 detailPage_api表头来自api的明细页面列表
* list: 表头固定的列表 detail: 表头固定列表的明细 * list: 表头固定的列表 detail: 表头固定列表的明细
*/ */
rowDrop(data,type) { rowDrop(data,type) {
if(!type || type == 'list_api'){ this.apiColumns_Table = data } if(!type || type == 'list_api'){ this.apiColumns_Table = data }
if(type && type == 'detail_api'){ this.apiColumns_DetailsTable = data } if(type && type == 'detail_api'){ this.apiColumns_DetailsTable = data }
// if(type && type == 'detailPage_api'){ this.apiColumns_DetailsPage = data } // if(type && type == 'detailPage_api'){ this.apiColumns_DetailsPage = data }

20
Code/Fe/src/mixins/TableMixins.js

@ -51,15 +51,19 @@ export const tableMixins = {
}, },
methods: { methods: {
// 主表-右侧操作列基础按钮 // 主表-右侧操作列基础按钮
buttonOperationList_rightBase(){ buttonOperationList_rightBase(op_e,op_d){
return [{ return [{
label:'编辑', label:'编辑',
name:'edit', name:'edit',
color:'#ff9000' color:'#ff9000',
hide:op_e && op_e.hide ? op_e.hide : false,
permission:op_e && op_e.permission ? op_e.permission : []
},{ },{
label:'删除', label:'删除',
name:'delete', name:'delete',
color:'red' color:'red',
hide:op_d && op_d.hide ? op_d.hide : false,
permission:op_d && op_d.permission ? op_d.permission : []
}] }]
}, },
// 主表-右侧操作列基础按钮 // 主表-右侧操作列基础按钮
@ -187,7 +191,7 @@ export const tableMixins = {
"name": "CreationTime", "name": "CreationTime",
"apiBaseType": "datetime", "apiBaseType": "datetime",
"baseApiName": _apiName + 'CreationTime', "baseApiName": _apiName + 'CreationTime',
"label": zhApiColumnsLable(_apiName + 'CreationTime') || _apiName + 'CreationTime', "label": zhApiColumnsLable(_apiName + 'CreationTime') || 'CreationTime',
"prop": "creationTime", "prop": "creationTime",
} }
) )
@ -199,7 +203,7 @@ export const tableMixins = {
"name": "CreatorId", "name": "CreatorId",
"apiBaseType": "string", "apiBaseType": "string",
"baseApiName": _apiName + 'CreatorId', "baseApiName": _apiName + 'CreatorId',
"label": zhApiColumnsLable(_apiName + 'CreatorId') || _apiName + 'CreatorId', "label": zhApiColumnsLable(_apiName + 'CreatorId') || 'CreatorId',
"prop": "creatorId", "prop": "creatorId",
} }
) )
@ -211,7 +215,7 @@ export const tableMixins = {
"name": "LastModificationTime", "name": "LastModificationTime",
"apiBaseType": "datetime", "apiBaseType": "datetime",
"baseApiName": _apiName + 'LastModificationTime', "baseApiName": _apiName + 'LastModificationTime',
"label": zhApiColumnsLable(_apiName + 'LastModificationTime') || _apiName + 'LastModificationTime', "label": zhApiColumnsLable(_apiName + 'LastModificationTime') || 'LastModificationTime',
"prop": "lastModificationTime", "prop": "lastModificationTime",
} }
) )
@ -223,7 +227,7 @@ export const tableMixins = {
"name": "LastModifierId", "name": "LastModifierId",
"apiBaseType": "string", "apiBaseType": "string",
"baseApiName": _apiName + 'LastModifierId', "baseApiName": _apiName + 'LastModifierId',
"label": zhApiColumnsLable(_apiName + 'LastModifierId') || _apiName + 'LastModifierId', "label": zhApiColumnsLable(_apiName + 'LastModifierId') || 'LastModifierId',
"prop": "lastModifierId", "prop": "lastModifierId",
} }
) )
@ -235,7 +239,7 @@ export const tableMixins = {
"name": "TenantId", "name": "TenantId",
"apiBaseType": "string", "apiBaseType": "string",
"baseApiName": _apiName + 'TenantId', "baseApiName": _apiName + 'TenantId',
"label": zhApiColumnsLable(_apiName + 'TenantId') || _apiName + 'TenantId', "label": zhApiColumnsLable(_apiName + 'TenantId') || 'TenantId',
"prop": "tenantId", "prop": "tenantId",
} }
) )

38
Code/Fe/src/permission.js

@ -12,7 +12,7 @@ NProgress.configure({
}) // NProgress Configuration }) // NProgress Configuration
const whiteList = ['/login','/callback'] // no redirect whitelist const whiteList = ['/login','/callback'] // no redirect whitelist
const noUserMsg = '获取用户信息失败,请重新登录 !' const loginErr = '登录失败,请重新登录 !'
const getErrMsg = '数据获取失败 !' const getErrMsg = '数据获取失败 !'
@ -45,10 +45,9 @@ const toPageInit = async (to, from, next) => {
// toNextHandle(to, from, next) // toNextHandle(to, from, next)
// }) // })
// .catch(()=>{ // .catch(()=>{
// // todo-fast:接口恢复后更改 // // toNextHandle(to, from, next)
// toNextHandle(to, from, next) // Message.error(loginErr)
// // Message.error(noUserMsg) // pageToLogin(to, from, next)
// // pageToLogin(to, from, next)
// }) // })
// return // return
// } // }
@ -61,6 +60,16 @@ const toPageInit = async (to, from, next) => {
} }
// 获取数据失败处理
const getErrHandle = (to, from, next) => {
let isAutoLogin = JSON.parse(localStorage.getItem('isConfigLogin')) || to.query.loginName
Message.error(getErrMsg)
if(!isAutoLogin){
store.dispatch("user/logout")
}
NProgress.done()
}
// 跳转处理 // 跳转处理
const toNextHandle = async (to, from, next) => { const toNextHandle = async (to, from, next) => {
let isFresh = false let isFresh = false
@ -68,8 +77,7 @@ const toNextHandle = async (to, from, next) => {
// 获取表头转义 // 获取表头转义
if(!store.getters.columZHList){ if(!store.getters.columZHList){
await store.dispatch('definition/getColumZHList').catch(()=>{ await store.dispatch('definition/getColumZHList').catch(()=>{
Message.error(getErrMsg) getErrHandle(to, from, next)
NProgress.done()
}) })
} }
@ -80,21 +88,19 @@ const toNextHandle = async (to, from, next) => {
.then(res=>{ .then(res=>{
// 没有权限(token失效处理) // 没有权限(token失效处理)
if(!res || res.length <=0){ if(!res || res.length <=0){
Message.error('用户无权限或者token失效,请重新登录') Message.error('用户无权限或者token失效,请配置权限或重新登录')
store.dispatch("user/logout") store.dispatch("user/logout")
} }
}) })
.catch(()=>{ .catch(()=>{
Message.error(getErrMsg) getErrHandle(to, from, next)
NProgress.done()
}) })
} }
// 获取枚举数据 // 获取枚举数据
if(!store.getters.enumList || store.getters.enumList.length <= 0){ if(!store.getters.enumList || store.getters.enumList.length <= 0){
await store.dispatch('definition/getDefinitionConfig').catch(()=>{ await store.dispatch('definition/getDefinitionConfig').catch(()=>{
Message.error(getErrMsg) getErrHandle(to, from, next)
NProgress.done()
}) })
} }
@ -142,6 +148,7 @@ router.beforeEach(async (to, from, next) => {
} else { } else {
// 如果有单点登录方式使用下方配置 // 如果有单点登录方式使用下方配置
// mgr.signinRedirect(); //执行重定向 // mgr.signinRedirect(); //执行重定向
if(isAutoLogin){ if(isAutoLogin){
let _username = localStorage.getItem("isConfigLogin") && localStorage.getItem("isConfigLogin") != 'false' ? localStorage.getItem("configLoginName") : to.query.loginName let _username = localStorage.getItem("isConfigLogin") && localStorage.getItem("isConfigLogin") != 'false' ? localStorage.getItem("configLoginName") : to.query.loginName
await store.dispatch('user/login', { await store.dispatch('user/login', {
@ -152,10 +159,9 @@ router.beforeEach(async (to, from, next) => {
toPageInit(to, from, next) toPageInit(to, from, next)
}) })
.catch(()=>{ .catch(()=>{
// todo-fast:接口恢复后更改 // toNextHandle(to, from, next)
toNextHandle(to, from, next) Message.error(loginErr)
// Message.error(noUserMsg) pageToLogin(to, from, next)
// pageToLogin(to, from, next)
}) })
}else{ }else{
console.log('没有token,不是登录页,不是自动登录,pageToLogin') console.log('没有token,不是登录页,不是自动登录,pageToLogin')

2
Code/Fe/src/store/modules/permission.js

@ -169,7 +169,7 @@ const actions = {
} }
// 存储所有的表名 // 存储所有的表名
commit('SET_TABLESNAME', _menuList) commit('SET_TABLESNAME', _menuList)
// 数据模拟,todo-new:接口获取 // 数据模拟,todo-faster:接口获取
let _treeMenusAll = null//树形菜单 let _treeMenusAll = null//树形菜单
// _treeMenusAll = [ // _treeMenusAll = [
// {name:"aaaaaaa"}, // {name:"aaaaaaa"},

4
Code/Fe/src/utils/defaultButtons.js

@ -13,7 +13,7 @@ export function defaultAddBtn(option) {
type: "primary", type: "primary",
icon: "el-icon-plus", icon: "el-icon-plus",
label: i18n.t('btns.add'), label: i18n.t('btns.add'),
name: "newly", name: "Create",
size: "mini", size: "mini",
background:"#31bb99" background:"#31bb99"
}) })
@ -122,5 +122,7 @@ function __defaultBtnOption(option,specific){
class:option && option.class ? option.class : specific.class, class:option && option.class ? option.class : specific.class,
isDetailExport:option && option.isDetailExport ? option.isDetailExport : false, isDetailExport:option && option.isDetailExport ? option.isDetailExport : false,
isRedundance:option && option.isRedundance ? option.isRedundance : false, isRedundance:option && option.isRedundance ? option.isRedundance : false,
permission:option && option.permission ? option.permission : null,
clientScope:option && option.clientScope ? option.clientScope : null,
} }
} }

7
Code/Fe/src/views/login/index.vue

@ -38,10 +38,9 @@
<svg-icon icon-class="svg_password" /> <svg-icon icon-class="svg_password" />
</span> </span>
<el-input <el-input
:key="passwordType"
ref="password" ref="password"
v-model="loginForm.password" v-model="loginForm.password"
:type="passwordType" :type="passwordType == 'svg_password' ? 'password' : 'text'"
placeholder="密码" placeholder="密码"
name="password" name="password"
tabindex="2" tabindex="2"
@ -171,8 +170,10 @@ export default {
}) })
}) })
.catch((error) => { .catch((error) => {
this.$message.error('用户名或密码错误!')
this.loading = false this.loading = false
if(!error){
this.$message.error('用户名或密码错误!')
}
}) })
} else { } else {
console.log('error submit!!') console.log('error submit!!')

4
Code/Fe/src/views/menuList/AbpIdentityMarkRoles.vue

@ -130,7 +130,7 @@
<el-dialog <el-dialog
:title="formTitle" :title="formTitle"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="600px" width="800px"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form <el-form
@ -138,8 +138,6 @@
:model="form" :model="form"
label-width="70px" label-width="70px"
:rules="rules" :rules="rules"
size="small"
:inline="true"
> >
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-input v-model="form.name" style="width: 380px" maxlength="23" /> <el-input v-model="form.name" style="width: 380px" maxlength="23" />

637
Code/Fe/src/views/menuList/AbpIdentityMarkUsers.vue

@ -0,0 +1,637 @@
<template>
<div class="appMainPage" v-loading="loading">
<div class="main">
<div class="table-active">
<div class="bttton-box">
<el-button
type="primary"
icon="el-icon-plus"
@click="handleCreate"
size="mini"
v-permission="['AbpIdentity.Users.Create']"
>创建用户</el-button
>
<el-button
type="success"
icon="el-icon-refresh"
@click.native.prevent="Createview"
size="mini"
>刷新</el-button
>
</div>
<div class="query-box">
<!-- 搜索 -->
<searchNormal
ref="normalSearch_UserManage"
@searchNormalClick="filtrate"
@searchNormalClear="filtrate"
></searchNormal>
</div>
</div>
<el-table
ref="multipleTable"
:data="tableData"
height="calc(100vh - 260px)"
style="width: 100%"
@sort-change="sortChange"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
:border="true"
>
<el-table-column :align="'center'" type="selection" width="55" />
<el-table-column
prop="userName"
label="用户名"
width="180"
:align="'left'"
sortable="custom"
/>
<el-table-column
prop="name"
label="姓名"
width="180"
:align="'left'"
sortable="custom"
/>
<el-table-column
prop="isActive"
label="是否启用"
sortable="custom"
:align="'center'"
width="180"
>
<template slot-scope="scope">
<span>{{ scope.row['isActive'] | trigger('whetherOrNot', "label") }}</span>
</template>
</el-table-column>
<el-table-column label="操作" :align="'center'" width="230">
<template slot-scope="scope">
<el-button
type="text"
@click="Update(scope.row)"
v-permission="['AbpIdentity.Users.Update']"
v-if="scope.row.name == 'admin' ? false : true"
>编辑</el-button>
<el-button
type="text"
@click="deleteUser(scope.row)"
v-if="scope.row.name == 'admin' ? false : true"
v-permission="['AbpIdentity.Users.Delete']"
style="color:red"
>删除用户</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="Footer">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryInfo.currentPage"
:page-sizes="[10, 15, 20]"
:page-size="queryInfo.pagesize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
<el-button
type="primary"
size="mini"
style="margin-left: 10px; background-color: #409eff"
>确定</el-button
>
</div>
<el-dialog
:title="formTitle"
:visible.sync="dialogVisible"
width="800px"
:close-on-click-modal="false"
:modal-append-to-body="false"
:append-to-body="false"
>
<el-form
ref="form"
:model="form"
label-width="70px"
:rules="rules"
>
<el-form-item label="用户名" prop="userName">
<el-input
v-model="form.userName"
maxlength="20"
/>
</el-form-item>
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" maxlength="20" />
</el-form-item>
<el-form-item label="角色" prop="roleNames">
<el-select
:disabled="!checkPermission(['AbpIdentity.Users.ManagePermissions']) && isEdit"
v-model="form.roleNames"
multiple
style="width: 100%"
placeholder="请选择"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.name"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="是否启用" prop="IsActive">
<el-select
v-model="form.IsActive"
style="width: 100%"
placeholder="请选择"
>
<el-option
v-for="item in userOptions('whetherOrNot')"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="密码" prop="password" v-if="!isEdit">
<el-input
ref="password"
v-model="form.password"
maxlength="16"
minlength="6"
:type="passwordType"
/>
<span class="show-pwd" @click="showPwd">
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
</span>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="resetform"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { isvalidPhone } from "@/utils/validate";
import checkPermission from '@/utils/permission'
import {
getPageListUsers,
usersroles,
postCreateUser,
postUpdateUser,
postDeleteUser,
getusersID,
} from "@/api/wms-auth";
import permission from "@/utils/permission/index";
import searchNormal from "@/components/searchNormal/index.vue"
export default {
directives: { permission },
components:{
searchNormal
},
name:"AbpIdentityMarkUsers",
data() {
//
const validPhone = (rule, value, callback) => {
if (!value) {
callback(new Error("请输入电话号码"));
} else if (!isvalidPhone(value)) {
callback(new Error("请输入正确的11位手机号码"));
} else {
callback();
}
};
const validName = (rule, value, callback) => {
if (!value) {
callback(new Error("请输入登录名称"));
} else if (/[\u4E00-\u9FA5]/g.test(value)) {
callback(new Error("登录名不能输入汉字"));
} else {
callback();
}
};
//
// const validpassword = (rule, value, callback) => {
// if (!value) {
// callback(new Error(""));
// } else {
// if (
// /^(?=.*\d)(?=.*[a-z]).{6,16}$/.test(
// value
// )
// ) {
// callback();
// } else {
// callback(new Error(",,6"));
// }
// }
// };
//
// const validpassword = (rule, value, callback) => {
// if (!value) {
// callback(new Error(""));
// } else {
// if (
// /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,16}$/.test(
// value
// )
// ) {
// callback();
// } else {
// callback(new Error(",,6"));
// }
// }
// };
//
const validpassword = (rule, value, callback) => {
if (!value) {
callback(new Error("请输入密码"));
} else {
if (
/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[~@#$%\*-\+=:,\\?\[\]\{}]).{6,16}$/.test(
value
)
) {
callback();
} else {
callback(new Error("密码必须包含大小写,数字与特殊字符混合,最小长度为6位"));
}
}
};
const checkEmail = (rule, value, callback) => {
const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
if (!value) {
return callback(new Error("邮箱不能为空"));
}
setTimeout(() => {
if (mailReg.test(value)) {
callback();
} else {
callback(new Error("请输入正确的邮箱格式"));
}
}, 100);
};
return {
loading:false,
//
dialogVisible: false,
//
isEdit: false,
//title
formTitle: "",
//
total: 0,
//
queryInfo: {
//
currentPage: 1,
//
pagesize: 20,
Sorting: "",
},
//
options: [],
//ID
usersId: "",
//
concurrencyStamp: "",
//
form: {
userName: "",
phoneNumber: "",
name: "",
email: "",
roleNames: [],
password: "",
surname: "",
lockoutEnabled: true,
IsActive: true,
},
//
passwordType: "password",
//
multipleSelection: [],
//table
tableData: [],
rules: {
userName: [
{ required: true, trigger: "blur", validator: validName },
{
min: 2,
max: 20,
message: "长度在 2 到 20 个字符",
trigger: "blur",
},
],
name: [
{ required: true, trigger: "blur", message: "请输入姓名" },
{
min: 2,
max: 20,
message: "长度在 2 到 20 个字符",
trigger: "blur",
},
],
email: [{ required: true, validator: checkEmail, trigger: "blur" }],
phoneNumber: [
{ required: true, trigger: "blur", validator: validPhone },
],
password: [
{ required: true, trigger: "blur", message: "请输入密码" },
{
min: 6,
max: 16,
message: "长度在 6 到 16 个字符",
trigger: "blur",
},
],
roleNames: [
{ required: true, message: "请选择角色", trigger: "change" },
],
},
};
},
created() {
//
usersroles().then((res) => {
this.options = res.items;
});
},
mounted() {
this.pageList();
},
methods: {
checkPermission,
//
userOptions(val){
let options = this.$staticOptions[val]
return options()
},
//table
pageList(val) {
this.loading = true
const data = {
Filter: val || '',
Sorting: this.queryInfo.Sorting,
SkipCount: (this.queryInfo.currentPage - 1) * this.queryInfo.pagesize,
MaxResultCount: this.queryInfo.pagesize,
};
getPageListUsers(data).then((res) => {
this.loading = false
const data = res;
this.total = data.totalCount;
this.tableData = data.items;
}).catch(()=>{
this.loading = false
});
},
//
showPwd() {
if (this.passwordType === "password") {
this.passwordType = "";
} else {
this.passwordType = "password";
}
this.$nextTick(() => {
this.$refs.password.focus();
});
},
//
sortChange(data) {
const { prop, order } = data;
if (!prop || !order) {
this.queryInfo.Sorting = "";
this.handleFilter();
return;
}
this.queryInfo.Sorting = prop + " " + order;
this.handleFilter();
},
//
handleFilter() {
this.queryInfo.currentPage = 1;
this.pageList();
},
//
filtrate(val) {
this.queryInfo.currentPage = 1;
this.pageList(val);
},
//
handleSizeChange(val) {
this.queryInfo.pagesize = val;
this.pageList();
},
//
handleCurrentChange(val) {
this.queryInfo.currentPage = val;
this.pageList();
},
//
resetform() {
this.$refs.form.resetFields();
this.dialogVisible = false;
this.form.userName = "";
this.form.phoneNumber = "";
this.form.name = "";
this.form.email = "";
this.form.roleNames = [];
this.form.password = "";
this.form.surname = "";
this.form.IsActive = "";
this.$refs.multipleTable.clearSelection();
},
handleCreate() {
this.formTitle = "创建用户";
this.dialogVisible = true;
this.isEdit = false;
this.form.phoneNumber = this.getRandomPhoneNumber()
this.form.email = this.getRandomEmail()
usersroles().then((res) => {
this.options = res.items
})
},
//
Createview() {
this.queryInfo.currentPage = 1;
this.queryInfo.Sorting = "";
this.$refs.normalSearch_UserManage.searchNormalClear()//
usersroles().then((res) => {
this.options = res.items;
});
this.$refs.multipleTable.clearSort();
},
//
usersID(data) {
getusersID(data).then((res) => {
const data = res.items;
this.form.roleNames = data.map((item) => {
return item.name;
});
});
},
//
Update(row) {
if (row) {
this.formTitle = "编辑用户";
this.usersId = row.id;
this.usersID(row.id);
this.form.userName = row.userName;
this.form.phoneNumber = row.phoneNumber;
this.form.name = row.name;
this.form.email = row.email;
this.form.surname = row.name;
this.form.lockoutEnabled = row.lockoutEnabled
this.concurrencyStamp = row.concurrencyStamp;
this.form.IsActive = row.isActive;
usersroles().then((res) => {
this.options = res.items;
});
this.isEdit = true;
this.dialogVisible = true;
}
},
//
submitForm() {
this.$refs.form.validate((valid) => {
//
if (valid && !this.isEdit) {
this.form.surname = this.form.name;
postCreateUser(this.form)
.then((res) => {
this.resetform();
this.$successMsg("创建成功!");
this.pageList();
})
.catch((err) => {
this.resetform();
});
} else if (valid && this.isEdit) {
//
const data = JSON.parse(JSON.stringify(this.form));
delete data.password;
data.concurrencyStamp = this.concurrencyStamp;
postUpdateUser(data, this.usersId)
.then((res) => {
this.$successMsg("编辑成功!");
this.pageList();
this.resetform();
})
.catch((err) => {
this.resetform();
});
} else {
this.$errorMsg("请按照提示继续输入!");
return false;
}
});
},
//
deleteUser(row){
this.$confirm("您确认删除 " + row.userName + " 用户吗?", "提示", {
confirmButtonText: "确认删除用户",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.loading = true
postDeleteUser(row.id)
.then((res) => {
this.loading = false
this.$successMsg("删除成功!");
this.pageList();
})
.catch((err) => {
this.loading = false
})
})
.catch((err) => {
console.log(err)
})
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
//table
handleRowClick(row, column, event) {
if (
this.multipleSelection.length == 1 &&
this.multipleSelection[0].id == row.id
) {
this.$refs.multipleTable.clearSelection();
return;
}
this.$refs.multipleTable.clearSelection();
this.$refs.multipleTable.toggleRowSelection(row);
},
// 11
getRandomPhoneNumber () {
return '1' + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1)
},
getRandomEmail () {
return '' + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + '@' + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + Math.floor(Math.random()*9+1) + '.com'
},
},
};
</script>
<style lang="scss" scoped>
.appMainPage {
.main {
.table-active {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
padding: 20px 0;
.bttton-box {
display: flex;
}
}
}
.el-table__body-wrapper {
tbody {
span {
cursor: pointer;
&:hover {
color: #409eff;
}
}
}
}
.Footer {
padding: 25px;
// background-color: #f2f2f2;
display: flex;
justify-content: flex-end;
::v-deep button {
background-color: #fff;
}
}
::v-deep .el-dialog {
.el-dialog__header {
button {
display: none;
}
}
}
.el-form-item{
margin-bottom: 30px;
}
.show-pwd {
position: absolute;
right: 10px;
}
}
</style>

612
Code/Fe/src/views/menuList/ExportCustomUserSetting.vue

@ -1,267 +1,271 @@
<template> <template>
<div class="page-box" v-loading="Loading.tableLoading"> <div class="page-box" v-loading="Loading.tableLoading">
<tablePagination <tablePagination
v-if="apiColumns_Table" v-if="apiColumns_Table"
:currenButtonData="currenButtonData" :currenButtonData="currenButtonData"
:tableData="tableData" :tableData="tableData"
:tableLoading="Loading.tableLoading" :tableLoading="Loading.tableLoading"
:tableColumns="apiColumns_Table" :tableColumns="apiColumns_Table"
@rowDrop="rowDrop" @rowDrop="rowDrop"
:totalCount="totalCount" :totalCount="totalCount"
:multipleSelection="multipleSelection" :multipleSelection="multipleSelection"
:MaxResultCount="PageListParams.MaxResultCount" :MaxResultCount="PageListParams.MaxResultCount"
@topbutton="topbutton" @topbutton="topbutton"
@inlineDialog="inlineDialog" @inlineDialog="inlineDialog"
@sortChange="sortChange" @sortChange="sortChange"
@alertoldSkipCount="alertoldSkipCount" @alertoldSkipCount="alertoldSkipCount"
@alterResultCount="alterResultCount" @alterResultCount="alterResultCount"
@handleSelectionChange="handleSelectionChange" @handleSelectionChange="handleSelectionChange"
:currentPageProps="oldSkipCount" :currentPageProps="oldSkipCount"
:quicklySearchOption="quicklySearchOption" :quicklySearchOption="quicklySearchOption"
@quicklySearchClick="quicklySearchClick" @quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear" @quicklySearchClear="quicklySearchClear"
:primarySearchOption="primarySearchOption" :primarySearchOption="primarySearchOption"
@overallSearchFormClick="overallSearchFormClick" @overallSearchFormClick="overallSearchFormClick"
:httpOverallSearchData="httpOverallSearchData" :httpOverallSearchData="httpOverallSearchData"
:buttonOperationList_right="buttonOperationList_rightBase" :buttonOperationList_right="(row)=>{return buttonOperationList_rightBase(
@buttonOperationClick_right="buttonOperationClick_right" {permission:['Z.ExportCustomUserSetting.Update'],hide:OperaButtonHide(row)},
> {permission:['Z.ExportCustomUserSetting.Delete'],hide:OperaButtonHide(row)}
<!-- :buttonOperationList_left="buttonOperationClick_leftBase" )}"
@buttonOperationClick_left="buttonOperationClick_left" --> @buttonOperationClick_right="buttonOperationClick_right"
<!-- <div slot="tableTopSlot"> >
上方按钮插槽位置预留 <!-- :buttonOperationList_left="buttonOperationClick_leftBase"
</div> --> @buttonOperationClick_left="buttonOperationClick_left" -->
<!-- <div slot="searchPrimarySlot"> <!-- <div slot="tableTopSlot">
普通初级搜索插槽位置预留 上方按钮插槽位置预留
</div> --> </div> -->
<!-- <template>表格内容插槽位置预留</template> --> <!-- <div slot="searchPrimarySlot">
</tablePagination> 普通初级搜索插槽位置预留
<!-- 新增与编辑 --> </div> -->
<newAndEdiDialog <!-- <template>表格内容插槽位置预留</template> -->
:loading="Loading.newAndEdiLoading" </tablePagination>
:active="active" <!-- 新增与编辑 -->
:pageStatus="pageStatus" <newAndEdiDialog
:formReveal="formReveal" :loading="Loading.newAndEdiLoading"
:formTitle="formTitle" :active="active"
:displayDialog="editDialog" :pageStatus="pageStatus"
:FormData="formReveal ? CreateFormData : editFormData" :formReveal="formReveal"
:Form="formReveal ? CreateForm : editForm" :formTitle="formTitle"
:Options="editOptions" :displayDialog="editDialog"
:Handle="editHandle" :FormData="formReveal ? CreateFormData : editFormData"
:Rules="formReveal ? editRules.cerateRule : editRules.editRule" :Form="formReveal ? CreateForm : editForm"
@FormSubmit="FormSubmit" :Options="editOptions"
@close="FormClose" :Handle="editHandle"
@goBack="goBack" :Rules="formReveal ? editRules.cerateRule : editRules.editRule"
@changeSelect="changeSelect" @FormSubmit="FormSubmit"
></newAndEdiDialog> @close="FormClose"
<!-- 搜索按钮窗体组件 --> @goBack="goBack"
<searchPage @changeSelect="changeSelect"
ref="searchTable" ></newAndEdiDialog>
:tableLoading="Loading.autoTableLoading" <!-- 搜索按钮窗体组件 -->
:advancedFilter="advancedFilter()" <searchPage
:filterPageListParams="filterPageListParams" ref="searchTable"
:formTitle="searchTitle" :tableLoading="Loading.autoTableLoading"
:displayDialog="displayDialog.AddNewDialog" :advancedFilter="advancedFilter()"
:searchTableData="searchData" :filterPageListParams="filterPageListParams"
:searchTableColumns="searchColumns" :formTitle="searchTitle"
:searchTotalCount="searchTotalCount" :displayDialog="displayDialog.AddNewDialog"
:supplierItemPage="searchPageListParams" :searchTableData="searchData"
@handleSelectionChange="prepareFormData" :searchTableColumns="searchColumns"
@SizeChange="searchAlterResultCount($event, searchPageListParams)" :searchTotalCount="searchTotalCount"
@CurrentChange="searchAlertoldSkipCount($event, searchPageListParams)" :supplierItemPage="searchPageListParams"
@tableButtonClick="searchSubmit(arguments)" @handleSelectionChange="prepareFormData"
></searchPage> @SizeChange="searchAlterResultCount($event, searchPageListParams)"
<!-- 新导入 disabledMethod 导入方式禁用 disabledIsAllowPartImport 是否局部导入禁用--> @CurrentChange="searchAlertoldSkipCount($event, searchPageListParams)"
<!-- methodValue 导入方式默认选项 是否局部导入 默认选项 --> @tableButtonClick="searchSubmit(arguments)"
<importFile ></searchPage>
:loading="Loading.importLoading" <!-- 新导入 disabledMethod 导入方式禁用 disabledIsAllowPartImport 是否局部导入禁用-->
:show="displayDialog.importDialog" <!-- methodValue 导入方式默认选项 是否局部导入 默认选项 -->
:disabledMethod = {method1:false,method2:false,method3:false} <importFile
:disabledIsAllowPartImport = {isAllowPartImport1:false,isAllowPartImport2:false} :loading="Loading.importLoading"
isAllowPartImportValue="1" :show="displayDialog.importDialog"
@importClick="postImportMergeClick(arguments)" :disabledMethod = {method1:false,method2:false,method3:false}
@postImportDown="importDown" :disabledIsAllowPartImport = {isAllowPartImport1:false,isAllowPartImport2:false}
></importFile> isAllowPartImportValue="1"
<!--抽屉--> @importClick="postImportMergeClick(arguments)"
<curren-Drawer @postImportDown="importDown"
ref="currenDrawer_Ref" ></importFile>
:title="apiColumns_DesTions" <!--抽屉-->
@rowDrop="rowDrop" <curren-Drawer
:tableColumns="apiColumns_DetailsTable" ref="currenDrawer_Ref"
:tabsDesTions="apiColumns_DesTions" :title="apiColumns_DesTions"
:DrawerLoading="Loading.DrawerLoading" @rowDrop="rowDrop"
:drawer="displayDialog.detailsDialog" :tableColumns="apiColumns_DetailsTable"
:Butttondata="[]" :tabsDesTions="apiColumns_DesTions"
:propsData="propsData" :DrawerLoading="Loading.DrawerLoading"
@drawerShut="(val) => (displayDialog.detailsDialog = val)" :drawer="displayDialog.detailsDialog"
@drawerbutton="drawerbutton" :Butttondata="[]"
@handleCommand="drawerHandle" :propsData="propsData"
@close-value="closeValue" @drawerShut="(val) => (displayDialog.detailsDialog = val)"
:firstTabs="firstTabs" @drawerbutton="drawerbutton"
:totalCount="totalCountDetails" @handleCommand="drawerHandle"
:currentPage="oldSkipCountDetails" @close-value="closeValue"
:MaxResultCount="MaxResultCountDetails" :firstTabs="firstTabs"
@alterResultCountDetails="alterResultCountDetails" :totalCount="totalCountDetails"
@alertoldSkipCountDetails="alertoldSkipCountDetails" :currentPage="oldSkipCountDetails"
:buttonOperationList_left="operationButtonsDetail" :MaxResultCount="MaxResultCountDetails"
></curren-Drawer> @alterResultCountDetails="alterResultCountDetails"
</div> @alertoldSkipCountDetails="alertoldSkipCountDetails"
</template> :buttonOperationList_left="operationButtonsDetail"
<script> ></curren-Drawer>
import { tableMixins } from "@/mixins/TableMixins" </div>
import { LoadingMixins } from "@/mixins/LoadingMixins" </template>
import { drawerMixins } from "@/mixins/drawerMixins" <script>
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins" import { tableMixins } from "@/mixins/TableMixins"
import { newAndEdiDialogMixins } from "@/mixins/newAndEdiDialogMixins" import { LoadingMixins } from "@/mixins/LoadingMixins"
import { mixins } from "@/mixins/mixins" import { drawerMixins } from "@/mixins/drawerMixins"
import { filterSelectMixins } from '@/mixins/filter-Select' import { TableHeaderMixins } from "@/mixins/TableHeaderMixins"
import { zhApiColumnsLable,firstWordSizeChange } from '@/utils/index' import { newAndEdiDialogMixins } from "@/mixins/newAndEdiDialogMixins"
import { getPageList } from '@/api/wms-api' import { mixins } from "@/mixins/mixins"
import { import { filterSelectMixins } from '@/mixins/filter-Select'
postCreate, import { zhApiColumnsLable,firstWordSizeChange } from '@/utils/index'
postUpdate, import { getPageList } from '@/api/wms-api'
} from "@/api/wms-api" import {
postCreate,
export default { postUpdate,
name: "ExportCustomUserSetting", } from "@/api/wms-api"
mixins: [
tableMixins, export default {
LoadingMixins, name: "ExportCustomUserSetting",
drawerMixins, mixins: [
TableHeaderMixins, tableMixins,
mixins, LoadingMixins,
filterSelectMixins, drawerMixins,
newAndEdiDialogMixins TableHeaderMixins,
], mixins,
computed: { filterSelectMixins,
editDialog: { newAndEdiDialogMixins
get: function (val) { ],
return this.displayDialog.newDialog || this.displayDialog.editDialog; computed: {
}, editDialog: {
get: function (val) {
return this.displayDialog.newDialog || this.displayDialog.editDialog;
}, },
}, },
watch:{ },
'displayDialog.editDialog'(n){ watch:{
if(n){ 'displayDialog.editDialog'(n){
this.editFormData.exportColumnNameArr = this.editFormData.exportColumnName_old.split(" ") if(n){
this.getColumList() this.editFormData.exportColumnNameArr = this.editFormData.exportColumnName_old.split(" ")
} this.getColumList()
} }
}, }
data () { },
const userInfo=this.$store.getters.currentUserInfo data () {
return { const userInfo=this.$store.getters.currentUserInfo
tableLoading:false, return {
// tableLoading:false,
currenButtonData: [ //
this.defaultAddBtn(),// currenButtonData: [
this.defaultFieldSettingBtn(),// this.defaultAddBtn(),//
this.defaultFreshBtn(),// this.defaultFieldSettingBtn(),//
this.defaultFilterBtn(),// this.defaultFreshBtn(),//
], this.defaultFilterBtn(),//
// ],
CreateFormData: { //
customUserSetting: null, CreateFormData: {
exportUserName: userInfo.name, customUserSetting: null,
exportUserId: userInfo.id, exportUserName: userInfo.name,
exportColumnName: null, exportUserId: userInfo.id,
exportTableName: null, exportColumnName: null,
exportColumnNameArr:null, exportTableName: null,
exportTableName_old:null, exportColumnNameArr:null,
}, exportTableName_old:null,
//
editFormData: {
id:null,
customUserSetting: null,
exportUserName: userInfo.name,
exportUserId: userInfo.id,
exportColumnName: null,
exportTableName: null,
exportColumnNameArr:null,
exportTableName_old:null,
exportColumnName_old:null
},
editOptions: {},
CreateForm: [
// { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 },
// { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 },
// { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 },
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", options: "whetherOrNotForNum", colSpan: 12 },
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName_old", userOptions: this.initTablesName(), colSpan: 12 },
{ type: "select", disabled:true, multiple:true, label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnNameArr", userOptions:null, colSpan: 12 },
],
editForm: [
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", options: "whetherOrNotForNum", colSpan: 12 },
{ type: "select", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName_old", userOptions: this.initTablesName(), colSpan: 12 },
{ type: "select", multiple:true, label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnNameArr", userOptions:null, colSpan: 12 },
],
editRules: {
cerateRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnNameArr: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName_old: [{ required: true, trigger: "blur", message: "不可为空" }],
},
editRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnNameArr: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName_old: [{ required: true, trigger: "blur", message: "不可为空" }],
}
},
columsList:[],
};
},
mounted () {
this.paging();
},
methods:{
pagingCallback(callback){
this.Loading.tableLoading = false
this.tableData.forEach(item=>{
item.exportTableName_old = item.exportTableName
item.exportColumnName_old = item.exportColumnName
item.exportTableName = zhApiColumnsLable(item.exportTableName)
let _arr = item.exportColumnName.split(" ")
let _zhArr = []
_arr.forEach(item2=>{
let _item2 = zhApiColumnsLable(item.exportTableName_old+firstWordSizeChange(item2,'Upper')) || item2
_zhArr.push(_item2)
})
item.exportColumnName = _zhArr.join(',')
})
if(callback)callback()
}, },
// / //
initTablesName(){ editFormData: {
let _names = this.$store.getters.tablesName id:null,
let tablesList = [] customUserSetting: null,
_names.forEach(item=>{ exportUserName: userInfo.name,
let _item = { exportUserId: userInfo.id,
label:zhApiColumnsLable(item), exportColumnName: null,
value:item exportTableName: null,
} exportColumnNameArr:null,
tablesList.push(_item) exportTableName_old:null,
}) exportColumnName_old:null
return tablesList
}, },
changeSelect(prop,val){ editOptions: {},
// CreateForm: [
if(prop=='exportTableName_old'){ // { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 },
if(this.formReveal){ // { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 },
this.CreateForm[2].disabled = false // { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 },
// this.CreateFormData.exportTableName = this.CreateFormData.exportTableName_old { type: "select", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", options: "whetherOrNotForNum", colSpan: 12 },
this.CreateFormData.exportColumnNameArr = [] { type: "select", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName_old", userOptions: this.initTablesName(), colSpan: 12 },
}else{ { type: "select", disabled:true, multiple:true, label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnNameArr", userOptions:null, colSpan: 12 },
this.editForm[2].disabled = false ],
// this.editFormData.exportTableName = this.editFormData.exportTableName_old editForm: [
this.editFormData.exportColumnNameArr = [] { type: "select", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", options: "whetherOrNotForNum", colSpan: 12 },
} { type: "select", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName_old", userOptions: this.initTablesName(), colSpan: 12 },
this.getColumList() { type: "select", multiple:true, label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnNameArr", userOptions:null, colSpan: 12 },
],
editRules: {
cerateRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnNameArr: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName_old: [{ required: true, trigger: "blur", message: "不可为空" }],
},
editRule: {
customUserSetting: [{ required: true, trigger: "blur", message: "不可为空" }],
exportColumnNameArr: [{ required: true, trigger: "blur", message: "不可为空" }],
exportTableName_old: [{ required: true, trigger: "blur", message: "不可为空" }],
} }
}, },
getColumList(){ columsList:[],
let val = this.formReveal ? this.CreateFormData.exportTableName_old : this.editFormData.exportTableName_old };
getPageList(this.PageListParams, val+'/base').then(res=>{ },
mounted () {
this.paging();
},
methods:{
pagingCallback(callback){
this.Loading.tableLoading = false
this.tableData.forEach(item=>{
item.exportTableName_old = item.exportTableName
item.exportColumnName_old = item.exportColumnName
item.exportTableName = zhApiColumnsLable(item.exportTableName)
let _arr = item.exportColumnName.split(" ")
let _zhArr = []
_arr.forEach(item2=>{
let _item2 = zhApiColumnsLable(item.exportTableName_old+firstWordSizeChange(item2,'Upper')) || item2
_zhArr.push(_item2)
})
item.exportColumnName = _zhArr.join(',')
})
if(callback)callback()
},
// /
initTablesName(){
let _names = this.$store.getters.tablesName
let tablesList = []
_names.forEach(item=>{
let _item = {
label:zhApiColumnsLable(item),
value:item
}
tablesList.push(_item)
})
return tablesList
},
changeSelect(prop,val){
//
if(prop=='exportTableName_old'){
if(this.formReveal){
this.CreateForm[2].disabled = false
// this.CreateFormData.exportTableName = this.CreateFormData.exportTableName_old
this.CreateFormData.exportColumnNameArr = []
}else{
this.editForm[2].disabled = false
// this.editFormData.exportTableName = this.editFormData.exportTableName_old
this.editFormData.exportColumnNameArr = []
}
this.getColumList()
}
},
getColumList(){
let val = this.formReveal ? this.CreateFormData.exportTableName_old : this.editFormData.exportTableName_old
getPageList(this.PageListParams, val+'/base')
.then(res=>{
let _column = res.items[0] let _column = res.items[0]
this.columsList = [] this.columsList = []
for(let item in _column){ for(let item in _column){
@ -279,46 +283,60 @@
this.editForm[2].userOptions = this.columsList this.editForm[2].userOptions = this.columsList
} }
}) })
}, .catch(err=>{
// let _name = ''
FormSubmit(val) { if(this.formReveal){
this.ref = val this.CreateForm[2].userOptions = []
this.Loading.newAndEdiLoading = true _name = this.CreateFormData.exportTableName
let _updata = this.formReveal ? this.URLOption_add : this.URLOption_edit }else{
let _url = _updata ? _updata : this.URLOption_base this.editForm[2].userOptions = []
switch (this.formReveal) { _name = this.editFormData.exportTableName
case true: }
this.CreateFormData.exportColumnName = this.CreateFormData.exportColumnNameArr.join(" ") this.$message.error(`暂无【${_name}】模块权限`)
this.CreateFormData.exportTableName = this.CreateFormData.exportTableName_old })
if(!_updata){_url = _url + '/create'} },
postCreate(this.CreateFormData, _url).then(res => { //
this.oldSkipCount = 1; FormSubmit(val) {
this.Loading.newAndEdiLoading = false this.ref = val
this.paging() this.Loading.newAndEdiLoading = true
this.FormResult("success") let _updata = this.formReveal ? this.URLOption_add : this.URLOption_edit
}).catch(err => { let _url = _updata ? _updata : this.URLOption_base
this.Loading.newAndEdiLoading = false switch (this.formReveal) {
this.FormResult("error") case true:
}) this.CreateFormData.exportColumnName = this.CreateFormData.exportColumnNameArr.join(" ")
break; this.CreateFormData.exportTableName = this.CreateFormData.exportTableName_old
case false: if(!_updata){_url = _url + '/create'}
if(!_updata){_url = _url + '/update-by-id'} postCreate(this.CreateFormData, _url).then(res => {
this.editFormData.exportColumnName = this.editFormData.exportColumnNameArr.join(" ") this.oldSkipCount = 1;
this.editFormData.exportTableName = this.editFormData.exportTableName_old this.Loading.newAndEdiLoading = false
postUpdate(this.editFormData, this.editFormData.id, _url).then(res => { this.paging()
this.propsData = res this.FormResult("success")
this.Loading.newAndEdiLoading = false }).catch(err => {
this.paging() this.Loading.newAndEdiLoading = false
this.FormResult("success") this.FormResult("error")
}).catch(err => { })
this.Loading.newAndEdiLoading = false break;
this.FormResult("error") case false:
}) if(!_updata){_url = _url + '/update-by-id'}
} this.editFormData.exportColumnName = this.editFormData.exportColumnNameArr.join(" ")
}, this.editFormData.exportTableName = this.editFormData.exportTableName_old
postUpdate(this.editFormData, this.editFormData.id, _url).then(res => {
this.propsData = res
this.Loading.newAndEdiLoading = false
this.paging()
this.FormResult("success")
}).catch(err => {
this.Loading.newAndEdiLoading = false
this.FormResult("error")
})
}
},
OperaButtonHide(data){
return data.creatorId != this.$store.getters.currentUserInfo.id
} }
}; }
</script> };
<style lang="scss" scoped> </script>
@import "@/styles/basicData.scss"; <style lang="scss" scoped>
</style> @import "@/styles/basicData.scss";
</style>
Loading…
Cancel
Save