<!-- 第一套标准装置多功能校准源 --> <!-- 第一种表格--增加行模式 --> <!-- 数字多用表(手持)、数字多用表(台式)、多功能店里参数测量仪、钳形电流表、指针式万用表 使用 --> <script lang="ts" setup name="TemplateDetailAddRowPattern"> import { ElMessage } from 'element-plus' import type { ITemplateDetailAddRowPattern } from './first-interface' import { useCheckList } from '@/commonMethods/useCheckList' import { getDictByCode } from '@/api/system/dict' import type { dictType } from '@/global' import { calc } from '@/utils/useCalc' import { caculateDecimalDigits } from '@/views/business/measure/item/useCalculateResolution' import { useRound } from '@/commonMethods/useRound' import { mergeTableRow, useMergeTableRow } from '@/commonMethods/useMergeTableRow' const props = defineProps({ pageType: { type: String, default: 'add', }, itemCategoryName: String, // 设备检定项分类名称 list: { type: Array as any, }, }) const list = ref<ITemplateDetailAddRowPattern[]>([]) // 表格数据 const mergeTableList = ref<ITemplateDetailAddRowPattern[]>([]) // 合并的表格数据表格数据 const checkoutList = ref<ITemplateDetailAddRowPattern[]>([]) // 选中数据 const columns = ref([]) as any // 表头数据 const columns_digitalMultimeterHandheld = ref([ // 数字多用表(手持) { text: '参数', value: 'params', align: 'center', required: true, width: '120' }, { text: '量', value: 'capacity', align: 'center', width: '120', required: true }, { text: '单位', value: 'unit', align: 'center', width: '120', required: true }, { text: '量程', value: 'rangeRange', align: 'center', required: true }, { text: '标准值', value: 'standardValue', align: 'center', required: true }, { text: '分辨力', value: 'resolution', align: 'center', required: true, width: '220', reg: (resolution: string | number) => { return Number(resolution) <= 1 } }, { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, width: '200' }, { text: '误差参数a', value: 'errorParamA', align: 'center', required: true }, { text: '误差参数b', value: 'errorParamB', align: 'center', required: true }, { text: '频率', value: 'frequency', align: 'center' }, { text: '频率单位', value: 'frequencyUnit', align: 'center', width: '120' }, ]) const columns_digitalMultimeterTable = ref([ // 数字多用表(台式) { text: '参数', value: 'params', align: 'center', required: true, width: '120' }, { text: '量', value: 'capacity', align: 'center', width: '120', required: true }, { text: '单位', value: 'unit', align: 'center', width: '120', required: true }, { text: '量程', value: 'rangeRange', align: 'center', required: true }, { text: '标准值', value: 'standardValue', align: 'center', required: true }, { text: '分辨力', value: 'resolution', align: 'center', required: true, width: '220', reg: (resolution: string | number) => { return Number(resolution) <= 1 } }, { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, width: '200' }, { text: '误差参数a', value: 'errorParamA', align: 'center', required: true }, { text: '误差参数b', value: 'errorParamB', align: 'center', required: true }, { text: '两线/四线模式', value: 'lineMode', align: 'center', required: false, width: '120' }, { text: '频率', value: 'frequency', align: 'center' }, { text: '频率单位', value: 'frequencyUnit', align: 'center', width: '120' }, ]) const columns_multifunctionalPowerParameterMeasuringInstrument = ref([ // 多功能电力参数测量仪 { text: '参数', value: 'params', align: 'center', required: true, width: '120' }, { text: '量', value: 'capacity', align: 'center', required: true, width: '120' }, { text: '单位', value: 'unit', align: 'center', width: '120', required: true }, { text: '标准值', value: 'standardValue', align: 'center', required: true }, { text: '分辨力', value: 'resolution', align: 'center', required: true, width: '220', reg: (resolution: string | number) => { return Number(resolution) <= 1 } }, { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, width: '200' }, { text: '误差参数a', value: 'errorParamA', align: 'center', required: true }, { text: '误差参数b', value: 'errorParamB', align: 'center', required: true }, { text: '频率', value: 'frequency', align: 'center' }, { text: '频率单位', value: 'frequencyUnit', align: 'center', width: '120' }, { text: '有效数字', value: 'effectiveNumber', align: 'center', width: '180' }, ]) const columns_clampAmmeter = ref([ // 钳形电流表 { text: '参数', value: 'params', align: 'center', required: true, width: '120' }, { text: '量', value: 'capacity', align: 'center', width: '120', required: true }, { text: '单位', value: 'unit', align: 'center', width: '120', required: true }, { text: '量程', value: 'rangeRange', align: 'center', required: true }, { text: '线圈放大', value: 'coilEnlarge', align: 'center', required: false, width: '120' }, { text: '标准值', value: 'standardValue', align: 'center', required: true }, { text: '分辨力', value: 'resolution', align: 'center', required: true, width: '220', reg: (resolution: string | number) => { return Number(resolution) <= 1 } }, { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, width: '200' }, { text: '误差参数a', value: 'errorParamA', align: 'center', required: true }, { text: '误差参数b', value: 'errorParamB', align: 'center', required: true }, { text: '频率', value: 'frequency', align: 'center' }, { text: '频率单位', value: 'frequencyUnit', align: 'center', width: '120' }, ]) const columns_pointerMultimeter = ref([ // 指针式万用表 { text: '参数', value: 'params', align: 'center', required: true, width: '120' }, { text: '量', value: 'capacity', align: 'center', width: '120', required: true }, { text: '单位', value: 'unit', align: 'center', width: '120', required: true }, { text: '量程', value: 'rangeRange', align: 'center', required: true }, { text: '示值', value: 'indicatingValue', align: 'center', required: true }, { text: '分辨力', value: 'resolution', align: 'center', required: true, width: '220', reg: (resolution: string | number) => { return Number(resolution) <= 1 } }, { text: '最大允许误差', value: 'maximumError', align: 'center', required: true, width: '200' }, { text: '准确度a', value: 'accuracyA', align: 'center', required: true }, { text: '指针式仪表满量程值', value: 'fullScaleValue', align: 'center', required: true }, { text: '单位', value: 'fullScaleValueUnit', align: 'center', required: true, width: '120' }, { text: '频率', value: 'frequency', align: 'center' }, { text: '频率单位', value: 'frequencyUnit', align: 'center', width: '120' }, ]) // ------------------------------------------字典---------------------------------------------- const paramsList = ref<dictType[]>([]) // 参数 const capacityList = ref<dictType[]>([]) // 量 const unitUList = ref<dictType[]>([]) // U单位 const unitIList = ref<dictType[]>([]) // I单位 const unitRList = ref<dictType[]>([]) // R单位 const frequencyUnitList = ref<dictType[]>([]) // 频率 const maximumErrorList = ref<dictType[]>([]) // 最大允许误差 const lineModeList = ref<dictType[]>([]) // 两线/四线模式 const coilEnlargeList = ref<dictType[]>([]) // 线圈放大 const coilEnlargeMap = ref({}) as any // 线圈放大map const fullScaleValueUnitList = ref<dictType[]>([]) // 指针式仪表满量程值单位 /** * 获取字典 */ function getDict() { // 参数 getDictByCode('bizFirstStandardParams').then((response) => { paramsList.value = response.data if (props.itemCategoryName === '多功能电力参数测量仪') { paramsList.value.pop() } }) // 量 getDictByCode('bizFirstStandardCapacity').then((response) => { capacityList.value = response.data }) // U单位 getDictByCode('bizFirstStandardUnitU').then((response) => { unitUList.value = response.data }) // I单位 getDictByCode('bizFirstStandardUnitI').then((response) => { unitIList.value = response.data }) // R单位 getDictByCode('bizFirstStandardUnitR').then((response) => { unitRList.value = response.data }) // 频率单位 getDictByCode('bizFirstStandardFrequencyUnit').then((response) => { frequencyUnitList.value = response.data }) // 两线/四线模式 getDictByCode('bizFirstStandardLineMode').then((response) => { lineModeList.value = response.data }) // 线圈放大 getDictByCode('bizFirstStandardCoilEnlarge').then((response) => { coilEnlargeList.value = response.data }) // 指针式仪表满量程值单位 getDictByCode('bizFirstStandardFullScaleValueUnit').then((response) => { fullScaleValueUnitList.value = response.data }) // 最大允许误差 const maximumErrorListNormal = [ { id: '=a*示值 + b*量程', name: '=a*示值 + b*量程', value: '=a*示值 + b*量程', }, { id: '=a*示值 + b*分辨力', name: '=a*示值 + b*分辨力', value: '=a*示值 + b*分辨力', }, { id: '=a*示值 + 常数b', name: '=a*示值 + 常数b', value: '=a*示值 + 常数b', }, { id: '=a*标准值 + b*量程', name: '=a*标准值 + b*量程', value: '=a*标准值 + b*量程', }, { id: '=a*标准值 + b*分辨力', name: '=a*标准值 + b*分辨力', value: '=a*标准值 + b*分辨力', }, { id: '=a*标准值 + 常数b', name: '=a*标准值 + 常数b', value: '=a*标准值 + 常数b', }, ] // 最大允许误差--多功能电力参数测量仪 const maximumErrorListElectricPower = [ { id: '[标准值 / (Vpri / Vsec)] * a + b * 分辨力', name: '[标准值 / (Vpri / Vsec)] * a+ b * 分辨力', value: '[标准值 / (Vpri / Vsec)] * a + b * 分辨力', }, { id: '[标准值 / (Vpri / Vsec)] * a + 常数b', name: '[标准值 / (Vpri / Vsec)] * a + 常数b', value: '[标准值 / (Vpri / Vsec)] * a + 常数b', }, { id: '[标准值 / (Vpri / Vsec)] * a + b * 量程', name: '[标准值 / (Vpri / Vsec)] * a + b * 量程', value: '[标准值 / (Vpri / Vsec)] * a + b * 量程', }, ] if (props.itemCategoryName === '多功能电力参数测量仪') { maximumErrorList.value = maximumErrorListElectricPower } else { maximumErrorList.value = maximumErrorListNormal } } getDict() // ------------------------------------------------------------------------------------------------ // 频率有数据的时候校验频率单位字段 const checkFrequencyUnit = () => { let result = true if (list.value.length) { for (let i = 0; i < list.value.length; i++) { if (`${list.value[i].frequency}` && !list.value[i].frequencyUnit) { ElMessage.warning(`请先完善 检定项表格 第${i + 1}行中 频率单位 字段`) result = false return } } } return result } // 校验表格(点击保存的时候用) const checkList = () => { return useCheckList(list.value, columns.value, '检定项表格') } /** * 在保存之前处理一下数值 * 在保存之前把标准值按照分辨力保存 */ const solveDataBeforeSave = () => { if (props.itemCategoryName === '数字多用表(手持)' || props.itemCategoryName === '数字多用表(台式)' || props.itemCategoryName === '钳形电流表') { list.value = list.value.map((item) => { if (!isNaN(Number(item.standardValue)) && !isNaN(Number(item.resolution))) { item.standardValue = `${useRound(Number(item.standardValue), caculateDecimalDigits(Number(item.resolution)))}` } return item }) } } // 增加行 const addRow = () => { if (!checkFrequencyUnit()) { return false } if (useCheckList(list.value, columns.value, '检定项表格')) { if (list.value.length) { // 增加行时默认上一行数据 list.value.push({ id: '', // 主键 params: list.value[list.value.length - 1].params, // 参数 capacity: list.value[list.value.length - 1].capacity, // 量 unit: list.value[list.value.length - 1].unit, // 单位 frequency: list.value[list.value.length - 1].frequency, // 频率 frequencyUnit: list.value[list.value.length - 1].frequencyUnit, // 频率单位 rangeRange: list.value[list.value.length - 1].rangeRange, // 量程 standardValue: list.value[list.value.length - 1].standardValue, // 标准值 resolution: list.value[list.value.length - 1].resolution, // 分辨力 // maximumError: list.value[list.value.length - 1].maximumError, // 最大允许误差 maximumError: props.itemCategoryName === '指针式万用表' ? '=准确度a*指针式仪表满量程值' : list.value[list.value.length - 1].maximumError, // 最大允许误差 errorParamA: list.value[list.value.length - 1].errorParamA, // 误差参数a errorParamB: list.value[list.value.length - 1].errorParamB, // 误差参数b lineMode: list.value[list.value.length - 1].lineMode, // 两线/四线模式 coilEnlarge: list.value[list.value.length - 1].coilEnlarge, // 线圈放大 accuracyA: list.value[list.value.length - 1].accuracyA, // 准确度a fullScaleValue: list.value[list.value.length - 1].fullScaleValue, // 指针式仪表满量程值 fullScaleValueUnit: list.value[list.value.length - 1].fullScaleValueUnit, // 指针式仪表满量程值单位 indicatingValue: list.value[list.value.length - 1].indicatingValue, // 示值 effectiveNumber: list.value[list.value.length - 1].effectiveNumber, // 有效数字 }) } else { list.value.push({ id: '', // 主键 params: '', // 参数 capacity: '', // 量 unit: '', // 单位 frequency: '', // 频率 frequencyUnit: '', // 频率单位 rangeRange: '', // 量程 standardValue: '', // 标准值 resolution: '0.0001', // 分辨力 maximumError: props.itemCategoryName === '指针式万用表' ? '=准确度a*指针式仪表满量程值' : '', // 最大允许误差 errorParamA: '', // 误差参数a errorParamB: '', // 误差参数b lineMode: '', // 两线/四线模式 coilEnlarge: '', // 线圈放大 accuracyA: '', // 准确度a fullScaleValue: '', // 指针式仪表满量程值 fullScaleValueUnit: '', // 指针式仪表满量程值单位 indicatingValue: '', // 示值 effectiveNumber: undefined, // 有效数字 }) } } } // 删除行 const deleteRow = () => { if (!checkoutList.value.length) { ElMessage.warning('请选中要删除的行') } else { list.value = list.value.filter((item: any) => { return !checkoutList.value.includes(item) }) } } // ----------------------------------------表格操作 ------------------------- const randomNum = `${new Date().getTime}${Math.random()}` const tableRef = ref() // 右击当前行操作 const clickIndex = ref(-1) const contextmenu = (row: any, column: any, event: any, index: number) => { if (props.pageType === 'detail') { return } // 阻止默认的右键菜单 event.preventDefault() clickIndex.value = list.value.findIndex(item => item === row) // console.log('右击', clickIndex.value) // 获取自定义菜单元素 var menu = document.getElementById(randomNum) as HTMLElement // 设置自定义菜单的位置并显示 let positionX = event.clientX let positionY = event.clientY if (window.innerHeight - event.clientY < 268) { positionY = window.innerHeight - 268 } else { positionY = event.clientY } if (window.innerWidth - event.clientX < 146) { positionX = window.innerWidth - 146 } else if (event.clientX - 180 < 146) { positionX = 180 } else { positionX = event.clientX - 146 / 2 } menu.style.top = `${positionY}px` menu.style.left = `${positionX}px` menu.style.display = 'block' } // 点击其他位置隐藏自定义菜单 document.addEventListener('click', () => { if (props.pageType === 'detail') { return } if (document.getElementById(randomNum)) { (document.getElementById(randomNum) as HTMLElement).style.display = 'none' } }) const mouseoutTable = () => { console.log('鼠标移出') if (props.pageType === 'detail') { return } if (document.getElementById(randomNum)) { (document.getElementById(randomNum) as HTMLElement).style.display = 'none' } } // 添加行 const costomAddRow = (type: string) => { if (type === 'current-pre') { // 当前行前方插入 list.value.splice(clickIndex.value, 0, JSON.parse(JSON.stringify({ ...list.value[clickIndex.value], id: `custom-${new Date().getTime()}` }))) } else if (type === 'current-next') { // 当前行后方方插入 list.value.splice(clickIndex.value + 1, 0, JSON.parse(JSON.stringify({ ...list.value[clickIndex.value], id: `custom-${new Date().getTime()}` }))) } else if (type === 'list-head') { // 列表头行插入 list.value.splice(0, 0, JSON.parse(JSON.stringify({ ...list.value[clickIndex.value], id: `custom-${new Date().getTime()}` }))) } else if (type === 'list-tail') { // 列表尾行插入 list.value.splice(list.value.length, 0, JSON.parse(JSON.stringify({ ...list.value[clickIndex.value], id: `custom-${new Date().getTime()}` }))) } else if (type === 'select-pre') { // 选中行前方插入 if (!checkoutList.value.length) { ElMessage.warning('未选择数据') return } checkoutList.value.forEach((item, index) => { const dataIndex = list.value.findIndex(citem => item === citem) list.value.splice(dataIndex, 0, JSON.parse(JSON.stringify({ ...item, id: `custom-${new Date().getTime()}` }))) }) tableRef.value!.clearSelection() } else if (type === 'select-next') { // 选中行后方插入 if (!checkoutList.value.length) { ElMessage.warning('未选择数据') return } checkoutList.value.forEach((item, index) => { const dataIndex = list.value.findIndex(citem => item === citem) list.value.splice(dataIndex + 1, 0, JSON.parse(JSON.stringify({ ...item, id: `custom-${new Date().getTime()}` }))) }) tableRef.value!.clearSelection() } else if (type === 'del-current') { list.value.splice(clickIndex.value, 1) } else if (type === 'del-select') { if (!checkoutList.value.length) { ElMessage.warning('未选择数据') return } checkoutList.value.forEach((item, index) => { const dataIndex = list.value.findIndex(citem => item === citem) list.value.splice(dataIndex, 1) }) tableRef.value!.clearSelection() } clickIndex.value = -1 } // -----------------------------------分辨力多0少0-------------------------------------------- // 点击减号 const clickSub = (row: ITemplateDetailAddRowPattern) => { if (calc(row.resolution, 10, '*') > 1) { ElMessage.warning('要求分辨力不能大于1') } else { row.resolution = calc(row.resolution, 10, '*') } } // 点击加号 const clickAdd = (row: ITemplateDetailAddRowPattern) => { row.resolution = calc(row.resolution, 10, '/') } // 监听参数变化,改变量 const handleParamsChange = (value: string, row: ITemplateDetailAddRowPattern) => { console.log(value) console.log(row) if (value === 'DCV' || value === 'ACV') { row.capacity = 'U' } else if (value === 'DCI' || value === 'ACI') { row.capacity = 'I' } else if (value === 'R') { row.capacity = 'R' } } // ------------------------------------------------------------------------------------------- // 清空配置方法 const clearConfig = () => { list.value = [] } // 多选 const handleSelectionChange = (e: any) => { checkoutList.value = e } watch(() => props.itemCategoryName, (newValue) => { if (newValue) { switch (newValue) { case '数字多用表(手持)': columns.value = columns_digitalMultimeterHandheld.value break case '数字多用表(台式)': columns.value = columns_digitalMultimeterTable.value break case '多功能电力参数测量仪': columns.value = columns_multifunctionalPowerParameterMeasuringInstrument.value break case '钳形电流表': columns.value = columns_clampAmmeter.value break case '指针式万用表': columns.value = columns_pointerMultimeter.value break } } }, { immediate: true }) watch(() => props.list, (newVal) => { if (newVal) { list.value = [...newVal] list.value = list.value.map((item: ITemplateDetailAddRowPattern) => { return { ...item, resolution: Number(item.resolution), frequency: item.frequency || '/', // 频率 frequencyUnit: item.frequencyUnit || '/', // 频率单位 } }) if (props.pageType === 'detail') { useMergeTableRow(list.value, ['params', 'capacity', 'unit', 'frequency', 'frequencyUnit', 'rangeRange']) } } }) defineExpose({ list, checkList, checkFrequencyUnit, clearConfig, solveDataBeforeSave }) </script> <template> <detail-block :title="props.pageType === 'detail' ? '' : ' '"> <template v-if="props.pageType !== 'detail'" #btns> <el-button type="primary" @click="addRow"> 增加行 </el-button> <el-button type="info" @click="deleteRow"> 删除行 </el-button> </template> <el-table ref="tableRef" :data="list" border style="width: 100%;" :span-method="mergeTableRow" :height="list.length > 10 ? 500 : null" @selection-change="handleSelectionChange" @row-contextmenu="contextmenu" > <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 #header> <span v-show="item.required" style="color: red;">*</span><span>{{ item.text }}</span> </template> <template #default="scope"> <!-- 参数 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'params'" v-model="scope.row[item.value]" placeholder="请选择" :disabled="props.pageType === 'detail'" filterable @change="(value: any) => handleParamsChange(value, scope.row)" > <el-option v-for="item in paramsList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <!-- 量 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'capacity'" v-model="scope.row[item.value]" placeholder="请选择" filterable disabled > <el-option v-for="item in capacityList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <!-- U单位 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'unit' && scope.row.capacity === 'U'" v-model="scope.row[item.value]" placeholder="请选择" :disabled="props.pageType === 'detail'" filterable > <el-option v-for="item in unitUList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <!-- I单位 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'unit' && scope.row.capacity === 'I'" v-model="scope.row[item.value]" placeholder="请选择" :disabled="props.pageType === 'detail'" filterable > <el-option v-for="item in unitIList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <!-- R单位 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'unit' && scope.row.capacity === 'R'" v-model="scope.row[item.value]" placeholder="请选择" :disabled="props.pageType === 'detail'" filterable > <el-option v-for="item in unitRList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <!-- 频率 --> <el-input v-if="props.pageType !== 'detail' && item.value === 'frequency' && (scope.row.params === 'ACV' || scope.row.params === 'ACI')" v-model="scope.row[item.value]" style="display: flex;" :autofocus="true" :placeholder="`${item.text}`" class="input" /> <!-- 频率单位 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'frequencyUnit' && (scope.row.params === 'ACV' || scope.row.params === 'ACI')" v-model="scope.row[item.value]" placeholder="单位" :disabled="props.pageType === 'detail'" filterable clearable > <el-option v-for="item in frequencyUnitList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <!-- 有效数字 --> <el-input-number v-if="props.pageType !== 'detail' && item.value === 'effectiveNumber'" v-model="scope.row.effectiveNumber" placeholder="有效数字" class="input" :min="1" :step="1" :precision="0" /> <!-- 最大允许误差 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'maximumError' && props.itemCategoryName !== '指针式万用表'" v-model="scope.row[item.value]" placeholder="请选择" :disabled="props.pageType === 'detail'" filterable > <el-option v-for="item in maximumErrorList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <!-- 两线/四线模式 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'lineMode' && scope.row.params === 'R'" v-model="scope.row[item.value]" placeholder="请选择" :disabled="props.pageType === 'detail'" filterable > <el-option v-for="item in lineModeList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <!-- 线圈放大 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'coilEnlarge' && (scope.row.params === 'DCI' || scope.row.params === 'ACI')" v-model="scope.row[item.value]" placeholder="请选择" :disabled="props.pageType === 'detail'" filterable > <el-option v-for="item in coilEnlargeList" :key="item.id" :label="item.name" :value="item.name" /> </el-select> <!-- 指针式仪表满量程值单位 --> <el-select v-if="props.pageType !== 'detail' && item.value === 'fullScaleValueUnit'" v-model="scope.row[item.value]" placeholder="请选择" :disabled="props.pageType === 'detail'" filterable > <el-option v-for="item in fullScaleValueUnitList" :key="item.id" :label="item.name" :value="item.value" /> </el-select> <span v-if="(item.value === 'frequency' && (scope.row.params !== 'ACV' && scope.row.params !== 'ACI')) || (item.value === 'frequencyUnit' && (scope.row.params !== 'ACV' && scope.row.params !== 'ACI')) || (item.value === 'lineMode' && scope.row.params !== 'R') || (item.value === 'coilEnlarge' && (scope.row.params !== 'DCI' && scope.row.params !== 'ACI')) " >/</span> <!-- 分辨力 --> <div v-if="item.value === 'resolution' && props.pageType !== 'detail'" style="display: flex;"> <icon-button v-if="pageType !== 'detail'" style="margin-right: 10px;" size="20" icon="icon-reduce-circle" title="扩大10倍" type="primary" @click="clickSub(scope.row)" /> <el-input v-if="props.pageType !== 'detail' " v-model="scope.row[item.value]" :autofocus="true" :placeholder="`${item.text}`" class="input" /> <icon-button v-if="pageType !== 'detail'" style="margin-left: 10px;" size="20" icon="icon-add-circle" title="缩小10倍" type="primary" @click="clickAdd(scope.row)" /> </div> <el-input v-if="props.pageType !== 'detail' && (item.value === 'rangeRange' || item.value === 'errorParamA' || item.value === 'errorParamB' || item.value === 'standardValue' || item.value === 'indicatingValue' || item.value === 'accuracyA' || item.value === 'fullScaleValue')" v-model="scope.row[item.value]" :autofocus="true" :placeholder="`${item.text}`" class="input" /> </template> </el-table-column> </el-table> <!-- 自定义菜单 --> <div :id="randomNum" class="custom-menu"> <p class="menu-item" @click="costomAddRow('current-pre')"> 当前行前方插入 </p> <p class="menu-item" @click="costomAddRow('current-next')"> 当前行后方插入 </p> <p class="menu-item" @click="costomAddRow('list-head')"> 列表头行插入 </p> <p class="menu-item" @click="costomAddRow('list-tail')"> 列表尾行插入 </p> <p v-if="pageType !== 'detail'" class="menu-item" @click="costomAddRow('select-pre')"> 选中行前方插入 </p> <!-- --> <p v-if="pageType !== 'detail'" class="menu-item" @click="costomAddRow('select-next')"> 选中行后方插入 </p> <p class="menu-item" @click="costomAddRow('del-current')"> 删除当前行 </p> <p v-if="pageType !== 'detail'" class="menu-item" @click="costomAddRow('del-select')"> 删除选中行 </p> </div> </detail-block> </template> <style lang="scss" scoped> .custom-menu { display: none; position: fixed; background-color: #fff; border-radius: 5px; padding: 5px 0; z-index: 1000; border: 1px solid #c8c9cc; box-shadow: 0 0 12px rgb(0 0 0 / 12%); .menu-item { display: flex; align-items: center; white-space: nowrap; list-style: none; line-height: 22px; padding: 5px 16px; margin: 0; // font-size: var(--el-font-size-base); color: #606266; cursor: pointer; outline: none; &:hover { background-color: #ecf5ff; color: #409eff; } } } </style>