|
|
@@ -16,7 +16,7 @@
|
|
|
<template #render="{column, record}" >
|
|
|
<template v-if="column.key === 'action'" >
|
|
|
<a-space>
|
|
|
- <a>算子详情</a>
|
|
|
+ <a @click="updateName(record)" >更改名称</a>
|
|
|
<a @click="pushVersion(record)" >新增版本</a>
|
|
|
<a @click="delOperator(record)" >删除</a>
|
|
|
</a-space>
|
|
|
@@ -26,30 +26,30 @@
|
|
|
</a-card>
|
|
|
<modal-pro
|
|
|
width="800px"
|
|
|
- label="创建算子"
|
|
|
+ :label="state.modalType === 'add' ? '创建算子' :'修改名称' "
|
|
|
:open="state.visible"
|
|
|
@cancel="closeModal"
|
|
|
@ok="submit"
|
|
|
>
|
|
|
<a-form style="width: 100%;" :labelCol="{span: 3}" :wrapperCol="{span: 14}" >
|
|
|
- <a-form-item label="算子ID" v-bind="validateInfos.aiId" extra="仅支持小写字母、数字、中划线,64字符以内,小写字母开头" >
|
|
|
+ <a-form-item label="算子ID" v-if="state.modalType === 'add'" v-bind="validateInfos.aiId" extra="仅支持小写字母、数字、中划线,64字符以内,小写字母开头" >
|
|
|
<InputTsx allowClear placeholder="请输入算子ID" v-model:value="operatorState.aiId" />
|
|
|
</a-form-item>
|
|
|
<a-form-item label="算子名称" v-bind="validateInfos.aiName" >
|
|
|
<InputTsx allowClear placeholder="请输入算子名称" v-model:value="operatorState.aiName" />
|
|
|
</a-form-item>
|
|
|
- <a-form-item label="算子类型" v-bind="validateInfos.aiModelType" >
|
|
|
+ <a-form-item label="算子类型" v-if="state.modalType === 'add'" v-bind="validateInfos.aiModelType" >
|
|
|
<a-select
|
|
|
ref="select"
|
|
|
v-model:value="operatorState.aiModelType"
|
|
|
style="width: 120px"
|
|
|
- @change="onChangeOperatorType"
|
|
|
>
|
|
|
<a-select-option v-for="item in state.type" :key="item.code" :value="item.code">{{item.name}}</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
</modal-pro>
|
|
|
+
|
|
|
</template>
|
|
|
<script lang='ts' setup >
|
|
|
import { OperatorController } from '@/controller'
|
|
|
@@ -101,10 +101,14 @@ const columns = [
|
|
|
|
|
|
const state = reactive<{
|
|
|
visible: boolean,
|
|
|
- type: {code: string; name: string;}[]
|
|
|
+ type: {code: string; name: string;}[],
|
|
|
+ updateNameVisible: boolean,
|
|
|
+ modalType: 'add' | 'update'
|
|
|
}>({
|
|
|
visible: false,
|
|
|
- type: []
|
|
|
+ updateNameVisible: false,
|
|
|
+ type: [],
|
|
|
+ modalType: 'add'
|
|
|
})
|
|
|
|
|
|
const operatorState = reactive<CVS.Operator>({
|
|
|
@@ -119,20 +123,16 @@ const { resetFields, validate, validateInfos } = useForm(operatorState, {
|
|
|
aiModelType: [{ required: true, message: '请选择算子类型' }]
|
|
|
})
|
|
|
|
|
|
-const onChangeOperatorType = () => {
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
const submit = () => {
|
|
|
validate().then(async () => {
|
|
|
- await OperatorController.add(operatorState)
|
|
|
+ state.modalType === 'add' ? await OperatorController.add(operatorState) : await OperatorController.upadteName(operatorState.aiId, operatorState.aiName)
|
|
|
closeModal()
|
|
|
tableProDom.value.reload()
|
|
|
}).catch(() => {})
|
|
|
}
|
|
|
|
|
|
const delOperator = async (record) => {
|
|
|
- await OperatorController.del(record.id)
|
|
|
+ await OperatorController.del(record.aiId)
|
|
|
tableProDom.value.reload()
|
|
|
}
|
|
|
|
|
|
@@ -146,12 +146,20 @@ const closeModal = () => {
|
|
|
|
|
|
const openModal = () => {
|
|
|
state.visible = true
|
|
|
+ state.modalType = 'add'
|
|
|
}
|
|
|
|
|
|
const getOperatorType = async () => {
|
|
|
state.type = await OperatorController.type()
|
|
|
}
|
|
|
|
|
|
+const updateName = async (record) => {
|
|
|
+ const data = await OperatorController.byId(record.aiId)
|
|
|
+ resetFields(data)
|
|
|
+ state.modalType = 'update'
|
|
|
+ state.visible = true
|
|
|
+}
|
|
|
+
|
|
|
const pushVersion = (record) => {
|
|
|
router.push({ path: '/cvs/operator/version', query: { aiId: record.aiId } })
|
|
|
}
|