From ea3c33c8561df39d4f123d1424fda99dd0f0c51d Mon Sep 17 00:00:00 2001 From: wujian <14790700720@163.com> Date: 星期四, 14 十一月 2024 08:15:41 +0800 Subject: [PATCH] add - panel --- jcdm-ui/src/views/main/da/paramCollection/index.vue | 127 ++++++++++++++++++++++++++--------------- 1 files changed, 80 insertions(+), 47 deletions(-) diff --git a/jcdm-ui/src/views/main/da/paramCollection/index.vue b/jcdm-ui/src/views/main/da/paramCollection/index.vue index f997702..0f2c5bb 100644 --- a/jcdm-ui/src/views/main/da/paramCollection/index.vue +++ b/jcdm-ui/src/views/main/da/paramCollection/index.vue @@ -1,22 +1,35 @@ <template> <div class="app-container"> <el-card class="box-card"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="浜у搧缂栫爜" prop="productCode"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px"> + <el-form-item label="鍙戝姩鏈虹紪鐮�" prop="sfcCode"> <el-input - v-model="queryParams.productCode" - placeholder="璇疯緭鍏ヤ骇鍝佺紪鐮�" + v-model="queryParams.sfcCode" + placeholder="璇疯緭鍏ュ彂鍔ㄦ満缂栫爜" clearable @keyup.enter.native="handleQuery" /> </el-form-item> - <el-form-item label="浜у搧鍚嶇О" prop="productName"> + <el-form-item label="宸ヤ綅缂栧彿" prop="locationCode"> <el-input - v-model="queryParams.productName" - placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�" + v-model="queryParams.locationCode" + placeholder="璇疯緭鍏ュ伐浣嶇紪鍙�" clearable @keyup.enter.native="handleQuery" /> + </el-form-item> + <el-form-item label="鏃ユ湡鑼冨洿" prop="dateConditions"> + <el-date-picker + v-model="queryParams.dateConditions" + type="daterange" + align="right" + unlink-panels + range-separator="鑷�" + start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" + value-format="yyyy-MM-dd" + @change="handleDateChange"> + </el-date-picker> </el-form-item> <el-form-item style="float: right"> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> @@ -73,23 +86,23 @@ <el-table v-loading="loading" border :data="paramCollectionList" @selection-change="handleSelectionChange" v-if="paramCollectionList.length > 0"> <el-table-column type="selection" width="55" align="center" /> - <el-table-column label="宸ュ崟缂栧彿" align="center" prop="workOrderNo"></el-table-column> - <el-table-column label="鎬绘垚搴忓垪鍙�" align="center" width="140" prop="sfcCode" ></el-table-column> - <el-table-column label="浜у搧缂栧彿" align="center" prop="productCode"></el-table-column> - <el-table-column label="浜х嚎缂栧彿" align="center" prop="productionLine"></el-table-column> - <el-table-column label="宸ヤ綅缂栧彿" align="center" prop="locationCode"></el-table-column> - <el-table-column label="璁惧缂栧彿" align="center" prop="equipmentNo"></el-table-column> - <el-table-column label="鍙傛暟缂栫爜" align="center" prop="paramCode"></el-table-column> +<!-- <el-table-column label="宸ュ崟缂栧彿" align="center" prop="workOrderNo"></el-table-column>--> + <el-table-column label="鍙戝姩鏈虹紪鐮�" align="center" width="160" prop="sfcCode" ></el-table-column> +<!-- <el-table-column label="浜у搧缂栧彿" align="center" prop="productCode"></el-table-column>--> +<!-- <el-table-column label="浜х嚎缂栧彿" align="center" prop="productionLine"></el-table-column>--> +<!-- <el-table-column label="璁惧缂栧彿" align="center" prop="equipmentNo"></el-table-column>--> + <el-table-column label="鍙傛暟鍚嶇О" align="center" prop="paramName" width="150" ></el-table-column> <el-table-column label="鍙傛暟鍊�" align="center" prop="paramValue"></el-table-column> + <el-table-column label="宸ヤ綅缂栧彿" align="center" prop="locationCode"></el-table-column> <el-table-column label="鍙傛暟涓婇檺" align="center" prop="paramUpper"></el-table-column> <el-table-column label="鍙傛暟涓嬮檺" align="center" prop="paramLower"></el-table-column> - <el-table-column label="閲囬泦鏃堕棿" align="center" prop="collectionTime" width="100"> + <el-table-column label="閲囬泦鏃堕棿" align="center" prop="collectionTime" width="160"> <template slot-scope="scope"> - <span>{{ parseTime(scope.row.collectionTime, '{y}-{m}-{d}') }}</span> + <span>{{ parseTime(scope.row.collectionTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> </template> </el-table-column> <el-table-column label="鐘舵��" align="center" prop="state"></el-table-column> - <el-table-column label="鍙傛暟鍚嶇О" align="center" prop="paramName" width="150" ></el-table-column> + <el-table-column label="鍙傛暟缂栫爜" align="center" prop="paramCode"></el-table-column> <el-table-column label="鍗曚綅" align="center" prop="unit"></el-table-column> <el-table-column label="绫诲瀷" align="center" prop="type"></el-table-column> <el-table-column fixed="right" width="200" label="鎿嶄綔" align="center" class-name="small-padding fixed-width" > @@ -131,24 +144,24 @@ <!-- 娣诲姞鎴栦慨鏀硅澶囦骇鍝佽繃绋嬪弬鏁伴噰闆嗗璇濇 --> <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body> <el-form ref="form" :model="form" :rules="rules" label-width="80px"> - <el-form-item label="宸ュ崟缂栧彿" prop="workOrderNo"> - <el-input v-model="form.workOrderNo" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> - <el-form-item label="鎬绘垚搴忓垪鍙�" prop="sfcCode"> +<!-- <el-form-item label="宸ュ崟缂栧彿" prop="workOrderNo">--> +<!-- <el-input v-model="form.workOrderNo" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" />--> +<!-- </el-form-item>--> + <el-form-item label="鍙戝姩鏈虹紪鐮�" prop="sfcCode"> <el-input v-model="form.sfcCode" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> </el-form-item> <el-form-item label="浜у搧缂栧彿" prop="productCode"> <el-input v-model="form.productCode" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> </el-form-item> - <el-form-item label="浜х嚎缂栧彿" prop="productionLine"> - <el-input v-model="form.productionLine" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> +<!-- <el-form-item label="浜х嚎缂栧彿" prop="productionLine">--> +<!-- <el-input v-model="form.productionLine" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" />--> +<!-- </el-form-item>--> <el-form-item label="宸ヤ綅缂栧彿" prop="locationCode"> <el-input v-model="form.locationCode" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> </el-form-item> - <el-form-item label="璁惧缂栧彿" prop="equipmentNo"> - <el-input v-model="form.equipmentNo" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> +<!-- <el-form-item label="璁惧缂栧彿" prop="equipmentNo">--> +<!-- <el-input v-model="form.equipmentNo" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" />--> +<!-- </el-form-item>--> <el-form-item label="鍙傛暟缂栫爜" prop="paramCode"> <el-input v-model="form.paramCode" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> </el-form-item> @@ -163,14 +176,6 @@ </el-form-item> <el-form-item label="鏍囧噯鍊�" prop="paramStandard"> <el-input v-model="form.paramStandard" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" /> - </el-form-item> - <el-form-item label="閲囬泦鏃堕棿" prop="collectionTime"> - <el-date-picker clearable - v-model="form.collectionTime" - type="date" - value-format="yyyy-MM-dd" - placeholder="璇烽�夋嫨閲囬泦鏃堕棿"> - </el-date-picker> </el-form-item> <el-form-item label="鐘舵��" prop="state"> <el-input v-model="form.state" placeholder="璇疯緭鍏ョ姸鎬�" /> @@ -196,11 +201,13 @@ <script> import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection/paramCollection"; +import {queryDaParamCollectionListForSearch} from "../../../../api/main/da/paramCollection/paramCollection"; export default { name: "ParamCollection", data() { return { + maxDate: '', // 閬僵灞� loading: true, // 閫変腑鏁扮粍 @@ -221,6 +228,7 @@ open: false, // 鏌ヨ鍙傛暟 queryParams: { + dateConditions: [], pageNum: 1, pageSize: 10, workOrderNo: null, @@ -238,18 +246,18 @@ id: [ { required: true, message: "涓婚敭id涓嶈兘涓虹┖", trigger: "blur" } ], - workOrderNo: [ - { required: true, message: "宸ュ崟缂栧彿涓嶈兘涓虹┖", trigger: "blur" } - ], + // workOrderNo: [ + // { required: true, message: "宸ュ崟缂栧彿涓嶈兘涓虹┖", trigger: "blur" } + // ], sfcCode: [ { required: true, message: "鎬绘垚搴忓垪鍙蜂笉鑳戒负绌�", trigger: "blur" } ], productCode: [ { required: true, message: "浜у搧缂栧彿涓嶈兘涓虹┖", trigger: "blur" } ], - productionLine: [ - { required: true, message: "浜х嚎缂栧彿涓嶈兘涓虹┖", trigger: "blur" } - ], + // productionLine: [ + // { required: true, message: "浜х嚎缂栧彿涓嶈兘涓虹┖", trigger: "blur" } + // ], locationCode: [ { required: true, message: "宸ヤ綅缂栧彿涓嶈兘涓虹┖", trigger: "blur" } ], @@ -263,17 +271,42 @@ }; }, created() { - this.getList(); + // this.getList(); }, methods: { + handleDateChange(value) { + if (value && value.length === 2) { + const startDate = value[0]; + const endDate = value[1]; + const dayCount = this.daysBetween(startDate, endDate); + if (dayCount + 1 > 3) { + this.$message.error('璇烽�夋嫨杩炵画鐨�3澶╋紒'); + this.queryParams.dateConditions = []; // 閲嶇疆鏃ユ湡鑼冨洿 + } + } + }, + daysBetween(startDate, endDate) { + const oneDay = 24 * 60 * 60 * 1000; // 姣忓ぉ鐨勬绉掓暟 + const startTime = new Date(startDate).getTime(); + const endTime = new Date(endDate).getTime(); + return Math.round(Math.abs((startTime - endTime) / oneDay)); + }, /** 鏌ヨ璁惧浜у搧杩囩▼鍙傛暟閲囬泦鍒楄〃 */ getList() { this.loading = true; - listParamCollection(this.queryParams).then(response => { - this.paramCollectionList = response.rows; - this.total = response.total; - this.loading = false; - }); + if ((this.queryParams.sfcCode == null || this.queryParams.sfcCode === '') && this.queryParams.dateConditions.length === 0){ + this.$message({ + message: '璇疯緭鍏ュ彂鍔ㄦ満鍙风爜鎴栬�呴�夋嫨鏌ヨ鏃ユ湡', + type: 'info' + }); + } else { + queryDaParamCollectionListForSearch(this.queryParams).then(response => { + this.paramCollectionList = response.rows; + this.total = response.total; + this.loading = false; + }); + } + }, // 鍙栨秷鎸夐挳 cancel() { -- Gitblit v1.9.3