feat(mes/qc/inspection/task): 添加工单附件管理功能

This commit is contained in:
2026-05-28 15:25:03 +08:00
parent 73e98af96e
commit 9cfb96f2c3

View File

@@ -112,6 +112,13 @@
</template>
</el-table-column> -->
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="附件" align="center" prop="attachmentFiles" width="80">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleAttachment(scope.row)">
{{ getAttachmentCount(scope.row) }}
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
<template slot-scope="scope">
<el-button v-if="!readonly" size="mini" type="text" icon="el-icon-edit"
@@ -366,6 +373,14 @@
</el-dialog>
<SchemeSelect :visible.sync="schemeVisible" @confirm="handleSchemeConfirm" />
<el-dialog :title="attachmentTitle" :visible.sync="attachmentOpen" width="500px" append-to-body>
<file-upload v-model="attachmentFiles" :limit="10" />
<div slot="footer" class="dialog-footer">
<el-button :loading="attachmentLoading" type="primary" @click="submitAttachment"> </el-button>
<el-button @click="attachmentOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@@ -376,6 +391,7 @@ import { listInspectionItemTemplate } from "@/api/mes/qc/inspectionItemTemplate"
import { SchemeSelect } from "@/components/KLPService";
import CoilSelector from "@/components/CoilSelector/index.vue";
import CurrentCoilNo from "@/components/KLPService/Renderer/CurrentCoilNo.vue";
import FileUpload from "@/components/FileUpload";
import { listCoilByIds, listMaterialCoil } from "@/api/wms/coil";
export default {
@@ -389,7 +405,8 @@ export default {
components: {
SchemeSelect,
CoilSelector,
CurrentCoilNo
CurrentCoilNo,
FileUpload
},
data() {
return {
@@ -471,6 +488,11 @@ export default {
enterCoilNoLoading: false,
selectedEnterCoilNos: [],
tempEnterCoilNo: '',
attachmentOpen: false,
attachmentTitle: '',
attachmentLoading: false,
attachmentTaskRow: null,
attachmentFiles: '',
};
},
computed: {
@@ -869,6 +891,29 @@ export default {
};
this.resetForm("itemForm");
},
getAttachmentCount(row) {
if (!row.attachmentFiles) return 0;
return row.attachmentFiles.split(',').filter(f => f).length;
},
handleAttachment(row) {
this.attachmentTaskRow = row;
this.attachmentTitle = `附件管理 - ${row.taskCode}`;
this.attachmentFiles = row.attachmentFiles || '';
this.attachmentOpen = true;
},
submitAttachment() {
this.attachmentLoading = true;
updateInspectionTask({
taskId: this.attachmentTaskRow.taskId,
attachmentFiles: this.attachmentFiles
}).then(() => {
this.$modal.msgSuccess('附件保存成功');
this.attachmentTaskRow.attachmentFiles = this.attachmentFiles;
this.attachmentOpen = false;
}).finally(() => {
this.attachmentLoading = false;
});
},
}
};
</script>