| | |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">巡检名称:</span> |
| | | <el-input |
| | | v-model="searchForm.supplierName" |
| | | style="width: 240px" |
| | | placeholder="输入巡检名称搜索" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >搜索</el-button |
| | | > |
| | | <el-input v-model="searchForm.inspectionName" style="width: 200px" placeholder="请输入" clearable @change="handleQuery" /> |
| | | <span class="search_title ml10">巡检类型:</span> |
| | | <el-select v-model="searchForm.inspectionType" style="width: 140px" placeholder="全部" clearable @change="handleQuery"> |
| | | <el-option label="定期巡检" :value="1" /><el-option label="临时巡检" :value="2" /><el-option label="故障巡检" :value="3" /> |
| | | </el-select> |
| | | <span class="search_title ml10">状态:</span> |
| | | <el-select v-model="searchForm.status" style="width: 120px" placeholder="全部" clearable @change="handleQuery"> |
| | | <el-option label="待执行" :value="0" /><el-option label="执行中" :value="1" /><el-option label="已完成" :value="2" /><el-option label="已取消" :value="3" /> |
| | | </el-select> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')" |
| | | >新增</el-button> |
| | | <el-button type="primary" @click="openForm('add')">新增巡检</el-button> |
| | | <el-button @click="handleOut">导出</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">删除</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | ></PIMTable> |
| | | <PIMTable rowKey="id" :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true" |
| | | @selection-change="handleSelectionChange" :tableLoading="tableLoading" @pagination="pagination"></PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? '新增巡检信息' : '编辑巡检信息'" |
| | | width="70%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | |
| | | <el-dialog v-model="dialogVisible" :title="operationType === 'add' ? '新增巡检' : '编辑巡检'" width="70%" @close="closeDia"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="巡检名称:" prop="supplierName"> |
| | | <el-input |
| | | v-model="form.supplierName" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item |
| | | label="巡检类型:" |
| | | prop="taxpayerIdentificationNum" |
| | | > |
| | | <el-select style="width:100%" v-model="form.taxpayerIdentificationNum" clearable> |
| | | <el-option v-for="(item,index) in typeList" :key="index" :label="item.label" :value="item.value"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"><el-form-item label="巡检名称:" prop="inspectionName"><el-input v-model="form.inspectionName" placeholder="请输入" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="巡检类型:" prop="inspectionType"> |
| | | <el-select v-model="form.inspectionType" placeholder="请选择" style="width:100%"> |
| | | <el-option label="定期巡检" :value="1" /><el-option label="临时巡检" :value="2" /><el-option label="故障巡检" :value="3" /> |
| | | </el-select> |
| | | </el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="巡检区域:" prop="companyAddress"> |
| | | <el-input |
| | | v-model="form.companyAddress" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计划开始时间:" prop="companyPhone"> |
| | | <el-date-picker style="width:100%" clearable value-format="YYYY-MM-DD" type="date" placeholder="选择日期时间" v-model="form.companyPhone"></el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"><el-form-item label="巡检区域:" prop="area"><el-input v-model="form.area" placeholder="请输入" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="巡检人员:" prop="inspector"><el-input v-model="form.inspector" placeholder="请输入" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计划结束时间:" prop="bankAccountName"> |
| | | <el-date-picker style="width:100%" clearable value-format="YYYY-MM-DD" type="date" placeholder="选择日期时间" v-model="form.bankAccountName"></el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="实际开始时间:" prop="bankAccountNum"> |
| | | <el-date-picker style="width:100%" clearable value-format="YYYY-MM-DD" type="date" placeholder="选择日期时间" v-model="form.bankAccountNum"></el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"><el-form-item label="巡检路径规划:" prop="routePlan"> |
| | | <el-input v-model="form.routePlan" type="textarea" :rows="2" placeholder="请输入巡检路径规划" /> |
| | | </el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="实际结束时间:" prop="contactUserName"> |
| | | <el-date-picker style="width:100%" clearable value-format="YYYY-MM-DD" type="date" placeholder="选择日期时间" v-model="form.contactUserName"></el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="巡检人员:" prop="contactUserPhone"> |
| | | <el-input |
| | | v-model="form.contactUserPhone" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"><el-form-item label="计划开始:" prop="planStartTime"><el-date-picker v-model="form.planStartTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" style="width:100%" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="计划结束:" prop="planEndTime"><el-date-picker v-model="form.planEndTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" style="width:100%" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"><el-form-item label="实际开始:"><el-date-picker v-model="form.actualStartTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" style="width:100%" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="实际结束:"><el-date-picker v-model="form.actualEndTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" style="width:100%" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"><el-form-item label="状态:"><el-select v-model="form.status" style="width:100%"> |
| | | <el-option label="待执行" :value="0" /><el-option label="执行中" :value="1" /><el-option label="已完成" :value="2" /><el-option label="已取消" :value="3" /> |
| | | </el-select></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"><el-form-item label="巡检结果/记录:"><el-input v-model="form.inspectionResult" type="textarea" :rows="2" placeholder="请输入巡检结果" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"><el-form-item label="AI视频分析结果:"><el-input v-model="form.aiAnalysis" type="textarea" :rows="2" placeholder="预留:AI视频分析结果" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="无人机/机器人数据:"><el-input v-model="form.uavData" type="textarea" :rows="2" placeholder="预留:无人机/机器人回传数据" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"><el-form-item label="巡检报告:"><el-input v-model="form.reportPath" type="textarea" :rows="2" placeholder="自动生成/填写巡检报告" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"><el-form-item label="备注:"><el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入" /></el-form-item></el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">取消</el-button> |
| | | </div> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">取消</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- 供应商导入对话框 --> |
| | | <el-dialog |
| | | :title="upload.title" |
| | | v-model="upload.open" |
| | | width="400px" |
| | | append-to-body |
| | | > |
| | | <el-upload |
| | | ref="uploadRef" |
| | | :limit="1" |
| | | accept=".xlsx, .xls" |
| | | :headers="upload.headers" |
| | | :action="upload.url + '?updateSupport=' + upload.updateSupport" |
| | | :disabled="upload.isUploading" |
| | | :on-progress="handleFileUploadProgress" |
| | | :on-success="handleFileSuccess" |
| | | :auto-upload="false" |
| | | drag |
| | | > |
| | | <el-icon class="el-icon--upload"><upload-filled /></el-icon> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | | <template #tip> |
| | | <div class="el-upload__tip text-center"> |
| | | <span>仅允许导入xls、xlsx格式文件。</span> |
| | | <!-- <el-link |
| | | type="primary" |
| | | :underline="false" |
| | | style="font-size: 12px; vertical-align: baseline" |
| | | @click="importTemplate" |
| | | >下载模板</el-link |
| | | > --> |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | <!-- 巡检报告 --> |
| | | <el-dialog v-model="reportVisible" :title="reportTitle" width="70%"> |
| | | <div v-html="reportContent" style="line-height: 1.8"></div> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitFileForm">确 定</el-button> |
| | | <el-button @click="upload.open = false">取 消</el-button> |
| | | </div> |
| | | <el-button type="primary" @click="downloadReport">下载报告</el-button> |
| | | <el-button @click="reportVisible = false">关闭</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { delSupplier } from "@/api/basicData/supplierManageFile.js"; |
| | | import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { |
| | | addSupplier, |
| | | getSupplier, |
| | | listSupplier, |
| | | updateSupplier, |
| | | } from "@/api/basicData/supplierManageFile.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { getToken } from "@/utils/auth.js"; |
| | | import { listInspection, addInspection, updateInspection, deleteInspection, generateInspectionReport } from "@/api/environmentAccess/inspection.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | const typeText = (t) => (t == 1 ? "定期巡检" : t == 2 ? "临时巡检" : t == 3 ? "故障巡检" : ""); |
| | | const statusText = (s) => (s == 0 ? "待执行" : s == 1 ? "执行中" : s == 2 ? "已完成" : s == 3 ? "已取消" : ""); |
| | | const statusType = (s) => (s == 0 ? "info" : s == 1 ? "primary" : s == 2 ? "success" : s == 3 ? "danger" : ""); |
| | | |
| | | const data = reactive({ searchForm: { inspectionName: "", inspectionType: undefined, status: undefined } }); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | const tableColumn = ref([ |
| | | { label: "巡检名称", prop: "inspectionName" }, |
| | | { label: "巡检类型", prop: "inspectionType", width: 100, dataType: "tag", formatData: (p) => typeText(p), formatType: () => "warning" }, |
| | | { label: "巡检区域", prop: "area" }, |
| | | { label: "巡检路径规划", prop: "routePlan", showOverflowTooltip: true }, |
| | | { label: "计划开始", prop: "planStartTime", width: 160 }, |
| | | { label: "巡检人员", prop: "inspector", width: 100 }, |
| | | { label: "状态", prop: "status", width: 90, dataType: "tag", formatData: (p) => statusText(p), formatType: (p) => statusType(p) }, |
| | | { label: "巡检结果", prop: "inspectionResult", showOverflowTooltip: true }, |
| | | { |
| | | label: "巡检名称", |
| | | prop: "supplierName", |
| | | width: 250, |
| | | }, |
| | | { |
| | | label: "巡检类型", |
| | | prop: "taxpayerIdentificationNum", |
| | | width: 230, |
| | | }, |
| | | { |
| | | label: "计划开始时间", |
| | | prop: "companyPhone", |
| | | width:150 |
| | | }, |
| | | { |
| | | label: "计划结束时间", |
| | | prop: "bankAccountName", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "实际开始时间", |
| | | prop: "bankAccountNum", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "实际结束时间", |
| | | prop: "contactUserName", |
| | | }, |
| | | { |
| | | label: "巡检人员", |
| | | prop: "contactUserPhone", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "巡检区域", |
| | | prop: "companyAddress", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "操作", |
| | | align: "center", |
| | | fixed: 'right', |
| | | dataType: "action", label: "操作", align: "center", fixed: "right", width: 100, |
| | | operation: [ |
| | | { |
| | | name: "编辑", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.maintainUserName !== userStore.nickName |
| | | } |
| | | }, |
| | | { name: "编辑", type: "text", clickFun: (row) => openForm("edit", row) }, |
| | | { name: "生成报告", type: "text", clickFun: (row) => openReport(row) }, |
| | | ], |
| | | }, |
| | | ]); |
| | | |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const typeList = ref([ |
| | | { label: "日常巡检", value: "日常巡检" }, |
| | | { label: "专项巡检", value: "专项巡检" }, |
| | | { label: "临时巡检", value: "临时巡检" }, |
| | | ]); |
| | | const page = reactive({ current: 1, size: 100, total: 0 }); |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | supplierName: "", |
| | | }, |
| | | form: { |
| | | supplierName: "", |
| | | taxpayerIdentificationNum: "", |
| | | companyAddress: "", |
| | | companyPhone: "", |
| | | bankAccountName: "", |
| | | bankAccountNum: "", |
| | | contactUserName: "", |
| | | contactUserPhone: "", |
| | | maintainUserId: "", |
| | | maintainTime: "", |
| | | }, |
| | | rules: { |
| | | supplierName: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | taxpayerIdentificationNum: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | companyAddress: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | companyPhone: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | bankAccountName: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | bankAccountNum: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | contactUserName: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | contactUserPhone: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | maintainUserId: [{ required: false, message: "请选择", trigger: "change" }], |
| | | maintainTime: [{ required: false, message: "请选择", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | const dialogVisible = ref(false); |
| | | const operationType = ref("add"); |
| | | const formRef = ref(); |
| | | const form = ref({}); |
| | | const rules = { inspectionName: [{ required: true, message: "请输入巡检名称", trigger: "blur" }] }; |
| | | |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | // 巡检报告 |
| | | const reportVisible = ref(false); |
| | | const reportContent = ref(""); |
| | | const reportTitle = ref("智能巡检报告"); |
| | | const openReport = (row) => { |
| | | generateInspectionReport(row.id).then((res) => { |
| | | reportContent.value = res.data; |
| | | reportTitle.value = (row.inspectionName || "智能巡检") + " - 巡检报告"; |
| | | reportVisible.value = true; |
| | | }).catch(() => { proxy.$modal.msgError("生成报告失败"); }); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | const downloadReport = () => { |
| | | const blob = new Blob([reportContent.value], { type: "application/msword" }); |
| | | const a = document.createElement("a"); |
| | | a.href = URL.createObjectURL(blob); |
| | | a.download = reportTitle.value + ".doc"; |
| | | a.click(); |
| | | URL.revokeObjectURL(a.href); |
| | | }; |
| | | /** 提交上传文件 */ |
| | | function submitFileForm() { |
| | | console.log(upload.url + '?updateSupport=' + upload.updateSupport) |
| | | proxy.$refs["uploadRef"].submit(); |
| | | } |
| | | |
| | | const handleQuery = () => { page.current = 1; getList(); }; |
| | | const pagination = (obj) => { page.current = obj.page; page.size = obj.limit; getList(); }; |
| | | const handleSelectionChange = (s) => { selectedRows.value = s; }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | listSupplier({ ...searchForm.value, ...page }).then((res) => { |
| | | listInspection({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }); |
| | | }).catch(() => { tableLoading.value = false; }); |
| | | }; |
| | | const upload = reactive({ |
| | | // 是否显示弹出层(供应商导入) |
| | | open: false, |
| | | // 弹出层标题(供应商导入) |
| | | title: "", |
| | | // 是否禁用上传 |
| | | isUploading: false, |
| | | // 是否更新已经存在的用户数据 |
| | | updateSupport: 1, |
| | | // 设置上传的请求头部 |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | // 上传的地址 |
| | | url: import.meta.env.VITE_APP_BASE_API + "/system/supplier/import", |
| | | }); |
| | | /** 导入按钮操作 */ |
| | | function handleImport() { |
| | | upload.title = "供应商导入"; |
| | | upload.open = true; |
| | | } |
| | | |
| | | /**文件上传中处理 */ |
| | | const handleFileUploadProgress = (event, file, fileList) => { |
| | | upload.isUploading = true; |
| | | }; |
| | | |
| | | /** 文件上传成功处理 */ |
| | | const handleFileSuccess = (response, file, fileList) => { |
| | | upload.open = false; |
| | | upload.isUploading = false; |
| | | proxy.$refs["uploadRef"].handleRemove(file); |
| | | getList(); |
| | | }; |
| | | // 表格选择数据 |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | // 打开弹框 |
| | | const openForm = (type, row) => { |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value.maintainUserId = userStore.id; |
| | | form.value.maintainTime = getCurrentDate(); |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (type === "edit") { |
| | | getSupplier(row.id).then((res) => { |
| | | form.value = { ...res.data }; |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | | form.value = type === "add" ? { status: 0 } : { ...row }; |
| | | dialogVisible.value = true; |
| | | }; |
| | | // 提交表单 |
| | | const closeDia = () => { proxy.resetForm("formRef"); dialogVisible.value = false; }; |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitEdit(); |
| | | } else { |
| | | submitAdd(); |
| | | } |
| | | } |
| | | formRef.value.validate((valid) => { |
| | | if (!valid) return; |
| | | const p = operationType.value === "add" ? addInspection(form.value) : updateInspection(form.value); |
| | | p.then(() => { proxy.$modal.msgSuccess("提交成功"); closeDia(); getList(); }); |
| | | }); |
| | | }; |
| | | // 提交新增 |
| | | const submitAdd = () => { |
| | | addSupplier(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // 提交修改 |
| | | const submitEdit = () => { |
| | | updateSupplier(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // 关闭弹框 |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // 导出 |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/system/supplier/export", {}, "供应商档案.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | // 删除 |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | // 检查是否有他人维护的数据 |
| | | const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("不可删除他人维护的数据"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("请选择数据"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除提示", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delSupplier(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | getList(); |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | if (!selectedRows.value.length) { proxy.$modal.msgWarning("请选择数据"); return; } |
| | | const ids = selectedRows.value.map((i) => i.id); |
| | | ElMessageBox.confirm("是否确认删除?", "删除", { confirmButtonText: "确认", cancelButtonText: "取消", type: "warning" }) |
| | | .then(() => { deleteInspection(ids).then(() => { proxy.$modal.msgSuccess("删除成功"); getList(); }); }).catch(() => {}); |
| | | }; |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("是否确认导出?", "导出", { confirmButtonText: "确认", cancelButtonText: "取消", type: "warning" }) |
| | | .then(() => { proxy.download("/environmentAccess/inspection/export", { ...searchForm.value }, "智能巡检台账.xlsx"); }).catch(() => {}); |
| | | }; |
| | | |
| | | // 获取当前日期并格式化为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); // 月份从0开始 |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | onMounted(() => { getList(); }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| | | <style scoped lang="scss"> |
| | | .ml10 { margin-left: 10px; } |
| | | .table_list { margin-top: unset; } |
| | | </style> |