|
|
@ -12,8 +12,8 @@ |
|
|
<template v-if="isListMode"> |
|
|
<template v-if="isListMode"> |
|
|
<div class="table-toolbar"> |
|
|
<div class="table-toolbar"> |
|
|
<div> |
|
|
<div> |
|
|
<el-button type="primary" size="mini" icon="el-icon-plus" @click="addModal">新增</el-button> |
|
|
|
|
|
<el-button size="mini" icon="el-icon-delete" @click="deleteModal">删除</el-button> |
|
|
|
|
|
|
|
|
<el-button type="primary" size="mini" icon="el-icon-plus" :disabled="authAdd" @click="addModal">新增</el-button> |
|
|
|
|
|
<el-button size="mini" icon="el-icon-delete" :disabled="authDelete" @click="deleteModal">删除</el-button> |
|
|
</div> |
|
|
</div> |
|
|
<span class="toolbar-tip">卷号、MRB、制程异常单为必填项</span> |
|
|
<span class="toolbar-tip">卷号、MRB、制程异常单为必填项</span> |
|
|
</div> |
|
|
</div> |
|
|
@ -34,7 +34,8 @@ |
|
|
<el-table-column prop="mrbRemark" label="备注" min-width="220" show-overflow-tooltip></el-table-column> |
|
|
<el-table-column prop="mrbRemark" label="备注" min-width="220" show-overflow-tooltip></el-table-column> |
|
|
<el-table-column label="操作" width="90" align="center"> |
|
|
<el-table-column label="操作" width="90" align="center"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<el-link style="cursor: pointer" @click="editModal(scope.row)">编辑</el-link> |
|
|
|
|
|
|
|
|
<el-link v-if="!authEdit" style="cursor: pointer" @click="editModal(scope.row)">编辑</el-link> |
|
|
|
|
|
<span v-else class="action-disabled">编辑</span> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
@ -124,11 +125,18 @@ export default { |
|
|
mode: { |
|
|
mode: { |
|
|
type: String, |
|
|
type: String, |
|
|
default: 'list' |
|
|
default: 'list' |
|
|
|
|
|
}, |
|
|
|
|
|
menuId: { |
|
|
|
|
|
type: [String, Number], |
|
|
|
|
|
default: '' |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
data () { |
|
|
data () { |
|
|
return { |
|
|
return { |
|
|
loading: false, |
|
|
loading: false, |
|
|
|
|
|
authEdit: false, |
|
|
|
|
|
authAdd: false, |
|
|
|
|
|
authDelete: false, |
|
|
scheduleData: { |
|
|
scheduleData: { |
|
|
site: '', |
|
|
site: '', |
|
|
orderNo: '', |
|
|
orderNo: '', |
|
|
@ -167,7 +175,48 @@ export default { |
|
|
return this.editDialogMode === 'edit' ? 'MRB异常单编辑' : 'MRB异常单登记' |
|
|
return this.editDialogMode === 'edit' ? 'MRB异常单编辑' : 'MRB异常单登记' |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
watch: { |
|
|
|
|
|
mode () { |
|
|
|
|
|
this.refreshAuthFlags() |
|
|
|
|
|
}, |
|
|
|
|
|
menuId () { |
|
|
|
|
|
this.refreshAuthFlags() |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
created () { |
|
|
|
|
|
this.refreshAuthFlags() |
|
|
|
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
resolvePermissionMenuId () { |
|
|
|
|
|
if (this.menuId !== undefined && this.menuId !== null && this.menuId !== '') { |
|
|
|
|
|
return String(this.menuId) |
|
|
|
|
|
} |
|
|
|
|
|
if (this.$route && this.$route.meta && this.$route.meta.menuId) { |
|
|
|
|
|
return String(this.$route.meta.menuId) |
|
|
|
|
|
} |
|
|
|
|
|
return '' |
|
|
|
|
|
}, |
|
|
|
|
|
refreshAuthFlags () { |
|
|
|
|
|
if (!this.isListMode || typeof this.isAuth !== 'function') { |
|
|
|
|
|
this.authEdit = false |
|
|
|
|
|
this.authAdd = false |
|
|
|
|
|
this.authDelete = false |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const functionId = this.resolvePermissionMenuId() |
|
|
|
|
|
if (!functionId) { |
|
|
|
|
|
this.authEdit = false |
|
|
|
|
|
this.authAdd = false |
|
|
|
|
|
this.authDelete = false |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
const addFlag = this.isAuth(functionId + ':addMrb') |
|
|
|
|
|
const updateFlag = this.isAuth(functionId + ':updateMrb') |
|
|
|
|
|
const deleteFlag = this.isAuth(functionId + ':deleteMrb') |
|
|
|
|
|
this.authEdit = !updateFlag |
|
|
|
|
|
this.authAdd = !addFlag |
|
|
|
|
|
this.authDelete = !deleteFlag |
|
|
|
|
|
}, |
|
|
createEmptyForm () { |
|
|
createEmptyForm () { |
|
|
return { |
|
|
return { |
|
|
id: null, |
|
|
id: null, |
|
|
@ -202,6 +251,7 @@ export default { |
|
|
})) |
|
|
})) |
|
|
}, |
|
|
}, |
|
|
init (scheduleData) { |
|
|
init (scheduleData) { |
|
|
|
|
|
this.refreshAuthFlags() |
|
|
this.scheduleData = { |
|
|
this.scheduleData = { |
|
|
site: scheduleData.site || '', |
|
|
site: scheduleData.site || '', |
|
|
orderNo: scheduleData.orderNo || '', |
|
|
orderNo: scheduleData.orderNo || '', |
|
|
@ -287,12 +337,20 @@ export default { |
|
|
this.selectedRowKeys = (rows || []).map(item => item.rowKey) |
|
|
this.selectedRowKeys = (rows || []).map(item => item.rowKey) |
|
|
}, |
|
|
}, |
|
|
addModal () { |
|
|
addModal () { |
|
|
|
|
|
if (this.authAdd) { |
|
|
|
|
|
this.$message.warning('当前用户无新增权限') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
this.editDialogMode = 'add' |
|
|
this.editDialogMode = 'add' |
|
|
this.editForm = this.createEmptyForm() |
|
|
this.editForm = this.createEmptyForm() |
|
|
this.editDialogVisible = true |
|
|
this.editDialogVisible = true |
|
|
this.clearValidate() |
|
|
this.clearValidate() |
|
|
}, |
|
|
}, |
|
|
editModal (row) { |
|
|
editModal (row) { |
|
|
|
|
|
if (this.authEdit) { |
|
|
|
|
|
this.$message.warning('当前用户无编辑权限') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (!row) { |
|
|
if (!row) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
@ -348,6 +406,10 @@ export default { |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
deleteModal () { |
|
|
deleteModal () { |
|
|
|
|
|
if (this.authDelete) { |
|
|
|
|
|
this.$message.warning('当前用户无删除权限') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) { |
|
|
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) { |
|
|
this.$message.warning('请先勾选要删除的记录') |
|
|
this.$message.warning('请先勾选要删除的记录') |
|
|
return |
|
|
return |
|
|
@ -496,6 +558,10 @@ export default { |
|
|
color: #909399; |
|
|
color: #909399; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.action-disabled { |
|
|
|
|
|
color: #c0c4cc; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.dialog-footer { |
|
|
.dialog-footer { |
|
|
text-align: center; |
|
|
text-align: center; |
|
|
margin-top: 15px; |
|
|
margin-top: 15px; |
|
|
|