Compare commits
No commits in common. "47d798e3803aedcfb2d38801ceaf87a4f59a6492" and "9facdae46f16a56083a88741224dda32f414bbca" have entirely different histories.
47d798e380
...
9facdae46f
|
|
@ -92,10 +92,6 @@ class MaterialViewSet(ModelViewSet):
|
|||
if (self.request.user.role != 'admin' and
|
||||
self.request.user.factory_id != self.get_object().factory_id):
|
||||
raise PermissionDenied("无权修改其他工厂的材料")
|
||||
|
||||
# 普通用户只能编辑创建中的材料
|
||||
if self.request.user.role != 'admin' and self.get_object().status != 'draft':
|
||||
raise PermissionDenied("只有创建中的材料可以编辑")
|
||||
serializer.save()
|
||||
|
||||
def perform_destroy(self, instance):
|
||||
|
|
@ -106,10 +102,6 @@ class MaterialViewSet(ModelViewSet):
|
|||
if (self.request.user.role != 'admin' and
|
||||
self.request.user.factory_id != instance.factory_id):
|
||||
raise PermissionDenied("无权删除其他工厂的材料")
|
||||
|
||||
# 普通用户只能删除创建中的材料
|
||||
if self.request.user.role != 'admin' and instance.status != 'draft':
|
||||
raise PermissionDenied("只有创建中的材料可以删除")
|
||||
instance.delete()
|
||||
|
||||
@action(detail=True, methods=['post'])
|
||||
|
|
|
|||
|
|
@ -119,9 +119,3 @@ a {
|
|||
.el-dialog {
|
||||
border-radius: var(--radius-lg);
|
||||
}
|
||||
|
||||
.dialog-scroll .el-dialog__body {
|
||||
max-height: 60vh;
|
||||
overflow: auto;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<el-dialog v-model="categoryDialogVisible" :title="categoryDialogTitle" width="480px" class="dialog-scroll">
|
||||
<el-dialog v-model="categoryDialogVisible" :title="categoryDialogTitle" width="480px">
|
||||
<el-form :model="categoryForm" label-width="90px">
|
||||
<el-form-item label="分类名称" required>
|
||||
<el-input v-model="categoryForm.name" />
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="subcategoryDialogVisible" :title="subcategoryDialogTitle" width="520px" class="dialog-scroll">
|
||||
<el-dialog v-model="subcategoryDialogVisible" :title="subcategoryDialogTitle" width="520px">
|
||||
<el-form :model="subcategoryForm" label-width="100px">
|
||||
<el-form-item label="所属分类" required>
|
||||
<el-select v-model="subcategoryForm.category" filterable>
|
||||
|
|
@ -233,11 +233,3 @@ onMounted(async () => {
|
|||
await loadSubcategories()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dialog-scroll :deep(.el-dialog__body) {
|
||||
max-height: 60vh;
|
||||
overflow: auto;
|
||||
padding-right: 8px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
/>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="640px" class="dialog-scroll">
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="640px">
|
||||
<el-form :model="form" label-width="100px">
|
||||
<el-form-item label="经销商" required>
|
||||
<el-input v-model="form.dealer_name" />
|
||||
|
|
@ -204,11 +204,5 @@ onMounted(() => {
|
|||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.dialog-scroll :deep(.el-dialog__body) {
|
||||
max-height: 60vh;
|
||||
overflow: auto;
|
||||
padding-right: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@
|
|||
<template #default="scope">
|
||||
<div class="table-actions">
|
||||
<el-button size="small" @click="goDetail(scope.row)">详情</el-button>
|
||||
<el-button v-if="canEdit(scope.row)" size="small" @click="openEdit(scope.row)">编辑</el-button>
|
||||
<el-button size="small" @click="openEdit(scope.row)">编辑</el-button>
|
||||
<el-button v-if="canSubmit(scope.row)" size="small" type="warning" @click="onSubmitAudit(scope.row)">提交审核</el-button>
|
||||
<el-button v-if="canApprove(scope.row)" size="small" type="success" @click="onApprove(scope.row)">审核通过</el-button>
|
||||
<el-button v-if="canApprove(scope.row)" size="small" type="danger" @click="onReject(scope.row)">审核拒绝</el-button>
|
||||
<el-button v-if="canDelete(scope.row)" size="small" type="danger" @click="onDelete(scope.row)">删除</el-button>
|
||||
<el-button size="small" type="danger" @click="onDelete(scope.row)">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
/>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="820px" class="dialog-scroll">
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="820px">
|
||||
<el-form :model="form" label-width="110px">
|
||||
<el-form-item label="材料名称" required>
|
||||
<el-input v-model="form.name" />
|
||||
|
|
@ -399,8 +399,6 @@ const onReject = async (row) => {
|
|||
loadMaterials()
|
||||
}
|
||||
|
||||
const canEdit = (row) => isAdmin.value || row.status === 'draft'
|
||||
const canDelete = (row) => isAdmin.value || row.status === 'draft'
|
||||
const canSubmit = (row) => !isAdmin.value && row.status === 'draft'
|
||||
const canApprove = (row) => isAdmin.value && row.status === 'pending'
|
||||
|
||||
|
|
@ -434,12 +432,6 @@ onMounted(() => {
|
|||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.dialog-scroll :deep(.el-dialog__body) {
|
||||
max-height: 60vh;
|
||||
overflow: auto;
|
||||
padding-right: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
/>
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="520px" class="dialog-scroll">
|
||||
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="520px">
|
||||
<el-form :model="form" label-width="90px">
|
||||
<el-form-item label="用户名" required>
|
||||
<el-input v-model="form.username" :disabled="isEdit" />
|
||||
|
|
@ -200,10 +200,4 @@ onMounted(() => {
|
|||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.dialog-scroll :deep(.el-dialog__body) {
|
||||
max-height: 60vh;
|
||||
overflow: auto;
|
||||
padding-right: 8px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue