add and delete tasks
This commit is contained in:
		| @@ -21,6 +21,7 @@ | |||||||
|         class="nest-menu" |         class="nest-menu" | ||||||
|       /> |       /> | ||||||
|     </el-submenu> |     </el-submenu> | ||||||
|  | <!--     <button type="button" class="btn btn-outline-light" style="margin-left: 5px" @click="addNewTask">+</button> --> | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
| @@ -57,6 +58,12 @@ export default { | |||||||
|     return {} |     return {} | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|  |     // addNewTask() { | ||||||
|  |     //   this.item.children.push({ | ||||||
|  |     //     name: "Task 2", | ||||||
|  |     //     path: "" | ||||||
|  |     //   }) | ||||||
|  |     // }, | ||||||
|     hasOneShowingChild(children = [], parent) { |     hasOneShowingChild(children = [], parent) { | ||||||
|       const showingChildren = children.filter(item => { |       const showingChildren = children.filter(item => { | ||||||
|         if (item.hidden) { |         if (item.hidden) { | ||||||
| @@ -67,6 +74,7 @@ export default { | |||||||
|           return true |           return true | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|  |       // console.log(showingChildren) | ||||||
|  |  | ||||||
|       // When there is only one child router, the child router is displayed by default |       // When there is only one child router, the child router is displayed by default | ||||||
|       if (showingChildren.length === 1) { |       if (showingChildren.length === 1) { | ||||||
|   | |||||||
| @@ -15,6 +15,7 @@ | |||||||
|         <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" /> |         <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" /> | ||||||
|       </el-menu> |       </el-menu> | ||||||
|     </el-scrollbar> |     </el-scrollbar> | ||||||
|  |      | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
|     <div :class="{hasTagsView:needTagsView}" class="main-container"> |     <div :class="{hasTagsView:needTagsView}" class="main-container"> | ||||||
|       <div :class="{'fixed-header':fixedHeader}"> |       <div :class="{'fixed-header':fixedHeader}"> | ||||||
|         <navbar /> |         <navbar /> | ||||||
|         <tags-view v-if="needTagsView" /> |         <!-- <tags-view v-if="needTagsView" /> --> | ||||||
|       </div> |       </div> | ||||||
|       <app-main /> |       <app-main /> | ||||||
| <!--       <right-panel v-if="showSettings"> | <!--       <right-panel v-if="showSettings"> | ||||||
|   | |||||||
| @@ -73,13 +73,13 @@ export const constantRoutes = [ | |||||||
|   { |   { | ||||||
|     path: '/', |     path: '/', | ||||||
|     component: Layout, |     component: Layout, | ||||||
|     redirect: '/uploader', |     redirect: '/vueUploader', | ||||||
|     children: [ |     children: [ | ||||||
|       { |       { | ||||||
|         path: 'vueUploader', |         path: 'vueUploader', | ||||||
|         component: () => import('@/views/VueUploader/index'), |         component: () => import('@/views/VueUploader/index'), | ||||||
|         name: 'VueUploader', |         name: 'Task', | ||||||
|         meta: { title: 'VueUploader', icon: 'documentation', affix: true } |         meta: { title: 'Task', icon: 'documentation', affix: true } | ||||||
|       } |       } | ||||||
|     ] |     ] | ||||||
|   }, |   }, | ||||||
| @@ -91,8 +91,8 @@ export const constantRoutes = [ | |||||||
|       { |       { | ||||||
|         path: 'vueUploader', |         path: 'vueUploader', | ||||||
|         component: () => import('@/views/VueUploader/index'), |         component: () => import('@/views/VueUploader/index'), | ||||||
|         name: 'VueUploader', |         name: 'Task', | ||||||
|         meta: { title: 'VueUploader', icon: 'documentation', affix: true } |         meta: { title: 'Task', icon: 'documentation', affix: true } | ||||||
|       } |       } | ||||||
|     ] |     ] | ||||||
|   }, |   }, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth' | |||||||
| const service = axios.create({ | const service = axios.create({ | ||||||
|   baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url |   baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url | ||||||
|   // withCredentials: true, // send cookies when cross-domain requests |   // withCredentials: true, // send cookies when cross-domain requests | ||||||
|   timeout: 500000 // request timeout |   timeout: 5000 // request timeout | ||||||
| }) | }) | ||||||
|  |  | ||||||
| // request interceptor | // request interceptor | ||||||
|   | |||||||
							
								
								
									
										49
									
								
								src/views/VueUploader/components/taskList.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/views/VueUploader/components/taskList.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | |||||||
|  |  <template> | ||||||
|  |   <div class="dropdown float-right"> | ||||||
|  |     <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||||||
|  |       {{ this.tasks[0].name }} | ||||||
|  |     </button> | ||||||
|  |     <div class="dropdown-menu" aria-labelledby="dropdownMenu2"> | ||||||
|  |       <button class="dropdown-item" type="button" v-for="task in tasks" @click="currentTask = task.name" v-text="task.name"></button> | ||||||
|  |       <div class="dropdown-divider"></div> | ||||||
|  |       <form class="px-4 py-3"> | ||||||
|  |         <div class="form-group"> | ||||||
|  |           <label for="exampleDropdownFormEmail1">Task Name</label> | ||||||
|  |           <input class="form-control" id="exampleDropdownFormEmail1" v-model="newTaskName"> | ||||||
|  |         </div> | ||||||
|  |         <button type="submit" class="btn btn-primary" @click="addNewTask()">+ Add new task</button> | ||||||
|  |         <button type="submit" class="btn btn-danger" @click="deleteTask">- Delete task</button> | ||||||
|  |       </form> | ||||||
|  |     </div> | ||||||
|  |   </div> | ||||||
|  | </template>  | ||||||
|  |  | ||||||
|  | <script> | ||||||
|  |   export default { | ||||||
|  |     data: function() { | ||||||
|  |       return { | ||||||
|  |         tasks: [{name: "Task 1"}], | ||||||
|  |         currentTask: "Task 1", | ||||||
|  |         newTaskName: "", | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     methods: { | ||||||
|  |       setCurrentTask(name) { | ||||||
|  |         this.currentTask = name | ||||||
|  |       }, | ||||||
|  |       addNewTask() { | ||||||
|  |         this.tasks.push({name: this.newTaskName}) | ||||||
|  |       }, | ||||||
|  |       deleteTask() { | ||||||
|  |         this.tasks.splice(this.tasks.indexOf({name: this.newTaskName})) | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | </script> | ||||||
|  |  | ||||||
|  | <style scoped> | ||||||
|  |   .dropdown { | ||||||
|  |     display: inline; | ||||||
|  |   } | ||||||
|  | </style> | ||||||
| @@ -1,9 +1,10 @@ | |||||||
| <template> | <template> | ||||||
| <div class="example-full"> | <div class="example-full"> | ||||||
|   <button type="button" class="btn btn-danger float-right btn-is-option" @click.prevent="isOption = !isOption"> |   <taskList></taskList> | ||||||
|  | <!--   <button type="button" class="btn btn-danger float-right btn-is-option" @click.prevent="isOption = !isOption"> | ||||||
|     <i class="fa fa-cog" aria-hidden="true"></i> |     <i class="fa fa-cog" aria-hidden="true"></i> | ||||||
|     Options |     Options | ||||||
|   </button> |   </button> --> | ||||||
|   <h1 id="example-title" class="example-title">Data Uploader</h1> |   <h1 id="example-title" class="example-title">Data Uploader</h1> | ||||||
|  |  | ||||||
|   <div v-show="$refs.upload && $refs.upload.dropActive" class="drop-active"> |   <div v-show="$refs.upload && $refs.upload.dropActive" class="drop-active"> | ||||||
| @@ -309,11 +310,12 @@ import Cropper from 'cropperjs' | |||||||
| import ImageCompressor from '@xkeshi/image-compressor' | import ImageCompressor from '@xkeshi/image-compressor' | ||||||
| import FileUpload from 'vue-upload-component' | import FileUpload from 'vue-upload-component' | ||||||
| import { sendAnalyzeRequest } from '@/api/user' | import { sendAnalyzeRequest } from '@/api/user' | ||||||
|  | import taskList from '@/views/VueUploader/components/taskList' | ||||||
| // import 'bootstrap' | // import 'bootstrap' | ||||||
| // import 'bootstrap/dist/css/bootstrap.min.css' | // import 'bootstrap/dist/css/bootstrap.min.css' | ||||||
| export default { | export default { | ||||||
|   components: { |   components: { | ||||||
|     FileUpload, |     FileUpload, taskList | ||||||
|   }, |   }, | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ | |||||||
| 	  <button type="button" class="btn btn-success" @click="onSendAnalyzeOnDateRequest">Apply</button> | 	  <button type="button" class="btn btn-success" @click="onSendAnalyzeOnDateRequest">Apply</button> | ||||||
|     </div> |     </div> | ||||||
|     <iframe src="http://localhost:808" width=1300 height=600></iframe> |     <iframe src="http://localhost:808" width=1300 height=600></iframe> | ||||||
|  |     <button type="button" class="btn btn-secondary" @click="onBackToUpload">Back</button> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
| @@ -39,6 +40,9 @@ export default { | |||||||
| 	          this.$router.push({ name: "plot" }) | 	          this.$router.push({ name: "plot" }) | ||||||
| 	        } | 	        } | ||||||
| 	    }) | 	    }) | ||||||
|  | 	  }, | ||||||
|  | 	  onBackToUpload() { | ||||||
|  | 	  	this.$router.push({ name: "Task" }) | ||||||
| 	  } | 	  } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user