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

Merge remote-tracking branch 'origin/master'

parents da936156 edba8797
...@@ -11,6 +11,7 @@ const getters = { ...@@ -11,6 +11,7 @@ const getters = {
introduction: state => state.user.introduction, introduction: state => state.user.introduction,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
permission_routes: state => state.permission.routes, permission_routes: state => state.permission.routes,
searchParams: state => state.searchSave.searchParams searchParams: state => state.searchSave.searchParams,
unitDisable: state => state.user.unitDisable
} }
export default getters export default getters
...@@ -12,7 +12,8 @@ const user = { ...@@ -12,7 +12,8 @@ const user = {
permissions: [], permissions: [],
specialTag: '', specialTag: '',
id: '', id: '',
deptId: '' deptId: '',
unitDisable: true
}, },
...@@ -40,6 +41,9 @@ const user = { ...@@ -40,6 +41,9 @@ const user = {
}, },
SET_ID: (state, id) => { SET_ID: (state, id) => {
state.id = id state.id = id
},
SET_UNITDISABLE: (state, unitDisable) => {
state.unitDisable = unitDisable
} }
}, },
...@@ -80,6 +84,11 @@ const user = { ...@@ -80,6 +84,11 @@ const user = {
commit('SET_DEPTID', user.deptId) commit('SET_DEPTID', user.deptId)
commit('SET_SPECIALTAG', user.specialTag) commit('SET_SPECIALTAG', user.specialTag)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
if (res.data.roles[0].roleKey === 'admin') {
commit('SET_UNITDISABLE', true)
} else {
commit('SET_UNITDISABLE', false)
}
resolve(res) resolve(res)
}).catch(error => { }).catch(error => {
reject(error) reject(error)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="search" style="border-bottom: 14px solid #f4f4f4"> <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 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-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 <el-option
v-for="(item,index) in deptList" v-for="(item,index) in deptList"
:key="index" :key="index"
...@@ -439,6 +439,7 @@ export default { ...@@ -439,6 +439,7 @@ export default {
} }
return { return {
queryShop: true, queryShop: true,
clearable: true,
userTypeList: [ userTypeList: [
{ {
label: '后台管理员', label: '后台管理员',
...@@ -634,7 +635,7 @@ export default { ...@@ -634,7 +635,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['roles', 'deptId']), ...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() { commonField() {
return commonField return commonField
} }
...@@ -654,14 +655,22 @@ export default { ...@@ -654,14 +655,22 @@ export default {
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改 // 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
// this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项 // this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
this.roleFunction() this.roleFunction()
this.getList() // 列表查询 // this.getList() // 列表查询
this.getDeptList() // this.getDeptList()
this.init()
// this.getConfigKey('sys.user.initPassword').then(response => { // this.getConfigKey('sys.user.initPassword').then(response => {
// this.initPassword = response.msg // this.initPassword = response.msg
// }) // })
}, },
methods: { methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.getList()
}, 1000)
},
roleFunction() { roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') { if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles) console.log('this.roles', this.roles)
this.queryShop = false this.queryShop = false
...@@ -688,7 +697,9 @@ export default { ...@@ -688,7 +697,9 @@ export default {
if (res.code === 200) { if (res.code === 200) {
this.deptList = res.data this.deptList = res.data
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
this.queryParams.deptId = res.data[0].businessId if (!this.clearable) {
this.queryParams.deptId = res.data[0].businessId
}
this.upload.deptId = res.data[0].businessId this.upload.deptId = res.data[0].businessId
this.form.deptId = res.data[0].businessId.map(item => Number(item)) this.form.deptId = res.data[0].businessId.map(item => Number(item))
} else { } else {
...@@ -840,10 +851,13 @@ export default { ...@@ -840,10 +851,13 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.page = 1, this.queryParams.page = 1
this.queryParams.rows = 10, this.queryParams.rows = 10
this.queryParams.name = '', this.queryParams.name = ''
this.queryParams.phone = '', this.queryParams.phone = ''
if (this.clearable) {
this.queryParams.deptId = ''
}
this.roleFunction() this.roleFunction()
this.handleQuery() this.handleQuery()
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true"> <el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="所属商家:" prop="unitId"> <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 <el-option
v-for="(item,index) in deptList" v-for="(item,index) in deptList"
:key="index" :key="index"
...@@ -256,6 +256,7 @@ export default { ...@@ -256,6 +256,7 @@ export default {
name: 'CmsBanner', name: 'CmsBanner',
data() { data() {
return { return {
clearable: false,
queryShop: true, queryShop: true,
imageUrl: '', imageUrl: '',
shareShopDiaLog: false, shareShopDiaLog: false,
...@@ -322,17 +323,24 @@ export default { ...@@ -322,17 +323,24 @@ export default {
}, },
computed: { computed: {
...mapGetters(['roles', 'deptId']), ...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() { commonField() {
return commonField return commonField
} }
}, },
created() { created() {
this.roleFunction() this.roleFunction()
this.getDeptList() this.init()
this.getList() // 列表查询 // this.getDeptList()
// this.getList() // 列表查询
}, },
methods: { methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.getList()
}, 1000)
},
/** 修改密码确定操作*/ /** 修改密码确定操作*/
handleShareShopSure() { handleShareShopSure() {
this.$refs.ruleForm.validate(pass => { this.$refs.ruleForm.validate(pass => {
...@@ -363,7 +371,9 @@ export default { ...@@ -363,7 +371,9 @@ export default {
if (res.code === 200) { if (res.code === 200) {
this.deptList = res.data this.deptList = res.data
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
this.queryParams.unitId = res.data[0].businessId if (!this.clearable) {
this.queryParams.unitId = res.data[0].businessId
}
} else { } else {
this.queryParams.unitId = '' this.queryParams.unitId = ''
} }
...@@ -380,6 +390,7 @@ export default { ...@@ -380,6 +390,7 @@ export default {
this.shareShopDiaLog = !this.shareShopDiaLog this.shareShopDiaLog = !this.shareShopDiaLog
}, },
roleFunction() { roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') { if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles) console.log('this.roles', this.roles)
this.queryShop = false this.queryShop = false
...@@ -481,7 +492,10 @@ export default { ...@@ -481,7 +492,10 @@ export default {
this.queryParams.page = 1, this.queryParams.page = 1,
this.queryParams.rows = 10, this.queryParams.rows = 10,
this.queryParams.bannerName = '', this.queryParams.bannerName = '',
this.queryParams.linkUrl = '', this.queryParams.linkUrl = ''
if (this.clearable) {
this.queryParams.unitId = ''
}
this.roleFunction() this.roleFunction()
this.handleQuery() this.handleQuery()
}, },
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="search" style="border-bottom: 14px solid #f4f4f4"> <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 ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="所属商家:" prop="unitId"> <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 <el-option
v-for="(item,index) in deptList" v-for="(item,index) in deptList"
:key="index" :key="index"
...@@ -51,6 +51,15 @@ ...@@ -51,6 +51,15 @@
:size="commonField.smallSize" :size="commonField.smallSize"
@click="handleExport" @click="handleExport"
>导出</el-button> >导出</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--> <!-- //新增按钮 v-->
<!-- <el-button--> <!-- <el-button-->
<!-- :class="commonField.addClass"--> <!-- :class="commonField.addClass"-->
...@@ -724,6 +733,46 @@ ...@@ -724,6 +733,46 @@
</div> </div>
</div> </div>
</el-drawer> </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> </div>
</template> </template>
...@@ -743,7 +792,7 @@ import { ...@@ -743,7 +792,7 @@ import {
} from '@/api/try/teaTrialCourse' } from '@/api/try/teaTrialCourse'
import { getDict } from '@/api/system/dict/data' import { getDict } from '@/api/system/dict/data'
import { validOpenCourse } from '@/api/classManagement' 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 { listAllShop, listCourseAll } from '@/api/sysUnit'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { import {
...@@ -751,11 +800,14 @@ import { ...@@ -751,11 +800,14 @@ import {
cmspriceclickList, cmspriceclickList,
cmspriceclickUpdate cmspriceclickUpdate
} from '@/api/contentManagement/sysContentVideoInformation' } from '@/api/contentManagement/sysContentVideoInformation'
import { getToken } from '@/utils/auth'
export default { export default {
name: 'Index', name: 'Index',
data() { data() {
return { return {
queryShop: true, queryShop: true,
clearable: false,
importLoading: false,
deptList: [], deptList: [],
// 技术岗位 // 技术岗位
technicalClassification: [], technicalClassification: [],
...@@ -900,7 +952,25 @@ export default { ...@@ -900,7 +952,25 @@ export default {
{ label: '试用', value: 0 }, { label: '试用', value: 0 },
{ label: '付费', value: 1 } { 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: '', actionUrl: '',
// 导入列表
fileList: [],
filelist: [], filelist: [],
userOptions: [], userOptions: [],
...@@ -913,7 +983,7 @@ export default { ...@@ -913,7 +983,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['roles', 'deptId']), ...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() { commonField() {
return commonField return commonField
} }
...@@ -931,10 +1001,17 @@ export default { ...@@ -931,10 +1001,17 @@ export default {
this.roleFunction() this.roleFunction()
}, },
mounted: function() { mounted: function() {
this.loadData() // this.getDeptList()
this.getDeptList() // this.loadData()
this.init()
}, },
methods: { methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.loadData()
}, 1000)
},
handleExport() { handleExport() {
cmspriceclickExport({ unitId: this.deptId }).then(response => { cmspriceclickExport({ unitId: this.deptId }).then(response => {
const blob = new Blob([response]) const blob = new Blob([response])
...@@ -949,13 +1026,21 @@ export default { ...@@ -949,13 +1026,21 @@ export default {
// this.download(response.msg); // this.download(response.msg);
}) })
}, },
/** 导入按钮操作 */
handleImport() {
this.upload.title = '推广次数导入'
this.upload.open = true
},
// 获取所有部门信息 // 获取所有部门信息
getDeptList() { getDeptList() {
console.log('this.clearable', this.clearable)
listAllShop().then(res => { listAllShop().then(res => {
if (res.code === 200) { if (res.code === 200) {
this.deptList = res.data this.deptList = res.data
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
this.queryParams.unitId = res.data[0].businessId if (!this.clearable) {
this.queryParams.unitId = res.data[0].businessId
}
} else { } else {
this.queryParams.unitId = '' this.queryParams.unitId = ''
} }
...@@ -963,6 +1048,7 @@ export default { ...@@ -963,6 +1048,7 @@ export default {
}) })
}, },
roleFunction() { roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') { if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles) console.log('this.roles', this.roles)
this.queryShop = false this.queryShop = false
...@@ -1359,9 +1445,12 @@ export default { ...@@ -1359,9 +1445,12 @@ export default {
resetQuery() { resetQuery() {
this.dateRangeBegin = [] this.dateRangeBegin = []
this.dateRangeEnd = [] this.dateRangeEnd = []
this.queryParams.page = 1, this.queryParams.page = 1
this.queryParams.rows = 10, this.queryParams.rows = 10
this.queryParams.title = '', this.queryParams.title = ''
if (this.clearable) {
this.queryParams.unitId = ''
}
this.roleFunction() this.roleFunction()
this.loadData() this.loadData()
}, },
...@@ -1500,7 +1589,7 @@ export default { ...@@ -1500,7 +1589,7 @@ export default {
_this.tableData = res.records _this.tableData = res.records
this.tableDataOri = JSON.parse(JSON.stringify(res.records)) this.tableDataOri = JSON.parse(JSON.stringify(res.records))
_this.fullscreenLoading = false _this.fullscreenLoading = false
if (res.rows.length === 0) { if (res.records.length === 0) {
_this.tableDataTips = '暂无数据' _this.tableDataTips = '暂无数据'
} }
}) })
...@@ -1553,6 +1642,75 @@ export default { ...@@ -1553,6 +1642,75 @@ export default {
this.drawerController.title = '新增开课' this.drawerController.title = '新增开课'
this.drawerController.drawer = true 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() { submitForm: function() {
if (this.multipleSelection.length === 0) { if (this.multipleSelection.length === 0) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="search" style="border-bottom: 14px solid #f4f4f4"> <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 ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="所属商家:" prop="unitId"> <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 <el-option
v-for="(item,index) in deptList" v-for="(item,index) in deptList"
:key="index" :key="index"
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" prop="title" label="新闻标题" width="200" show-overflow-tooltip /> <el-table-column align="left" prop="title" label="新闻标题" width="200" show-overflow-tooltip />
<el-table-column align="left" label="新闻标题图" prop="path"> <el-table-column align="left" label="新闻标题图" prop="path">
<template slot-scope="scope"> <template slot-scope="scope">
<div :id="step(scope.$index)"> <div :id="step(scope.$index)">
<el-image <el-image
...@@ -113,12 +113,12 @@ ...@@ -113,12 +113,12 @@
<span>{{ scope.row.isTop === 1 ? '是' : '否' }}</span> <span>{{ scope.row.isTop === 1 ? '是' : '否' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" prop="isRecommended" label="是否为推荐新闻" show-overflow-tooltip> <el-table-column align="left" prop="isRecommended" label="是否为推荐新闻" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.isRecommended === 1 ? '是' : '否' }}</span> <span>{{ scope.row.isRecommended === 1 ? '是' : '否' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" prop="newsType" label="文章来源" show-overflow-tooltip> <el-table-column align="left" prop="newsType" label="文章来源" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ newsTypeMap[scope.row.newsType] }}</span> <span>{{ newsTypeMap[scope.row.newsType] }}</span>
</template> </template>
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
append-to-body append-to-body
> >
<div class="img_content"> <div class="img_content">
<img v-show="src" id="crawlerImage" :src="src" alt="Crawler Image"> <img v-show="src" id="crawlerImage" :src="src" alt="Crawler Image">
</div> </div>
<div class="dialogWarnText">二维码小程序爬取文章由于限制,1天内内最多爬1次,否则会存在公众号被封的风险</div> <div class="dialogWarnText">二维码小程序爬取文章由于限制,1天内内最多爬1次,否则会存在公众号被封的风险</div>
<el-checkbox-group v-model="souceList"> <el-checkbox-group v-model="souceList">
...@@ -291,6 +291,7 @@ export default { ...@@ -291,6 +291,7 @@ export default {
// }, // },
data() { data() {
return { return {
clearable: false,
imgLoading: false, imgLoading: false,
webLoading: false, webLoading: false,
intervalId: null, intervalId: null,
...@@ -409,7 +410,7 @@ export default { ...@@ -409,7 +410,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['roles', 'deptId']), ...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() { commonField() {
return commonField return commonField
} }
...@@ -418,10 +419,17 @@ export default { ...@@ -418,10 +419,17 @@ export default {
this.roleFunction() this.roleFunction()
}, },
mounted: function() { mounted: function() {
this.loadData() // this.loadData()
this.getDeptList() // this.getDeptList()
this.init()
}, },
methods: { methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.loadData()
}, 1000)
},
beforeCrawlerData() { beforeCrawlerData() {
this.crawlerDigShow = true this.crawlerDigShow = true
}, },
...@@ -434,14 +442,21 @@ export default { ...@@ -434,14 +442,21 @@ export default {
}) })
}, },
startImage() { startImage() {
this.imgLoading = true const message = this.souceList.join('、')
console.log(this.souceList.join(',')) this.$confirm('您正在抓取' + message + '数据, 是否确认抓取?', '是否确认抓取', {
scanCrawlerPicture(this.souceList.join(',')).then(res => { confirmButtonText: '确定',
this.checkId = res.data cancelButtonText: '取消',
this.checkStatus() type: 'warning'
}).catch(err => { }).then(() => {
this.$message.warning(err.message) this.imgLoading = true
this.imgLoading = false console.log(this.souceList.join(','))
scanCrawlerPicture(this.souceList.join(',')).then(res => {
this.checkId = res.data
this.checkStatus()
}).catch(err => {
this.$message.warning(err.message)
this.imgLoading = false
})
}) })
}, },
checkStatus() { checkStatus() {
...@@ -465,13 +480,19 @@ export default { ...@@ -465,13 +480,19 @@ export default {
}, },
// 测试定时爬虫 // 测试定时爬虫
crawlerData() { crawlerData() {
this.webLoading = true this.$confirm('您正在抓取中国保险行业协会 行业要闻数据, 是否确认抓取?', '是否确认抓取', {
crawler().then(res => { confirmButtonText: '确定',
this.checkId = res.data cancelButtonText: '取消',
this.checkStatus() type: 'warning'
}).catch(err => { }).then(() => {
this.$message.warning(err.message) this.webLoading = true
this.webLoading = false crawler().then(res => {
this.checkId = res.data
this.checkStatus()
}).catch(err => {
this.$message.warning(err.message)
this.webLoading = false
})
}) })
}, },
/** 修改密码确定 操作*/ /** 修改密码确定 操作*/
...@@ -524,6 +545,7 @@ export default { ...@@ -524,6 +545,7 @@ export default {
this.shareShopDiaLog = !this.shareShopDiaLog this.shareShopDiaLog = !this.shareShopDiaLog
}, },
roleFunction() { roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') { if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles) console.log('this.roles', this.roles)
this.queryShop = false this.queryShop = false
...@@ -536,7 +558,9 @@ export default { ...@@ -536,7 +558,9 @@ export default {
if (res.code === 200) { if (res.code === 200) {
this.deptList = res.data this.deptList = res.data
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
this.queryParams.unitId = res.data[0].businessId if (!this.clearable) {
this.queryParams.unitId = res.data[0].businessId
}
} else { } else {
this.queryParams.unitId = '' this.queryParams.unitId = ''
} }
...@@ -582,10 +606,13 @@ export default { ...@@ -582,10 +606,13 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams.page = 1, this.queryParams.page = 1
this.queryParams.rows = 10, this.queryParams.rows = 10
this.queryParams.title = '', this.queryParams.title = ''
this.dateRange = [] this.dateRange = []
if (this.clearable) {
this.queryParams.unitId = ''
}
this.roleFunction() this.roleFunction()
this.loadData() this.loadData()
}, },
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="search" style="border-bottom: 14px solid #f4f4f4"> <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 ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="所属商家:" prop="unitId"> <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 <el-option
v-for="(item,index) in deptList" v-for="(item,index) in deptList"
:key="index" :key="index"
...@@ -224,6 +224,7 @@ export default { ...@@ -224,6 +224,7 @@ export default {
rules: { rules: {
shops: [{ required: true, message: '请选择所属商家', trigger: 'change' }] shops: [{ required: true, message: '请选择所属商家', trigger: 'change' }]
}, },
clearable: false,
ruleForm: { ruleForm: {
shops: [], shops: [],
row: '' row: ''
...@@ -333,7 +334,7 @@ export default { ...@@ -333,7 +334,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['roles', 'deptId']), ...mapGetters(['roles', 'deptId', 'unitDisable']),
commonField() { commonField() {
return commonField return commonField
} }
...@@ -342,10 +343,17 @@ export default { ...@@ -342,10 +343,17 @@ export default {
this.roleFunction() this.roleFunction()
}, },
mounted: function() { mounted: function() {
this.loadData() // this.loadData()
this.getDeptList() // this.getDeptList()
this.init()
}, },
methods: { methods: {
init() {
this.getDeptList()
setTimeout(() => {
this.loadData()
}, 1000)
},
/** 修改密码确定操作*/ /** 修改密码确定操作*/
handleShareShopSure() { handleShareShopSure() {
this.$refs.ruleForm.validate(pass => { this.$refs.ruleForm.validate(pass => {
...@@ -382,6 +390,7 @@ export default { ...@@ -382,6 +390,7 @@ export default {
this.shareShopDiaLog = !this.shareShopDiaLog this.shareShopDiaLog = !this.shareShopDiaLog
}, },
roleFunction() { roleFunction() {
this.clearable = this.unitDisable
if (this.roles[0].roleKey !== 'admin') { if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles) console.log('this.roles', this.roles)
this.queryShop = false this.queryShop = false
...@@ -394,7 +403,9 @@ export default { ...@@ -394,7 +403,9 @@ export default {
if (res.code === 200) { if (res.code === 200) {
this.deptList = res.data this.deptList = res.data
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
this.queryParams.unitId = res.data[0].businessId if (!this.clearable) {
this.queryParams.unitId = res.data[0].businessId
}
} else { } else {
this.queryParams.unitId = '' this.queryParams.unitId = ''
} }
...@@ -444,6 +455,9 @@ export default { ...@@ -444,6 +455,9 @@ export default {
this.queryParams.rows = 10, this.queryParams.rows = 10,
this.queryParams.videoTitle = '', this.queryParams.videoTitle = '',
this.dateRange = [] this.dateRange = []
if (this.clearable) {
this.queryParams.unitId = ''
}
this.roleFunction() this.roleFunction()
this.loadData() 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