diff --git a/src/main.js b/src/main.js index 539f207..921b70c 100644 --- a/src/main.js +++ b/src/main.js @@ -10,6 +10,7 @@ import '@/element-ui-theme' import '@/assets/scss/index.scss' import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios import { isAuth } from '@/utils' +import { accessField } from '@/utils' import cloneDeep from 'lodash/cloneDeep' import JsonExcel from 'vue-json-excel' import i18n from '@/i18n/i18n' @@ -34,6 +35,7 @@ if (process.env.NODE_ENV !== 'production') { // 挂载全局 Vue.prototype.$http = httpRequest // ajax请求方法 Vue.prototype.isAuth = isAuth // 权限方法 +Vue.prototype.accessField = accessField // 权限方法 Vue.prototype.getLodop = getLodop // 打印 Vue.prototype.decimalUtil = decimalUtil // 计算 Vue.prototype.dayjs = dayjs //时间格式化插件 2021-11-02 diff --git a/src/router/index.js b/src/router/index.js index 8e59d7b..88d0e59 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -77,6 +77,7 @@ router.beforeEach((to, from, next) => { router.options.isAddDynamicMenuRoutes = true sessionStorage.setItem('menuList', JSON.stringify(data.menuList || '[]')) sessionStorage.setItem('permissions', JSON.stringify(data.permissions || '[]')) + sessionStorage.setItem('accessField', JSON.stringify(data.accessField || '[]')) next({ ...to, replace: true }) } else { sessionStorage.setItem('menuList', '[]') diff --git a/src/utils/index.js b/src/utils/index.js index e104929..0a80a2a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -21,6 +21,11 @@ export function isAuth (key) { return JSON.parse(sessionStorage.getItem('permissions') || '[]').indexOf(key) !== -1 || false } + +export function accessField (key) { + return JSON.parse(sessionStorage.getItem('accessField') || '[]').indexOf(key) !== -1 || false +} + /** * 树形数据转换 * @param {*} data diff --git a/src/views/modules/project/projectInfo/projectInfo.vue b/src/views/modules/project/projectInfo/projectInfo.vue index 9bb5368..981a013 100644 --- a/src/views/modules/project/projectInfo/projectInfo.vue +++ b/src/views/modules/project/projectInfo/projectInfo.vue @@ -365,7 +365,8 @@ import sample from "./com_project_sample";/*組件*/ import test from "./com_project_test";/*組件*/ import purchase from "./com_project_info_purchase_request";/*組件*/ - import technicalSpecification from "./com_project_technicalSpecification";/*組件*/ + import technicalSpecification from "./com_project_technicalSpecification"; + /*組件*/ export default { components: { Chooselist, @@ -988,29 +989,11 @@ } }, watch: { - // $route: { - // handler: function (val, oldVal) { - // this.$router.onReady(() => { - // if (this.$route.query.order) { - // this.modelData.orderNo = this.$route.query.order - // this.modelData.site = this.$route.query.site - // this.modelData.user = this.$route.query.user - // if (this.modelData.orderNo) { - // this.tableHanddle(this.modelData) - // } - // } - // }) - // }, - // // 深度观察监听 - // deep: true - // }, - - // updateData: { + // columnList1: { // deep: true, // handler: function (newV, oldV) { - // this.updateData.projectID = this.updateData.projectID.toUpperCase(); - // this.updateData.oriSOOrderNo = this.updateData.oriSOOrderNo.toUpperCase(); - // this.updateData.orderType = this.updateData.orderType.toUpperCase(); + // debugger + // // } // } }, @@ -1360,12 +1343,14 @@ status: true, languageCode: this.$i18n.locale } + await getTableUserListLanguage(queryTableUser).then(({data}) => { if (data.rows.length > 0) { //this.columnList = [] switch (columnId) { case 1: this.columnList1 = data.rows + this.checkField(); break; // case 2: // this.columnList1 = data.rows @@ -1387,7 +1372,6 @@ // 获取 tableDefault 列 async getColumnList(tableId, columnId) { - this.queryTable.tableId = tableId let queryTable= { functionId: this.$route.meta.menuId, tableId: tableId, @@ -1398,6 +1382,7 @@ switch (columnId) { case 1: this.columnList1 = data.rows + this.checkField(); break; // case 2: // this.columnList1 = data.rows @@ -1512,6 +1497,17 @@ }, + checkField(){ + + if(!this.accessField('10202001')){ + this.columnList1=this.columnList1.filter(item => item.columnProp !== 'customerId'); + this.columnList1=this.columnList1.filter(item => item.columnProp !== 'customerName'); + } + if(!this.accessField('10202002')){ + this.columnList1=this.columnList1.filter(item => item.columnProp !== 'projectSource'); + } + + }, }, created() { this.getTableUserColumn(this.$route.meta.menuId+'table1',1) diff --git a/src/views/modules/sys/user.vue b/src/views/modules/sys/user.vue index 2541993..ca4c910 100644 --- a/src/views/modules/sys/user.vue +++ b/src/views/modules/sys/user.vue @@ -242,7 +242,7 @@ - 关闭 + 关闭