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. 610
      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({
url: authApi + '/identity/users/reset-password/' + id,
method: 'post'
url: authApi + '/identity/users/change-password/' + id,
method: 'post',
data
})
}

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

@ -307,7 +307,8 @@ export default {
_list.push(item)
}else{
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{
item.permission = []
}

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

@ -12,6 +12,7 @@
:border="tableBorder"
style="width: 100%"
:cell-style="cellStyle"
:cell-class-name="cellClassName"
use-virtual
:height="uTableHeight"
header-row-class-name="uTableHeader"
@ -93,7 +94,7 @@
size="mini"
>
<el-option
v-for="item in getItemEnums(item)"
v-for="item in item.enums_list"
:key="item.value"
:label="item.label"
:value="item.value"
@ -166,6 +167,7 @@
:key="indexButton"
type="text"
size="mini"
v-permission="itemButton.permission"
:style="{color:itemButton.color || '#409EFF'}"
@click="buttonOperationClick_right(scope.row, itemButton, indexButton)"
>{{itemButton.label}}</el-button>
@ -211,8 +213,10 @@ import { formatTimeStrToStr } from "@/utils/formatTime";
import _ from "lodash";
import { getMatchRegConformValue } from "@/utils/index"
import showCopyJsonPop from "@/components/showCopyJsonPop"
import permission from "@/directive/permission/index"
export default {
name: "currenTable",
directives: { permission },
components:{ showCopyJsonPop },
filters: {
formatDate(time) {
@ -316,6 +320,12 @@ export default {
return Function;
}
},
cellClassName: {
type: Function,
default: () => {
return Function;
}
},
// app-main100%
setUTableHeight: {
type: Number,
@ -388,6 +398,12 @@ export default {
this.setTableHeightHandle()
},
methods: {
//
doFreshLayout(){
if (this.$refs.multipleTable && this.$refs.multipleTable.doLayout) {
this.$refs.multipleTable.doLayout()
}
},
//
setTableHeightHandle(height){
let _height = height || this.setUTableHeight
@ -640,9 +656,11 @@ export default {
//
initApiEnumList(item,data){
let _item_enumList = {}
item.enums_list.forEach((item,key)=>{
_item_enumList[item.value] = item.label
})
if(item.enums_list){
item.enums_list.forEach((item,key)=>{
_item_enumList[item.value] = item.label
})
}
return _item_enumList[data] || '未定义'
},
// | | json
@ -666,24 +684,6 @@ export default {
if(type == 'detail')this.showDetailInfo(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) {
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}
this.closeExportDrop()
this.Loading.appMainLoading = true
this.Loading.tableLoading = true
postExport(_params,_data, _exportUrl, _special).then(res => {
this.blob(res, name)//使用前端导出名称
this.Loading.appMainLoading = false
this.Loading.tableLoading = false
}).catch(err => {
this.Loading.appMainLoading = false
this.Loading.tableLoading = false
this.$errorMsg('导出失败,请重试!')
})
},
// 点击常用按钮
@ -66,11 +67,11 @@ export const TableHeaderMixins = {
this.paging()
// this.$store.dispatch("app/appMainLoading", true)
}
// 新增(原始前端写死配置方式)
else if (val == 'newly') {
// 新增(原始前端写死配置)
else if (val == 'Create') {
this.formTitle = "新增" + this.$route.meta.title;
this.formReveal = true
this.theEvent = "newly"
this.theEvent = "Create"
this.displayDialog.newDialog = true;
}
// Api新增(参数配置从api获取)
@ -289,7 +290,7 @@ export const TableHeaderMixins = {
* list_api: 表头来自api的列表 detail_api: 表头来自api列表的明细 detailPage_api表头来自api的明细页面列表
* list: 表头固定的列表 detail: 表头固定列表的明细
*/
rowDrop(data,type) {
rowDrop(data,type) {
if(!type || type == 'list_api'){ this.apiColumns_Table = data }
if(type && type == 'detail_api'){ this.apiColumns_DetailsTable = 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: {
// 主表-右侧操作列基础按钮
buttonOperationList_rightBase(){
buttonOperationList_rightBase(op_e,op_d){
return [{
label:'编辑',
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:'删除',
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",
"apiBaseType": "datetime",
"baseApiName": _apiName + 'CreationTime',
"label": zhApiColumnsLable(_apiName + 'CreationTime') || _apiName + 'CreationTime',
"label": zhApiColumnsLable(_apiName + 'CreationTime') || 'CreationTime',
"prop": "creationTime",
}
)
@ -199,7 +203,7 @@ export const tableMixins = {
"name": "CreatorId",
"apiBaseType": "string",
"baseApiName": _apiName + 'CreatorId',
"label": zhApiColumnsLable(_apiName + 'CreatorId') || _apiName + 'CreatorId',
"label": zhApiColumnsLable(_apiName + 'CreatorId') || 'CreatorId',
"prop": "creatorId",
}
)
@ -211,7 +215,7 @@ export const tableMixins = {
"name": "LastModificationTime",
"apiBaseType": "datetime",
"baseApiName": _apiName + 'LastModificationTime',
"label": zhApiColumnsLable(_apiName + 'LastModificationTime') || _apiName + 'LastModificationTime',
"label": zhApiColumnsLable(_apiName + 'LastModificationTime') || 'LastModificationTime',
"prop": "lastModificationTime",
}
)
@ -223,7 +227,7 @@ export const tableMixins = {
"name": "LastModifierId",
"apiBaseType": "string",
"baseApiName": _apiName + 'LastModifierId',
"label": zhApiColumnsLable(_apiName + 'LastModifierId') || _apiName + 'LastModifierId',
"label": zhApiColumnsLable(_apiName + 'LastModifierId') || 'LastModifierId',
"prop": "lastModifierId",
}
)
@ -235,7 +239,7 @@ export const tableMixins = {
"name": "TenantId",
"apiBaseType": "string",
"baseApiName": _apiName + 'TenantId',
"label": zhApiColumnsLable(_apiName + 'TenantId') || _apiName + 'TenantId',
"label": zhApiColumnsLable(_apiName + 'TenantId') || 'TenantId',
"prop": "tenantId",
}
)

38
Code/Fe/src/permission.js

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

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

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

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

@ -13,7 +13,7 @@ export function defaultAddBtn(option) {
type: "primary",
icon: "el-icon-plus",
label: i18n.t('btns.add'),
name: "newly",
name: "Create",
size: "mini",
background:"#31bb99"
})
@ -122,5 +122,7 @@ function __defaultBtnOption(option,specific){
class:option && option.class ? option.class : specific.class,
isDetailExport:option && option.isDetailExport ? option.isDetailExport : 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" />
</span>
<el-input
:key="passwordType"
ref="password"
v-model="loginForm.password"
:type="passwordType"
:type="passwordType == 'svg_password' ? 'password' : 'text'"
placeholder="密码"
name="password"
tabindex="2"
@ -171,8 +170,10 @@ export default {
})
})
.catch((error) => {
this.$message.error('用户名或密码错误!')
this.loading = false
if(!error){
this.$message.error('用户名或密码错误!')
}
})
} else {
console.log('error submit!!')

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

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

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

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