-
+
- 新增
+ 新增
-
+
{{insertSelectItem}}
- mdi-close
+ mdi-close
+
@@ -414,27 +428,24 @@
- 新增
+ v-model="modifySelectItem"/>
+ 新增
+ 拖曳選項以排序
-
-
-
-
- {{ modifySelectItem }}
-
-
-
-
+
+
+ {{ modifySelectItem }}
+
+ mdi-close
+
+
+
@@ -449,28 +460,6 @@
-
-
-
-
-
-
-
- {{ tag.name }}
-
-
-
-
-
-
-
@@ -542,11 +531,9 @@
modifySelectItems: [],
modifySelectItem: '',
dialogModifySelectItem: false,
- selection: null,
- currentTag: null,
tags: [{
name: 'Shoping',
- },{
+ }, {
name: 'Art',
}, {
name: 'Tech',
@@ -554,6 +541,7 @@
name: 'Creative Writing'
}
],
+ oldIndex: '',
}
},
async mounted() {
@@ -570,8 +558,19 @@
this.getCols();
},
dialogModifySelectItem() {
- this.getModifySelectItems();
+ if (this.modifySelectItems.length === 0) {
+ this.getModifySelectItems();
+ }
+ },
+ modifySelectItems() {
+ console.log(this.modifySelectItems[0]);
+ },
+ dialogInsert() {
+ this.insertColItem.index = (parseInt(this.allCols[this.assertGroup[this.currentTab].value][this.allCols[this.assertGroup[this.currentTab].value].length - 1].index) + 1).toString();
},
+ dialogModify() {
+ this.oldIndex = this.modifyColItem.index;
+ }
},
methods: {
// eslint-disable-next-line no-unused-vars
@@ -579,34 +578,8 @@
// console.log(col);
console.log(this.modifySelectItems);
},
- dragStart() {
-
- if (this.modifySelectItems[this.selection]) {
- this.currentTag = this.modifySelectItems[this.selection];
- }
- else {
- this.currentTag = null;
- }
- // console.log(this.selection);
- // console.log(this.currentTag);
- // console.log(this.tags[0].name);
- },
- dragEnd() {
- var self = this;
- console.log(this.currentTag);
- if (this.currentTag) {
- this.modifySelectItems.forEach((x, i) => {
- if (x === self.currentTag) self.selection = i;
- });
- }
- // console.log(this.selection);
- // console.log(this.currentTag);
- console.log(this.modifySelectItems[0]);
-
- },
closeDialogInsertSelectItem() {
- this.dialogInsertSelectItem = false
- this.insertSelectItems = [];
+ this.dialogInsertSelectItem = false;
},
getModifySelectItems() {
this.$axios.get(`/assert/selectItems?tablename=${this.modifyColItem.tablename}&&colname=${this.modifyColItem.colname}`).then((resp) => {
@@ -616,9 +589,9 @@
},
closeDialogModifySelectItem() {
this.dialogModifySelectItem = false;
- this.modifySelectItems = [];
+ // this.modifySelectItems = [];
},
- pushSelectItem() {
+ pushInsertSelectItem() {
if (this.insertSelectItems.indexOf(this.insertSelectItem) >= 0 || this.insertSelectItem === '') {
alert('選項不得重複或為空');
} else {
@@ -626,9 +599,20 @@
this.insertSelectItem = '';
}
},
- deleteSelectItem(index) {
+ pushModifySelectItem() {
+ if (this.modifySelectItems.indexOf(this.modifySelectItem) >= 0 || this.modifySelectItem === '') {
+ alert('選項不得重複或為空');
+ } else {
+ this.modifySelectItems.push(this.modifySelectItem);
+ this.modifySelectItem = '';
+ }
+ },
+ deleteInsertSelectItem(index) {
this.insertSelectItems.splice(index, 1);
},
+ deleteModifySelectItem(index) {
+ this.modifySelectItems.splice(index, 1);
+ },
oninput(item, key, val) {
this.$set(item, key, val);
},
@@ -658,20 +642,23 @@
},
insertCol() {
for (const key in this.insertColItem) {
- if (this.insertColItem[key] === '') {
+ if (this.insertColItem[key] === '' && key !== 'tablename') {
+ console.log(key);
alert('所有資料不可為空');
return;
- } else {
- this.insertColItem.tablename = this.assertGroup[this.currentTab].value;
- this.insertColItem.insertselectItems = this.insertSelectItems;
- this.$axios.post(`/assert/col`, this.insertColItem).then(() => {
- this.getCols();
- this.close();
- this.insertSelectItems = [];
- }
- );
}
}
+ this.insertColItem.tablename = this.assertGroup[this.currentTab].value;
+ this.insertColItem.insertSelectItems = this.insertSelectItems;
+ this.$axios.post(`/assert/col`, this.insertColItem).then(() => {
+ this.getCols();
+ this.close();
+ this.insertSelectItems = [];
+ delete this.insertColItem.tablename;
+ delete this.insertColItem.insertselectItems;
+ }
+ );
+
},
close() {
this.dialogInsert = false;
@@ -697,14 +684,26 @@
this.selectItem = resp.data.data;
});
},
- modifyCol(item) {
- console.log(item);
- item.tablename = this.tablename;
- this.$axios.put(`/assert/col`, item).then(() => {
+ modifyCol() {
+ for (const key in this.modifyColItem) {
+ if (this.modifyColItem[key] === '') {
+ alert('所有資料不可為空');
+ return;
+ }
+ }
+ this.modifyColItem.tablename = this.assertGroup[this.currentTab].value;
+ this.modifyColItem.modifySelectItems = this.modifySelectItems;
+ this.modifyColItem.oldIndex = this.oldIndex;
+ this.$axios.put(`/assert/col`, this.modifyColItem).then(() => {
this.getCols();
this.close();
+ this.modifySelectItems = [];
+ delete this.modifyColItem.tablename;
+ delete this.modifyColItem.modifySelectItems;
+ delete this.modifyColItem.oldIndex;
}
);
+
},
deleteCol(item) {
let yes = confirm('確定刪除');
diff --git a/app/src/components/Inventory.vue b/app/src/components/Inventory.vue
index 0dd1594..5d14dfd 100644
--- a/app/src/components/Inventory.vue
+++ b/app/src/components/Inventory.vue
@@ -321,6 +321,7 @@
});
},
getHeaders() {
+ this.headers.push({'text': '', 'value': 'actions', sortable: false});
this.$axios.get(`/headers?tablename=${this.tablename}`).then((resp) => {
this.cols = resp.data.data;
resp.data.data.forEach((item) => {
@@ -337,7 +338,6 @@
this.insertItem[item.colname] = null;
this.searchItem[item.colname] = null;
});
- this.headers.push({'text': '', 'value': 'actions', sortable: false});
});
},
getInventories() {
diff --git a/src/main/java/com/moze/rms/controller/AssertGroupController.java b/src/main/java/com/moze/rms/controller/AssertGroupController.java
index 21aa87e..f26195a 100644
--- a/src/main/java/com/moze/rms/controller/AssertGroupController.java
+++ b/src/main/java/com/moze/rms/controller/AssertGroupController.java
@@ -1,11 +1,11 @@
package com.moze.rms.controller;
import com.moze.rms.dao.AssertDAO;
-import com.moze.rms.entity.dto.SelectItemDTO;
import com.moze.rms.entity.model.MappingCol;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -53,12 +53,12 @@ public class AssertGroupController {
}
@GetMapping("/Types")
- public JsonResult getTypesByTable(@RequestParam String tablename) {
+ public JsonResult getTypesByTable(@RequestParam String tablename) {
return new JsonResult(StatusCode.SUCCESS, assertDAO.findTypesByTable(tablename));
}
@GetMapping("/allCols")
- public JsonResult getCols(@RequestParam String tablename) {
+ public JsonResult getCols(@RequestParam String tablename) {
// return new JsonResult(StatusCode.SUCCESS, data.stream().collect(Collectors.groupingBy(SelectItemDTO::getColname)));
List