服务器脚本策略
This commit is contained in:
@@ -1,34 +1,11 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="form" ref="form" label-width="130px" class="dynamic-form">
|
||||
<el-col :span="14">
|
||||
<el-form-item :label="`源文件1地址格式`" prop="sourceFilePathType" :rules="[{ required: true, message: '请选择地址格式', trigger: 'change' }]">
|
||||
<el-radio-group v-model="form.sourceFilePathType" :disabled="readonly">
|
||||
<!-- <el-radio label="platform">平台文件地址</el-radio>-->
|
||||
<el-radio label="1">外网HTTP(S)</el-radio>
|
||||
</el-radio-group>
|
||||
<div class="tip">注意:当文件大小超过100M时,请选择【外网HTTP(S)】地址格式</div>
|
||||
<!-- <div class="error-tip" v-if="source.sizeError">您选择的文件已经超过100M,请更改文件地址格式选择</div>-->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 添加源文件按钮 -->
|
||||
<el-col :span="10" style="vertical-align: top;" v-if="!readonly">
|
||||
<el-form-item style="margin-left: -130px;">
|
||||
<el-button type="primary" @click="addSource" class="add-btn">添加</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 源文件地址 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="`源文件1地址`" prop="sourceFilePath" :rules="[{ required: true, message: '请输入外网地址', trigger: 'change' }]">
|
||||
<el-input v-model="form.sourceFilePath" :disabled="readonly" placeholder="请输入外网地址" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 动态源文件部分 循环多个源文件地址 -->
|
||||
<div v-for="(source, index) in form.sources" :key="index" class="source-item">
|
||||
<!-- 源文件地址格式 -->
|
||||
<el-col :span="14">
|
||||
<el-form-item :label="`源文件${index + 2}地址格式`" prop="sourceFilePathType" :rules="[{ required: true, message: '请选择地址格式', trigger: 'change' }]">
|
||||
<el-form-item :label="`源文件${index + 1}地址格式`" :prop="`sources.${index}.sourceFilePathType`" :rules="[{ required: true, message: '请选择地址格式', trigger: 'change' }]">
|
||||
<el-radio-group v-model="source.sourceFilePathType" :disabled="readonly">
|
||||
<!-- <el-radio label="platform">平台文件地址</el-radio>-->
|
||||
<el-radio label="1">外网HTTP(S)</el-radio>
|
||||
@@ -37,15 +14,20 @@
|
||||
<!-- <div class="error-tip" v-if="source.sizeError">您选择的文件已经超过100M,请更改文件地址格式选择</div>-->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10" style="vertical-align: top;" v-if="readonly ? false : index === 0 ? true : false">
|
||||
<el-form-item style="margin-left: -130px;">
|
||||
<el-button type="primary" @click="addSource" class="add-btn">添加</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 添加源文件按钮 -->
|
||||
<el-col :span="10" v-if="!readonly">
|
||||
<el-col :span="10" v-if="readonly ? false : index !== 0 ? true : false">
|
||||
<el-form-item style="margin-left: -130px;">
|
||||
<el-button type="danger" @click="removeSource(index)" class="delete-btn">删除</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 源文件地址 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="`源文件${index + 2}地址`" prop="sourceFilePath" :rules="[{ required: true, message: '请输入外网地址', trigger: 'change' }]">
|
||||
<el-form-item :label="`源文件${index + 1}地址`" :prop="`sources.${index}.sourceFilePath`" :rules="[{ required: true, message: '请输入外网地址', trigger: 'blur' }]">
|
||||
<el-input v-model="source.sourceFilePath" :disabled="readonly" placeholder="请输入外网地址" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -92,8 +74,7 @@
|
||||
formData: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
sourceFilePathType: '1',
|
||||
sources: [], // 源文件数组,初始为空
|
||||
sources: [{sourceFilePathType: '1', sourceFilePath: ''}], // 源文件数组,初始为空
|
||||
commands: [{commandContent: ''}], // 命令内容数组
|
||||
})
|
||||
},
|
||||
@@ -108,7 +89,7 @@
|
||||
immediate: true, // 初始化时立即执行一次
|
||||
handler(newVal) {
|
||||
if (newVal && typeof newVal === 'object' && Object.keys(newVal).length === 0) {
|
||||
this.form = {sourceFilePathType: '1', sources: [], commands: [{commandContent: ''}]};
|
||||
this.form = {sources: [{sourceFilePathType: '1', sourceFilePath: ''}], commands: [{commandContent: ''}]};
|
||||
} else {
|
||||
this.form = newVal;
|
||||
}
|
||||
@@ -123,11 +104,8 @@
|
||||
methods: {
|
||||
// 添加源文件
|
||||
addSource() {
|
||||
this.form.sources.push({
|
||||
sourceFilePathType: '1',
|
||||
sourceFilePath: '',
|
||||
// sizeError: false
|
||||
});
|
||||
// sizeError: false
|
||||
this.form.sources.push({sourceFilePathType: '1', sourceFilePath: ''});
|
||||
},
|
||||
|
||||
// 删除源文件
|
||||
|
||||
@@ -107,8 +107,24 @@
|
||||
if (val && val.data) {
|
||||
val.data.includedDevicesId = val.data.includedDevicesId.split(',').map(id => Number(id));
|
||||
this.ruleFormData = val.data;
|
||||
// this.resourceType = val.data.resourceType;
|
||||
// this.tempContent[val.data.resourceType] = val.data[val.data.resourceType];
|
||||
// 第二节点
|
||||
val.data['sources'] = [];
|
||||
val.data['commands'] = [];
|
||||
val.data.executionMethod = val.data.executionMethod && val.data.executionMethod.toString();
|
||||
val.data.commandContent = val.data && val.data.commandContent.split(',');
|
||||
val.data.sourceFilePath = val.data && val.data.sourceFilePath.split(',');
|
||||
if (val.data.commandContent && val.data.commandContent.length > 0) {
|
||||
val.data.commandContent.forEach(item => {
|
||||
val.data['commands'].push({commandContent: item});
|
||||
});
|
||||
}
|
||||
if (val.data.sourceFilePath && val.data.sourceFilePath.length > 0) {
|
||||
val.data.sourceFilePath.forEach(item => {
|
||||
val.data['sources'].push({sourceFilePathType: '1', sourceFilePath: item});
|
||||
});
|
||||
}
|
||||
console.log('bbbb===',val.data);
|
||||
this.ruleFormDataTow = val.data;
|
||||
}
|
||||
}).catch(() => {
|
||||
// this.$modal.msgError("操作失败")
|
||||
@@ -159,8 +175,6 @@
|
||||
let newFormVal = {commandContent: [], sourceFilePath: [], sourceFilePathType: []};
|
||||
this.$refs.dyncForm.submitForm().then(formData => {
|
||||
this.ruleFormDataTow = formData;
|
||||
newFormVal['sourceFilePath'].push(formData.sourceFilePath);
|
||||
newFormVal['sourceFilePathType'].push(formData.sourceFilePathType);
|
||||
if (formData && formData.commands && formData.commands.length > 0) {
|
||||
formData.commands.forEach(item => {
|
||||
newFormVal['commandContent'].push(item.commandContent);
|
||||
|
||||
Reference in New Issue
Block a user