From ae633932334e456278babd24c47d746b3807bab7 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 05 八月 2025 17:06:44 +0800 Subject: [PATCH] 计量器具台账开发联调、检定校准记录开发联调 --- src/views/equipmentManagement/measurementEquipment/index.vue | 264 ++++++++++++++ src/views/productionManagement/productionReporting/index.vue | 6 src/views/customerService/feedbackRegistration/index.vue | 2 src/views/equipmentManagement/measurementEquipment/components/formDia.vue | 249 +++++++++++++ src/views/equipmentManagement/calibration/index.vue | 207 +++++++++++ src/views/productionManagement/productionDispatching/components/formDia.vue | 2 src/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue | 254 ++++++++++++++ src/api/equipmentManagement/calibration.js | 27 + src/api/equipmentManagement/measurementEquipment.js | 35 + 9 files changed, 1,041 insertions(+), 5 deletions(-) diff --git a/src/api/equipmentManagement/calibration.js b/src/api/equipmentManagement/calibration.js new file mode 100644 index 0000000..54b99f9 --- /dev/null +++ b/src/api/equipmentManagement/calibration.js @@ -0,0 +1,27 @@ +// 妫�瀹氭牎鍑嗚褰� +import request from "@/utils/request"; + +// 鍒嗛〉鏌ヨ +export function ledgerRecordListPage(query) { + return request({ + url: "/measuringInstrumentLedgerRecord/listPage", + method: "get", + params: query, + }); +} +// 鏍″噯 +export function ledgerRecordVerifying(query) { + return request({ + url: "/measuringInstrumentLedger/verifying", + method: "post", + data: query, + }); +} +// 淇敼鏍″噯 +export function ledgerRecordUpdate(query) { + return request({ + url: "/measuringInstrumentLedgerRecord/update", + method: "post", + data: query, + }); +} \ No newline at end of file diff --git a/src/api/equipmentManagement/measurementEquipment.js b/src/api/equipmentManagement/measurementEquipment.js new file mode 100644 index 0000000..a22c034 --- /dev/null +++ b/src/api/equipmentManagement/measurementEquipment.js @@ -0,0 +1,35 @@ +// 璁¢噺鍣ㄥ叿鍙拌处 +import request from "@/utils/request"; + +// 鍒嗛〉鏌ヨ +export function measuringInstrumentListPage(query) { + return request({ + url: "/measuringInstrumentLedger/listPage", + method: "get", + params: query, + }); +} +// 鍒犻櫎 +export function measuringInstrumentDelete(query) { + return request({ + url: "/measuringInstrumentLedger/delete", + method: "delete", + data: query, + }); +} +// 鏂板 +export function measuringInstrumentAdd(query) { + return request({ + url: "/measuringInstrumentLedger/add", + method: "post", + data: query, + }); +} +// 淇敼 +export function measuringInstrumentUpdate(query) { + return request({ + url: "/measuringInstrumentLedger/update", + method: "post", + data: query, + }); +} \ No newline at end of file diff --git a/src/views/customerService/feedbackRegistration/index.vue b/src/views/customerService/feedbackRegistration/index.vue index 40f0f1f..780de93 100644 --- a/src/views/customerService/feedbackRegistration/index.vue +++ b/src/views/customerService/feedbackRegistration/index.vue @@ -12,7 +12,7 @@ clearable @change="handleQuery" /> - <span style = "margin-left: 10px;" class="search_title">澶勭悊鐘舵�侊細</span> + <span style="margin-left: 10px;" class="search_title">澶勭悊鐘舵�侊細</span> <el-select v-model="searchForm.status" placeholder="璇烽�夋嫨鐘舵��" @change="handleQuery" style="width: 140px" clearable> <el-option label="寰呭鐞�" :value="1"></el-option> <el-option label="宸插鐞�" :value="2"></el-option> diff --git a/src/views/equipmentManagement/calibration/index.vue b/src/views/equipmentManagement/calibration/index.vue new file mode 100644 index 0000000..2e23184 --- /dev/null +++ b/src/views/equipmentManagement/calibration/index.vue @@ -0,0 +1,207 @@ +<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 @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} from "element-plus"; +import useUserStore from "@/store/modules/user.js"; +import CalibrationDia from "@/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue"; +import {ledgerRecordListPage} from "@/api/equipmentManagement/calibration.js"; +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: "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: "鎿嶄綔", + align: "center", + fixed: 'right', + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + openCalibrationDia("edit", row); + }, + disabled: (row) => { + return row.userId !== userStore.id + } + }, + ], + }, +]); +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 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/equipmentManagement/measurementEquipment/components/calibrationDia.vue b/src/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue new file mode 100644 index 0000000..4cd8970 --- /dev/null +++ b/src/views/equipmentManagement/measurementEquipment/components/calibrationDia.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="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="璇烽�夋嫨" + disabled + 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="璇烽�夋嫨" + disabled + 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"; +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: "", + }, + 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) => { + operationType.value = type; + dialogFormVisible.value = true; + userListNoPageByTenantId().then((res) => { + userList.value = res.data; + }); + if (type === "edit") { + form.value.valid = row.valid; + form.value.recordDate = row.recordDate; + } + 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; + 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") { + 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/equipmentManagement/measurementEquipment/components/formDia.vue b/src/views/equipmentManagement/measurementEquipment/components/formDia.vue new file mode 100644 index 0000000..19706ac --- /dev/null +++ b/src/views/equipmentManagement/measurementEquipment/components/formDia.vue @@ -0,0 +1,249 @@ +<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 + disabled + > + <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" + disabled + 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: "", + }, + 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; + 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("鏂板鎴愬姛") + closeDia() + }) + } else { + measuringInstrumentUpdate(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/equipmentManagement/measurementEquipment/index.vue b/src/views/equipmentManagement/measurementEquipment/index.vue new file mode 100644 index 0000000..1060e65 --- /dev/null +++ b/src/views/equipmentManagement/measurementEquipment/index.vue @@ -0,0 +1,264 @@ +<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> + </div> +</template> + +<script setup> +import {onMounted, ref} from "vue"; +import FormDia from "@/views/equipmentManagement/measurementEquipment/components/formDia.vue"; +import {ElMessageBox} from "element-plus"; +import useUserStore from "@/store/modules/user.js"; +import CalibrationDia from "@/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue"; +import { + measuringInstrumentDelete, + measuringInstrumentListPage +} from "@/api/equipmentManagement/measurementEquipment.js"; +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", + fixed: 'right', + operation: [ + { + name: "妫�瀹氭牎鍑�", + type: "text", + clickFun: (row) => { + openCalibrationDia("add", row); + }, + }, + { + name: "闄勪欢", + type: "text", + clickFun: (row) => { + openCalibrationDia("add", 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 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) { + // 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹� + const unauthorizedData = selectedRows.value.filter(item => item.userId !== userStore.id); + 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; + 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 diff --git a/src/views/productionManagement/productionDispatching/components/formDia.vue b/src/views/productionManagement/productionDispatching/components/formDia.vue index 9d9ec9e..a60f751 100644 --- a/src/views/productionManagement/productionDispatching/components/formDia.vue +++ b/src/views/productionManagement/productionDispatching/components/formDia.vue @@ -3,7 +3,7 @@ <el-dialog v-model="dialogFormVisible" title="鐢熶骇娲惧伐" - width="70%" + width="50%" @close="closeDia" > <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> diff --git a/src/views/productionManagement/productionReporting/index.vue b/src/views/productionManagement/productionReporting/index.vue index 42036f8..3ceae74 100644 --- a/src/views/productionManagement/productionReporting/index.vue +++ b/src/views/productionManagement/productionReporting/index.vue @@ -59,7 +59,7 @@ type="index" width="60" /> - <el-table-column label="鏈鐢熶骇鏁伴噺" prop="finishedNum" align="center"> + <el-table-column label="鏈鐢熶骇鏁伴噺" prop="finishedNum" align="center" width="400"> <template #default="scope"> <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="scope.row.finishedNum" @@ -72,7 +72,7 @@ </template> </el-table-column> <!-- <el-table-column label="寰呯敓浜ф暟閲�" prop="pendingNum" width="240" align="center"></el-table-column>--> - <el-table-column label="鐢熶骇浜�" prop="schedulingUserId" width="240"> + <el-table-column label="鐢熶骇浜�" prop="schedulingUserId" width="400"> <template #default="scope"> <el-select v-model="scope.row.schedulingUserId" @@ -89,7 +89,7 @@ </el-select> </template> </el-table-column> - <el-table-column label="鐢熶骇鏃ユ湡" prop="schedulingDate" width="240"> + <el-table-column label="鐢熶骇鏃ユ湡" prop="schedulingDate" width="400"> <template #default="scope"> <el-date-picker v-model="scope.row.schedulingDate" -- Gitblit v1.9.3