From 305b8976e9ad666e52c157ebc79f05c2fe03d1ff Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期二, 05 九月 2023 16:46:42 +0800 Subject: [PATCH] modified: src/components/experiment/checkTheReport/index.vue modified: src/views/laboratory/ledger/index.vue modified: src/views/standardLibrary/index.vue --- src/views/laboratory/ledger/index.vue | 174 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 105 insertions(+), 69 deletions(-) diff --git a/src/views/laboratory/ledger/index.vue b/src/views/laboratory/ledger/index.vue index 48f4240..12f8143 100644 --- a/src/views/laboratory/ledger/index.vue +++ b/src/views/laboratory/ledger/index.vue @@ -1,23 +1,9 @@ <template> <div class="ledger-main"> <div class="page-header-search"> - <div class="search-bar"> - <el-form ref="form" :inline="true" :model="searchData"> - <el-form-item> - <el-input v-model="searchData.keyword" placeholder="璇疯緭鍏ョ紪鍙�/璁惧鍚嶇О/鍨嬪彿瑙勬牸"> - <i slot="prefix" class="el-input__icon el-icon-search" /> - </el-input> - </el-form-item> - <el-form-item> - <el-button type="primary" @click="filterTableData">鏌ヨ</el-button> - <el-button type="primary" plain @click="resetBtn">閲嶇疆</el-button> - <!-- <el-button type="text">楂樼骇鎼滅储<i class="el-icon-arrow-down el-icon--right" /></el-button> --> - </el-form-item> - </el-form> - </div> <div class="serve-btn"> <el-button type="primary" icon="el-icon-plus" - @click="addDrawerVisible = true; equipmentform.equipmentMeasurement = 1; equipmentform.whetherDataAcquisition = 1">鏂板浠櫒</el-button> + @click="showAddDrawer()">鏂板浠櫒</el-button> </div> </div> <div class="content-main"> @@ -39,16 +25,31 @@ <div class="library-table"> <div class="table-header"> <div class="search-bar"> - <el-radio-group v-model="radioValue" @change="getConditionTable"> - <!-- <el-radio-button label="0">鍏ㄩ儴</el-radio-button> --> - <el-radio-button v-for="item in conditionsOptions" :key="item.value" :label="item.value"> - {{ item.label }} - </el-radio-button> - </el-radio-group> - <el-checkbox v-model="isOut" @change="getExpireTable" :style="{ 'marginLeft': '12px' }">宸茶繃鏈�</el-checkbox> - </div> - <div class="serve-btn"> - <!-- <el-button type="primary" icon="el-icon-plus">鏂板浜哄憳</el-button> --> + <el-row :gutter="20"> + <el-col :span="15"> + <el-form ref="form" :inline="true" :model="searchData"> + <el-form-item> + <el-input v-model="searchData.keyword" placeholder="璇疯緭鍏ョ紪鍙�/璁惧鍚嶇О/鍨嬪彿瑙勬牸"> + <i slot="prefix" class="el-input__icon el-icon-search" /> + </el-input> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="filterTableData">鏌ヨ</el-button> + <el-button type="primary" plain @click="resetBtn">閲嶇疆</el-button> + <!-- <el-button type="text">楂樼骇鎼滅储<i class="el-icon-arrow-down el-icon--right" /></el-button> --> + </el-form-item> + </el-form> + </el-col> + <el-col :span="9"> + <el-radio-group v-model="radioValue" @change="getConditionTable"> + <!-- <el-radio-button label="0">鍏ㄩ儴</el-radio-button> --> + <el-radio-button v-for="item in conditionsOptions" :key="item.value" :label="item.value"> + {{ item.label }} + </el-radio-button> + </el-radio-group> + <el-checkbox v-model="isOut" @change="getExpireTable" :style="{ 'marginLeft': '12px' }">宸茶繃鏈�</el-checkbox> + </el-col> + </el-row> </div> </div> <div class="table-box"> @@ -375,7 +376,7 @@ <el-form label-position="top" ref="addmeasureForm" :model="measureForm"> <el-row :gutter="20"> <el-col :span="12"> - <el-form-item label="璐熻矗浜�" prop="userId" :rules="[{ required: true, message: '璇烽�夋嫨璐熻矗浜�', trigger: 'blur' }]"> + <el-form-item label="璐熻矗浜�" prop="userId" :rules="[{ required: true, message: '璇烽�夋嫨璐熻矗浜�', trigger: 'change' }]"> <el-select v-model="measureForm.userId" clearable filterable :allow-create="true" placeholder="璐熻矗浜�" style="width:100%"> <el-option v-for="item in userOpetions" :key="item.id" :label="item.label" :value="item.value" /> @@ -405,7 +406,7 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="缁撴灉" prop="result" :rules="[{ required: true, message: '璇烽�夋嫨缁撴灉', trigger: 'blur' }]"> + <el-form-item label="缁撴灉" prop="result" :rules="[{ required: true, message: '璇烽�夋嫨缁撴灉', trigger: 'change' }]"> <el-select v-model="measureForm.result" clearable filterable :allow-create="true" placeholder="璇烽�夋嫨缁撴灉" style="width:100%"> <el-option v-for="item in resultOptions" :key="item.id" :label="item.label" :value="item.value" /> @@ -429,7 +430,7 @@ </el-row> <el-row :gutter="20"> <el-col :span="24"> - <el-form-item label=""> + <el-form-item label="" prop="file"> <el-upload ref="upload" class="upload-demo" action="#" :on-change="handleUpload" :auto-upload="false"> <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> </el-upload> @@ -585,7 +586,7 @@ result: null, performanceIndex: null, remarks: null, - file: null + file: "" }, activeTabsName: 'codePoints', // 鐮佺偣琛ㄦ牸鐨勭姸鎬侊細鏁版嵁灞曠ずfalse/鏂板杈撳叆true @@ -611,8 +612,7 @@ }, measureFormVisible(newVal){ if(newVal === false){ - this.measureForm.file = null; - this.$refs['upload'].clearFiles(); + this.resetForm("addmeasureForm"); } } }, @@ -621,6 +621,27 @@ this.getUserOptions() }, methods: { + //鏄剧ず鏂板浠櫒妯℃�佹 + showAddDrawer(){ + this.addDrawerVisible = true; + this.equipmentform = { + acceptanceDate: '', // 楠屾敹鏃ユ湡 + arrivalDate: '', // 鍒拌揣鏃ユ湡 + classifyId: '', // 鎵�灞炲垎绫� + conditions: '', // 鐘舵�� + descriptiveness: '', // 鎻忚堪 + equipmentCode: '', // 璁惧缂栧彿 + equipmentMeasurement: 1, // 浠櫒璁惧璁¢噺 + equipmentName: '', // 浠櫒璁惧鍚嶇О + errorRate: '', // 涓嶇‘瀹氬害/鍑嗙‘搴�/鏈�澶у厑璁歌宸� + userId: '', // 淇濈浜� + manufacturer: '', // 鐢熶骇鍘傚 + measuringRange: '', // 娴嬮噺鑼冨洿 + specificationsModels: '', // 鍨嬪彿瑙勬牸 + storagePlace: '', // 瀛樻斁鍦扮偣 + whetherDataAcquisition: 1 // 鏄惁鏀寔鏁伴噰 + } + }, // 鑾峰彇鍒嗙被鏁版嵁 async getThreeData() { const { data } = await getClassifyList() @@ -796,50 +817,66 @@ this.addDrawerVisible = false }, resetForm(formName) { + this.measureForm = { + userId: null, + measurementUnit: null, + date: null, + uncertainty: null, + result: null, + performanceIndex: null, + remarks: null, + file: "" + } this.$refs[formName].resetFields(); }, cancelAddMeasure() { this.$refs['upload'].clearFiles(); this.measureForm.file = null; this.measureFormVisible = false - this.resetForm('addmeasureForm') + this.resetForm('addmeasureForm'); }, // 娣诲姞璁¢噺淇℃伅 async addMeasure() { - let v = this.submitForm('addmeasureForm') - console.log(v); - if (!v) { - return - } - // 鏍煎紡鍖栨椂闂� - this.measureForm.instrumentId = this.equipmentDetail.id - if (Array.isArray(this.measureForm.date)) { - this.measureForm.beginDate = parseTime(this.measureForm.date[0], '{y}-{m}-{d}') - this.measureForm.endDate = parseTime(this.measureForm.date[1], '{y}-{m}-{d}') - } - console.log(this.measureForm) - const formData = new FormData() - formData.append('file', this.measureForm.file?.raw, this.measureForm.file?.name) - console.log(this.measureForm) - for (const key in this.measureForm) { - console.log(key) - // if (key === 'file') return - formData.append(key, this.measureForm[key]) - } - console.log(formData) - try { - const { data } = await addMetricalInformation(formData) - console.log(data) - this.$message.success('娣诲姞鎴愬姛') - const { data: informationList } = await getMetricalInformationList({ InstrumentId: this.equipmentDetail.id }) - this.measureTable = informationList - this.measureForm = {} - this.measureFormVisible = false - } catch (error) { - this.$message.error('娣诲姞澶辫触') - } - this.measureForm.file = null; - this.$refs['upload'].clearFiles(); + this.$refs['addmeasureForm'].validate(async(valid)=>{ + if(valid){ + // 鏍煎紡鍖栨椂闂� + this.measureForm.instrumentId = this.equipmentDetail.id + if (Array.isArray(this.measureForm.date)) { + this.measureForm.beginDate = parseTime(this.measureForm.date[0], '{y}-{m}-{d}') + this.measureForm.endDate = parseTime(this.measureForm.date[1], '{y}-{m}-{d}') + } + console.log(this.measureForm) + const formData = new FormData() + if(this.measureForm.file == null || this.measureForm.file == ""){ + this.$message.warning("璇烽�夋嫨瑕佷笂浼犵殑鏂囦欢!"); + return; + }else{ + formData.append('file', this.measureForm.file?.raw, this.measureForm.file?.name) + } + console.log(this.measureForm) + for (const key in this.measureForm) { + console.log(key) + // if (key === 'file') return + formData.append(key, this.measureForm[key]) + } + console.log(formData) + try { + const { data } = await addMetricalInformation(formData) + console.log(data) + this.$message.success('娣诲姞鎴愬姛') + const { data: informationList } = await getMetricalInformationList({ InstrumentId: this.equipmentDetail.id }) + this.measureTable = informationList + this.measureForm = {} + this.measureFormVisible = false + } catch (error) { + this.$message.error('娣诲姞澶辫触') + } + this.measureForm.file = null; + this.$refs['upload'].clearFiles(); + }else{ + console.log(32); + } + }); }, // 鍏抽棴璁惧璇︽儏鎶藉眽 closeDetailDrawer() { @@ -857,7 +894,7 @@ }, // 鏂囦欢涓婁紶 handleUpload(file, fileList) { - // console.log(file, fileList) + console.log(file, fileList) this.measureForm.file = file }, // 鏍规嵁杈撳叆鐨勮澶囩紪鍙凤紝璁惧鍚嶇О鎴栬�呭瀷鍙疯鏍煎叧閿瓧杩涜杩囨护鍒楄〃 @@ -1050,13 +1087,12 @@ background: #ecf5ff !important; border-color: #b3d8ff !important; } - .el-form { .el-form-item { margin-bottom: 0px !important; .el-input { - width: 360px; + width: 500px; } } } -- Gitblit v1.9.3