From 6dd2ed2eb744d085130554abed50ca1a98c8c508 Mon Sep 17 00:00:00 2001 From: 李林 <z1292839451@163.com> Date: 星期一, 21 八月 2023 09:16:52 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/utils/request.js | 2 src/api/util/requestUtil.js | 11 + src/views/laboratory/measure/Add.vue | 170 +++++++++++++++----- src/views/laboratory/measure/index.vue | 158 +++++++++++++++++-- src/layout/index.vue | 6 src/layout/components/AppMain.vue | 6 src/utils/dateUtil.js | 49 ++++++ src/components/Breadcrumb/index.vue | 11 + src/api/laboratory/measure.js | 20 ++ 9 files changed, 364 insertions(+), 69 deletions(-) diff --git a/src/api/laboratory/measure.js b/src/api/laboratory/measure.js index 3a6104e..cf5033a 100644 --- a/src/api/laboratory/measure.js +++ b/src/api/laboratory/measure.js @@ -33,4 +33,22 @@ method: 'get', params }) -} \ No newline at end of file +} + +//鑾峰彇user鍒楄〃鍜屼华鍣ㄥ垪琛� +export function getListUserAndListIns(params) { + return request({ + url: '/metering-plan/getListUserAndListIns', + method: 'get', + params + }) +} + +//娣诲姞璁″垝浠ュ強璁¢噺淇℃伅 +export function addPlanAndMeasure(data) { + return request({ + url: '/metering-plan/addPlanAndMeasure', + method: 'post', + data + }) +} diff --git a/src/api/util/requestUtil.js b/src/api/util/requestUtil.js index 263da29..dee7d95 100644 --- a/src/api/util/requestUtil.js +++ b/src/api/util/requestUtil.js @@ -15,4 +15,13 @@ data }) } - +export function postFile(path, data) { + return request({ + url: path, + method: 'post', + headers: { + 'Content-Type': 'multipart/form-data' + }, + data + }) +} diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index a038a02..3c4c407 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -12,6 +12,7 @@ </el-col> <el-col :span="12" style="background-color: #fff;display: flex;justify-content: end; align-items: center;"> <el-button v-if="backPlan" type="primary" icon="el-icon-refresh-left" size="mini" plain @click="backPlanUp">杩斿洖</el-button> + <el-button v-if="add" size="mini" @click="breadd" style="width: 60px;" type="primary">淇濆瓨</el-button> <el-col :span="1"></el-col> </el-col> </div> @@ -24,7 +25,8 @@ data() { return { levelList: null, - backPlan: false + backPlan: false, + add: false } }, watch: { @@ -40,6 +42,13 @@ this.$parent.combackPlan() this.backPlan=false }, + breadd(){ + this.add=false + this.$parent.indexAdd() + }, + showadd(){ + this.add=true + }, triggerBtnPlan(){ this.backPlan?this.backPlan=false:this.backPlan=true }, diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue index 6b65965..48fea47 100644 --- a/src/layout/components/AppMain.vue +++ b/src/layout/components/AppMain.vue @@ -20,6 +20,12 @@ }, triggerMainBtnPlan(){ this.$parent.triggerCombackBtn() + }, + mainAdd(){ + this.$refs.child.measureAdd() + }, + mainShowAdd(){ + this.$parent.showIndexAdd() } } } diff --git a/src/layout/index.vue b/src/layout/index.vue index a1016fa..37ab14d 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -58,6 +58,12 @@ combackPlan(){ this.$refs.main.childMethod() }, + indexAdd(){ + this.$refs.main.mainAdd() + }, + showIndexAdd(){ + this.$refs.breadcrumb.showadd() + }, triggerCombackBtn(){ this.$refs.breadcrumb.triggerBtnPlan() } diff --git a/src/utils/dateUtil.js b/src/utils/dateUtil.js new file mode 100644 index 0000000..33df681 --- /dev/null +++ b/src/utils/dateUtil.js @@ -0,0 +1,49 @@ +export function dateFormat(longTypeDate) { + var dateTypeDate = ""; + var date = new Date(); + date.setTime(longTypeDate); + dateTypeDate += date.getFullYear(); //骞� + dateTypeDate += "-" + getMonth(date); //鏈� + dateTypeDate += "-" + getDay(date); //鏃� + return dateTypeDate; +} + +//杩斿洖 01-12 鐨勬湀浠藉�� +function getMonth(date) { + var month = ""; + month = date.getMonth() + 1; //getMonth()寰楀埌鐨勬湀浠芥槸0-11 + if (month < 10) { + month = "0" + month; + } + return month; +} +//杩斿洖01-30鐨勬棩鏈� +function getDay(date) { + var day = ""; + day = date.getDate(); + if (day < 10) { + day = "0" + day; + } + return day; +} +function datetimeFormat(longTypeDate) { + var dateTypeDate = ""; + var date = new Date(); + date.setTime(longTypeDate); + dateTypeDate += date.getFullYear(); //骞� + dateTypeDate += "-" + this.getMonth(date); //鏈� + dateTypeDate += "-" + this.getDay(date); //鏃� + return dateTypeDate; +} +function format(d) { + var y = d.getFullYear(); + var m = d.getMonth() + 1; + if (m < 10) { + m = "0" + m; + } + var day = d.getDate(); + if (day < 10) { + day = "0" + day; + } + return y + "-" + m + "-" + day; +} \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index a9ff826..2b822e9 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -18,7 +18,7 @@ // let each request carry token // ['X-Token'] is a custom headers key // please modify it according to the actual situation - config.headers['token'] = getToken() + config.headers['X-Token'] = getToken() } config.headers['link'] = store.state.settings.link // console.log('config' ,config) diff --git a/src/views/laboratory/measure/Add.vue b/src/views/laboratory/measure/Add.vue index 0cf9cd1..224b34e 100644 --- a/src/views/laboratory/measure/Add.vue +++ b/src/views/laboratory/measure/Add.vue @@ -8,15 +8,15 @@ <el-form-item> <el-col :span="6" style="display: flex;justify-content: space-around;"> <span>璐熻矗浜猴細</span> - <el-select v-model="planAddInfo.measurePerson" placeholder="璇烽�夋嫨娲诲姩鍖哄煙"> - <el-option label="鍖哄煙涓�" value="shanghai"></el-option> - <el-option label="鍖哄煙浜�" value="beijing"></el-option> + <el-select v-model="planAddInfo.measurePerson" placeholder="璇烽�夋嫨璐熻矗浜�"> + <el-option v-for="item in userList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> </el-select> </el-col> <el-col :span="8" style="display: flex;justify-content: space-around;"> <span>璁″垝鏃堕棿锛�</span> - <el-date-picker v-model="planAddInfo.planDate" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡"> + <el-date-picker v-model="planAddInfo.planDate" type="daterange" range-separator="鑷�" + start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"> </el-date-picker> </el-col> <el-col :span="5"></el-col> @@ -36,39 +36,54 @@ :show-text="false"></el-progress> </el-col> </el-col> + <el-col style="width:93%;height: 20vh;margin-top: 30px; margin-left: 40px;"> + <el-button icon="el-icon-plus" @click="addcodePointsTable()" style="margin-bottom: 10px;" + type="primary">鏂板璁¢噺</el-button> <el-table ref="codePointsTable" :cell-style="{ textAlign: 'center' }" :header-cell-style="{ border: '0px', background: '#f5f7fa', color: '#606266', boxShadow: 'inset 0 1px 0 #ebeef5', textAlign: 'center' }" :data="codePointsTable" style="width: 100%"> - <el-table-column type="index" label="搴忓彿" min-width="90" /> - <el-table-column prop="equipmentPointName" label="浠櫒璁惧鍚嶇О" min-width="150"> + <el-table-column type="index" v-model="codePointsTable.index" label="搴忓彿" min-width="90" /> + <el-table-column prop="equipmentPointName" label="浠櫒璁惧" min-width="150"> <template slot-scope="scope"> - <span v-show="!codePointesTableStatus">{{ scope.row.equipmentPoint }}</span> - <el-input v-show="codePointesTableStatus" v-model="scope.row.equipmentPoint" /> + <span v-show="!codePointesTableStatus">{{ scope.row.equipmentPointName }}</span> + <el-select @change="insListChange(scope.row.equipmentPointName,scope)" v-model="scope.row.equipmentPointName" placeholder="璇烽�夋嫨浠櫒璁惧"> + <el-option v-for="item in insList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> </template> </el-table-column> - <el-table-column prop="measuringRange" label="娴嬮噺鑼冨洿" min-width="150"> <template slot-scope="scope"> <span v-show="!codePointesTableStatus">{{ scope.row.measuringRange }}</span> - <el-input v-show="codePointesTableStatus" v-model="scope.row.measuringRange" /> + <el-input disabled v-show="codePointesTableStatus" v-model="scope.row.measuringRange" /> </template> </el-table-column> - <el-table-column prop="unit" label="鍗曚綅" min-width="150"> + <el-table-column prop="termValidity" label="璁¢噺鍛ㄦ湡" min-width="150"> <template slot-scope="scope"> - <span v-show="!codePointesTableStatus">{{ scope.row.unit }}</span> - <el-input v-show="codePointesTableStatus" v-model="scope.row.unit" /> + <span v-show="!codePointesTableStatus">{{ scope.row.termValidity }}</span> + <el-input disabled v-show="codePointesTableStatus" v-model="scope.row.termValidity" /> </template> </el-table-column> - <el-table-column prop="descriptiveness" label="鎻忚堪" min-width="200"> + <el-table-column prop="result" label="璁¢噺缁撴灉" min-width="200"> <template slot-scope="scope"> - <span v-show="!codePointesTableStatus">{{ scope.row.descriptiveness }}</span> - <el-input v-show="codePointesTableStatus" v-model="scope.row.descriptiveness" /> + <span v-show="!codePointesTableStatus">{{ scope.row.result }}</span> + <el-select v-model="scope.row.result" placeholder="璇烽�夋嫨"> + <el-option v-for="item in result" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> </template> </el-table-column> - <el-table-column prop="descriptiveness" label="鎿嶄綔" min-width="200"> + <el-table-column prop="endDate" label="璁¢噺鏃ユ湡" min-width="200"> <template slot-scope="scope"> - <el-tag type="" icon=""></el-tag> + <span v-show="!codePointesTableStatus">{{ scope.row.endDate }}</span> + <el-date-picker v-model="scope.row.endDate" type="date" placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </template> + </el-table-column> + <el-table-column prop="index" label="鎿嶄綔" min-width="200"> + <template slot-scope="scope"> + <span><a @click="removetableIndex(scope.row.index)" style="color: deepskyblue;">浣滃簾</a></span> </template> </el-table-column> </el-table> @@ -76,41 +91,110 @@ </div> </template> <script> +import { + getListUserAndListIns, addPlanAndMeasure +} from '@/api/laboratory/measure' +import { dateFormat } from "../../../utils/dateUtil"; export default { data() { return { planAddInfo: { - plannedOrderNumber: 7897897987, - measurePerson: '鏌愭煇浜�', - planDate: "2021-09-08 ~ 2024-08-09", - unit: '鏌愭煇妫�娴嬪眬', - createPerson: '鏌愭煇璐熻矗浜�', - createTime: '2021-09-08' + plannedOrderNumber: '', + measurePerson: '', + planDate: "", + unit: '', + createPerson: '', + createTime: '' }, codePointsTable: [{ - id: '', + "index": 1, + "equipmentPointName": '', + "measuringRange": '', + "termValidity": "", + "result": null, + }], + result: [{ + label: '鍚堟牸', + value: 1 + }, { + label: '鐭鍚庡彲鐢�', + value: 2 + }, { + label: '涓嶅悎鏍�', + value: 3 + }], + userList: [], + insList: [], + instrumentList:[], + // 鐮佺偣琛ㄦ牸鐨勭姸鎬侊細鏁版嵁灞曠ずfalse/鏂板杈撳叆true + codePointesTableStatus: false, + } + }, + async created() { + this.codePointsTable = [] + let res = await getListUserAndListIns() + res.data.userList.forEach(element => { + this.userList.push({ label: element.name, value: element.id }) + }); + this.instrumentList=res.data.instrumentList + res.data.instrumentList.forEach(item => { + this.insList.push({ label: item.equipmentName, value: item.id }) + }) + console.log(this.insList); + }, + methods: { + addcodePointsTable() { + const newObj = { + index: this.codePointsTable.length + 1, equipmentPointName: '', measuringRange: '', termValidity: "", - planDate: null, - }], - // 鐮佺偣琛ㄦ牸鐨勭姸鎬侊細鏁版嵁灞曠ずfalse/鏂板杈撳叆true - codePointesTableStatus: true, - } - }, - methods: { - // 鏂板璁惧鐮佺偣 - addNewCodePoints() { - // - if (!this.codePointsTable) { - this.codePointsTable = [] + result: null, + endDate: null, + planDate: null } - const newObj = {} - newObj.equipmentPointName = '' - newObj.descriptiveness = '' - newObj.unit = '' - newObj.instrumentId = this.equipmentDetail.id this.codePointsTable.push(newObj) + this.codePointesTableStatus = true + }, + removetableIndex(id) { + this.codePointsTable = this.codePointsTable.filter(item => { + return item.index != id; + }) + }, + async add() { + console.log(111111); + this.planAddInfo.startTime = dateFormat(this.planAddInfo.planDate[0]) + this.planAddInfo.endTime = dateFormat(this.planAddInfo.planDate[1]) + console.log(this.planAddInfo); + this.planAddInfo.planDate = null + this.codePointsTable.forEach(item => { + if(item.endDate!=null&&item.endDate!=''){ + item.endDate = dateFormat(item.endDate) + } + }) + console.log(this.codePointsTable); + let data = {} + this.codePointsTable.length>0?data = { measureList: this.codePointsTable, plan: this.planAddInfo }:data = {plan: this.planAddInfo } + let add = await addPlanAndMeasure(data) + this.planAddInfo={ + plannedOrderNumber: '', + measurePerson: '', + planDate: "", + unit: '', + createPerson: '', + createTime: '' + } + this.codePointsTable=[] + return add.data + }, + insListChange(i,s){ + console.log(i); + console.log(s.$index); + let ins= this.instrumentList.filter(item=>{ + return item.id==i + })[0] + this.codePointsTable[s.$index].measuringRange=ins.measuringRange + this.codePointsTable[s.$index].termValidity=ins.termValidity+'鏈�' } } } diff --git a/src/views/laboratory/measure/index.vue b/src/views/laboratory/measure/index.vue index d133f34..eaa03d0 100644 --- a/src/views/laboratory/measure/index.vue +++ b/src/views/laboratory/measure/index.vue @@ -117,11 +117,12 @@ </div> </div> </div> - <div style="position: absolute;top:14px;left: 9px;transition: 1s;width: 99%;height: 82vh;background-color: #fff;z-index: 21;"> - <Add/> + <div + :style="`position: absolute;top:${addTop}px;left: 9px;transition: 1s;width: 99%;height: 82vh;background-color: #fff;z-index: 21;`"> + <Add ref="add" /> </div> <div id="myMOdel" - :style="`position: absolute;transition: 1s;top:${mymodelTop}px; left: 9px; width: 99%; height: 65vh; background-color: #fff;z-index: 20;`"> + :style="`position: absolute;transition: 1s;top:${mymodelTop}px; left: 9px; width: 99%; height: 85vh; background-color: #fff;z-index: 20;`"> <el-col :span="10"> <p style="font-size: 13px;padding-left: 40px;">璁″垝淇℃伅</p> </el-col> @@ -188,16 +189,77 @@ <el-table-column prop="imCreateTime" label="鍒涘缓鏃ユ湡" /> <el-table-column prop="measurementName" label="鍒涘缓浜�" /> <el-table-column prop="measurementUnit" label="璁¢噺鍗曚綅" /> - <el-table-column prop="equipmentCode" label="璁¢噺缂栧彿" /> + <el-table-column prop="code" label="璁¢噺缂栧彿" /> + <el-table-column prop="equipmentCode" label="鎿嶄綔"> + <template slot-scope="scope"> + <a @click="measureUp(scope)" style="color: deepskyblue;">璁¢噺</a> + </template> + </el-table-column> </el-table> </el-col> - <el-col style="width: 93%;margin-left: 40px; margin-top: 90px;display: flex;justify-content: end;"> + <el-col style="width: 93%;margin-left: 40px; margin-top: 250px;display: flex;justify-content: end;"> <el-pagination @size-change="handleSizeChangePlan" @current-change="handleCurrentChangePllan" - :current-page="currentPagePlan" :page-sizes="[5, 10, 20]" :page-size="pageSizePlan" + :current-page="currentPagePlan" :page-sizes="[5, 10]" :page-size="pageSizePlan" layout="total, sizes, prev, pager, next, jumper" :total="totalPlan"> </el-pagination> </el-col> </div> + <el-dialog class="measureForm" title="璁¢噺" :visible.sync="dialogVisible"> + <el-form label-position="top" ref="upmeasureForm" :model="measureUpInfo"> + <el-row :gutter="20"> + <el-col :span="24"> + <el-form-item label="妫�瀹氭湁鏁堟湡" prop="date" :rules="[{ required: true, message: '璇烽�夋嫨妫�瀹氭湁鏁堟湡', trigger: 'change' }]"> + <el-date-picker v-model="measureUpInfo.date" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" + end-placeholder="缁撴潫鏃ユ湡" /> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="12"> + <el-form-item label="涓嶇‘瀹氬害" prop="uncertainty" + :rules="[{ required: true, message: '璇峰~鍐欎笉纭畾搴�', trigger: 'blur' }]"> + <el-input placeholder="璇峰~鍐欎笉纭畾搴�" v-model="measureUpInfo.uncertainty" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="缁撴灉" prop="result" :rules="[{ required: true, message: '璇烽�夋嫨缁撴灉', trigger: 'change' }]"> + <el-select v-model="measureUpInfo.result" clearable filterable :allow-create="true" placeholder="璇烽�夋嫨缁撴灉" + style="width:100%"> + <el-option v-for="item in result" :key="item.id" :label="item.label" :value="item.value" /> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="24"> + <el-form-item label="鎬ц兘鎸囨爣"> + <el-input v-model="measureUpInfo.performanceIndex" type="textarea" :rows="2" placeholder="璇疯緭鍏ュ唴瀹�" /> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="24"> + <el-form-item label="澶囨敞"> + <el-input v-model="measureUpInfo.remarks" type="textarea" :rows="2" placeholder="璇疯緭鍏ュ唴瀹�" /> + </el-form-item> + </el-col> + </el-row> + <el-row :gutter="20"> + <el-col :span="24"> + <el-form-item label=""> + <el-upload class="upload-demo" action="#" :on-change="handleUpload" :auto-upload="false"> + <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button> + </el-upload> + </el-form-item> + </el-col> + </el-row> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button type="primary" @click="addMeasure">纭� 瀹�</el-button> + + <el-button @click="dialogVisible=false">鍙� 娑�</el-button> + </span> + </el-dialog> </div> </div> </template> @@ -211,6 +273,26 @@ }, data() { return { + dialogVisible: false, + tableIndex: null, + measureUpInfo:{ + result: null, + date: null, + uncertainty: null, + performanceIndex: null, + remarks: null, + file: null + }, + result: [{ + label: '鍚堟牸', + value: 1 + }, { + label: '鐭鍚庡彲鐢�', + value: 2 + }, { + label: '涓嶅悎鏍�', + value: 3 + }], searchData: { code: '', name: '', @@ -232,9 +314,8 @@ currentPagePlan: 1, pageSizePlan: 5, totalPlan: 0, - drawer: false, direction: 'rtl', - lookVisible: true, + lookVisible: false, measureData: [], planInfo: { plannedOrderNumber: 7897897987, @@ -244,7 +325,8 @@ createPerson: '鏌愭煇璐熻矗浜�', createTime: '2021-09-08' }, - mymodelTop: -600,//14 + mymodelTop: -700,//14 + addTop: -700, planId: 0 } }, @@ -253,7 +335,29 @@ // this.getPlanPageList() }, methods: { + upResult(){ + this.measureData[this.tableIndex].result=this.resultUp + + }, + measureUp(scope) { + console.log(scope); + this.dialogVisible = true + this.tableIndex=scope.$index + this.measureUpInfo.result=scope.row.result + }, + measureAdd() { + let add = this.$refs.add.add() + if (add) { + this.addTop = -700 + this.$message({ + message: '鎿嶄綔鎴愬姛锛�', + type: 'success' + }); + this.lookVisible = false + } + }, async handleSizeChangePlan(num) { + console.log(num); this.pageSizePlan = num await this.limitGetPlanMeasureInstrument() }, @@ -262,14 +366,18 @@ await this.limitGetPlanMeasureInstrument() }, addPlan() { - this.drawer = true + this.addTop = 14 + this.lookVisible = true + this.$parent.mainShowAdd() }, async limitGetPlanMeasureInstrument() { - let res = await limitGetPlanMeasureRequest({ + let param = { id: this.planId, currentPage: this.currentPagePlan, - pageSize: this.pageSize - }) + pageSize: this.pageSizePlan + } + console.log(param); + let res = await limitGetPlanMeasureRequest(param) this.totalPlan = res.data.taotal this.measureData = res.data.list }, @@ -299,7 +407,7 @@ }, combackLookPlan() { this.lookVisible = false - this.mymodelTop = -600 + this.mymodelTop = -700 }, blurSearch() { if (this.radioValue === 1) { @@ -309,17 +417,21 @@ handleClose() { this.drawer = false }, - handleCurrentChange() { - this.getStandingPageList() + handleCurrentChange(num) { + this.currentPage = num + this.radioValue ? this.getPlanPageList() : this.getStandingPageList() }, - handleSizeChange() { - this.getStandingPageList() + handleSizeChange(num) { + this.pageSize = num + this.radioValue ? this.getPlanPageList() : this.getStandingPageList() }, async getStandingPageList() { - const res = await getStandingPageList({ + let param = { currentPage: this.currentPage, pageSize: this.pageSize, code: this.searchData.code, name: this.searchData.name, unit: this.searchData.measureunit - }) + } + console.log(param); + const res = await getStandingPageList(param) this.measureLedgerTable = res.data.records this.total = res.data.total this.measureLedgerTable.forEach(item => { @@ -362,10 +474,12 @@ this.reset() }, async getPlanPageList() { - const res = await getPlanPageList({ + let param = { currentPage: this.currentPage, pageSize: this.pageSize, code: this.searchData.code, name: this.searchData.name, unit: this.searchData.measureunit - }) + } + console.log(param); + const res = await getPlanPageList(param) res.data.list.forEach(item => { item.palanDate = item.beginTime + " ~ " + item.endTime }) -- Gitblit v1.9.3