文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 6450f073 by 李严凡

createTask上传文件接口设置

parent 0cf411f7
......@@ -25,15 +25,17 @@
<el-col span="8">
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
action="/api/files/upload"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-success="uploadSuccessF"
multiple
:limit="7"
:data="'3:'+(index)"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button size="small" type="primary" >点击上传</el-button>
<el-button size="small" type="primary" @click="setIndex(index)">点击上传</el-button>
</el-upload>
</el-col>
<el-col span="6">
......@@ -81,15 +83,17 @@
<el-col span="6">
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
action="/api/files/upload"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-remove="removeSuccess"
:before-remove="beforeRemove"
:on-success="uploadSuccessP"
:data="'3:'+(index)"
multiple
:limit="7"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
<el-button size="small" type="primary" @click="setIndex(index)">点击上传</el-button>
</el-upload>
</el-col>
......@@ -125,19 +129,21 @@
<!-- 上传图片-->
<el-row :gutter="20" >
<el-col span="6">
<!-- 上传文件传参3表示图层分片,index表示第几个分片,用“:”分割-->
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
action="/api/files/upload"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-success="uploadSuccessL"
multiple
:data="'3:'+(index)"
:limit="7"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
<el-button size="small" type="primary" @click="setIndex(index)">点击上传</el-button>
</el-upload>
</el-col>
<el-col span="10">
<el-input type="textarea" :row="6" placeholder="请输入分片描述" @input="change($event)" v-model="domain.textarea" style="margin-bottom: 10px;height:40px" maxlength="150" show-word-limit="150">
......@@ -158,7 +164,7 @@
<el-col offset="17" span="7">
<el-form-item style="margin-top: 20px">
<el-input v-model="taskName" @input="change($event)" placeholder="输入任务名称" style="width: 200px"></el-input>
<el-button type="primary" @click="submitForm('dynamicValidateForm')" style="margin-left: 15px">创建任务</el-button>
<el-button type="primary" @click="submitForm(taskName)" style="margin-left: 15px">创建任务</el-button>
</el-form-item>
</el-col>
</el-row>
......@@ -169,7 +175,7 @@
<el-form-item label="模板名称" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<input v-model="mm" placeholder="输入实体或属性">{{mm}}</input>
<input v-model="mm" placeholder="输入实体或属性">
<!-- 树状结构-->
<div class="block">
<el-tree
......@@ -307,7 +313,7 @@ export default {
}]
}];
return {
m:'好的撒',
Index : 0,//在分片中的位置
dialogFormVisible: false,
form: {
name: '',
......@@ -323,32 +329,7 @@ export default {
dynamicValidateForm: {
//domains--文本信息
domains: [{
piecesOptions: [{
pvalue: '1',
plabel: '模板1'
}, {
pvalue: '2',
plabel: '模板2'
}, {
pvalue: '3',
plabel: '模板3'
}],
pvalue:'',
createMode:false
},{
piecesOptions: [{
pvalue: '1',
plabel: '模板1'
}, {
pvalue: '2',
plabel: '模板2'
}, {
pvalue: '3',
plabel: '模板3'
}],
pvalue:'',
createMode:false
},{
fileName:new Array(),
piecesOptions: [{
pvalue: '1',
plabel: '模板1'
......@@ -363,17 +344,11 @@ export default {
createMode:false
}],
pictureDomains:[{
textarea:'',
},{
textarea:'',
},{
fileName: new Array(),
textarea:'',
}],
layerDoamins:[{
textarea:'',
},{
textarea:'',
},{
fileName: new Array(),
textarea:'',
}],
},
......@@ -382,22 +357,58 @@ export default {
createModeLable:'自定义模板',
data: JSON.parse(JSON.stringify(data)),
data: JSON.parse(JSON.stringify(data)),
fName:'',
taskName:''
};
},
computed:{
userInfo(){
return this.$store.state.userInfo
}
},
methods: {
setIndex(index){
this.Index = index;
},
uploadSuccessF(response,file,fileList){
this.fName=file.name;
this.dynamicValidateForm.domains[this.Index - 1].fileName.push(this.fName);
//console.log(this.fName);
//console.log(this.taskName);
},
uploadSuccessP(response,file,fileList){
this.fName=file.name;
this.dynamicValidateForm.pictureDomains[this.Index - 1].fileName.push(this.fName);
//console.log(this.fName);
//console.log(this.taskName);
},
uploadSuccessL(response,file,fileList){
this.fName=file.name;
this.dynamicValidateForm.layerDoamins[this.Index - 1].fileName.push(this.fName);
// console.log(this.fName);
// console.log(this.dynamicValidateForm.layerDoamins[this.Index].fileName);
},
removeSuccess(file,fileList){
console.log("del:"+file.name);
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
// 提示
this.$alert('submit', '提示', {
confirmButtonText: '确定',
type: 'succes'
})
} else {
console.log('error submit!!');
return false;
}
});
console.log(this.dynamicValidateForm);
this.axios({
method:'post',
url:"/api/task/createTask",
data:{
userId: this.userInfo.userId,
taskName: this.taskName,
task: this.dynamicValidateForm,
}
}).then(res=>{
if(res.data.code == 1){
self.$router.push({path: '/releaseTask'});
}
else{
alert("上传失败");
}
})
},
resetForm(formName) {
this.$refs[formName].resetFields();
......@@ -426,6 +437,7 @@ export default {
//添加文字分片
if(ptype == 1){
this.dynamicValidateForm.domains.push({
fileName:new Array(),
piecesOptions: [{
pvalue: '1',
plabel: '模板1'
......@@ -436,20 +448,22 @@ export default {
pvalue: '3',
plabel: '模板3'
}],
pvalue:'',
createMode:'',
pvalue:'1',
createMode:false,
key: Date.now()
});
}
//添加图像分片
else if(ptype == 2){
this.dynamicValidateForm.pictureDomains.push({
fileName:new Array(),
textarea:'',
key: Date.now()
});
}
else if(ptype == 3){
this.dynamicValidateForm.layerDoamins.push({
fileName:new Array(),
textarea:'',
key: Date.now()
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment