Browse Source

fix:创建模型实例适配ANN

pull/86/head
肖晋飞 3 weeks ago
parent
commit
619fdc7c06
  1. 13
      src/views/run/instant/CreateModal.vue
  2. 10
      src/views/run/instant/instant.data.ts
  3. 21
      src/views/run/model/PointTable.vue

13
src/views/run/instant/CreateModal.vue

@ -27,7 +27,6 @@ const state = reactive<any>({
const isDisabled = ref<boolean>(true) const isDisabled = ref<boolean>(true)
const [registerCreateModal, {setModalProps, closeModal}] = useModalInner(async (data) => { const [registerCreateModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
alert(444)
await resetFields() await resetFields()
current.value=0; current.value=0;
state.selectedData=[]; state.selectedData=[];
@ -61,12 +60,13 @@ const [registerForm, {validate, resetFields,getFieldsValue, setFieldsValue, upda
interface instantForms { interface instantForms {
modelId?: string modelId?: string
mpName?: string mpName?: string
algorithmId?: string
} }
const instantForm = reactive<instantForms>({ const instantForm = reactive<instantForms>({
modelId: '', modelId: '',
mpName: '', mpName: '',
algorithmId: ''
}) })
async function updatempName(selectedRowKeys, selectedRows) { async function updatempName(selectedRowKeys, selectedRows) {
resetFields() resetFields()
@ -74,12 +74,13 @@ async function updatempName(selectedRowKeys, selectedRows) {
state.selectedData = selectedRows; state.selectedData = selectedRows;
// //
if (selectedRows.length !== 0) { if (selectedRows.length !== 0) {
state.type = selectedRows[0].algorithm === 'ANN' console.log(selectedRows)
state.type = selectedRows[0].algorithmId === '2'
state.pointInfo = JSON.parse(selectedRows[0].modelInfo).pointInfo state.pointInfo = JSON.parse(selectedRows[0].modelInfo).pointInfo
for (const p of state.pointInfo) { for (const p of state.pointInfo) {
p.modelName = selectedRows[0].modelName p.modelName = selectedRows[0].modelName
p.modelDescription = selectedRows[0].description p.modelDescription = selectedRows[0].description
p.algorithm = selectedRows[0].algorithm p.algorithm = selectedRows[0].algorithmId
} }
} }
@ -124,6 +125,7 @@ async function updatempName(selectedRowKeys, selectedRows) {
}) })
instantForm.modelId = selectedRows.length !== 0 ? `${selectedRows[0].modelId}` : `` instantForm.modelId = selectedRows.length !== 0 ? `${selectedRows[0].modelId}` : ``
instantForm.mpName = selectedRows.length !== 0 ? `${selectedRows[0].modelName}-实例` : `` instantForm.mpName = selectedRows.length !== 0 ? `${selectedRows[0].modelName}-实例` : ``
instantForm.algorithmId=selectedRows.length !== 0 ? `${selectedRows[0].algorithmId}` : ``
setFieldsValue(instantForm) setFieldsValue(instantForm)
} }
@ -146,6 +148,9 @@ async function handleSubmit() {
// //
const pointInfoNew = pointRef.value.getPointTableData() const pointInfoNew = pointRef.value.getPointTableData()
values.pointInfo = pointInfoNew values.pointInfo = pointInfoNew
console.log(pointInfoNew)
alert(444)
await createInstant(values) await createInstant(values)
emit('success') emit('success')
createMessage.success(t('common.saveSuccessText')) createMessage.success(t('common.saveSuccessText'))

10
src/views/run/instant/instant.data.ts

@ -348,6 +348,16 @@ export const createInstantForm: FormSchema[] = [
span: 12, span: 12,
}, },
}, },
{
label: '算法id',
field: 'algorithmId',
component: 'Input',
required: true,
show: false,
colProps: {
span: 12,
},
},
{ {
label: '实例名称', label: '实例名称',
field: 'mpName', field: 'mpName',

21
src/views/run/model/PointTable.vue

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { defineExpose, onMounted, reactive, ref, watch } from 'vue' import {defineExpose, h, onMounted, reactive, ref, watch} from 'vue'
import { autoCompleteProps } from 'ant-design-vue/es/auto-complete' import { autoCompleteProps } from 'ant-design-vue/es/auto-complete'
import PointModal from '../../exa/history/PointModal.vue' import PointModal from '../../exa/history/PointModal.vue'
import { columns } from './point.data' import { columns } from './point.data'
@ -7,7 +7,7 @@ import { BasicTable, TableAction, useTable } from '@/components/Table'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { IconEnum } from '@/enums/appEnum' import { IconEnum } from '@/enums/appEnum'
import { useModal } from '@/components/Modal' import { useModal } from '@/components/Modal'
import {Tag} from 'ant-design-vue'
defineOptions({ name: 'ModelTable' }) defineOptions({ name: 'ModelTable' })
const props = defineProps({ const props = defineProps({
data: { data: {
@ -54,7 +54,16 @@ onMounted(() => {
title: '测点类型', title: '测点类型',
dataIndex: 'type', dataIndex: 'type',
width: 80, width: 80,
slots: { customRender: 'type' }, // slots: { customRender: 'type' },
customRender: ({ record }) => {
return h(
Tag,
{
color: record.type ? 'default' : 'blue',
},
() => (record.type ? '输出' : '输入'),
)
}
}]) }])
} }
}) })
@ -85,9 +94,9 @@ defineExpose({ getPointTableData })
<template> <template>
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #type="{ record }"> <!-- <template #type="{ record }">-->
{{ record.type ? '输入' : '输出' }} <!-- {{ record.type ? '输出' : '输入' }}-->
</template> <!-- </template>-->
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<TableAction <TableAction

Loading…
Cancel
Save