|
|
|
@ -34,6 +34,12 @@
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['qms:qcInspectionTemplate:export']">导出</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="warning" plain icon="Download" @click="handleExportTemplate" v-hasPermi="['qms:qcInspectionTemplate:export']">导出模板</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="primary" plain icon="Upload" @click="handleImport" v-hasPermi="['qms:qcInspectionTemplate:add']">导入</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
</template>
|
|
|
|
@ -309,11 +315,12 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
<input ref="fileInput" type="file" accept=".xlsx, .xls" style="display: none" @change="onFileChange" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup name="QcInspectionTemplate" lang="ts">
|
|
|
|
|
import { listQcInspectionTemplate, getQcInspectionTemplate, delQcInspectionTemplate, addQcInspectionTemplate, updateQcInspectionTemplate, getQcTemplateItemList } from '@/api/qms/qcInspectionTemplate';
|
|
|
|
|
import { listQcInspectionTemplate, getQcInspectionTemplate, delQcInspectionTemplate, addQcInspectionTemplate, updateQcInspectionTemplate, getQcTemplateItemList, importData } from '@/api/qms/qcInspectionTemplate';
|
|
|
|
|
import { QcInspectionTemplateVO, QcInspectionTemplateQuery, QcInspectionTemplateForm } from '@/api/qms/qcInspectionTemplate/types';
|
|
|
|
|
import { listQcTemplateItem, getQcTemplateItem, delQcTemplateItem, addQcTemplateItem, updateQcTemplateItem } from '@/api/qms/qcTemplateItem';
|
|
|
|
|
import { QcTemplateItemVO, QcTemplateItemQuery, QcTemplateItemForm } from '@/api/qms/qcTemplateItem/types';
|
|
|
|
@ -689,6 +696,45 @@ const handleExport = () => {
|
|
|
|
|
}, `qcInspectionTemplate_${new Date().getTime()}.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 导出模板按钮操作 */
|
|
|
|
|
const handleExportTemplate = () => {
|
|
|
|
|
proxy?.download('qms/qcInspectionTemplate/exportTemplate', {
|
|
|
|
|
|
|
|
|
|
}, `qcInspectionTemplate_template_${new Date().getTime()}.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 导出模板按钮操作 */
|
|
|
|
|
const handleExportTemplate = () => {
|
|
|
|
|
proxy?.download('qms/qcInspectionTemplate/exportTemplate', {
|
|
|
|
|
|
|
|
|
|
}, `qcInspectionTemplate_template_${new Date().getTime()}.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 导入按钮操作 */
|
|
|
|
|
const fileInput = ref<HTMLInputElement>();
|
|
|
|
|
const uploading = ref(false);
|
|
|
|
|
const handleImport = () => {
|
|
|
|
|
fileInput.value?.click();
|
|
|
|
|
}
|
|
|
|
|
const onFileChange = async (event: Event) => {
|
|
|
|
|
const input = event.target as HTMLInputElement;
|
|
|
|
|
if (input.files && input.files.length > 0) {
|
|
|
|
|
const file = input.files[0];
|
|
|
|
|
uploading.value = true;
|
|
|
|
|
try {
|
|
|
|
|
await importData(file, true);
|
|
|
|
|
proxy?.$modal.msgSuccess("导入成功");
|
|
|
|
|
await getList();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
proxy?.$modal.msgError("导入失败");
|
|
|
|
|
console.error(err);
|
|
|
|
|
} finally {
|
|
|
|
|
uploading.value = false;
|
|
|
|
|
input.value = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取检测类型列表(不分页,获取全部)
|
|
|
|
|
let qcInspectionTypeList = ref([]);
|
|
|
|
@ -705,6 +751,31 @@ const getInspectionItemList = async () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 导入按钮操作 */
|
|
|
|
|
const fileInput = ref<HTMLInputElement>();
|
|
|
|
|
const uploading = ref(false);
|
|
|
|
|
const handleImport = () => {
|
|
|
|
|
fileInput.value?.click();
|
|
|
|
|
}
|
|
|
|
|
const onFileChange = async (event: Event) => {
|
|
|
|
|
const input = event.target as HTMLInputElement;
|
|
|
|
|
if (input.files && input.files.length > 0) {
|
|
|
|
|
const file = input.files[0];
|
|
|
|
|
uploading.value = true;
|
|
|
|
|
try {
|
|
|
|
|
await importData(file, true);
|
|
|
|
|
proxy?.$modal.msgSuccess("导入成功");
|
|
|
|
|
await getList();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
proxy?.$modal.msgError("导入失败");
|
|
|
|
|
console.error(err);
|
|
|
|
|
} finally {
|
|
|
|
|
uploading.value = false;
|
|
|
|
|
input.value = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList();
|
|
|
|
|
getInspectionTypeList();
|
|
|
|
|