Newer
Older
xc-business-system / src / views / business / measure / item / components / sixth / templateDetail.vue
<!-- 第6套:安全阀标准装置 -->
<script lang="ts" setup name="TemplateDetailSixth">
import type { IList } from './templateDetail-interface'
import type { dictType } from '@/global'
import { getDictByCode } from '@/api/system/dict'
import { calc } from '@/utils/useCalc'
import { useCheckList } from '@/commonMethods/useCheckList'
import { calculate, recalculate } from '@/api/business/measure/caculate'

const props = defineProps({
  pageType: {
    type: String,
    default: 'add',
  },
  itemCategoryName: {
    type: String,
    require: true,
  }, // 设备检定项分类名称
  belongStandardEquipment: { // 检校标准装置code
    type: String,
    require: true,
  },
  list: {
    type: Array as any,
  },
  form: { // 检定项表单
    type: Object as any,
  },
  itemId: { // 检定项id
    type: String,
    default: '',
  },
})
const list = ref<IList[]>([]) // 表格数据
const tableLoading = ref(false)
// ----------------------------------------表头------------------------------------------------
const columns = ref([ // 开路电压(电子式绝缘电阻表(数字式)、电子式绝缘电阻表(指针式)、兆欧式)上面表格
  { text: '检定项目', value: 'params', align: 'center', required: true },
  { text: '标称值', value: 'nominalValue', align: 'center', required: true },
  { text: '标称值单位', value: 'unit', align: 'center', required: true },
  { text: '允许值', value: 'allowValue', align: 'center', required: true },
])
// ---------------------------------------------校验---------------------------------------------------
// 校验表格(点击保存的时候用、生成标准器示值)
const checkList = () => {
  // return useCheckList(list.value, columns.value, '检定项表格')
}
// ------------------------------------------------------------------------------------------------
// 点击计算结果--上方表格计算
const calculateDataTop = () => {

}
// 点击生成辅助接地电阻--下面表格计算
const calculateDataBottom = () => {

}
// -----------------------------------------------------------------------------------------------------

watch(() => props.list, (newVal) => { // 检定项表格
  if (newVal) {
    list.value = [...newVal]
  }
})

defineExpose({ list })
</script>

<template>
  <div style="padding: 0 10px;">
    <el-checkbox v-model="form.appearance" :checked="true" :disabled="pageType === 'detail'">
      外观检查
    </el-checkbox>
    <el-checkbox v-model="form.mfsy" :checked="true" :disabled="pageType === 'detail'">
      密封试验
    </el-checkbox>
  </div>
  <div style="padding: 0 10px;">
    <el-checkbox v-model="form.zdyl" :checked="true" :disabled="pageType === 'detail'">
      整定压力
    </el-checkbox>
  </div>
  <!-- 上面表格 -->
  <detail-block title=" " style="margin-top: 0;">
    <template v-if="props.pageType !== 'detail'" #btns>
      <el-button type="primary">
        增加行
      </el-button>
      <el-button type="info">
        删除行
      </el-button>
      <el-button type="primary">
        计算结果
      </el-button>
    </template>
    <el-table
      ref="tableRef"
      v-loading="tableLoading"
      :data="list"
      border
      style="width: 100%;"
    >
      <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"
        align="center"
      >
        <template #header>
          <span v-show="item.required" style="color: red;">*</span><span>{{ item.text }}</span>
        </template>
      </el-table-column>
    </el-table>
  </detail-block>
</template>