Browse Source

只有登录人具备 PJM 角色(R002)时才会出现,并且才能执行删除

master
han\hanst 1 day ago
parent
commit
6aa641193d
  1. 45
      src/views/modules/common/uploadFileList1.vue
  2. 2
      src/views/modules/eam/com_project_proof_record.vue

45
src/views/modules/common/uploadFileList1.vue

@ -1,6 +1,7 @@
<script> <script>
import {uploadFileList} from '@/api/base/baseFunction.js'; import {uploadFileList} from '@/api/base/baseFunction.js';
import {deleteDocumentType,getProofDocument} from "@/api/eam/eamProofing.js"; import {deleteDocumentType,getProofDocument} from "@/api/eam/eamProofing.js";
import {getBusinessRoleList} from '@/api/factory/site.js';
import {EventBus} from "../../../main"; import {EventBus} from "../../../main";
export default { export default {
name: "uploadFileList", name: "uploadFileList",
@ -107,11 +108,18 @@ export default {
}, },
isEditable: Boolean, isEditable: Boolean,
isMassProductionStage: Boolean, isMassProductionStage: Boolean,
// 打样文档附件上传才要求 PJM;其它复用该弹窗的页面不传,删除按钮保持原样
requirePjmRole: {
type: Boolean,
default: false
}
}, },
data () { data () {
return { return {
//fileRemark: '', //fileRemark: '',
fileName: '', fileName: '',
// 登录人是否拥有 PJM 角色(access_role.role_no = R002)。未确认前按无权限处理,避免按钮先露出来
hasPjmRole: false,
noType1: '', noType1: '',
conclusion: '', conclusion: '',
documentGroupDesc: '', documentGroupDesc: '',
@ -164,15 +172,28 @@ export default {
}else { }else {
return this.isEditable ? 'N/A' : ''; return this.isEditable ? 'N/A' : '';
} }
},
// 未开启角色限制时所有人可删;开启后必须已确认当前登录人有 R002
canDeleteDocument () {
if (!this.requirePjmRole) {
return true
}
return this.hasPjmRole
} }
}, },
watch: { watch: {
conclusionDefaultValue(newValue) { conclusionDefaultValue(newValue) {
this.conclusion = newValue; this.conclusion = newValue;
},
uploadDialog (visible) {
if (visible) {
this.loadPjmDeletePermission()
}
} }
}, },
created() { created() {
this.conclusion = this.conclusionDefaultValue; this.conclusion = this.conclusionDefaultValue;
this.loadPjmDeletePermission()
}, },
beforeDestroy() { beforeDestroy() {
// 组件销毁前清理数据 // 组件销毁前清理数据
@ -292,7 +313,30 @@ export default {
uploadDocumentClickRow(row) { uploadDocumentClickRow(row) {
this.documentClickRow = JSON.parse(JSON.stringify(row)) this.documentClickRow = JSON.parse(JSON.stringify(row))
}, },
// PJM 以 access_role.role_no=R002 为准,与待上传页「全部」视图的人员口径一致
loadPjmDeletePermission () {
if (!this.requirePjmRole) {
return
}
const username = this.$store.state.user && this.$store.state.user.name
? this.$store.state.user.name
: ''
if (!username) {
this.hasPjmRole = false
return
}
getBusinessRoleList({ username }).then(({data}) => {
const roleList = data && data.code === 0 && Array.isArray(data.row2) ? data.row2 : []
this.hasPjmRole = roleList.some((role) => role && String(role.roleNo || '').trim() === 'R002')
}).catch(() => {
this.hasPjmRole = false
})
},
DeleteDocumentType(row) { DeleteDocumentType(row) {
if (!this.canDeleteDocument) {
this.$message.warning('仅PJM角色(R002)可以删除')
return
}
this.$confirm('是否删除该文档清单?', '提示', { this.$confirm('是否删除该文档清单?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
@ -488,6 +532,7 @@ export default {
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="canDeleteDocument"
header-align="center" header-align="center"
align="center" align="center"
width="100" width="100"

2
src/views/modules/eam/com_project_proof_record.vue

@ -638,7 +638,7 @@
:project-id="proofDocumenCurrentRow.projectId" :project-no="proofDocumenCurrentRow.projectNo" :project-desc="proofDocumenCurrentRow.projectDesc" :document-type="proofDocumenCurrentRow.documentType" :id="documentClickRow.id" :project-id="proofDocumenCurrentRow.projectId" :project-no="proofDocumenCurrentRow.projectNo" :project-desc="proofDocumenCurrentRow.projectDesc" :document-type="proofDocumenCurrentRow.documentType" :id="documentClickRow.id"
:customer-no="proofDocumenCurrentRow.customerNo" :customer-desc="proofDocumenCurrentRow.customerDesc" :test-part-no="proofDocumenCurrentRow.testPartNo" :project-part-id="proofDocumenCurrentRow.projectPartId" :customer-no="proofDocumenCurrentRow.customerNo" :customer-desc="proofDocumenCurrentRow.customerDesc" :test-part-no="proofDocumenCurrentRow.testPartNo" :project-part-id="proofDocumenCurrentRow.projectPartId"
:part-desc="proofDocumenCurrentRow.partDesc" :column-file-content-array="columnFileContentArray" :proof-document-list="proofDocumentList" :document-definition-list-id="documentClickRow.documentDefinitionListId" :part-desc="proofDocumenCurrentRow.partDesc" :column-file-content-array="columnFileContentArray" :proof-document-list="proofDocumentList" :document-definition-list-id="documentClickRow.documentDefinitionListId"
path="/upload/test" :is-editable="isEditable"></upload-file-list-1>
path="/upload/test" :is-editable="isEditable" :require-pjm-role="true"></upload-file-list-1>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div> </div>

Loading…
Cancel
Save