123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <el-dialog
- :title="title"
- :visible.sync="dialogOpen"
- width="1000px"
- :close-on-click-modal="false"
- append-to-body
- @opened="initData"
- @close="handleCancel"
- >
- <el-form ref="form" :model="formData" :rules="rules" label-width="100px">
- <el-form-item label="任务名称" prop="name">
- <el-input v-model="formData.name" placeholder="请输入任务名称" />
- </el-form-item>
- <el-form-item label="模型类型" prop="type" @change="queryModels">
- <el-select
- v-model="queryFrom.modelType"
- placeholder="请选择模型类型"
- clearable
- >
- <el-option
- v-for="dict in dict.type.biz_model_type"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="模型类型" prop="type" @change="queryModels">
- <el-select
- v-model="queryFrom.modelTypet"
- placeholder="请选择模型种类"
- clearable
- >
- <el-option
- v-for="dict in dict.type.model_tepe_t"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="模型" prop="modelId">
- <el-select v-model="formData.modelId" placeholder="请选择模型" @change="onModelChange">
- <el-option
- v-for="item in faultPhysicalOptions"
- :key="item.modelId"
- :label="item.modelName"
- :value="item.modelId"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item v-if="formData.modelId && modelType" label="模型参数">
- <dynamic-parameter-form :model-typedisbale="modelType==='0'" :config-data="initialData" @submit="handleSubmitDataList" />
- </el-form-item>
- <el-form-item label="说明" prop="remark">
- <el-input
- v-model="formData.remark"
- type="textarea"
- placeholder="请输入内容"
- />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="handleSubmit">确 定</el-button>
- <el-button @click="handleCancel">取 消</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import DynamicParameterForm from '@/views/dataGen/DynamicParameterForm.vue'
- import {
- addDdAlgorithm,
- updateDdAlgorithm,
- fileCopys
- } from "@/api/test/ddAlgorithm";
- import { getFaultPhysicalOptions } from '@/api/model/faultPhysical'
- import {getFaultPhysical} from "@/api/model/faultPhysical";
- import { addData } from '@/api/data/data'
- export default {
- components:{
- DynamicParameterForm
- },
- computed: {
- title() {
- if (this.options === 'add') {
- return '添加功能验证';
- }
- if (this.options === 'edit') {
- return '修改功能验证';
- }
- return '';
- },
- },
- props: {
- value: {
- type: Boolean,
- default: false
- },
- dataInfo: {
- type: Object,
- default: null
- },
- options: {
- type: String,
- default: 'add'
- },
- dataOptions: {
- type: Array,
- default: () => []
- },
- },
- dicts: ["biz_model_type","param_type","model_tepe_t"],
- data() {
- return {
- queryFrom:{
- modelType:'',
- modelTypet:'',
- modelAttribution:1
- },
- faultPhysicalOptions:[],
- //指定文件上传路径
- customPath:"",
- formData: {
- apiPath:null,
- id: null,
- name: null,
- modelId: null,
- dataId: null,
- truthLabels: null,
- testLabels: null,
- remark: null,
- startTime: null,
- endTime: null,
- createBy: null,
- createTime: null,
- updateBy: null,
- updateTime: null,
- },
- initialData:[],
- modelType:null,
- selectedModel:{},
- fileForm:{},
- rules: {},
- dialogOpen: false
- };
- },
- model: {
- prop: 'value',
- event: 'callback'
- },
- watch: {
- value(newVal) {
- this.dialogOpen = newVal;
- }
- },
- methods: {
- queryModels(){
- console.log('111111',this.queryFrom)
- getFaultPhysicalOptions(this.queryFrom).then(resp => {
- this.faultPhysicalOptions = resp.data || [];
- console.log(this.faultPhysicalOptions)
- });
- },
- onModelChange(modelId){
- //获取模型参数详情
- getFaultPhysical(modelId).then(rest => {
- this.initialData = rest.data.configData;
- this.modelType=rest.data.modelAttribution;
- this.formData.modelId = rest.data.modelId;
- console.log('modelDataParams',rest.data.modelAttribution)
- });
- console.log(this.selectedModel)
- },
- handleSubmitDataList(data) {
- this.formData.postApiData = JSON.stringify(data);
- this.formData.bizParams= JSON.stringify(data);
- console.log('submit', this.formData)
- },
- handleUploadSuccess(datas){
- console.log('handleChildData',datas);
- const fileData= {
- fileName : datas.fileName,
- filelocalPath : datas.filelocalPath,
- modelPath:this.selectedModel.modelPath
- }
- const addDataform={
- name:'验证数据',
- type:'3',
- fileName:datas.fileName,
- fileSize:datas.fileSize,
- fileSizeBytes:datas.fileSizeBytes,
- fileSuffix:datas.fileSuffix,
- filelocalPath:datas.filelocalPath,
- filePath:datas.filelocalPath+'\\'+datas.fileName,
- }
- addData(addDataform);
- console.log('fileData',fileData)
- fileCopys(fileData);
- this.formData.outputPath = this.selectedModel.modelPath
- },
- initData() {
- this.queryModels();
- if (this.options!== 'add') {
- this.formData = { ...this.dataInfo };
- }
- },
- handleSubmit() {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- if (this.formData.id != null) {
- updateDdAlgorithm(this.formData).then((response) => {
- this.$modal.msgSuccess("修改成功");
- this.handleCancel();
- });
- } else {
- addDdAlgorithm(this.formData).then((response) => {
- this.$modal.msgSuccess("新增成功");
- this.handleCancel();
- });
- }
- }
- });
- },
- handleCancel() {
- this.formData = {
- id: null,
- name: null,
- modelId: null,
- dataId: null,
- truthLabels: null,
- testLabels: null,
- remark: null,
- startTime: null,
- endTime: null,
- createBy: null,
- createTime: null,
- updateBy: null,
- updateTime: null,
- };
- this.$emit('callback', false);
- }
- }
- };
- </script>
|