设备类型接口
This commit is contained in:
@@ -39,10 +39,11 @@ import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/i
|
||||
import DevicePopup from '@/views/machine/device/components/devicePopup.vue'
|
||||
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import { getPqDevList, deletePqDev, exportPqDev, downloadTemplate, importPqDev } from '@/api/device/device/index.ts'
|
||||
import { getPqDevList, deletePqDev, exportPqDev, downloadTemplate, importPqDev,getPqDev } from '@/api/device/device/index.ts'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { computed, onBeforeMount, onMounted, reactive, ref } from 'vue'
|
||||
import { useModeStore , useAppSceneStore} from '@/stores/modules/mode'; // 引入模式 store
|
||||
import { forEach } from 'lodash'
|
||||
|
||||
const modeStore = useModeStore();
|
||||
const dictStore = useDictStore()
|
||||
@@ -53,7 +54,17 @@ const devicePopup = ref()
|
||||
const ConditionsIsShow = ref(false)
|
||||
|
||||
const boundPqDevList=ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备
|
||||
|
||||
// 存储设备类型选项
|
||||
const devTypeOptions = ref<{
|
||||
id: string;
|
||||
name: string ,
|
||||
icd:string ,
|
||||
power:string,
|
||||
devVolt:number,
|
||||
devCurr:number,
|
||||
devChns:number,
|
||||
}[]>([])
|
||||
|
||||
const getTableList = async (params: any) => {
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
newParams.searchEndTime = endDate.value
|
||||
@@ -75,15 +86,17 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||
...(appSceneStore.currentScene != '1' ? {
|
||||
search: { el: 'input' },
|
||||
} : {}),
|
||||
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
prop: 'devType',
|
||||
label: '设备类型',
|
||||
minWidth: 200,
|
||||
enum: dictStore.getDictData('Dev_Type'),
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
render: (scope) => {
|
||||
// 查找设备类型名称
|
||||
const name = devTypeOptions.value.find(option => option.id === scope.row.devType);
|
||||
return <span>{name?.name}</span>
|
||||
},
|
||||
},
|
||||
{
|
||||
prop: 'createDate',
|
||||
@@ -194,6 +207,17 @@ const importFile = async () => {
|
||||
deviceImportExcel.value?.acceptParams(params)
|
||||
}
|
||||
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const response = await getPqDev()
|
||||
devTypeOptions.value = response.data.map(item => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
icd: item.icd,
|
||||
power: item.power,
|
||||
devVolt: item.devVolt,
|
||||
devCurr: item.devCurr,
|
||||
devChns: item.devChns
|
||||
}))
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user