|
|
|
|
@ -69,6 +69,12 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="备注" align="center" prop="remark" v-if="columns[8].visible"/>
|
|
|
|
|
<el-table-column label="附件" align="center" v-if="columns[14] && columns[14].visible">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="primary" :disabled="!scope.row.photoAddress" @click="handlePreview(scope.row)">预览</el-button>
|
|
|
|
|
<el-button link type="primary" :disabled="!scope.row.ossId" @click="handleDownload(scope.row)">下载</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tooltip content="修改" placement="top">
|
|
|
|
|
@ -111,7 +117,13 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="保养标准" prop="maintProtocol">
|
|
|
|
|
<el-input v-model="form.maintProtocol" placeholder="请输入保养标准" />
|
|
|
|
|
<!-- <el-input v-model="form.maintProtocol" placeholder="请输入保养标准" /> -->
|
|
|
|
|
<el-select v-model="form.maintProtocol" placeholder="请选择保养标准" clearable>
|
|
|
|
|
<el-option v-for="item in maintProtocolOptions"
|
|
|
|
|
:key="item.maintProtocol"
|
|
|
|
|
:label="item.maintProtocol"
|
|
|
|
|
:value="item.maintProtocol" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="操作描述" prop="operationDescription">
|
|
|
|
|
<el-input v-model="form.operationDescription" placeholder="请输入操作描述" />
|
|
|
|
|
@ -128,6 +140,9 @@
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="附件" prop="file">
|
|
|
|
|
<FileUpload v-model="form.file" :limit="1" :file-type="['doc','docx','xls','ppt','txt','pdf']" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
@ -144,6 +159,8 @@ import { listDmsKnowledgeMaint, getDmsKnowledgeMaint, delDmsKnowledgeMaint, addD
|
|
|
|
|
import { DmsKnowledgeMaintVO, DmsKnowledgeMaintQuery, DmsKnowledgeMaintForm } from '@/api/dms/dmsKnowledgeMaint/types';
|
|
|
|
|
import {getBaseDeviceTypeList} from "@/api/dms/baseDeviceType";
|
|
|
|
|
import {getDmsBaseMaintStationList} from "@/api/dms/dmsBaseMaintStation";
|
|
|
|
|
import FileUpload from '@/components/FileUpload/index.vue';
|
|
|
|
|
import { getDmsBaseMaintStandardList } from '@/api/dms/dmsBaseMaintStandard';
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const { active_flag } = toRefs<any>(proxy?.useDict('active_flag'));
|
|
|
|
|
@ -181,6 +198,7 @@ const columns = ref<FieldOption[]>([
|
|
|
|
|
{ key: 11, label: `创建时间`, visible: false },
|
|
|
|
|
{ key: 12, label: `更新人`, visible: false },
|
|
|
|
|
{ key: 13, label: `更新时间`, visible: false },
|
|
|
|
|
{ key: 14, label: `附件`, visible: true },
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const initFormData: DmsKnowledgeMaintForm = {
|
|
|
|
|
@ -280,6 +298,8 @@ const handleUpdate = async (row?: DmsKnowledgeMaintVO) => {
|
|
|
|
|
const _knowledgeMaintId = row?.knowledgeMaintId || ids.value[0]
|
|
|
|
|
const res = await getDmsKnowledgeMaint(_knowledgeMaintId);
|
|
|
|
|
Object.assign(form.value, res.data);
|
|
|
|
|
// 回显已上传附件(支持通过 ossId 查询)
|
|
|
|
|
(form.value as any).file = res.data?.ossId ? res.data.ossId : undefined;
|
|
|
|
|
dialog.visible = true;
|
|
|
|
|
dialog.title = "修改保养知识库";
|
|
|
|
|
}
|
|
|
|
|
@ -289,6 +309,14 @@ const submitForm = () => {
|
|
|
|
|
dmsKnowledgeMaintFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
const f: any = form.value as any;
|
|
|
|
|
if (f.file && f.file.length > 0) {
|
|
|
|
|
f.ossId = f.file[0]?.ossId;
|
|
|
|
|
f.photoAddress = f.file[0]?.url;
|
|
|
|
|
} else {
|
|
|
|
|
f.ossId = undefined;
|
|
|
|
|
f.photoAddress = undefined;
|
|
|
|
|
}
|
|
|
|
|
if (form.value.knowledgeMaintId) {
|
|
|
|
|
await updateDmsKnowledgeMaint(form.value).finally(() => buttonLoading.value = false);
|
|
|
|
|
} else {
|
|
|
|
|
@ -331,9 +359,33 @@ const getBaseMaintStationOption = async () => {
|
|
|
|
|
maintStationOptions.value = res.data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 保养标准下拉框
|
|
|
|
|
let maintProtocolOptions = ref([]);
|
|
|
|
|
const getMaintProtocolOption = async () => {
|
|
|
|
|
const res = await getDmsBaseMaintStandardList(null);
|
|
|
|
|
maintProtocolOptions.value = res.data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getBaseDeviceTypeOption();
|
|
|
|
|
getBaseMaintStationOption();
|
|
|
|
|
getMaintProtocolOption();
|
|
|
|
|
getList();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 预览与下载附件
|
|
|
|
|
const handlePreview = (row: DmsKnowledgeMaintVO) => {
|
|
|
|
|
if (row.photoAddress) {
|
|
|
|
|
window.open(row.photoAddress, '_blank');
|
|
|
|
|
} else {
|
|
|
|
|
proxy?.$modal.msgWarning('暂无附件预览');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const handleDownload = (row: DmsKnowledgeMaintVO) => {
|
|
|
|
|
if (row.ossId) {
|
|
|
|
|
proxy?.$download.oss(row.ossId as any);
|
|
|
|
|
} else {
|
|
|
|
|
proxy?.$modal.msgWarning('暂无可下载附件');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|