<!-- 标准装置台账信息详情 标准配套设备 --> <script name="StandardBookStandard" lang="ts" setup> import type { Ref } from 'vue' import { onMounted, ref } from 'vue' import dayjs from 'dayjs' import { ElLoading, ElMessage } from 'element-plus' import type { FormRules } from 'element-plus' import type { IForm, IStandardList, ITechFiles } from '../book-interface' import selectEquipment from '../dialog/selectEquipment.vue' import selectBuildStandardDialog from './selectBuildStandardDialog.vue' import selectTechFiles from './selectTechFiles.vue' import { getDictByCode } from '@/api/system/dict' import type { TableColumn } from '@/components/NormalTable/table_interface' import useUserStore from '@/store/modules/user' import type { deptType, dictType } from '@/global' import { getDeptTreeList } from '@/api/system/dept' import { getUserList } from '@/api/system/user' import showPhoto from '@/components/showPhoto/index.vue' import { UploadFile } from '@/api/file' import { toTreeList } from '@/utils/structure' import { useCheckList } from '@/commonMethods/useCheckList' import { useSetAllRowReadable } from '@/commonMethods/useSetAllRowReadable' import { isNumber } from '@/utils/validate' defineProps({ pageType: { // 页面类型 add新建 edit编辑 detail详情 type: String, default: 'detail', }, }) const user = useUserStore() // 用户信息 const list = ref<IStandardList[]>([]) // 表格数据 const checkoutList = ref<IStandardList[]>([]) // 多选数据\ const equipmentRef = ref() // 选择设备组件ref const columns = ref<TableColumn[]>([ // 表头 { text: '统一编号', value: 'equipmentNo', align: 'center' }, { text: '计量标准的主标准器及配套设备名称', value: 'equipmentName', align: 'center' }, { text: '型号规格', value: 'model', align: 'center' }, { text: '测量范围', value: 'measureRange', align: 'center' }, { text: '不确定度或允许误差极限或准确度等级', value: 'uncertainty', align: 'center' }, ]) // -----------------------------------------methods-------------------------------------- // 点击标签识读 const scan = () => { ElMessage.info('敬请期待') } // 点击批量增加 const multiAdd = () => { } // 点击增加行 const add = () => { const index = list.value.findIndex((item: IStandardList) => !item.equipmentNo && !item.equipmentName) if (index !== -1) { ElMessage.warning('请完善上一条设备信息') return } list.value.push({ id: '', // 主键 equipmentNo: '', // 统一编号 equipmentName: '', // 计量标准的主标准器及配套设备名称 model: '', // 型号规格 measureRange: '', // 测量范围 uncertainty: '', // 不确定度或允许误差极限或准确度等级 }) } // 点击删除行 const del = () => { } // 多选发生改变时 const handleSelectionChange = (e: any) => { checkoutList.value = e } // 点击选择设备 const selectedEquipment = (index: number) => { // selectEquipmentIndex.value = index equipmentRef.value.initDialog() } // 选择好设备 const confirmSelect = () => { } // -------------------------------------------钩子------------------------------------------------ onMounted(async () => { }) </script> <template> <detail-block title="标准配套设备"> <template v-if="pageType !== 'detail'" #btns> <el-button type="primary" @click="scan"> 标签识读 </el-button> <el-button type="primary" @click="multiAdd"> 批量增加 </el-button> <el-button type="primary" @click="add"> 增加行 </el-button> <el-button type="info" @click="del"> 删除行 </el-button> </template> <el-table :data="list" border style="width: 100%;" @selection-change="handleSelectionChange" > <el-table-column v-if="pageType !== 'detail'" type="selection" width="38" /> <el-table-column align="center" label="序号" width="80" type="index" /> <el-table-column v-for="item in columns" :key="item.value" :prop="item.value" :label="item.text" :width="item.width" align="center" > <template v-if="item.value === 'equipmentNo' && pageType !== 'detail'" #default="scope" > <el-input v-model="scope.row[item.value]" :placeholder="`${item.text}`" class="input" disabled > <template #append> <el-button v-if="pageType !== 'detail'" size="small" @click="selectedEquipment(scope.$index)" > 选择 </el-button> </template> </el-input> </template> </el-table-column> </el-table> </detail-block> <!-- 选择设备 --> <select-equipment ref="equipmentRef" @confirm="confirmSelect" /> </template>