<!-- 标准装置台账信息详情 计量人员 -->
<script name="StandardBookPerson" 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, IPersonList, ITechFiles } from '../book-interface'
import selectPerson from '../dialog/selectPerson.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<IPersonList[]>([]) // 表格数据
const checkoutList = ref<IPersonList[]>([]) // 多选数据\
const personRef = ref() // 选择计量人员组件ref
const columns = ref<TableColumn[]>([ // 表头
{ text: '人员编号', value: 'staffNo', align: 'center' },
{ text: '姓名', value: 'staffName', align: 'center' },
{ text: '职称', value: 'titleExperience', align: 'center' },
{ text: '检定员证书', value: 'certName', align: 'center' },
{ text: '证书有效期', value: 'effectiveDate', align: 'center', width: '120' },
{ text: '计量专业', value: 'major', align: 'center' },
])
// -----------------------------------------methods--------------------------------------
// 点击增加行
const add = () => {
const index = list.value.findIndex((item: IPersonList) => !item.staffNo && !item.staffName)
if (index !== -1) {
ElMessage.warning('请完善上一条人员信息')
return
}
list.value.push({
id: '', // 主键
staffNo: '', // 人员编号
staffName: '', // 姓名
titleExperience: '', // 职称
certName: '', // 检定员证书
effectiveDate: '', // 证书有效期
major: '', // 计量专业
})
}
// 点击删除行
const del = () => {
}
// 多选发生改变时
const handleSelectionChange = (e: any) => {
checkoutList.value = e
}
// 点击选择人员
const selectedPerson = (index: number) => {
// selectEquipmentIndex.value = index
personRef.value.initDialog()
}
// 选择好计量人员
const confirmSelect = () => {
}
// -------------------------------------------钩子------------------------------------------------
onMounted(async () => {
})
</script>
<template>
<detail-block title="计量人员">
<template v-if="pageType !== 'detail'" #btns>
<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 === 'staffNo' && 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="selectedPerson(scope.$index)"
>
选择
</el-button>
</template>
</el-input>
</template>
</el-table-column>
</el-table>
</detail-block>
<!-- 选择设备 -->
<select-person ref="personRef" @confirm="confirmSelect" />
</template>