Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3768db7bfb | ||
|
|
26eb66cb85 | ||
|
|
6508c97a63 | ||
|
|
68d60bda80 | ||
|
|
cf075b7021 | ||
|
|
fd6496895a | ||
|
|
0a3289d6a8 | ||
|
|
543afadea4 | ||
|
|
95290a4ecb | ||
|
|
9e874e9b5f | ||
|
|
66e24cfea0 | ||
|
|
1f09f74e61 |
@@ -21,6 +21,13 @@ ELADMIN 前端源码
|
|||||||
|
|
||||||
模板文档: [https://panjiachen.github.io/vue-element-admin-site/zh/guide/](https://panjiachen.github.io/vue-element-admin-site/zh/guide/)
|
模板文档: [https://panjiachen.github.io/vue-element-admin-site/zh/guide/](https://panjiachen.github.io/vue-element-admin-site/zh/guide/)
|
||||||
|
|
||||||
|
#### VPS推荐
|
||||||
|
<a href="https://bwh81.net/aff.php?aff=70876" target="_blank">
|
||||||
|
<img src="https://eladmin.vip/images/banner/side.jpeg" style="width: 435px;border-radius: 2px;">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
使用优惠码: `BWHCCNCXVV`,可获得 6.81% 的折扣, [查看介绍](https://bwhstock.in/)
|
||||||
|
|
||||||
#### Build Setup
|
#### Build Setup
|
||||||
**推荐 node 版本:12-16**
|
**推荐 node 版本:12-16**
|
||||||
``` bash
|
``` bash
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
"@riophae/vue-treeselect": "^0.4.0",
|
"@riophae/vue-treeselect": "^0.4.0",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"@wangeditor/editor-for-vue": "^1.0.2",
|
"@wangeditor/editor-for-vue": "^1.0.2",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.28.0",
|
||||||
"clipboard": "2.0.4",
|
"clipboard": "2.0.4",
|
||||||
"codemirror": "^5.49.2",
|
"codemirror": "^5.49.2",
|
||||||
"core-js": "^2.6.12",
|
"core-js": "^2.6.12",
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
"mavon-editor": "^2.9.1",
|
"mavon-editor": "^2.9.1",
|
||||||
"normalize.css": "7.0.0",
|
"normalize.css": "7.0.0",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"path-to-regexp": "2.4.0",
|
"path-to-regexp": "8.0.0",
|
||||||
"qs": "^6.10.1",
|
"qs": "^6.10.1",
|
||||||
"screenfull": "4.2.0",
|
"screenfull": "4.2.0",
|
||||||
"sortablejs": "1.8.4",
|
"sortablejs": "1.8.4",
|
||||||
@@ -66,8 +66,7 @@
|
|||||||
"vuedraggable": "2.20.0",
|
"vuedraggable": "2.20.0",
|
||||||
"vuex": "3.1.0",
|
"vuex": "3.1.0",
|
||||||
"wangeditor": "^4.7.11",
|
"wangeditor": "^4.7.11",
|
||||||
"webpack": "^4.46.0",
|
"webpack": "^4.46.0"
|
||||||
"xlsx": "^0.18.5"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/parser": "^7.7.4",
|
"@babel/parser": "^7.7.4",
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ export function getDepts(params) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDeptSuperior(ids) {
|
export function getDeptSuperior(ids, exclude) {
|
||||||
|
exclude = exclude !== undefined ? exclude : false
|
||||||
const data = ids.length || ids.length === 0 ? ids : Array.of(ids)
|
const data = ids.length || ids.length === 0 ? ids : Array.of(ids)
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dept/superior',
|
url: 'api/dept/superior?exclude=' + exclude,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -45,6 +45,14 @@ export function updatePass(user) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resetPwd(ids) {
|
||||||
|
return request({
|
||||||
|
url: 'api/users/resetPwd',
|
||||||
|
method: 'put',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function updateEmail(form) {
|
export function updateEmail(form) {
|
||||||
const data = {
|
const data = {
|
||||||
password: encrypt(form.pass),
|
password: encrypt(form.pass),
|
||||||
@@ -57,5 +65,5 @@ export function updateEmail(form) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del }
|
export default { add, edit, del, resetPwd }
|
||||||
|
|
||||||
|
|||||||
BIN
src/assets/images/background.jpeg
Normal file
BIN
src/assets/images/background.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 236 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 152 KiB |
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-button v-permission="permission.edit" :loading="crud.status.cu === 2" :disabled="disabledEdit" size="mini" type="primary" icon="el-icon-edit" @click="crud.toEdit(data)" />
|
<el-button v-permission="permission.edit" :loading="crud.status.cu === 2" :disabled="disabledEdit" size="mini" type="primary" icon="el-icon-edit" @click.stop="crud.toEdit(data)" />
|
||||||
<el-popover v-model="pop" v-permission="permission.del" placement="top" width="180" trigger="manual" @show="onPopoverShow" @hide="onPopoverHide">
|
<el-popover v-model="pop" v-permission="permission.del" placement="top" width="180" trigger="manual" @show="onPopoverShow" @hide="onPopoverHide">
|
||||||
<p>{{ msg }}</p>
|
<p>{{ msg }}</p>
|
||||||
<div style="text-align: right; margin: 0">
|
<div style="text-align: right; margin: 0">
|
||||||
<el-button size="mini" type="text" @click="doCancel">取消</el-button>
|
<el-button size="mini" type="text" @click="doCancel">取消</el-button>
|
||||||
<el-button :loading="crud.dataStatus[crud.getDataId(data)].delete === 2" type="primary" size="mini" @click="crud.doDelete(data)">确定</el-button>
|
<el-button :loading="crud.dataStatus[crud.getDataId(data)].delete === 2" type="primary" size="mini" @click="crud.doDelete(data)">确定</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-button slot="reference" :disabled="disabledDle" type="danger" icon="el-icon-delete" size="mini" @click="toDelete" />
|
<el-button slot="reference" :disabled="disabledDle" type="danger" icon="el-icon-delete" size="mini" @click.stop="toDelete" />
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,138 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<input ref="excel-upload-input" class="excel-upload-input" type="file" accept=".xlsx, .xls" @change="handleClick">
|
|
||||||
<div class="drop" @drop="handleDrop" @dragover="handleDragover" @dragenter="handleDragover">
|
|
||||||
拖拽excel文件到此处 或者
|
|
||||||
<el-button :loading="loading" style="margin-left:16px;" size="mini" type="primary" @click="handleUpload">
|
|
||||||
浏览
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import XLSX from 'xlsx'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
beforeUpload: Function, // eslint-disable-line
|
|
||||||
onSuccess: Function// eslint-disable-line
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loading: false,
|
|
||||||
excelData: {
|
|
||||||
header: null,
|
|
||||||
results: null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
generateData({ header, results }) {
|
|
||||||
this.excelData.header = header
|
|
||||||
this.excelData.results = results
|
|
||||||
this.onSuccess && this.onSuccess(this.excelData)
|
|
||||||
},
|
|
||||||
handleDrop(e) {
|
|
||||||
e.stopPropagation()
|
|
||||||
e.preventDefault()
|
|
||||||
if (this.loading) return
|
|
||||||
const files = e.dataTransfer.files
|
|
||||||
if (files.length !== 1) {
|
|
||||||
this.$message.error('只支持单个文件上传!')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const rawFile = files[0]
|
|
||||||
|
|
||||||
if (!this.isExcel(rawFile)) {
|
|
||||||
this.$message.error('只支持.xlsx, .xls, .csv 格式文件')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
this.upload(rawFile)
|
|
||||||
e.stopPropagation()
|
|
||||||
e.preventDefault()
|
|
||||||
},
|
|
||||||
handleDragover(e) {
|
|
||||||
e.stopPropagation()
|
|
||||||
e.preventDefault()
|
|
||||||
e.dataTransfer.dropEffect = 'copy'
|
|
||||||
},
|
|
||||||
handleUpload() {
|
|
||||||
this.$refs['excel-upload-input'].click()
|
|
||||||
},
|
|
||||||
handleClick(e) {
|
|
||||||
const files = e.target.files
|
|
||||||
const rawFile = files[0] // only use files[0]
|
|
||||||
if (!rawFile) return
|
|
||||||
this.upload(rawFile)
|
|
||||||
},
|
|
||||||
upload(rawFile) {
|
|
||||||
this.$refs['excel-upload-input'].value = null // fix can't select the same excel
|
|
||||||
|
|
||||||
if (!this.beforeUpload) {
|
|
||||||
this.readerData(rawFile)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const before = this.beforeUpload(rawFile)
|
|
||||||
if (before) {
|
|
||||||
this.readerData(rawFile)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
readerData(rawFile) {
|
|
||||||
this.loading = true
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const reader = new FileReader()
|
|
||||||
reader.onload = e => {
|
|
||||||
const data = e.target.result
|
|
||||||
const workbook = XLSX.read(data, { type: 'array' })
|
|
||||||
const firstSheetName = workbook.SheetNames[0]
|
|
||||||
const worksheet = workbook.Sheets[firstSheetName]
|
|
||||||
const header = this.getHeaderRow(worksheet)
|
|
||||||
const results = XLSX.utils.sheet_to_json(worksheet)
|
|
||||||
this.generateData({ header, results })
|
|
||||||
this.loading = false
|
|
||||||
resolve()
|
|
||||||
}
|
|
||||||
reader.readAsArrayBuffer(rawFile)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getHeaderRow(sheet) {
|
|
||||||
const headers = []
|
|
||||||
const range = XLSX.utils.decode_range(sheet['!ref'])
|
|
||||||
let C
|
|
||||||
const R = range.s.r
|
|
||||||
/* start in the first row */
|
|
||||||
for (C = range.s.c; C <= range.e.c; ++C) { /* walk every column in the range */
|
|
||||||
const cell = sheet[XLSX.utils.encode_cell({ c: C, r: R })]
|
|
||||||
/* find the cell in the first row */
|
|
||||||
let hdr = 'UNKNOWN ' + C // <-- replace with your desired default
|
|
||||||
if (cell && cell.t) hdr = XLSX.utils.format_cell(cell)
|
|
||||||
headers.push(hdr)
|
|
||||||
}
|
|
||||||
return headers
|
|
||||||
},
|
|
||||||
isExcel(file) {
|
|
||||||
return /\.(xlsx|xls|csv)$/.test(file.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.excel-upload-input{
|
|
||||||
display: none;
|
|
||||||
z-index: -9999;
|
|
||||||
}
|
|
||||||
.drop{
|
|
||||||
border: 2px dashed #bbb;
|
|
||||||
width: 600px;
|
|
||||||
height: 160px;
|
|
||||||
line-height: 160px;
|
|
||||||
margin: 0 auto;
|
|
||||||
font-size: 24px;
|
|
||||||
border-radius: 5px;
|
|
||||||
text-align: center;
|
|
||||||
color: #bbb;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<upload-excel-component :on-success="handleSuccess" :before-upload="beforeUpload" />
|
|
||||||
<el-table :data="tableData" border highlight-current-row style="width: 100%;margin-top:20px;">
|
|
||||||
<el-table-column v-for="item of tableHeader" :key="item" :prop="item" :label="item" />
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import UploadExcelComponent from '@/components/UploadExcel/index.vue'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'UploadExcel',
|
|
||||||
components: { UploadExcelComponent },
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
tableData: [],
|
|
||||||
tableHeader: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
beforeUpload(file) {
|
|
||||||
const isLt1M = file.size / 1024 / 1024 < 1
|
|
||||||
if (isLt1M) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$message({
|
|
||||||
message: '请不要上传大于1m的文件.',
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
handleSuccess({ results, header }) {
|
|
||||||
this.tableData = results
|
|
||||||
this.tableHeader = header
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -47,7 +47,7 @@ import Config from '@/settings'
|
|||||||
import { getCodeImg } from '@/api/login'
|
import { getCodeImg } from '@/api/login'
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
import Background from '@/assets/images/background.webp'
|
import Background from '@/assets/images/background.jpeg'
|
||||||
export default {
|
export default {
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -161,10 +161,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getSupDepts(id) {
|
getSupDepts(id) {
|
||||||
crudDept.getDeptSuperior(id).then(res => {
|
crudDept.getDeptSuperior(id, true).then(res => {
|
||||||
const date = res.content
|
const data = res.content
|
||||||
this.buildDepts(date)
|
this.buildDepts(data)
|
||||||
this.depts = date
|
this.depts = data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
buildDepts(depts) {
|
buildDepts(depts) {
|
||||||
|
|||||||
@@ -57,7 +57,19 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
<rrOperation />
|
<rrOperation />
|
||||||
</div>
|
</div>
|
||||||
<crudOperation show="" :permission="permission" />
|
<crudOperation show="" :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
v-permission="['admin','user:add']"
|
||||||
|
:disabled="crud.selections.length === 0"
|
||||||
|
class="filter-item"
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-refresh-left"
|
||||||
|
@click="resetPwd(crud.selections)"
|
||||||
|
>重置密码
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
</div>
|
</div>
|
||||||
<!--表单渲染-->
|
<!--表单渲染-->
|
||||||
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="570px">
|
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="570px">
|
||||||
@@ -471,6 +483,23 @@ export default {
|
|||||||
},
|
},
|
||||||
checkboxT(row, rowIndex) {
|
checkboxT(row, rowIndex) {
|
||||||
return row.id !== this.user.id
|
return row.id !== this.user.id
|
||||||
|
},
|
||||||
|
resetPwd(datas) {
|
||||||
|
this.$confirm(`你选中了 ${datas.length} 位用户,确认重置用户的密码吗?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
const ids = []
|
||||||
|
datas.forEach(val => {
|
||||||
|
ids.push(val.id)
|
||||||
|
})
|
||||||
|
console.log(ids)
|
||||||
|
crudUser.resetPwd(ids).then(() => {
|
||||||
|
this.crud.notify('重置成功, 用户新密码:123456', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
}).catch(() => {})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user