| | |
| | | </el-col> |
| | | <el-col> |
| | | <el-form :model="planAddInfo" style="padding-left: 150px;"> |
| | | <el-form-item> |
| | | <el-col> |
| | | <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> |
| | | <el-form-item label="负责人:" :rules="[{ required: true, message: '请选择负责人', trigger: 'change' }]"> |
| | | <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-form-item> |
| | | </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-form-item label="计划时间:" :rules="[{ required: true, message: '请选择计划时间', trigger: 'change' }]"> |
| | | <el-date-picker v-model="planAddInfo.planDate" type="daterange" range-separator="至" |
| | | start-placeholder="开始日期" end-placeholder="结束日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | </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-form-item label="计量单位:"> |
| | | <el-input style="width: 150px;" v-model="planAddInfo.unit" placeholder=""></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-form> |
| | | </el-col> |
| | | <el-col> |
| | |
| | | :show-text="false"></el-progress> |
| | | </el-col> |
| | | </el-col> |
| | | |
| | | <el-col style="width:93%;height: 20vh;margin-top: 30px; margin-left: 40px;"> |
| | | <el-table ref="codePointsTable" :cell-style="{ textAlign: 'center' }" |
| | | <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" 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> |
| | |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { |
| | | getListUserAndListIns, addPlanAndMeasure |
| | | } from '@/api/laboratory/measure' |
| | | import { dateFormat } from "../../../utils/dateUtil"; |
| | | import { MessageBox, Message } from 'element-ui' |
| | | 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 }) |
| | | }) |
| | | }, |
| | | 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() { |
| | | if (this.planAddInfo.measurePerson == null || this.planAddInfo.measurePerson == ''||this.planAddInfo.planDate[0]==null||this.planAddInfo.planDate[0]=='') { |
| | | Message({ |
| | | message: "负责人和计划日期不能为空!", |
| | | type: 'warning', |
| | | duration: 2 * 1000 |
| | | }) |
| | | return false |
| | | } |
| | | 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 + '月' |
| | | } |
| | | } |
| | | } |