¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/router/axios'; |
| | | |
| | | // å表æ¥è¯¢ |
| | | export function getEnumTypeList(params) { |
| | | return request({ |
| | | url: "/api/webEnumController/getEnumTypeList", |
| | | method: "get", |
| | | params |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * æé®å¤ç ä¸å¡ç±»åå®¡ç¾ |
| | | */ |
| | | import {paramLow,callPreEvent, callPostEvent} from '../BaseAction'; |
| | | import {validatenull} from "@/util/validate"; |
| | | import Vue from "vue"; |
| | | import func from "@/util/func"; |
| | | import {download} from "@/api/base/file"; |
| | | |
| | | export const doAction = (options,callback) => { |
| | | console.log(options) |
| | | options.sourceData = options.sourceData || {}; |
| | | options.dataStore = options.dataStore || []; |
| | | if (!options.dataStore || options.dataStore.length < 1) { |
| | | Vue.prototype.$message.error("请è³å°éæ©ä¸æ¡æ°æ®"); |
| | | return false; |
| | | } |
| | | |
| | | callPreEvent(options, doBefore, function (options) { |
| | | showStartWindow(options, function () { |
| | | callPostEvent(options, doAfter, callback,type); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | /** |
| | | * æ¾ç¤ºæµç¨ççªå£ |
| | | * @param options æé®çé
ç½®ä¿¡æ¯ |
| | | * @param callback åè° |
| | | */ |
| | | export const showStartWindow = (options,callback)=> { |
| | | const paramVOS = options.paramVOS; |
| | | // if (!paramVOS['form'] && !paramVOS['context']) { |
| | | // Vue.prototype.$message.error("æé®é
ç½®ä¸æ£ç¡®"); |
| | | // return false; |
| | | // } |
| | | // func.downloadFileByBlobHandler(); |
| | | |
| | | } |
| | | /** |
| | | * åç½®äºä»¶ |
| | | * @param options æé®çé
ç½®ä¿¡æ¯ |
| | | * @param callback åè° |
| | | */ |
| | | export const doBefore = (options,callback)=> { |
| | | console.log("æ§è¡å¢å åç½®äºä»¶") |
| | | if(callback){ |
| | | callback(options); |
| | | } |
| | | } |
| | | /** |
| | | * åç½®äºä»¶ |
| | | * @param options æé®çé
ç½®ä¿¡æ¯ |
| | | * @param callback åè° |
| | | */ |
| | | export const doAfter = (options,callback,actionType)=> { |
| | | console.log('æ§è¡å¢å åç½®äºä»¶'); |
| | | if(callback){ |
| | | callback(actionType); |
| | | } |
| | | } |
| | |
| | | downloadfile: () => {import("@/components/actions/base/downloadFileAction").then(module => { |
| | | module.doAction(options,callback); |
| | | })}, |
| | | uprevision: () => {import("@/components/actions/base/upRevisionAction").then(module => { |
| | | module.doAction(options,callback); |
| | | })} |
| | | }; |
| | | if (handlers[type]) { |
| | | handlers[type]() |
| | | handlers[type](); |
| | | } else { |
| | | Vue.prototype.$message.error('æªæ¾å°å¯¹åºactionï¼è¯·éæ°é
ç½®æé®ï¼'); |
| | | } |
| | |
| | | import topNotice from './top-notice' |
| | | import topLang from "./top-lang"; |
| | | import {changePassword} from "@/api/user" |
| | | import func from "@/util/func"; |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | submitSwitch(form, done) { |
| | | let userInfo = JSON.parse(localStorage.getItem('saber-userInfo')); |
| | | |
| | | let params = {userOid:userInfo.content.userOid,...form} |
| | | let params = { |
| | | userOid:userInfo.content.userOid, |
| | | oldPassword:func.encryptData(form.oldPassword,'daliantan0v0vcip'), |
| | | password:func.encryptData(form.password,'daliantan0v0vcip'), |
| | | confirmPassword:func.encryptData(form.confirmPassword,'daliantan0v0vcip'), |
| | | |
| | | } |
| | | changePassword(params).then(res =>{ |
| | | console.log(res); |
| | | if(res.data.code === 200){ |
| | | this.$message.success(res.data.msg); |
| | | this.passwordVisible = false; |
| | | } |
| | | }).catch(err => { |
| | | console.log(err); |
| | | }) |
| | | // this.$store.dispatch("refreshToken", form).then(() => { |
| | | // this.userBox = false; |
| | |
| | | import {loginByUsername, loginBySocial, loginBySso, getUserInfo, logout, refreshToken, getButtons} from '@/api/user' |
| | | import {getTopMenu, getRoutes} from '@/api/system/menu' |
| | | import md5 from 'js-md5' |
| | | import func from "@/util/func"; |
| | | |
| | | |
| | | function addPath(ele, first) { |
| | |
| | | //æ ¹æ®ç¨æ·åç»å½ |
| | | LoginByUsername({commit}, userInfo) { |
| | | return new Promise((resolve, reject) => { |
| | | loginByUsername(userInfo.deptId, userInfo.roleId, userInfo.username,userInfo.password, userInfo.type, userInfo.key,).then(res => { |
| | | let passwordDes = func.encryptData(userInfo.password,'daliantan0v0vcip') |
| | | loginByUsername(userInfo.deptId, userInfo.roleId, userInfo.username,passwordDes, userInfo.type, userInfo.key,).then(res => { |
| | | const data = res.data; |
| | | if (data.code === 200) { |
| | | // commit('SET_TOKEN', data.obj.sessionInfo.token); |
| | |
| | | /** |
| | | * éç¨å·¥å
·ç±» |
| | | */ |
| | | import CryptoJS from 'crypto-js' |
| | | |
| | | export default class func { |
| | | /** |
| | | * ä¸ä¸ºç©º |
| | |
| | | return item[attr] !== array[0][attr]; |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 3deså å¯ |
| | | * @param message |
| | | * @param key |
| | | * @returns {string} |
| | | */ |
| | | encryptByDES(message, key) { |
| | | const keyHex = CryptoJS.enc.Utf8.parse(key); |
| | | const encrypted = CryptoJS.DES.encrypt(message, keyHex, { |
| | | mode: CryptoJS.mode.ECB, |
| | | padding: CryptoJS.pad.Pkcs7 |
| | | }); |
| | | return encrypted.toString(); |
| | | } |
| | | |
| | | /** |
| | | * HmacMD5å å¯ |
| | | * @param message |
| | | * @param key |
| | | * @returns {string} |
| | | * @constructor |
| | | */ |
| | | static HmacMD5(message, key) { |
| | | const encrypted = CryptoJS.HmacMD5(message,key); |
| | | return encrypted.toString(); |
| | | } |
| | | |
| | | /** |
| | | * aeså å¯ |
| | | * @param data |
| | | * @param secretKey |
| | | * @returns {string} |
| | | */ |
| | | static encryptData(data, secretKey) { |
| | | const key = CryptoJS.enc.Utf8.parse(secretKey); |
| | | const iv = CryptoJS.enc.Utf8.parse(secretKey.substr(0, 16)); // AES block size is 128 bits (16 bytes) |
| | | const encrypted = CryptoJS.AES.encrypt(data, key, { |
| | | iv: iv, |
| | | mode: CryptoJS.mode.CBC, |
| | | padding: CryptoJS.pad.Pkcs7 |
| | | }); |
| | | return encrypted.toString(); |
| | | } |
| | | } |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud |
| | | ref="userCrud" |
| | | :data="tableData" |
| | | :option="option" |
| | | :table-loading="tableLoading" |
| | | @on-load="getTableList" |
| | | @refresh-change="handleRefresh" |
| | | @search-change="handleSearch" |
| | | @search-reset="handleReset" |
| | | @selection-change="selectChange" |
| | | @row-click="rowClickHandler" |
| | | > |
| | | |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <el-button icon="el-icon-plus" size="small" type="primary" @click="rowSaveHandlerClick">å建</el-button> |
| | | </template> |
| | | |
| | | </avue-crud> |
| | | <el-dialog |
| | | v-dialogDrag |
| | | v-loading="dialogLoading" |
| | | :visible.sync="dialogVisible" |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | title="æ°å¢" |
| | | width="70%" |
| | | > |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åç§°ï¼" prop="id"> |
| | | <el-input v-model="form.id"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ ç¾ï¼"> |
| | | <el-input v-model="form.name"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç±»åï¼"> |
| | | <el-select v-model="form.type" placeholder="è¯·éæ©ç±»å"> |
| | | <el-option label="String" value="String"></el-option> |
| | | <el-option label="Integer" value="Integer"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="é¿åº¦ï¼"> |
| | | <el-input-number v-model="form.num" :max="999" :min="1" label="æè¿°æå"></el-input-number> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <avue-crud |
| | | ref="dialogCrud" |
| | | :data="dialogData" |
| | | :option="dialogOption" |
| | | @row-save="rowSaveDialogHandler" |
| | | @row-update="rowUpdateDialogHandler" |
| | | @row-del="rowDeleteDialogHandler" |
| | | > |
| | | </avue-crud> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="rowSaveHandler">ç¡® å®</el-button> |
| | | <el-button @click="dialogVisible = false">å æ¶</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import basicOption from '@/util/basic-option' |
| | | import {getEnumTypeList} from "@/api/modeling/enumType/api"; |
| | | |
| | | export default { |
| | | name: "index", |
| | | data() { |
| | | return { |
| | | dialogData: [], |
| | | dialogOption: { |
| | | ...basicOption, |
| | | refreshBtn: false, |
| | | selection: false, |
| | | column: [ |
| | | { |
| | | label: 'æä¸¾é¡¹å', |
| | | prop: 'name', |
| | | sortable: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请è¾å
¥æä¸¾é¡¹å', |
| | | trigger: 'blur' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: 'æä¸¾å¼', |
| | | prop: 'value', |
| | | sortable: true, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请è¾å
¥æä¸¾å¼', |
| | | trigger: 'blur' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: 'æè¿°', |
| | | prop: 'description', |
| | | sortable: true, |
| | | }, |
| | | ] |
| | | }, |
| | | rules: { |
| | | id: [ |
| | | {required: true, message: '请è¾å
¥æä¸¾é¡¹å', trigger: 'blur'}, |
| | | {validator: this.validateEnglishOnly, trigger: 'blur'} |
| | | ], |
| | | }, |
| | | form: { |
| | | id: '', |
| | | name: '', |
| | | type: 'String', |
| | | num: 50 |
| | | }, |
| | | dialogLoading: false, |
| | | dialogVisible: false, |
| | | tableData: [], |
| | | option: { |
| | | ...basicOption, |
| | | calcHeight: -60, |
| | | searchMenuSpan: 8, |
| | | addBtn: false, |
| | | editBtn: false, |
| | | column: [ |
| | | { |
| | | label: 'æä¸¾åç§°', |
| | | prop: 'id', |
| | | sortable: true, |
| | | }, |
| | | { |
| | | label: 'æ ç¾', |
| | | prop: 'name', |
| | | sortable: true, |
| | | }, |
| | | { |
| | | label: 'è¿åç±»å', |
| | | prop: 'enumValueDataTypeText', |
| | | sortable: true, |
| | | } |
| | | ] |
| | | }, |
| | | tableLoading: false, |
| | | } |
| | | }, |
| | | methods: { |
| | | //è¡¨æ ¼æ¥è¯¢è¯·æ± |
| | | getTableList() { |
| | | this.tableLoading = true; |
| | | getEnumTypeList().then(res => { |
| | | const data = res.data.data; |
| | | this.tableData = data; |
| | | this.tableLoading = false; |
| | | }).catch(err => { |
| | | this.$message.error(err) |
| | | }); |
| | | }, |
| | | |
| | | // è¡¨æ ¼å¤´é¨å·æ° |
| | | handleRefresh() { |
| | | this.getTableList(); |
| | | }, |
| | | |
| | | // æç´¢ |
| | | handleSearch() { |
| | | |
| | | }, |
| | | |
| | | // éç½®æç´¢æ¡ä»¶ |
| | | handleReset() { |
| | | |
| | | }, |
| | | |
| | | // éæ©æ¡ |
| | | selectChange() { |
| | | |
| | | }, |
| | | |
| | | // ç¹å»è¡ |
| | | rowClickHandler() { |
| | | }, |
| | | |
| | | // æ°å¢ |
| | | rowSaveHandlerClick() { |
| | | this.dialogVisible = true; |
| | | this.dialogData = []; |
| | | }, |
| | | |
| | | // ä¿®æ¹ |
| | | rowUpdateHandler() { |
| | | |
| | | }, |
| | | |
| | | // æä¸¾é¡¹æ°å¢ |
| | | rowSaveDialogHandler(row, done, loading) { |
| | | const status = this.dialogData.some(item => item.name === row.name); |
| | | if (status) { |
| | | this.$message.error('æä¸¾é¡¹åç§°ä¸è½é夿·»å ï¼') |
| | | loading(); |
| | | } else { |
| | | |
| | | if (this.form.type === "Integer") { |
| | | if (!/^\-?\d+$/.test(row.value)) { |
| | | // 妿åå§å符串å
å«éæ°åå符ï¼åè§ä¸ºæ æ |
| | | this.$message.error('æä¸¾å¼å¿
é¡»æ¯Integerç±»å'); |
| | | return loading(); |
| | | } |
| | | |
| | | let numValue = parseInt(row.value); |
| | | if (isNaN(numValue) || !Number.isInteger(numValue)) { |
| | | // 妿 numValue æ¯ NaN æè
䏿¯Integerç±»åï¼åè§ä¸ºæ æ |
| | | this.$message.error('æä¸¾å¼å¿
é¡»æ¯Integerç±»å'); |
| | | return loading(); |
| | | } |
| | | } |
| | | |
| | | if (row.value.length > this.form.num) { |
| | | this.$message.error('æä¸¾å¼è¶
è¿æå¤§é¿åº¦ï¼') |
| | | return loading(); |
| | | } |
| | | |
| | | this.dialogData.push(row); |
| | | done(); |
| | | } |
| | | }, |
| | | |
| | | // æä¸¾é¡¹ä¿®æ¹ |
| | | rowUpdateDialogHandler(row, index, done, loading) { |
| | | this.dialogData.splice(index, 1, row); |
| | | done(); |
| | | }, |
| | | |
| | | // æä¸¾é¡¹å é¤ |
| | | rowDeleteDialogHandler(row, index) { |
| | | this.dialogData.splice(index, 1); |
| | | }, |
| | | |
| | | // æ°å¢ä¿å |
| | | rowSaveHandler() { |
| | | const lengthStatus = this.dialogData.some(item => item.value > this.form.num) |
| | | if (lengthStatus) { |
| | | this.$message.error('è¯·æ£æ¥æä¸¾å¼æ¯å¦è¶
è¿æå¤§é¿åº¦ï¼') |
| | | return; |
| | | } |
| | | |
| | | if(this.form.type === "Integer"){ |
| | | // 夿æ¯å¦å
å«å符 |
| | | const integerStatus = this.dialogData.some(item => { |
| | | if (!/^\-?\d+$/.test(item.value)) { |
| | | return true; |
| | | } |
| | | }) |
| | | |
| | | // 夿æ¯å¦æ¯integeræ ¼å¼ |
| | | const integerNumStatus = this.dialogData.some(item => { |
| | | let numValue = parseInt(item.value); |
| | | if (isNaN(numValue) || !Number.isInteger(numValue)) { |
| | | return true; |
| | | } |
| | | }) |
| | | |
| | | if(integerStatus || integerNumStatus){ |
| | | this.$message.error('æä¸¾å¼å¿
é¡»æ¯Integerç±»å'); |
| | | return; |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // åªè½è¾å
¥è±ææ£åæ ¡éª |
| | | validateEnglishOnly(rule, value, callback) { |
| | | if (!value) { |
| | | return callback(new Error('请è¾å
¥æä¸¾é¡¹å')); |
| | | } |
| | | if (!/^[A-Za-z]+$/.test(value)) { |
| | | return callback(new Error('åªè½è¾å
¥è±æåæ¯')); |
| | | } |
| | | callback(); // éªè¯éè¿ |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请è¾å
¥å§å', |
| | | message: '请è¾å
¥è´¦å·', |
| | | trigger: 'blur' |
| | | } |
| | | ] |