Browse Source

plm字段权限

master
ruanqi 2 years ago
parent
commit
5b989cc8b0
  1. 2
      src/main.js
  2. 1
      src/router/index.js
  3. 5
      src/utils/index.js
  4. 42
      src/views/modules/project/projectInfo/projectInfo.vue
  5. 2
      src/views/modules/sys/user.vue

2
src/main.js

@ -10,6 +10,7 @@ import '@/element-ui-theme'
import '@/assets/scss/index.scss' import '@/assets/scss/index.scss'
import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios import httpRequest from '@/utils/httpRequest' // api: https://github.com/axios/axios
import { isAuth } from '@/utils' import { isAuth } from '@/utils'
import { accessField } from '@/utils'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
import JsonExcel from 'vue-json-excel' import JsonExcel from 'vue-json-excel'
import i18n from '@/i18n/i18n' import i18n from '@/i18n/i18n'
@ -34,6 +35,7 @@ if (process.env.NODE_ENV !== 'production') {
// 挂载全局 // 挂载全局
Vue.prototype.$http = httpRequest // ajax请求方法 Vue.prototype.$http = httpRequest // ajax请求方法
Vue.prototype.isAuth = isAuth // 权限方法 Vue.prototype.isAuth = isAuth // 权限方法
Vue.prototype.accessField = accessField // 权限方法
Vue.prototype.getLodop = getLodop // 打印 Vue.prototype.getLodop = getLodop // 打印
Vue.prototype.decimalUtil = decimalUtil // 计算 Vue.prototype.decimalUtil = decimalUtil // 计算
Vue.prototype.dayjs = dayjs //时间格式化插件 2021-11-02 Vue.prototype.dayjs = dayjs //时间格式化插件 2021-11-02

1
src/router/index.js

@ -77,6 +77,7 @@ router.beforeEach((to, from, next) => {
router.options.isAddDynamicMenuRoutes = true router.options.isAddDynamicMenuRoutes = true
sessionStorage.setItem('menuList', JSON.stringify(data.menuList || '[]')) sessionStorage.setItem('menuList', JSON.stringify(data.menuList || '[]'))
sessionStorage.setItem('permissions', JSON.stringify(data.permissions || '[]')) sessionStorage.setItem('permissions', JSON.stringify(data.permissions || '[]'))
sessionStorage.setItem('accessField', JSON.stringify(data.accessField || '[]'))
next({ ...to, replace: true }) next({ ...to, replace: true })
} else { } else {
sessionStorage.setItem('menuList', '[]') sessionStorage.setItem('menuList', '[]')

5
src/utils/index.js

@ -21,6 +21,11 @@ export function isAuth (key) {
return JSON.parse(sessionStorage.getItem('permissions') || '[]').indexOf(key) !== -1 || false 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 * @param {*} data

42
src/views/modules/project/projectInfo/projectInfo.vue

@ -365,7 +365,8 @@
import sample from "./com_project_sample";/*組件*/ import sample from "./com_project_sample";/*組件*/
import test from "./com_project_test";/*組件*/ import test from "./com_project_test";/*組件*/
import purchase from "./com_project_info_purchase_request";/*組件*/ import purchase from "./com_project_info_purchase_request";/*組件*/
import technicalSpecification from "./com_project_technicalSpecification";/*組件*/
import technicalSpecification from "./com_project_technicalSpecification";
/*組件*/
export default { export default {
components: { components: {
Chooselist, Chooselist,
@ -988,29 +989,11 @@
} }
}, },
watch: { 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, // deep: true,
// handler: function (newV, oldV) { // 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, status: true,
languageCode: this.$i18n.locale languageCode: this.$i18n.locale
} }
await getTableUserListLanguage(queryTableUser).then(({data}) => { await getTableUserListLanguage(queryTableUser).then(({data}) => {
if (data.rows.length > 0) { if (data.rows.length > 0) {
//this.columnList = [] //this.columnList = []
switch (columnId) { switch (columnId) {
case 1: case 1:
this.columnList1 = data.rows this.columnList1 = data.rows
this.checkField();
break; break;
// case 2: // case 2:
// this.columnList1 = data.rows // this.columnList1 = data.rows
@ -1387,7 +1372,6 @@
// tableDefault // tableDefault
async getColumnList(tableId, columnId) { async getColumnList(tableId, columnId) {
this.queryTable.tableId = tableId
let queryTable= { let queryTable= {
functionId: this.$route.meta.menuId, functionId: this.$route.meta.menuId,
tableId: tableId, tableId: tableId,
@ -1398,6 +1382,7 @@
switch (columnId) { switch (columnId) {
case 1: case 1:
this.columnList1 = data.rows this.columnList1 = data.rows
this.checkField();
break; break;
// case 2: // case 2:
// this.columnList1 = data.rows // 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() { created() {
this.getTableUserColumn(this.$route.meta.menuId+'table1',1) this.getTableUserColumn(this.$route.meta.menuId+'table1',1)

2
src/views/modules/sys/user.vue

@ -242,7 +242,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="modelFlag = false">关闭</el-button>
<el-button type="primary" @click="functionFlag = false">关闭</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 字段授权 --> <!-- 字段授权 -->

Loading…
Cancel
Save