From 7bbab0e74d1d0208fa24ec67e3201427078980cd Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期日, 04 一月 2026 17:01:59 +0800
Subject: [PATCH] 器具校准,校准记录
---
src/views/measurementEquipment/index.vue | 270 ++++++++++++
src/views/calibration/index.vue | 246 +++++++++++
src/views/measurementEquipment/components/calibrationDia.vue | 268 ++++++++++++
src/views/measurementEquipment/filesDia.vue | 202 +++++++++
src/api/equipmentManagement/calibration.js | 9
src/views/measurementEquipment/components/formDia.vue | 254 ++++++++++++
6 files changed, 1,249 insertions(+), 0 deletions(-)
diff --git a/src/api/equipmentManagement/calibration.js b/src/api/equipmentManagement/calibration.js
index 54b99f9..472a4ef 100644
--- a/src/api/equipmentManagement/calibration.js
+++ b/src/api/equipmentManagement/calibration.js
@@ -24,4 +24,13 @@
method: "post",
data: query,
});
+}
+
+// 鍒犻櫎璁板綍
+export function ledgerRecordDelete(ids) {
+ return request({
+ url: "/measuringInstrumentLedgerRecord/delete",
+ method: "delete",
+ data: ids,
+ });
}
\ No newline at end of file
diff --git a/src/views/calibration/index.vue b/src/views/calibration/index.vue
new file mode 100644
index 0000000..12d5556
--- /dev/null
+++ b/src/views/calibration/index.vue
@@ -0,0 +1,246 @@
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <div>
+ <span class="search_title">妫�瀹氭棩鏈燂細</span>
+ <el-date-picker
+ v-model="searchForm.recordDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 160px"
+ @change="handleQuery"
+ />
+ <span class="search_title ml10">褰曞叆鏃ユ湡锛�</span>
+ <el-date-picker
+ v-model="searchForm.entryDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 160px"
+ @change="handleQuery"
+ />
+ <span class="search_title ml10">璁¢噺鍣ㄥ叿缂栧彿锛�</span>
+ <el-input v-model="searchForm.code" placeholder="璇疯緭鍏ョ紪鍙�" clearable style="width: 240px" @change="handleQuery"/>
+<!-- <span class="search_title ml10">鐘舵�侊細</span>-->
+<!-- <el-select v-model="searchForm.status" placeholder="璇烽�夋嫨鐘舵��" @change="handleQuery" style="width: 160px" clearable>-->
+<!-- <el-option label="鏈夋晥" :value="1"></el-option>-->
+<!-- <el-option label="閫炬湡" :value="2"></el-option>-->
+<!-- </el-select>-->
+ <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
+ >鎼滅储</el-button
+ >
+ </div>
+ <div>
+ <el-button @click="handleOut">瀵煎嚭</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>
+ </div>
+ <calibration-dia ref="calibrationDia" @close="handleQuery"></calibration-dia>
+ </div>
+</template>
+
+<script setup>
+import {onMounted, ref} from "vue";
+import {ElMessageBox, ElMessage} from "element-plus";
+import useUserStore from "../../store/modules/user.js";
+import CalibrationDia from "../../views/measurementEquipment/components/calibrationDia.vue";
+import {ledgerRecordListPage, ledgerRecordDelete} from "../../api/equipmentManagement/calibration.js";
+const { proxy } = getCurrentInstance();
+const userStore = useUserStore()
+
+const data = reactive({
+ searchForm: {
+ recordDate: "",
+ code: "",
+ entryDate: "",
+ },
+});
+const { searchForm } = toRefs(data);
+
+const tableColumn = ref([
+ // {
+ // label: "鐘舵��",
+ // prop: "status",
+ // dataType: "tag",
+ // formatData: (params) => {
+ // if (params == 1) {
+ // return "鏈夋晥";
+ // } else if (params == 2) {
+ // return "閫炬湡";
+ // } else {
+ // return null;
+ // }
+ // },
+ // formatType: (params) => {
+ // if (params == 1) {
+ // return "success";
+ // } else if (params == 2) {
+ // return "danger";
+ // } else {
+ // return null;
+ // }
+ // },
+ // },
+ {
+ label: "妫�瀹氭棩鏈�",
+ prop: "recordDate",
+ width: 130,
+ },
+ {
+ label: "璁¢噺鍣ㄥ叿缂栧彿",
+ prop: "code",
+ width: 150,
+ },
+ {
+ label: "璁¢噺鍣ㄥ叿鍚嶇О",
+ prop: "name",
+ width: 200,
+ },
+ {
+ label: "瑙勬牸鍨嬪彿",
+ prop: "model",
+ width:200
+ },
+ {
+ label: "鏈夋晥鏈�",
+ prop: "valid",
+ width: 100,
+ },
+ {
+ label: "褰曞叆浜�",
+ prop: "userName",
+ },
+ {
+ label: "褰曞叆鏃ユ湡",
+ prop: "entryDate",
+ width: 130,
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ width: 100,
+ align: "center",
+ fixed: 'right',
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: (row) => {
+ openCalibrationDia("edit", row);
+ },
+ },
+ {
+ name: "鍒犻櫎",
+ type: "text",
+ style: {
+ color: "#F56C6C"
+ },
+ clickFun: (row) => {
+ handleDelete(row);
+ },
+ },
+ ],
+ },
+]);
+const tableData = ref([]);
+const tableLoading = ref(false);
+const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+});
+const selectedRows = ref([]);
+
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+ selectedRows.value = selection;
+};
+const calibrationDia = ref()
+
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ page.current = 1;
+ getList();
+};
+const pagination = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+};
+const getList = () => {
+ tableLoading.value = true;
+ ledgerRecordListPage({ ...searchForm.value, ...page }).then((res) => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ }).catch((err) => {
+ tableLoading.value = false;
+ })
+};
+
+// 鎵撳紑妫�瀹氭牎鍑嗗脊妗�
+const openCalibrationDia = (type, row) => {
+ nextTick(() => {
+ calibrationDia.value?.openDialog(type, row)
+ })
+}
+
+// 鍒犻櫎璁板綍
+const handleDelete = (row) => {
+ ElMessageBox.confirm(`纭鍒犻櫎璁¢噺鍣ㄥ叿缂栧彿涓�"${row.code}"鐨勬瀹氳褰曞悧锛焋, "鍒犻櫎纭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ ledgerRecordDelete([row.id]).then(() => {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getList();
+ }).catch(() => {
+ ElMessage.error("鍒犻櫎澶辫触");
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑堝垹闄�");
+ });
+};
+
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/measuringInstrumentLedgerRecord/export", {}, "妫�瀹氭牎鍑嗚褰�.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+onMounted(() => {
+ getList();
+});
+</script>
+
+<style scoped>
+
+</style>
\ No newline at end of file
diff --git a/src/views/measurementEquipment/components/calibrationDia.vue b/src/views/measurementEquipment/components/calibrationDia.vue
new file mode 100644
index 0000000..4141f43
--- /dev/null
+++ b/src/views/measurementEquipment/components/calibrationDia.vue
@@ -0,0 +1,268 @@
+<template>
+ <div>
+ <el-dialog
+ v-model="dialogFormVisible"
+ title="璁¢噺鍣ㄥ叿"
+ width="50%"
+ @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="customerName">
+ <el-input
+ v-model="form.code"
+ placeholder="璇疯緭鍏�"
+ clearable
+ disabled
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="璁¢噺鍣ㄥ叿鍚嶇О锛�" prop="proDesc">
+ <el-input
+ v-model="form.name"
+ placeholder="璇疯緭鍏�"
+ clearable
+ disabled
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="妫�瀹氭棩鏈燂細" prop="recordDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.recordDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鏈夋晥鏈燂細" prop="valid">
+ <el-input
+ v-model="form.valid"
+ placeholder="璇疯緭鍏�"
+ clearable
+ >
+ <template #append>鏃�</template>
+ </el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="褰曞叆浜猴細" prop="userId">
+ <el-select
+ v-model="form.userId"
+ placeholder="璇烽�夋嫨"
+ filterable
+ default-first-option
+ :reserve-keyword="false"
+ clearable
+ >
+ <el-option
+ v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId"
+ ></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="褰曞叆鏃ユ湡锛�" prop="entryDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.entryDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+<!-- <el-row :gutter="30">-->
+<!-- <el-col :span="24">-->
+<!-- <el-form-item label="闄勪欢鏉愭枡锛�" prop="remark">-->
+<!-- <el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload" auto-upload-->
+<!-- :headers="upload.headers" :before-upload="handleBeforeUpload" :on-error="handleUploadError"-->
+<!-- :on-success="handleUploadSuccess" :on-remove="handleRemove">-->
+<!-- <el-button type="primary" v-if="operationType !== 'view'">涓婁紶</el-button>-->
+<!-- <template #tip v-if="operationType !== 'view'">-->
+<!-- <div class="el-upload__tip">-->
+<!-- 鏂囦欢鏍煎紡鏀寔-->
+<!-- doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z-->
+<!-- </div>-->
+<!-- </template>-->
+<!-- </el-upload>-->
+<!-- </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>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+import {ref} from "vue";
+import useUserStore from "../../../store/modules/user.js";
+import {userListNoPageByTenantId} from "../../../api/system/user.js";
+import {afterSalesServiceAdd, afterSalesServiceUpdate} from "@/api/customerService/index.js";
+import {getToken} from "../../../utils/auth.js";
+import {ledgerRecordUpdate, ledgerRecordVerifying} from "../../../api/equipmentManagement/calibration.js";
+import {delLedgerFile} from "../../../api/salesManagement/salesLedger.js";
+const { proxy } = getCurrentInstance()
+const emit = defineEmits(['close'])
+const dialogFormVisible = ref(false);
+const operationType = ref('')
+const userStore = useUserStore();
+
+const data = reactive({
+ form: {
+ code: "",
+ name: "",
+ valid: "",
+ recordDate: "",
+ userId: "",
+ entryDate: "",
+ tempFileIds: []
+ },
+ rules: {
+ code: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ name: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ valid: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ recordDate: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
+ userId: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
+ entryDate: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
+ }
+})
+const { form, rules } = toRefs(data);
+const userList = ref([])
+const fileList = ref([]);
+const upload = reactive({
+ // 涓婁紶鐨勫湴鍧�
+ url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
+ // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+ headers: { Authorization: "Bearer " + getToken() },
+});
+
+// 鎵撳紑寮规
+const openDialog = (type, row) => {
+ console.log(row)
+ operationType.value = type;
+ dialogFormVisible.value = true;
+ userListNoPageByTenantId().then((res) => {
+ userList.value = res.data;
+ });
+ fileList.value = []
+ if(type !== "add"){
+ form.value.tempFileIds = [];
+ }
+ if (type === "edit") {
+ form.value.valid = row.valid;
+ form.value.recordDate = row.recordDate;
+ fileList.value = row.commonFiles;
+ }
+ if(type === "add"){
+ fileList.value = row.commonFiles;
+ }
+
+ form.value.id = row.id;
+ form.value.code = row.code;
+ form.value.name = row.name;
+ form.value.userId = userStore.id;
+ form.value.entryDate = getCurrentDate();
+}
+
+// 涓婁紶鍓嶆牎妫�
+function handleBeforeUpload(file) {
+ proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
+ return true;
+}
+// 涓婁紶澶辫触
+function handleUploadError(err) {
+ proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触");
+ proxy.$modal.closeLoading();
+}
+// 涓婁紶鎴愬姛鍥炶皟
+function handleUploadSuccess(res, file, uploadFiles) {
+ proxy.$modal.closeLoading();
+ if (res.code === 200) {
+ file.tempId = res.data.tempId;
+ form.value.tempFileIds.push(file.tempId);
+ proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
+ } else {
+ proxy.$modal.msgError(res.msg);
+ proxy.$refs.fileUpload.handleRemove(file);
+ }
+}
+// 绉婚櫎鏂囦欢
+function handleRemove(file) {
+ if (operationType.value === "edit") {
+ let ids = [];
+ ids.push(file.id);
+ delLedgerFile(ids).then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ });
+ }
+}
+
+const submitForm = () => {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ if (operationType.value === "verifying") {
+ ledgerRecordVerifying(form.value).then(response => {
+ proxy.$modal.msgSuccess("妫�瀹氭牎鍑嗘垚鍔�")
+ closeDia()
+ })
+ } else {
+ ledgerRecordUpdate(form.value).then(response => {
+ proxy.$modal.msgSuccess("淇敼鎴愬姛")
+ closeDia()
+ })
+ }
+ }
+ })
+}
+// 鍏抽棴寮规
+const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ emit('close')
+};
+// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� 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}`;
+}
+defineExpose({
+ openDialog,
+});
+</script>
+
+<style scoped>
+
+</style>
\ No newline at end of file
diff --git a/src/views/measurementEquipment/components/formDia.vue b/src/views/measurementEquipment/components/formDia.vue
new file mode 100644
index 0000000..55db4ca
--- /dev/null
+++ b/src/views/measurementEquipment/components/formDia.vue
@@ -0,0 +1,254 @@
+<template>
+ <div>
+ <el-dialog
+ v-model="dialogFormVisible"
+ title="璁¢噺鍣ㄥ叿"
+ width="50%"
+ @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="code">
+ <el-input
+ v-model="form.code"
+ placeholder="璇疯緭鍏�"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="璁¢噺鍣ㄥ叿鍚嶇О锛�" prop="name">
+ <el-input
+ v-model="form.name"
+ placeholder="璇疯緭鍏�"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
+ <el-input
+ v-model="form.model"
+ placeholder="璇疯緭鍏�"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="棰勮涓嬫妫�瀹氭棩鏈燂細" prop="nextDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.nextDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="褰曞叆浜猴細" prop="userId">
+ <el-select
+ v-model="form.userId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ filterable
+ default-first-option
+ :reserve-keyword="false"
+ >
+ <el-option
+ v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId"
+ ></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="褰曞叆鏃ユ湡锛�" prop="recordDate">
+ <el-date-picker
+ style="width: 100%"
+ v-model="form.recordDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+<!-- <el-row :gutter="30">-->
+<!-- <el-col :span="24">-->
+<!-- <el-form-item label="闄勪欢鏉愭枡锛�" prop="remark">-->
+<!-- <el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload" auto-upload-->
+<!-- :headers="upload.headers" :before-upload="handleBeforeUpload" :on-error="handleUploadError"-->
+<!-- :on-success="handleUploadSuccess" :on-remove="handleRemove">-->
+<!-- <el-button type="primary" v-if="operationType !== 'view'">涓婁紶</el-button>-->
+<!-- <template #tip v-if="operationType !== 'view'">-->
+<!-- <div class="el-upload__tip">-->
+<!-- 鏂囦欢鏍煎紡鏀寔-->
+<!-- doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z-->
+<!-- </div>-->
+<!-- </template>-->
+<!-- </el-upload>-->
+<!-- </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>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+import {ref} from "vue";
+import useUserStore from "../../../store/modules/user.js";
+import {userListNoPageByTenantId} from "../../../api/system/user.js";
+import {afterSalesServiceAdd, afterSalesServiceUpdate} from "@/api/customerService/index.js";
+import {getToken} from "../../../utils/auth.js";
+import {measuringInstrumentAdd, measuringInstrumentUpdate} from "../../../api/equipmentManagement/measurementEquipment.js";
+const { proxy } = getCurrentInstance()
+const emit = defineEmits(['close'])
+const dialogFormVisible = ref(false);
+const operationType = ref('')
+const userStore = useUserStore();
+
+const data = reactive({
+ form: {
+ code: "",
+ name: "",
+ model: "",
+ validDate: "",
+ nextDate: "",
+ userId: "",
+ recordDate: "",
+ tempFileIds: []
+ },
+ rules: {
+ code: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ name: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ model: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ validDate: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ nextDate: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
+ userId: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
+ recordDate: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
+ }
+})
+const { form, rules } = toRefs(data);
+const userList = ref([])
+const fileList = ref([]);
+const upload = reactive({
+ // 涓婁紶鐨勫湴鍧�
+ url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
+ // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+ headers: { Authorization: "Bearer " + getToken() },
+});
+
+// 鎵撳紑寮规
+const openDialog = (type, row) => {
+ operationType.value = type;
+ dialogFormVisible.value = true;
+ fileList.value = []
+ form.value.userId = userStore.id;
+ form.value.recordDate = getCurrentDate();
+ userListNoPageByTenantId().then((res) => {
+ userList.value = res.data;
+ });
+ if (type === "edit") {
+ form.value = {...row}
+ }
+}
+
+// 涓婁紶鍓嶆牎妫�
+function handleBeforeUpload(file) {
+ proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
+ return true;
+}
+// 涓婁紶澶辫触
+function handleUploadError(err) {
+ proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触");
+ proxy.$modal.closeLoading();
+}
+// 涓婁紶鎴愬姛鍥炶皟
+function handleUploadSuccess(res, file, uploadFiles) {
+ proxy.$modal.closeLoading();
+ if (res.code === 200) {
+ file.tempId = res.data.tempId;
+ form.value.tempFileIds.push(res.data.tempId)
+ proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
+ } else {
+ proxy.$modal.msgError(res.msg);
+ proxy.$refs.fileUpload.handleRemove(file);
+ }
+}
+// 绉婚櫎鏂囦欢
+function handleRemove(file) {
+ if (operationType.value === "edit") {
+ let ids = [];
+ ids.push(file.id);
+ delLedgerFile(ids).then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ });
+ }
+}
+
+const submitForm = () => {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ if (operationType.value === "add") {
+ measuringInstrumentAdd(form.value).then(response => {
+ proxy.$modal.msgSuccess("鏂板鎴愬姛")
+ form.value.tempFileIds = []
+ closeDia()
+ })
+ } else {
+ measuringInstrumentUpdate(form.value).then(response => {
+ proxy.$modal.msgSuccess("淇敼鎴愬姛")
+ form.value.tempFileIds = []
+ closeDia()
+ })
+ }
+ }
+ })
+}
+// 鍏抽棴寮规
+const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ emit('close')
+};
+// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� 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}`;
+}
+defineExpose({
+ openDialog,
+});
+</script>
+
+<style scoped>
+
+</style>
\ No newline at end of file
diff --git a/src/views/measurementEquipment/filesDia.vue b/src/views/measurementEquipment/filesDia.vue
new file mode 100644
index 0000000..0751eac
--- /dev/null
+++ b/src/views/measurementEquipment/filesDia.vue
@@ -0,0 +1,202 @@
+<template>
+ <div>
+ <el-dialog
+ v-model="dialogFormVisible"
+ title="涓婁紶闄勪欢"
+ width="50%"
+ @close="closeDia"
+ >
+ <div style="margin-bottom: 10px;text-align: right">
+ <el-upload
+ v-model:file-list="fileList"
+ class="upload-demo"
+ :action="uploadUrl"
+ :on-success="handleUploadSuccess"
+ :on-error="handleUploadError"
+ name="file"
+ :show-file-list="false"
+ :headers="headers"
+ style="display: inline;margin-right: 10px"
+ >
+ <el-button type="primary">涓婁紶闄勪欢</el-button>
+ </el-upload>
+ <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ </div>
+ <PIMTable
+ rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :tableLoading="tableLoading"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ height="500"
+ >
+ </PIMTable>
+ <pagination
+ style="margin: 10px 0"
+ v-show="total > 0"
+ @pagination="paginationSearch"
+ :total="total"
+ :page="page.current"
+ :limit="page.size"
+ />
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="closeDia">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ <filePreview ref="filePreviewRef" />
+ </div>
+</template>
+
+<script setup>
+import {ref} from "vue";
+import {ElMessageBox} from "element-plus";
+import {getToken} from "../../utils/auth.js";
+import filePreview from '../../components/filePreview/index.vue'
+import {
+ fileAdd,
+ fileDel,
+ fileListPage
+} from "../../api/financialManagement/revenueManagement.js";
+import Pagination from "../../components/PIMTable/Pagination.vue";
+const { proxy } = getCurrentInstance()
+const emit = defineEmits(['close'])
+
+const dialogFormVisible = ref(false);
+const currentId = ref('')
+const selectedRows = ref([]);
+const filePreviewRef = ref()
+const tableColumn = ref([
+ {
+ label: "鏂囦欢鍚嶇О",
+ prop: "name",
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ operation: [
+ {
+ name: "涓嬭浇",
+ type: "text",
+ clickFun: (row) => {
+ downLoadFile(row);
+ },
+ },
+ {
+ name: "棰勮",
+ type: "text",
+ clickFun: (row) => {
+ lookFile(row);
+ },
+ }
+ ],
+ },
+]);
+const page = reactive({
+ current: 1,
+ size: 100,
+});
+const total = ref(0);
+const tableData = ref([]);
+const fileList = ref([]);
+const tableLoading = ref(false);
+const accountType = ref('')
+const headers = ref({
+ Authorization: "Bearer " + getToken(),
+});
+const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/file/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃
+
+// 鎵撳紑寮规
+const openDialog = (row,type) => {
+ accountType.value = type;
+ dialogFormVisible.value = true;
+ currentId.value = row.id;
+ getList()
+}
+const paginationSearch = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+};
+const getList = () => {
+ fileListPage({accountId: currentId.value,accountType:accountType.value, ...page}).then(res => {
+ tableData.value = res.data.records;
+ total.value = res.data.total;
+ })
+}
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+ selectedRows.value = selection;
+};
+
+// 鍏抽棴寮规
+const closeDia = () => {
+ dialogFormVisible.value = false;
+ emit('close')
+};
+// 涓婁紶鎴愬姛澶勭悊
+function handleUploadSuccess(res, file) {
+ // 濡傛灉涓婁紶鎴愬姛
+ if (res.code == 200) {
+ const fileRow = {}
+ fileRow.name = res.data.originalName
+ fileRow.url = res.data.tempPath
+ uploadFile(fileRow)
+ } else {
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ }
+}
+function uploadFile(file) {
+ file.accountId = currentId.value;
+ file.accountType = accountType.value;
+ fileAdd(file).then(res => {
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
+ getList()
+ })
+}
+// 涓婁紶澶辫触澶勭悊
+function handleUploadError() {
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+}
+// 涓嬭浇闄勪欢
+const downLoadFile = (row) => {
+ proxy.$download.name(row.url);
+}
+// 鍒犻櫎
+const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map((item) => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }).then(() => {
+ fileDel(ids).then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ }).catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+// 棰勮闄勪欢
+const lookFile = (row) => {
+ filePreviewRef.value.open(row.url)
+}
+
+defineExpose({
+ openDialog,
+});
+</script>
+
+<style scoped>
+
+</style>
\ No newline at end of file
diff --git a/src/views/measurementEquipment/index.vue b/src/views/measurementEquipment/index.vue
new file mode 100644
index 0000000..58bb003
--- /dev/null
+++ b/src/views/measurementEquipment/index.vue
@@ -0,0 +1,270 @@
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <div>
+ <span class="search_title">褰曞叆鏃ユ湡锛�</span>
+ <el-date-picker
+ v-model="searchForm.recordDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 160px"
+ @change="handleQuery"
+ />
+ <span class="search_title ml10">璁¢噺鍣ㄥ叿缂栧彿锛�</span>
+ <el-input v-model="searchForm.code" placeholder="璇疯緭鍏ョ紪鍙�" clearable style="width: 240px" @change="handleQuery"/>
+ <span class="search_title ml10">鐘舵�侊細</span>
+ <el-select v-model="searchForm.status" placeholder="璇烽�夋嫨鐘舵��" @change="handleQuery" style="width: 160px" clearable>
+ <el-option label="鏈夋晥" :value="1"></el-option>
+ <el-option label="閫炬湡" :value="2"></el-option>
+ </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="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button @click="handleOut">瀵煎嚭</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>
+ </div>
+ <form-dia ref="formDia" @close="handleQuery"></form-dia>
+ <calibration-dia ref="calibrationDia" @close="handleQuery"></calibration-dia>
+ <files-dia ref="filesDia"></files-dia>
+ </div>
+</template>
+
+<script setup>
+import {onMounted, ref} from "vue";
+import FormDia from "../measurementEquipment/components/formDia.vue";
+import {ElMessageBox} from "element-plus";
+import useUserStore from "../../store/modules/user.js";
+import CalibrationDia from "../measurementEquipment/components/calibrationDia.vue";
+import {
+ measuringInstrumentDelete,
+ measuringInstrumentListPage
+} from "../../api/equipmentManagement/measurementEquipment.js";
+import FilesDia from "./filesDia.vue";
+const { proxy } = getCurrentInstance();
+const userStore = useUserStore()
+
+const data = reactive({
+ searchForm: {
+ recordDate: "",
+ code: "",
+ status: "",
+ },
+});
+const { searchForm } = toRefs(data);
+
+const tableColumn = ref([
+ {
+ label: "鐘舵��",
+ prop: "status",
+ dataType: "tag",
+ formatData: (params) => {
+ if (params == 1) {
+ return "鏈夋晥";
+ } else if (params == 2) {
+ return "閫炬湡";
+ } else {
+ return null;
+ }
+ },
+ formatType: (params) => {
+ if (params == 1) {
+ return "success";
+ } else if (params == 2) {
+ return "danger";
+ } else {
+ return null;
+ }
+ },
+ },
+ {
+ label: "鏈�杩戜竴娆℃瀹氭棩鏈�",
+ prop: "mostDate",
+ width: 130,
+ },
+ {
+ label: "璁¢噺鍣ㄥ叿缂栧彿",
+ prop: "code",
+ width: 150,
+ },
+ {
+ label: "璁¢噺鍣ㄥ叿鍚嶇О",
+ prop: "name",
+ width: 200,
+ },
+ {
+ label: "瑙勬牸鍨嬪彿",
+ prop: "model",
+ width:200
+ },
+ {
+ label: "鏈夋晥鏈�",
+ prop: "valid",
+ width: 130,
+ },
+ {
+ label: "棰勮涓嬫妫�瀹氭棩鏈�",
+ prop: "nextDate",
+ width: 130,
+ },
+ {
+ label: "褰曞叆浜�",
+ prop: "userName",
+ },
+ {
+ label: "褰曞叆鏃ユ湡",
+ prop: "recordDate",
+ width: 130,
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ width: '130',
+ fixed: 'right',
+ operation: [
+ {
+ name: "妫�瀹氭牎鍑�",
+ type: "text",
+ clickFun: (row) => {
+ openCalibrationDia("verifying", row);
+ },
+ },
+ // {
+ // name: "闄勪欢",
+ // type: "text",
+ // clickFun: (row) => {
+ // openFilesFormDia(row);
+ // },
+ // },
+ ],
+ },
+]);
+const tableData = ref([]);
+const tableLoading = ref(false);
+const filesDia = ref()
+const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+});
+const selectedRows = ref([]);
+
+// 鎵撳紑闄勪欢寮规
+const openFilesFormDia = (row) => {
+ console.log(row)
+ nextTick(() => {
+ filesDia.value?.openDialog( row,'璁¢噺鍣ㄥ叿鍙拌处')
+ })
+};
+
+// 琛ㄦ牸閫夋嫨鏁版嵁
+const handleSelectionChange = (selection) => {
+ selectedRows.value = selection;
+};
+const formDia = ref()
+const calibrationDia = ref()
+
+// 鏌ヨ鍒楄〃
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ page.current = 1;
+ getList();
+};
+const pagination = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+};
+const getList = () => {
+ tableLoading.value = true;
+ measuringInstrumentListPage({ ...searchForm.value, ...page }).then((res) => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ }).catch((err) => {
+ tableLoading.value = false;
+ })
+};
+
+// 鎵撳紑寮规
+const openForm = (type, row) => {
+ nextTick(() => {
+ formDia.value?.openDialog(type, row)
+ })
+};
+// 鎵撳紑妫�瀹氭牎鍑嗗脊妗�
+const openCalibrationDia = (type, row) => {
+ nextTick(() => {
+ calibrationDia.value?.openDialog(type, row)
+ })
+}
+
+const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map((item) => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ tableLoading.value = true;
+ measuringInstrumentDelete(ids)
+ .then((res) => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/measuringInstrumentLedger/export", {}, "璁¢噺鍣ㄥ叿鍙拌处.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+onMounted(() => {
+ getList();
+});
+</script>
+
+<style scoped>
+
+</style>
\ No newline at end of file
--
Gitblit v1.9.3