diff --git a/src/assets/img/devLogin.jpg b/src/assets/img/devLogin.jpg new file mode 100644 index 0000000..52be3e7 Binary files /dev/null and b/src/assets/img/devLogin.jpg differ diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index bcff7de..d45d351 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -134,6 +134,8 @@ export default { methods:{ handleSelect(index){ this.onRoutes = index + this.$store.commit('setInfoTab', '1') + this.$store.commit('setColumnId', '') sessionStorage.setItem('sideBar',index) }, initMenu() { diff --git a/src/router/index.js b/src/router/index.js index c0fedca..653bf6d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -214,6 +214,11 @@ let router = new Router({ component: () => import('../views/Login.vue'), meta: { title: '登录' } }, + { + path: '/devLogin', + component: () => import('../views/devLogin.vue'), + meta: { title: '开发者登录' } + }, { path: '/join', component: () => import('../views/join'), @@ -240,8 +245,9 @@ router.beforeEach(function(to, from, next) { // 根据路由元信息设置文档标题 window.document.title = to.meta.title || '中台'; //使用钩子函数对路由进行权限跳转 - if (!sessionStorage.getItem('token') && to.path !== '/login' && to.path !== '/join' && to.path !== '/success') { - next('/login'); + const login = location.href.includes('dev.huorantech.cn') ? '/devLogin' : '/login' + if (!sessionStorage.getItem('token') && to.path !== login && to.path !== '/join' && to.path !== '/success') { + next(login); } else { next(); } diff --git a/src/setting.js b/src/setting.js index 8ecc39f..9c69488 100644 --- a/src/setting.js +++ b/src/setting.js @@ -12,7 +12,7 @@ if (isDev) { host = 'http://121.37.12.51/' // host = 'https://huorantech.cn/' // host = 'http://192.168.31.51:9000/'// 榕 - host = 'http://192.168.31.116:9000/'// 赓 + // host = 'http://192.168.31.116:9000/'// 赓 } else if (isPro) { jumpPath = 'https://www.huorantech.cn/judgmentPoint/' } diff --git a/src/views/Login.vue b/src/views/Login.vue index 0f58088..c60d10a 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -199,6 +199,7 @@ export default { sessionStorage.setItem('token',res.data.token) this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`).then(res => { const list = res.permissionMenu + this.$store.commit('setDataPer', res.dataPermissionList) this.$message.success(message); this.$router.push({ path: list[0].children[0].path diff --git a/src/views/course/AddCurriculum.vue b/src/views/course/AddCurriculum.vue index a5f3913..08bad9e 100644 --- a/src/views/course/AddCurriculum.vue +++ b/src/views/course/AddCurriculum.vue @@ -96,7 +96,7 @@ - + @@ -203,13 +203,14 @@ + :inactive-value="1" + :disabled="scope.row.disabled"> @@ -239,7 +240,7 @@ @@ -253,13 +254,14 @@ + :inactive-value="1" + :disabled="scope.row.disabled"> @@ -315,7 +317,7 @@ @@ -326,7 +328,7 @@ @@ -445,6 +447,7 @@ export default { updateTime: 0, systemAll: [], systems: [], + systemsAll: [], systemChecked: [], curSystem: '', projects: [], @@ -454,7 +457,8 @@ export default { checkeds: [], checkedAll: [], checkAll: false, - suppliers: [] + suppliers: [], + mulSystem: this.$store.state.btns.includes('/curriculum:支持多系统组课'), // 是否支持多系统组课 }; }, watch: { @@ -488,15 +492,17 @@ export default { }, mounted() { + console.log(33, this.$store.state.btns.includes('/curriculum:支持多系统组课')) this.getSubject() this.getConfig() + this.getSystem() this.getSupplier() this.form.cid && this.getInfoData() }, methods: { getInfoData() { - this.$post(`${this.api.curriculumDetail}?cid=${this.form.cid}`).then(res => { - let { data } = res; + this.$post(`${this.api.curriculumDetail}?cid=${this.form.cid}`).then(({ data }) => { + if (data.supplier) data.supplier = data.supplier.split(',').map(e => +e) if (data.categoryId) { this.$get(this.api.courseProfessionalClass, { disciplineId: data.categoryId }).then(res => { this.ProfessionalClassList = res.list; @@ -510,18 +516,45 @@ export default { this.$nextTick(() => { this.form = data; data.miniProgramPictureAddress || this.$set(this.form, 'miniProgramPictureAddress', '') - this.practiceData = data.practiceConfig; - this.assessmentData = data.assessmentConfig; + const pList = data.practiceConfig + const { systemsAll } = this + pList.map(e => { + if (!systemsAll.find(n => n.systemId == e.systemId)) e.disabled = true + }) + this.practiceData = pList + + const aList = data.assessmentConfig + aList.map(e => { + if (!systemsAll.find(n => n.systemId == e.systemId)) e.disabled = true + }) + this.assessmentData = aList }); }).catch(err => { }); }, // 获取供应厂商 getSupplier() { - this.$get(this.api.getSupplierListByRole).then(res => { + const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') + console.log("🚀 ~ file: AddCurriculum.vue ~ line 523 ~ getSupplier ~ sid", sid) + this.$get(this.api.getSupplierListByRole, { + permissionId: sid.permissionId + }).then(res => { this.suppliers = res.supplierList }).catch(res => {}) }, + // 获取系统 + getSystem() { + const checked = this.permissions ? this.assessmentData : this.practiceData + const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') + this.$post(this.api.queryServiceConfig, { + systemName: '', + pageNum: 1, + pageSize: 1000, + supplierId: sid ? sid.supplierId : '' + }).then(({ serviceList }) => { + this.systemsAll = serviceList.records + }).catch(err => {}) + }, getSubject() { // 获取学科类别 this.$get(this.api.courseDiscipline).then(res => { this.subjectList = res.list; @@ -618,10 +651,12 @@ export default { // 获取系统 getConfig() { const checked = this.permissions ? this.assessmentData : this.practiceData + const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') this.$post(this.api.queryServiceConfig, { systemName: this.systemKeyword, pageNum: 1, - pageSize: 1000 + pageSize: 1000, + supplierId: sid ? sid.supplierId : '' }).then(res => { const list = res.serviceList.records this.systemAll = JSON.parse(JSON.stringify(list)) // 全部系统,另外保存 @@ -673,6 +708,11 @@ export default { this.projectKeyword = '' this.$get(`${this.api.getInternalProjectBySystemId}?permissions=${this.permissions}&systemId=${item.systemId}`).then(res => { if (val) { + // 如果不支持多选系统,选中后全部取消选中再选中当前系统 + if (!this.mulSystem) { + this.systems.map(e => e.check = false) + item.check = true + } res.map(e => { if (!checkeds.find(n => n.projectId == e.projectId && n.systemId == e.systemId)) { checkeds.push(e) @@ -711,6 +751,7 @@ export default { }) this.checkAll = !this.projects.find(e => !e.check) // 同步全选框 this.checkedAll = JSON.parse(JSON.stringify(this.checkeds)) // 全部已选项目,另外保存 + console.log("🚀 ~ file: AddCurriculum.vue ~ line 728 ~ projectChange ~ checkedAll", this.checkeds, item) }, // 已选择项目模糊查询 filterChecked() { @@ -719,6 +760,7 @@ export default { }, // 删除已选项目 delProject(i, e) { + if (e.disabled) return this.$confirm("确定要删除吗?", "提示", { type: "warning" }).then(() => { @@ -819,7 +861,7 @@ export default { this.$refs.form.validate((valid) => { if (valid) { if (this.submiting) return false - const { form } = this + const form = JSON.parse(JSON.stringify(this.form)) const { businessProportion, manufacturerProportion, settlementMethod, settlementPrice } = form if (settlementMethod == 0) { if(!settlementPrice) return this.$message.warning('请输入结算单价') @@ -831,7 +873,9 @@ export default { if(isNaN(manufacturerProportion)) return this.$message.warning('产品厂商占比请输入数字') if(+businessProportion + +manufacturerProportion !== 100) return this.$message.warning('比例分成总和须为100%,请重新修改') } - if (!this.form.coverUrl) { + form.supplier = form.supplier.join() + debugger + if (!form.coverUrl) { this.$message.warning("请上传课程封面"); return; } @@ -839,7 +883,7 @@ export default { this.$message.warning("请添加练习配置"); return; } else { - this.form.systemIdByPractice = this.practiceData.map(i => { + form.systemIdByPractice = this.practiceData.map(i => { let obj = { isShow: i.isShow, projectId: i.projectId, @@ -848,13 +892,13 @@ export default { }; return obj; }); - this.form.systemIdByPractice.sort((a, b) => a.sort - b.sort) + form.systemIdByPractice.sort((a, b) => a.sort - b.sort) } if (!this.assessmentData.length) { this.$message.warning("请添加考核配置"); return; } else { - this.form.systemIdByAssessment = this.assessmentData.map(i => { + form.systemIdByAssessment = this.assessmentData.map(i => { let obj = { isShow: i.isShow, projectId: i.projectId, @@ -863,7 +907,7 @@ export default { }; return obj; }); - this.form.systemIdByAssessment.sort((a, b) => a.sort - b.sort) + form.systemIdByAssessment.sort((a, b) => a.sort - b.sort) } this.submiting = true this.loadIns = this.$loading({ @@ -872,8 +916,8 @@ export default { spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' }) - if (this.form.cid) { - this.$post(this.api.modifyCourse, this.form).then((res) => { + if (form.cid) { + this.$post(this.api.modifyCourse, form).then((res) => { this.$message.success("编辑成功"); this.backPage() }).catch((res) => { @@ -881,7 +925,7 @@ export default { this.loadIns.close() }); } else { - this.$post(this.api.createCurriculum, this.form).then((res) => { + this.$post(this.api.createCurriculum, form).then((res) => { !fromBack ? this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", { type: "success", confirmButtonText: "马上设置", @@ -1055,8 +1099,12 @@ $avatar-width: 104px; .rm { font-size: 14px; cursor: pointer; + &.disabled { + color: #ccc; + cursor: not-allowed; + } &:hover { - color: #9076FF; + color: #17161f; } } } diff --git a/src/views/course/contentSettings.vue b/src/views/course/contentSettings.vue index 49395bc..d6c7832 100644 --- a/src/views/course/contentSettings.vue +++ b/src/views/course/contentSettings.vue @@ -72,7 +72,7 @@ - + @@ -84,7 +84,7 @@ - + - +
- + diff --git a/src/views/customer/customer.vue b/src/views/customer/customer.vue index 1932405..eddfcc9 100644 --- a/src/views/customer/customer.vue +++ b/src/views/customer/customer.vue @@ -143,7 +143,7 @@ export default { searchContent: this.form.keyword, page: this.page, size: this.pageSize, - supplierId: sid ? sid.supplierId : '' + supplierId: (sid && !sid.all) ? sid.supplierId : '' }).then(res => { this.listData = res.message.list this.total = res.message.totalCount diff --git a/src/views/data/Framework.vue b/src/views/data/Framework.vue index 25b3b73..00b75c8 100644 --- a/src/views/data/Framework.vue +++ b/src/views/data/Framework.vue @@ -569,6 +569,7 @@ export default { Promise.all(this.tablePromises).then(_ => { handleDisabled(res) this.importTypeList = res + this.$refs.typeTree.setCurrentKey() this.importLoading = false }) }).catch(res => { diff --git a/src/views/data/Product.vue b/src/views/data/Product.vue index e9d44fe..847b108 100644 --- a/src/views/data/Product.vue +++ b/src/views/data/Product.vue @@ -228,7 +228,12 @@ export default { previewHead: [], previewData: [], submited: false, - suppliers: [] + suppliers: [ + { + supplierName: '或然科技', + supplierId: '1' + } + ] }; }, watch: { @@ -257,7 +262,7 @@ export default { }, mounted() { this.getData() - this.getSupplier() + // this.getSupplier() }, methods: { // 获取产品列表 @@ -269,6 +274,7 @@ export default { pageSize: this.pageSize, productName: this.keyword, status: this.status, + supplierId: '1' }).then(res => { this.listData = res.pageList.records this.totals = res.pageList.total @@ -281,7 +287,10 @@ export default { }, // 获取供应厂商 getSupplier() { - this.$get(this.api.getSupplierListByRole).then(res => { + const sid = this.$store.state.dataPer.find(e => e.permissionName === '数据管理') + this.$get(this.api.getSupplierListByRole, { + permissionId: sid.permissionId + }).then(res => { this.suppliers = res.supplierList }).catch(res => {}) }, @@ -556,7 +565,7 @@ export default { if(!productName) return this.$message.warning('请输入数据产品名称') if(!market) return this.$message.warning('请输入市场单价格') if(isNaN(market)) return this.$message.warning('市场单价格请输入数字') - if(!supplier) return this.$message.warning('请输入供应厂商') + if(!supplier) return this.$message.warning('请选择供应厂商') if (settlementMethod == 0) { if(!settlementPrice) return this.$message.warning('请输入结算单价') if(isNaN(settlementPrice)) return this.$message.warning('结算单价请输入数字') diff --git a/src/views/devLogin.vue b/src/views/devLogin.vue new file mode 100644 index 0000000..937c046 --- /dev/null +++ b/src/views/devLogin.vue @@ -0,0 +1,422 @@ + + + + + \ No newline at end of file diff --git a/src/views/information/list/index.vue b/src/views/information/list/index.vue index f40fd39..473149b 100644 --- a/src/views/information/list/index.vue +++ b/src/views/information/list/index.vue @@ -31,6 +31,7 @@ export default { switchTab(id) { this.tabsName = id this.$store.commit('setInfoTab', id) + this.$store.commit('setColumnId', '') }, // 页面离开询问保存 routeLeave(fn, param) { diff --git a/src/views/order/AddOrder.vue b/src/views/order/AddOrder.vue index 041ba58..b42870e 100644 --- a/src/views/order/AddOrder.vue +++ b/src/views/order/AddOrder.vue @@ -988,13 +988,15 @@ export default { }, // 获取全部客户 getClients() { + // const sid = this.$store.state.dataPer.find(e => e.permissionName === '客户管理') this.$post(this.api.queryCustomer, { countries: this.form.countries, provinceId: '', cityId: '', searchContent: '', page: 1, - size: 1000 + size: 1000, + // supplierId: sid ? sid.supplierId : '' }).then(res => { this.clients = res.message.list }).catch(res => {}) @@ -1142,11 +1144,13 @@ export default { }, // 获取课程权限列表 getCourseJurisdiction() { + const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') let param = { pageSize: 10, pageNum: this.coursePage, isShelves: 1, // 只获取上架的课程 - curriculumName: this.curriculumName + curriculumName: this.curriculumName, + supplierId: sid ? sid.supplierId : '' }; this.dataLoading = true; this.$post(this.api.curriculumList, param).then(res => { diff --git a/src/views/order/Order.vue b/src/views/order/Order.vue index 145c256..3d0091d 100644 --- a/src/views/order/Order.vue +++ b/src/views/order/Order.vue @@ -75,19 +75,7 @@ - - - + @@ -251,13 +239,17 @@ export default { }, // 获取学校列表 getSchool() { + let sid = this.$store.state.dataPer.find(e => e.permissionName === '客户管理') + // 如果没有客户管理的权限,则取订单的供应商 + if (!sid) sid = this.$store.state.dataPer.find(e => e.permissionName === '订单管理') this.$post(this.api.queryCustomer, { countries: '中国', provinceId: '', cityId: '', searchContent: '', page: 1, - size: 10000 + size: 10000, + // supplierId: sid ? sid.supplierId : '' }).then(res => { this.schools = res.message.list }).catch(res => {}) @@ -275,13 +267,6 @@ export default { arr.push(row.orderId); this.$post(this.api.orderDelete, { ids: arr }).then(res => { this.$message.success("删除成功"); - if(this.orderData.length == 2){ - - }else{ - if(this.pageNo > 1){ - this.pageNo = this.pageNo-1 - } - } this.refreshCache(row.customerId) this.getData(); }).catch(res => { @@ -309,15 +294,11 @@ export default { }).then(() => { this.$post(this.api.orderDelete, { ids: list }).then(res => { const { orderData } = this - list.map(e => this.refreshCache(orderData.find(n => n.orderId == e).customerId)) + console.log("🚀 ~ file: Order.vue ~ line 299 ~ this.$post ~ message", list, orderData) this.$message.success("删除成功"); - if(list.length == this.orderData.length){ - if(this.pageNo > 1){ - this.pageNo = this.pageNo-1 - } - } this.$refs.table.clearSelection() this.getData(); + list.map(e => this.refreshCache(orderData.find(n => n.orderId == e).customerId)) }).catch(err => { }); }).catch(err => { diff --git a/src/views/order/selectClient.vue b/src/views/order/selectClient.vue index 48ecdaf..f64f70e 100644 --- a/src/views/order/selectClient.vue +++ b/src/views/order/selectClient.vue @@ -161,13 +161,15 @@ export default { methods: { // 取得列表 getData() { + // const sid = this.$store.state.dataPer.find(e => e.permissionName === '客户管理') this.$post(this.api.queryCustomer, { countries: this.form.countries, provinceId: this.form.provinces, cityId: this.form.city, searchContent: this.form.keyword, page: this.page, - size: this.pageSize + size: this.pageSize, + // supplierId: sid ? sid.supplierId : '' }).then(res => { res.message.list.map(e => { e.checked = false; diff --git a/src/views/system/role.vue b/src/views/system/role.vue index 5f7bc3e..1e6e90e 100644 --- a/src/views/system/role.vue +++ b/src/views/system/role.vue @@ -55,7 +55,8 @@ :props="defaultProps"> {{ node.label }} - 数据权限 + 数据权限 + ({{ data.supplierNames }})
@@ -71,7 +72,7 @@

请选择要关联的供应商系统

全部 - {{ item.supplierName }} + {{ item.supplierName }}
取 消 @@ -112,7 +113,7 @@ export default { dataVisible: false, suppliers: [], dataCheckAll: false, - curData: {} + curData: {}, }; }, watch: { @@ -125,6 +126,7 @@ export default { }, mounted() { this.getData() + this.getSupplier() }, methods: { getData() { @@ -133,6 +135,12 @@ export default { this.total = res.rolePage.total; }).catch(res => {}); }, + // 获取供应商 + getSupplier(data) { + this.$get(this.api.getSupplierList).then(res => { + this.suppliers = res.supplierList + }).catch(res => {}) + }, currentChange(val) { this.page = val; this.getData(); @@ -211,6 +219,18 @@ export default { } } catch (error) { } + // 默认全部供应商都勾选,并且至少要勾选一个 + const { datas, suppliers } = this + const ids = suppliers.map(e => e.supplierId) + data[0].children.map(e => { + if (datas.includes(e.name)) { + e.supplierNames = '' + if (!row) { + e.supplierIds = ids + } + + } + }) this.permissions = data; if (row) { this.getDetail(row); @@ -230,25 +250,37 @@ export default { checkAll(val) { this.suppliers.map(e => e.check = val) }, + // 数据权限回调 + supChange(val) { + this.dataCheckAll = !this.suppliers.find(e => !e.check) + }, // 展示数据权限弹框 - showData(data) { + showData(data, node) { this.curData = data this.dataVisible = true - this.$get(this.api.getSupplierList).then(res => { - const list = res.supplierList - const ids = data.supplierIds - list.map(e => e.check = ids ? ids.includes(e.supplierId) : false) - this.suppliers = list - this.dataCheckAll = !list.find(e => !e.check) - console.log("🚀 ~ file: role.vue ~ line 235 ~ showData ~ data", data) - }).catch(res => {}) + const list = this.suppliers + let ids = data.supplierIds + list.map(e => this.$set(e, 'check', ids ? ids.includes(e.supplierId) : false)) + this.suppliers = list + this.dataCheckAll = !list.find(e => !e.check) }, // 数据权限确定 dataSubmit() { + const ids = [] + let names = [] + this.suppliers.filter(e => e.check).map(e => { + ids.push(e.supplierId) + names.push(e.supplierName) + }) + names = this.dataCheckAll ? '全部' : names.join() + if (!ids.length) return this.$message.warning('请至少勾选一个供应商') const { id } = this.curData this.permissions[0].children.map(e => { // 给当前选择的权限赋上供应商id,提交的时候一起处理 - if (e.id == id) e.supplierIds = this.suppliers.filter(e => e.check).map(e => e.supplierId) + if (e.id == id) { + e.supplierIds = ids + e.supplierNames = names + } }) this.dataVisible = false }, @@ -269,7 +301,23 @@ export default { async getDetail(row) { // 查询详情 let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`); this.form = res.role; - this.form.id = row.id; + this.form.id = row.id + const checked = res.permissionList + const per = res.permissionVoList + const ids = this.suppliers.map(e => e.supplierId) + const len = ids.length + // 把勾选了的权限赋值为supplierIds + this.permissions[0].children.map(e => { + const sup = per.find(n => n.permissionId == e.id) + // 如果有数据权限,直接取值;或者没有勾选该权限,则直接勾选全部数据权限 + if (sup) { + e.supplierIds = sup.supplierId.split(',').map(e => +e) + e.supplierNames = sup.supplierName.split(',').length === len ? '全部' : sup.supplierName + } else if (!checked.includes(e.id)) { + e.supplierIds = ids + } + }) + console.log(33, this.permissions) this.checkedIds = this.handleRolePer(res.permissionList, this.permissions); this.$refs.per.setCheckedNodes(this.checkedIds); }, @@ -323,10 +371,8 @@ export default { \ No newline at end of file diff --git a/src/views/theoreticalCourse/list/index.vue b/src/views/theoreticalCourse/list/index.vue index f8eb546..360854b 100644 --- a/src/views/theoreticalCourse/list/index.vue +++ b/src/views/theoreticalCourse/list/index.vue @@ -48,10 +48,12 @@ export default { }, initTabs() { const { btns } = this.$store.state - const tab1 = btns.includes('/course/list:课程管理') - const tab2 = btns.includes('/course/list:分类管理') + const tab1 = btns.includes('/theoreticalCourse:平台自建') + const tab2 = btns.includes('/theoreticalCourse:院校创建') + const tab3 = btns.includes('/theoreticalCourse:分类管理') tab1 || delete this.tabs.first tab2 || delete this.tabs.second + tab3 || delete this.tabs.third } } };