huangsijun
2025-11-06 372494883079be03b921f6686691271355bfdd14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<template>
  <!--
        作者:luoyiming
        时间:2019-10-25
        描述:插件-添加
    -->
  <el-dialog title="应用回收站" :visible.sync="dialogVisible" @close='dialogFormVisible' :close-on-click-modal="false"
    :close-on-press-escape="false">
      <el-table size="small" :data="categoryList" border style="width: 100%" v-loading="loading">
        <!-- <el-table-column prop="app_icon" label="图标"></el-table-column> -->
        <el-table-column prop="app_name" label="名称"></el-table-column>
        <el-table-column prop="app_name" label="操作" width="200">
          <template slot-scope="scope">
            <el-button @click="addClick(scope.row)" size="small">添加</el-button>
            <el-button type="danger" @click="deleteClick(scope.row)" size="small">彻底删除</el-button>
           </template>
        </el-table-column>
      </el-table>
    <!-- <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible">取 消</el-button>
      <el-button type="primary" @click="addClick()" :loading="loading">确 定</el-button>
    </div> -->
  </el-dialog>
</template>
 
<script>
  import ApplicationApi from '@/api/application.js';
  export default {
    data() {
      return {
        form: {
          status: 0,
          srot: 1,
          app_name: '',
          desc: '',
          ico: '',
          url: 'index/index',
          sort: 1,
 
        },
        categoryList: [],
        srot: '1',
        radio: '1',
        /*左边长度*/
        formLabelWidth: '120px',
        /*是否显示*/
        dialogVisible: false,
        /*是否正在加载*/
        loading: true,
      };
    },
    props: {
      open_add:Boolean,
      curModel:Object
    },
    created() {
      this.dialogVisible = this.open_add;
      /*获取插件列表*/
      this.getCategoryList();
    },
    methods: {
      /*获取插件*/
      getCategoryList() {
        let self = this;
        let Params = {
          plus_category_id:self.curModel.plus_category_id
        };
        ApplicationApi.getplugs(Params, true)
          .then(data => {
            self.loading = false;
            self.categoryList = data.data.accessList;
          })
          .catch(error => {
            self.loading = false;
          });
      },
 
      /*添加插件*/
      addClick(e) {
        let self = this;
        let params = {
          id:e.id,
          category_id:self.curModel.id
        };
        ApplicationApi.addplugs(params, true).then(res => {
            self.loading = false;
            if (res.code == 1) {
              self.$message({
                message: '恭喜你,添加成功',
                type: 'success'
              });
              self.dialogFormVisible(true);
            } else {
                self.loading = false;
              self.$message.error('错了哦,这是一条错误消息');
            }
          })
          .catch(error => {
              self.loading = false;
          });
      },
 
      /*关闭弹窗*/
      dialogFormVisible(e) {
        if (e) {
          this.$emit('closeDialog', {
            type: 'success',
            openDialog: false
          })
        } else {
          this.$emit('closeDialog', {
            type: 'error',
            openDialog: false
          })
        }
      },
      /*删除插件*/
      deleteClick(row) {
        let self = this;
        self
          .$confirm('彻底删除后将不可恢复,确认删除该记录吗?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          })
          .then(() => {
            self.loading = true;
            ApplicationApi.deleteplugs(
              {
                id: row.id
              },
              true
            )
              .then(res => {
                 self.loading = false;
                 if (res.code == 1) {
                   self.$message({
                     message:'操作成功',
                     type: 'success'
                   });
                   self.dialogFormVisible(true);
                 } else {
                     self.loading = false;
                   self.$message.error('错了哦,这是一条错误消息');
                 }
              })
              .catch(error => {
                self.loading = false;
              });
          })
          .catch(() => {});
      },
 
    }
  };
</script>
 
<style></style>