|
|
|
@ -47,6 +47,12 @@
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['qms:qcInspectionType:export']">导出</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="warning" plain icon="Download" @click="handleExportTemplate" v-hasPermi="['qms:qcInspectionType:export']">导出模板</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="primary" plain icon="Upload" @click="handleImport" v-hasPermi="['qms:qcInspectionType:add']">导入</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
</template>
|
|
|
|
@ -86,6 +92,7 @@
|
|
|
|
|
|
|
|
|
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改检测类型对话框 -->
|
|
|
|
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
|
|
|
|
<el-form ref="qcInspectionTypeFormRef" :model="form" :rules="rules" label-width="120px">
|
|
|
|
@ -126,11 +133,12 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
<input ref="fileInput" type="file" accept=".xlsx, .xls" style="display: none" @change="onFileChange" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup name="QcInspectionType" lang="ts">
|
|
|
|
|
import { listQcInspectionType, getQcInspectionType, delQcInspectionType, addQcInspectionType, updateQcInspectionType } from '@/api/qms/qcInspectionType';
|
|
|
|
|
import { listQcInspectionType, getQcInspectionType, delQcInspectionType, addQcInspectionType, updateQcInspectionType, importData } from '@/api/qms/qcInspectionType';
|
|
|
|
|
import { QcInspectionTypeVO, QcInspectionTypeQuery, QcInspectionTypeForm } from '@/api/qms/qcInspectionType/types';
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
@ -189,12 +197,12 @@ const data = reactive<PageData<QcInspectionTypeForm, QcInspectionTypeQuery>>({
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
typeId: [
|
|
|
|
|
{ required: true, message: "检测类型主键不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
typeCode: [
|
|
|
|
|
{ required: true, message: "检测类型编码不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
|
// typeId: [
|
|
|
|
|
// { required: true, message: "检测类型主键不能为空", trigger: "blur" }
|
|
|
|
|
// ],
|
|
|
|
|
// typeCode: [
|
|
|
|
|
// { required: true, message: "检测类型编码不能为空", trigger: "blur" }
|
|
|
|
|
// ],
|
|
|
|
|
typeName: [
|
|
|
|
|
{ required: true, message: "检测类型名称不能为空", trigger: "blur" }
|
|
|
|
|
],
|
|
|
|
@ -299,6 +307,36 @@ const handleExport = () => {
|
|
|
|
|
}, `qcInspectionType_${new Date().getTime()}.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleExportTemplate = () => {
|
|
|
|
|
proxy?.download('qms/qcInspectionType/exportTemplate', {
|
|
|
|
|
|
|
|
|
|
}, `qcInspectionType_${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 = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|