1 本需求采用了微同科技开源脚手架。
2 在该脚手架的基础上,实现算法平台。
3 计算模块主要是对题目的输入进行运算,然后输出结果
<template>
<el-dialog
:title="'计算'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="thisDataForm" :rules="dataRule" ref="dataForm"
label-width="80px">
<el-form-item label="数据输入" prop="input">
<el-input type="textarea"
:autosize="{ minRows: 5, maxRows: 8}"
v-model="thisDataForm.input" :disabled="disabled" placeholder="数据输入"></el-input>
</el-form-item>
<el-form-item label="数据输出" prop="output">
<el-input type="textarea"
:autosize="{ minRows: 5, maxRows: 8}"
v-model="thisDataForm.output" :disabled="!disabled" placeholder="数据输出"></el-input>
</el-form-item>
<el-form-item label="算法耗时" prop="cost">
<el-input v-model="thisDataForm.cost" :disabled="!disabled" placeholder="算法耗时"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button v-if="!disabled" type="primary" @click="dataFormSubmit()">计算</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
disabled: false,
visible: false,
dataForm: {
id: 0,
title: '',
code: '',
introduce: '',
inputExplain: '',
outputExplain: '',
applicationScenario: '',
titleLink: '',
remark: ''
},
thisDataForm: {
id: 0,
input: '',
output: '',
cost: ''
},
dataRule: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
]
}
}
},
methods: {
init (id, disabled) {
this.disabled = disabled
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: `/alg/subject/info/${this.dataForm.id}`,
method: 'get'
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm = data.subject
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm']
.validate((valid) => {
if (valid) {
this.$http({
url: `/alg/subject/cal`,
method: 'post',
data: this.dataForm
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500
})
this.visible = true
this.thisDataForm.cost = data.cost
this.thisDataForm.output = data.output
debugger
this.$emit('refreshDataList')
}
})
}
})
}
}
}
</script>
/**
* 算法计算
*
* @param algSubject algSubject
* @return RestResponse
*/
@SysLog("计算")
@RequestMapping("/cal")
@RequiresPermissions("alg:subject:save")
public RestResponse cal(@RequestBody AlgSubjectEntity algSubject) {
logger.info("start");
return RestResponse.success().put("output","reulst").put("cost","cost");
}
这里只是把框架搭建起来了,具体算法是要写的。后面再慢慢把算法加进来。
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/chengqiuming/article/details/126198305
内容来源于网络,如有侵权,请联系作者删除!