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

Commit 6450f073 by 李严凡

createTask上传文件接口设置

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