|
|
@@ -11,7 +11,7 @@
|
|
|
@edit="edit"
|
|
|
@delet_data="deleteData"
|
|
|
@group_member="groupMember"
|
|
|
- :pageSize='sum'
|
|
|
+ :pageSize="sum"
|
|
|
></Table>
|
|
|
</div>
|
|
|
<div class="page">
|
|
|
@@ -23,11 +23,17 @@
|
|
|
></Tablepage>
|
|
|
</div>
|
|
|
<div class="modal" v-if="modalFlag">
|
|
|
- <Modal :modalFlag="modalFlag" @hide_modal="showModal" @submit='submit'></Modal>
|
|
|
+ <Modal
|
|
|
+ :modalFlag="modalFlag"
|
|
|
+ @hide_modal="showModal"
|
|
|
+ @submit="submit"
|
|
|
+ ></Modal>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
- <GroupMember />
|
|
|
+ <GroupMember
|
|
|
+ :groupId='groupId'
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -53,15 +59,8 @@ export default {
|
|
|
currentPage: 1,
|
|
|
// 表格配置
|
|
|
tableData: [],
|
|
|
- getDate: [
|
|
|
- { group: "第一小组", str: "13" },
|
|
|
- { group: "第二小组", str: "14" },
|
|
|
- { group: "第三小组", str: "15" },
|
|
|
- { group: "第四小组", str: "125" },
|
|
|
- { group: "第五小组", str: "125" },
|
|
|
- ],
|
|
|
- functionData: [],
|
|
|
modalFlag: false, // 控制模态框展示
|
|
|
+ groupId: ''
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -98,50 +97,143 @@ export default {
|
|
|
}
|
|
|
console.log(this.currentPage);
|
|
|
},
|
|
|
- // 获取数据
|
|
|
- getData: function () {
|
|
|
- this.tableData = [];
|
|
|
- this.functionData = [];
|
|
|
- this.getDate.forEach((element) => {
|
|
|
- this.tableData.push({
|
|
|
- group: element.group,
|
|
|
- });
|
|
|
- this.functionData.push({
|
|
|
- str: element.str,
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
// 展示、隐藏模态框
|
|
|
showModal: function () {
|
|
|
this.modalFlag = !this.modalFlag;
|
|
|
},
|
|
|
- // 模态框保存
|
|
|
- submit: function(groupName) {
|
|
|
- console.log('小组保存', groupName);
|
|
|
+ // 模态框保存,
|
|
|
+ submit: function (groupName) {
|
|
|
+ console.log("小组保存", groupName);
|
|
|
+ this.addGroupInfo(groupName).then(() => {
|
|
|
+ this.selectGroupList();
|
|
|
+ });
|
|
|
this.modalFlag = false;
|
|
|
},
|
|
|
// 点击编辑
|
|
|
edit(index, newName) {
|
|
|
- console.log(this.functionData[index].str, newName);
|
|
|
+ console.log(index, newName);
|
|
|
+ let id = this.tableData[index]['id'];
|
|
|
+ this.updateGroupInfo(id, newName).then(() => {
|
|
|
+ this.selectGroupList();
|
|
|
+ })
|
|
|
},
|
|
|
// 点击删除
|
|
|
- deleteData: function(index) {
|
|
|
- console.log("删除", this.functionData[index].str);
|
|
|
+ deleteData: function (index) {
|
|
|
+ console.log("删除", index);
|
|
|
+ let id = this.tableData[index]['id'];
|
|
|
+ this.deleteGroupInfo(id).then(() => {
|
|
|
+ this.selectGroupList();
|
|
|
+ })
|
|
|
},
|
|
|
- // 点击系列车型
|
|
|
- groupMember: function(index) {
|
|
|
+ // 点击小组成员
|
|
|
+ groupMember: function (index) {
|
|
|
// 页面变化
|
|
|
this.$router.push({ query: { tag: "group_menber" } });
|
|
|
- console.log("点击系列车型", this.functionData[index].str);
|
|
|
+ this.groupId = this.tableData[index]['id'];
|
|
|
+ },
|
|
|
+ // 新增小组 接口
|
|
|
+ addGroupInfo: function (groupName) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$http({
|
|
|
+ method: "post",
|
|
|
+ url: "/sys/group/addGroupInfo",
|
|
|
+ data: {
|
|
|
+ groupName
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data && res.data.code === 200) {
|
|
|
+ console.log(res);
|
|
|
+ resolve();
|
|
|
+ } else {
|
|
|
+ alert("新增失败,请重试");
|
|
|
+ console.log(res);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ reject(err);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取列表 接口
|
|
|
+ selectGroupList: function () {
|
|
|
+ this.$http({
|
|
|
+ method: "post",
|
|
|
+ url: "/sys/group/selectGroupList",
|
|
|
+ data: {},
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data && res.data.code === 200) {
|
|
|
+ console.log(res);
|
|
|
+ this.tableData = res.data.data;
|
|
|
+ this.sum = res.data.count;
|
|
|
+ } else {
|
|
|
+ console.log(res);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 编辑平台模块,接口
|
|
|
+ updateGroupInfo: function (id, platformName) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$http({
|
|
|
+ method: "post",
|
|
|
+ url: "/sys/group/updateGroupInfo",
|
|
|
+ data: {
|
|
|
+ id,
|
|
|
+ platformName,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res, 1111);
|
|
|
+ if (res.data && res.data.code === 200) {
|
|
|
+ console.log(res);
|
|
|
+ resolve();
|
|
|
+ } else {
|
|
|
+ alert("编辑失败,请重试");
|
|
|
+ console.log(res);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ alert("编辑失败,请重试");
|
|
|
+ console.log(err);
|
|
|
+ reject(err);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 删除平台模块 接口
|
|
|
+ deleteGroupInfo: function (id) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.$http({
|
|
|
+ method: "post",
|
|
|
+ url: "/sys/group/deleteGroupInfo",
|
|
|
+ data: {
|
|
|
+ id
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data && res.data.code === 200) {
|
|
|
+ console.log(res);
|
|
|
+ resolve();
|
|
|
+ } else {
|
|
|
+ alert("编辑失败,请重试");
|
|
|
+ console.log(res);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ alert("编辑失败,请重试");
|
|
|
+ console.log(err);
|
|
|
+ reject(err);
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
- // 删除数据
|
|
|
- detletData: function() {
|
|
|
- console.log('删除数据');
|
|
|
- }
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- this.getData();
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.selectGroupList();
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|