| | |
| | | <template> |
| | | <div> |
| | | <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="viewDeviceDialog" title="查看设备" width="80%" @close="closeDia"> |
| | | <div style="text-align: right;margin-bottom: 10px"> |
| | | <div v-if="!readOnly" style="text-align: right;margin-bottom: 10px"> |
| | | <el-button size="small" type="primary" @click="addRow">添加</el-button> |
| | | <el-button size="small" type="danger" @click="clearTable">清空</el-button> |
| | | </div> |
| | |
| | | clearable |
| | | filterable |
| | | placeholder="设备名称" |
| | | size="small" @change="(val)=>changeMachineName(val, scope.$index)"> |
| | | size="small" :disabled="readOnly" @change="(val)=>changeMachineName(val, scope.$index)"> |
| | | <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.value"> |
| | | {{item.label + item.value}} |
| | | </el-option> |
| | |
| | | <p>型号规格</p> |
| | | </template> |
| | | <template #default="{row}"> |
| | | <el-input v-model="row.machineSpecification" size="small"/> |
| | | <el-input v-model="row.machineSpecification" size="small" :disabled="readOnly"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column header-align="center" label="测量范围" prop="machineMeasuringRange"> |
| | |
| | | <p>测量范围</p> |
| | | </template> |
| | | <template #default="{row}"> |
| | | <el-input v-model="row.machineMeasuringRange" size="small" type="textarea"/> |
| | | <el-input v-model="row.machineMeasuringRange" size="small" type="textarea" :disabled="readOnly"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column header-align="center" label="①扩展不确定度②最大允差③准确度等级" prop="other"> |
| | |
| | | <p>①扩展不确定度②最大允差③准确度等级</p> |
| | | </template> |
| | | <template #default="{row}"> |
| | | <el-input v-model="row.other" size="small" type="textarea"/> |
| | | <el-input v-model="row.other" size="small" type="textarea" :disabled="readOnly"/> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <template #footer><span class="dialog-footer"> |
| | | <el-button @click="closeDia">取 消</el-button> |
| | | <el-button type="primary" @click="handleDeviceInfo">确 定</el-button> |
| | | <el-button v-if="!readOnly" type="primary" @click="handleDeviceInfo">确 定</el-button> |
| | | </span></template> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | |
| | | export default { |
| | | name: 'ViewDeviceDialog', |
| | | props: { readOnly: { type: Boolean, default: false } }, |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | | components: {}, |
| | | data() { |
| | |
| | | }, |
| | | // 增加表格行数据 |
| | | addRow () { |
| | | if (this.readOnly) return |
| | | this.machineAttachmentList.push({ |
| | | machineName: '', |
| | | machineSpecification: '', |
| | |
| | | }, |
| | | // 清空表格数据 |
| | | clearTable () { |
| | | if (this.readOnly) return |
| | | this.machineAttachmentList = [] |
| | | }, |
| | | // 选择设备的回调 |
| | | changeMachineName (val, index) { |
| | | if (this.readOnly) return |
| | | const index1 = this.equipOptions.findIndex(item => item.value === val); |
| | | if (index1 !== -1) { |
| | | this.machineAttachmentList[index].deviceId = this.equipOptions[index1].id; |
| | |
| | | }, |
| | | // 提交设备信息 |
| | | handleDeviceInfo () { |
| | | if (this.readOnly) return |
| | | if (this.machineAttachmentList.length === 0) { |
| | | this.$message.warning('请添加信息') |
| | | return |