Commit ada4790c authored by 刘帅阳's avatar 刘帅阳

Merge remote-tracking branch 'origin/master'

parents da936156 edba8797
......@@ -11,6 +11,7 @@ const getters = {
introduction: state => state.user.introduction,
permissions: state => state.user.permissions,
permission_routes: state => state.permission.routes,
searchParams: state => state.searchSave.searchParams
searchParams: state => state.searchSave.searchParams,
unitDisable: state => state.user.unitDisable
}
export default getters
......@@ -12,7 +12,8 @@ const user = {
permissions: [],
specialTag: '',
id: '',
deptId: ''
deptId: '',
unitDisable: true
},
......@@ -40,6 +41,9 @@ const user = {
},
SET_ID: (state, id) => {
state.id = id
},
SET_UNITDISABLE: (state, unitDisable) => {
state.unitDisable = unitDisable
}
},
......@@ -80,6 +84,11 @@ const user = {
commit('SET_DEPTID', user.deptId)
commit('SET_SPECIALTAG', user.specialTag)
commit('SET_AVATAR', avatar)
if (res.data.roles[0].roleKey === 'admin') {
commit('SET_UNITDISABLE', true)
} else {
commit('SET_UNITDISABLE', false)
}
resolve(res)
}).catch(error => {
reject(error)
......
......@@ -3,7 +3,7 @@
<div class="search" style="border-bottom: 14px solid #f4f4f4">
<el-form v-show="showSearch" ref="queryForm" style="padding: 0 0 0 10px" class="formClass" :model="queryParams" :inline="true" label-width="auto">
<el-form-item label="所属商家:" prop="deptId">
<el-select v-model="queryParams.deptId" filterable placeholder="请选择所属商家" style="width: 100%">
<el-select v-model="queryParams.deptId" filterable :clearable="clearable" placeholder="请选择所属商家" style="width: 100%">
<el-option
v-for="(item,index) in deptList"
:key="index"
......@@ -439,6 +439,7 @@ export default {
}
return {
queryShop: true,
clearable: true,
userTypeList: [
{
label: '后台管理员',
......@@ -634,7 +635,7 @@ export default {
}
},
computed: {
...mapGetters(['roles', 'deptId']),
...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() {
return commonField
}
......@@ -654,14 +655,22 @@ export default {
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
// this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
this.roleFunction()
this.getList() // 列表查询
this.getDeptList()
// this.getList() // 列表查询
// this.getDeptList()
this.init()
// this.getConfigKey('sys.user.initPassword').then(response => {
// this.initPassword = response.msg
// })
},
methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.getList()
}, 1000)
},
roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles)
this.queryShop = false
......@@ -688,7 +697,9 @@ export default {
if (res.code === 200) {
this.deptList = res.data
if (res.data && res.data.length > 0) {
if (!this.clearable) {
this.queryParams.deptId = res.data[0].businessId
}
this.upload.deptId = res.data[0].businessId
this.form.deptId = res.data[0].businessId.map(item => Number(item))
} else {
......@@ -840,10 +851,13 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.page = 1,
this.queryParams.rows = 10,
this.queryParams.name = '',
this.queryParams.phone = '',
this.queryParams.page = 1
this.queryParams.rows = 10
this.queryParams.name = ''
this.queryParams.phone = ''
if (this.clearable) {
this.queryParams.deptId = ''
}
this.roleFunction()
this.handleQuery()
},
......
......@@ -2,7 +2,7 @@
<div class="app-container">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="所属商家:" prop="unitId">
<el-select v-model="queryParams.unitId" filterable placeholder="请选择所属商家" style="width: 100%">
<el-select v-model="queryParams.unitId" :clearable="clearable" filterable placeholder="请选择所属商家" style="width: 100%">
<el-option
v-for="(item,index) in deptList"
:key="index"
......@@ -256,6 +256,7 @@ export default {
name: 'CmsBanner',
data() {
return {
clearable: false,
queryShop: true,
imageUrl: '',
shareShopDiaLog: false,
......@@ -322,17 +323,24 @@ export default {
},
computed: {
...mapGetters(['roles', 'deptId']),
...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() {
return commonField
}
},
created() {
this.roleFunction()
this.getDeptList()
this.getList() // 列表查询
this.init()
// this.getDeptList()
// this.getList() // 列表查询
},
methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.getList()
}, 1000)
},
/** 修改密码确定操作*/
handleShareShopSure() {
this.$refs.ruleForm.validate(pass => {
......@@ -363,7 +371,9 @@ export default {
if (res.code === 200) {
this.deptList = res.data
if (res.data && res.data.length > 0) {
if (!this.clearable) {
this.queryParams.unitId = res.data[0].businessId
}
} else {
this.queryParams.unitId = ''
}
......@@ -380,6 +390,7 @@ export default {
this.shareShopDiaLog = !this.shareShopDiaLog
},
roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles)
this.queryShop = false
......@@ -481,7 +492,10 @@ export default {
this.queryParams.page = 1,
this.queryParams.rows = 10,
this.queryParams.bannerName = '',
this.queryParams.linkUrl = '',
this.queryParams.linkUrl = ''
if (this.clearable) {
this.queryParams.unitId = ''
}
this.roleFunction()
this.handleQuery()
},
......
......@@ -5,7 +5,7 @@
<div class="search" style="border-bottom: 14px solid #f4f4f4">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="所属商家:" prop="unitId">
<el-select v-model="queryParams.unitId" clearable filterable placeholder="请选择所属商家" style="width: 100%">
<el-select v-model="queryParams.unitId" :clearable="clearable" filterable placeholder="请选择所属商家" style="width: 100%">
<el-option
v-for="(item,index) in deptList"
:key="index"
......@@ -51,6 +51,15 @@
:size="commonField.smallSize"
@click="handleExport"
>导出</el-button>
<el-button
v-show="clearable"
:class="commonField.resetClass"
:type="commonField.resetIcon"
:icon="commonField.importIcon"
:size="commonField.smallSize"
@click="handleImport"
>{{ commonField.importName }}
</el-button>
<!-- //新增按钮 v-->
<!-- <el-button-->
<!-- :class="commonField.addClass"-->
......@@ -724,6 +733,46 @@
</div>
</div>
</el-drawer>
<!-- 代言人导入对 话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<!-- <el-select v-model="upload.deptId" :disabled="!queryShop" filterable placeholder="所属商家" style="width: 100%">-->
<!-- <el-option-->
<!-- v-for="(item,index) in deptList"-->
<!-- :key="index"-->
<!-- :label="item.unitName"-->
<!-- :value="item.businessId"-->
<!-- />-->
<!-- </el-select>-->
<el-upload
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
:on-change="employeeUpload"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-preview="handlePreview"
:file-list="fileList"
drag
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<!-- <div slot="tip" class="el-upload__tip">-->
<!-- <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>-->
<!-- </div>-->
<div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="upload.open = false">取 消</el-button>
<el-button class="submitBtn" :loading="importLoading" type="primary" @click="submitFileForm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -743,7 +792,7 @@ import {
} from '@/api/try/teaTrialCourse'
import { getDict } from '@/api/system/dict/data'
import { validOpenCourse } from '@/api/classManagement'
import { importTemplateSysuser, listByIdentity } from '@/api/system/user'
import { importSysUserExcel, importTemplateSysuser, listByIdentity } from '@/api/system/user'
import { listAllShop, listCourseAll } from '@/api/sysUnit'
import { mapGetters } from 'vuex'
import {
......@@ -751,11 +800,14 @@ import {
cmspriceclickList,
cmspriceclickUpdate
} from '@/api/contentManagement/sysContentVideoInformation'
import { getToken } from '@/utils/auth'
export default {
name: 'Index',
data() {
return {
queryShop: true,
clearable: false,
importLoading: false,
deptList: [],
// 技术岗位
technicalClassification: [],
......@@ -900,7 +952,25 @@ export default {
{ label: '试用', value: 0 },
{ label: '付费', value: 1 }
],
// 导入参数
upload: {
// 是否显示弹出层(代言人导入)
open: false,
deptId: '',
// 弹出层标题(代言人导入)
title: '',
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: 'Bearer ' + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + '/sysuser/import'
},
actionUrl: '',
// 导入列表
fileList: [],
filelist: [],
userOptions: [],
......@@ -913,7 +983,7 @@ export default {
}
},
computed: {
...mapGetters(['roles', 'deptId']),
...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() {
return commonField
}
......@@ -931,10 +1001,17 @@ export default {
this.roleFunction()
},
mounted: function() {
this.loadData()
this.getDeptList()
// this.getDeptList()
// this.loadData()
this.init()
},
methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.loadData()
}, 1000)
},
handleExport() {
cmspriceclickExport({ unitId: this.deptId }).then(response => {
const blob = new Blob([response])
......@@ -949,13 +1026,21 @@ export default {
// this.download(response.msg);
})
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = '推广次数导入'
this.upload.open = true
},
// 获取所有部门信息
getDeptList() {
console.log('this.clearable', this.clearable)
listAllShop().then(res => {
if (res.code === 200) {
this.deptList = res.data
if (res.data && res.data.length > 0) {
if (!this.clearable) {
this.queryParams.unitId = res.data[0].businessId
}
} else {
this.queryParams.unitId = ''
}
......@@ -963,6 +1048,7 @@ export default {
})
},
roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles)
this.queryShop = false
......@@ -1359,9 +1445,12 @@ export default {
resetQuery() {
this.dateRangeBegin = []
this.dateRangeEnd = []
this.queryParams.page = 1,
this.queryParams.rows = 10,
this.queryParams.title = '',
this.queryParams.page = 1
this.queryParams.rows = 10
this.queryParams.title = ''
if (this.clearable) {
this.queryParams.unitId = ''
}
this.roleFunction()
this.loadData()
},
......@@ -1500,7 +1589,7 @@ export default {
_this.tableData = res.records
this.tableDataOri = JSON.parse(JSON.stringify(res.records))
_this.fullscreenLoading = false
if (res.rows.length === 0) {
if (res.records.length === 0) {
_this.tableDataTips = '暂无数据'
}
})
......@@ -1553,6 +1642,75 @@ export default {
this.drawerController.title = '新增开课'
this.drawerController.drawer = true
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
// 文件上传 成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false
this.upload.isUploading = false
this.$refs.upload.clearFiles()
this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true })
this.getList()
},
/** 导入change*/
employeeUpload(file, fileList) {
if (fileList.length > 1) {
fileList.splice(0, 1)
}
this.fileList = fileList[0].raw
},
/** 导入remove操作*/
handleRemove(file, fileList) {
this.fileList = []
},
/** 导入beforeRemove操作*/
beforeRemove(file, fileList) {
this.fileList = []
},
/* 上传文件所需求 */
handlePreview(file) {
},
// 提交上传文件
submitFileForm() {
// this.$refs.upload.submit()
this.importLoading = true
if (!this.upload.deptId) {
this.$message.warning('请选择所属商家')
this.importLoading = false
} else if (this.fileList.length === 0) {
this.$message.warning('请上传文件')
// 导入成功后关闭弹出框
this.importLoading = false
this.upload.open = true
} else { // 根据后台需求数据格式
console.log('this.fileList', this.fileList)
var formData = new FormData() // 当前为空
formData.append('file', this.fileList)
formData.append('deptId', this.upload.deptId)
importSysUserExcel(formData).then(res => {
if (res.code === 200) {
this.$message.success('导入成功')
this.fileList = []
// 导入成功后关闭弹出框
this.importLoading = false
this.upload.open = false
// 导入成功后刷新页面
this.getList()
} else if (res.code === 41020) {
this.$message.info('上传超时,请重新上传')
this.importLoading = false
} else {
this.$message.error(res.message)
this.importLoading = false
}
}).catch(err => {
// this.$message.success(err.message)
this.importLoading = false
})
}
},
/** 提交按钮 */
submitForm: function() {
if (this.multipleSelection.length === 0) {
......
......@@ -5,7 +5,7 @@
<div class="search" style="border-bottom: 14px solid #f4f4f4">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="所属商家:" prop="unitId">
<el-select v-model="queryParams.unitId" filterable placeholder="请选择所属商家" style="width: 100%">
<el-select v-model="queryParams.unitId" :clearable="clearable" filterable placeholder="请选择所属商家" style="width: 100%">
<el-option
v-for="(item,index) in deptList"
:key="index"
......@@ -291,6 +291,7 @@ export default {
// },
data() {
return {
clearable: false,
imgLoading: false,
webLoading: false,
intervalId: null,
......@@ -409,7 +410,7 @@ export default {
}
},
computed: {
...mapGetters(['roles', 'deptId']),
...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() {
return commonField
}
......@@ -418,10 +419,17 @@ export default {
this.roleFunction()
},
mounted: function() {
this.loadData()
this.getDeptList()
// this.loadData()
// this.getDeptList()
this.init()
},
methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.loadData()
}, 1000)
},
beforeCrawlerData() {
this.crawlerDigShow = true
},
......@@ -434,6 +442,12 @@ export default {
})
},
startImage() {
const message = this.souceList.join('、')
this.$confirm('您正在抓取' + message + '数据, 是否确认抓取?', '是否确认抓取', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.imgLoading = true
console.log(this.souceList.join(','))
scanCrawlerPicture(this.souceList.join(',')).then(res => {
......@@ -443,6 +457,7 @@ export default {
this.$message.warning(err.message)
this.imgLoading = false
})
})
},
checkStatus() {
this.intervalId = setInterval(() => {
......@@ -465,6 +480,11 @@ export default {
},
// 测试定时爬虫
crawlerData() {
this.$confirm('您正在抓取中国保险行业协会 行业要闻数据, 是否确认抓取?', '是否确认抓取', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.webLoading = true
crawler().then(res => {
this.checkId = res.data
......@@ -473,6 +493,7 @@ export default {
this.$message.warning(err.message)
this.webLoading = false
})
})
},
/** 修改密码确定 操作*/
handleShareShopSure() {
......@@ -524,6 +545,7 @@ export default {
this.shareShopDiaLog = !this.shareShopDiaLog
},
roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles)
this.queryShop = false
......@@ -536,7 +558,9 @@ export default {
if (res.code === 200) {
this.deptList = res.data
if (res.data && res.data.length > 0) {
if (!this.clearable) {
this.queryParams.unitId = res.data[0].businessId
}
} else {
this.queryParams.unitId = ''
}
......@@ -582,10 +606,13 @@ export default {
/** 重置按钮操作 */
resetQuery() {
this.queryParams.page = 1,
this.queryParams.rows = 10,
this.queryParams.title = '',
this.queryParams.page = 1
this.queryParams.rows = 10
this.queryParams.title = ''
this.dateRange = []
if (this.clearable) {
this.queryParams.unitId = ''
}
this.roleFunction()
this.loadData()
},
......
......@@ -5,7 +5,7 @@
<div class="search" style="border-bottom: 14px solid #f4f4f4">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="所属商家:" prop="unitId">
<el-select v-model="queryParams.unitId" filterable placeholder="请选择所属商家" style="width: 100%">
<el-select v-model="queryParams.unitId" :clearable="clearable" filterable placeholder="请选择所属商家" style="width: 100%">
<el-option
v-for="(item,index) in deptList"
:key="index"
......@@ -224,6 +224,7 @@ export default {
rules: {
shops: [{ required: true, message: '请选择所属商家', trigger: 'change' }]
},
clearable: false,
ruleForm: {
shops: [],
row: ''
......@@ -333,7 +334,7 @@ export default {
}
},
computed: {
...mapGetters(['roles', 'deptId']),
...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() {
return commonField
}
......@@ -342,10 +343,17 @@ export default {
this.roleFunction()
},
mounted: function() {
this.loadData()
this.getDeptList()
// this.loadData()
// this.getDeptList()
this.init()
},
methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.loadData()
}, 1000)
},
/** 修改密码确定操作*/
handleShareShopSure() {
this.$refs.ruleForm.validate(pass => {
......@@ -382,6 +390,7 @@ export default {
this.shareShopDiaLog = !this.shareShopDiaLog
},
roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles)
this.queryShop = false
......@@ -394,7 +403,9 @@ export default {
if (res.code === 200) {
this.deptList = res.data
if (res.data && res.data.length > 0) {
if (!this.clearable) {
this.queryParams.unitId = res.data[0].businessId
}
} else {
this.queryParams.unitId = ''
}
......@@ -444,6 +455,9 @@ export default {
this.queryParams.rows = 10,
this.queryParams.videoTitle = '',
this.dateRange = []
if (this.clearable) {
this.queryParams.unitId = ''
}
this.roleFunction()
this.loadData()
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment