From 8eef54d67522f078266a54f0c0596b67c012e6d6 Mon Sep 17 00:00:00 2001 From: value <z1292839451@163.com> Date: 星期二, 29 八月 2023 14:34:05 +0800 Subject: [PATCH] bug --- src/views/laboratory/measure/Add.vue | 196 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 193 insertions(+), 3 deletions(-) diff --git a/src/views/laboratory/measure/Add.vue b/src/views/laboratory/measure/Add.vue index a2f0802..0533251 100644 --- a/src/views/laboratory/measure/Add.vue +++ b/src/views/laboratory/measure/Add.vue @@ -1,10 +1,200 @@ <template> <div> - 11112561564564456456 + <el-col :span="10"> + <p style="font-size: 13px;padding-left: 40px;">璁″垝淇℃伅</p> + </el-col> + <el-col> + <el-form :model="planAddInfo" style="padding-left: 150px;"> + <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 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> + </el-col> + <el-col :span="5"></el-col> + <el-col :span="5" style="display: flex;justify-content: space-around;"> + <span>璁¢噺鍗曚綅锛�</span> + <el-input style="width: 150px;" v-model="planAddInfo.unit" placeholder=""></el-input> + </el-col> + </el-form-item> + </el-form> + </el-col> + <el-col> + <el-col style="font-size: 13px;padding-left: 55px;"> + 璁¢噺淇℃伅 + </el-col> + <el-col> + <el-progress style="width: 95%;padding-left: 40px;margin-top: 20px;" :percentage="6" :stroke-width="2" + :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 max-height="300" 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" 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.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 disabled v-show="codePointesTableStatus" v-model="scope.row.measuringRange" /> + </template> + </el-table-column> + <el-table-column prop="termValidity" label="璁¢噺鍛ㄦ湡" min-width="150"> + <template slot-scope="scope"> + <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="result" label="璁¢噺缁撴灉" min-width="200"> + <template slot-scope="scope"> + <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="endDate" label="璁¢噺鏃ユ湡" min-width="200"> + <template slot-scope="scope"> + <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> + </el-col> </div> </template> <script> -export default{ - +import { + getListUserAndListIns, addPlanAndMeasure +} from '@/api/laboratory/measure' +import { dateFormat } from "../../../utils/dateUtil"; +export default { + data() { + return { + planAddInfo: { + plannedOrderNumber: '', + measurePerson: '', + planDate: "", + unit: '', + createPerson: '', + createTime: '' + }, + codePointsTable: [{ + "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 }) + }) + }, + methods: { + addcodePointsTable() { + const newObj = { + index: this.codePointsTable.length + 1, + equipmentPointName: '', + measuringRange: '', + termValidity: "", + result: null, + endDate: null, + planDate: null + } + 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+'鏈�' + } + } } </script> \ No newline at end of file -- Gitblit v1.9.3