gaoshp
2024-06-02 b46e6d2306515f94bf77c06e8d80ac76267e3ddb
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!--
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-05-30 18:17:23
 * @FilePath: /smart-web/src/views/master/person/main/index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div class="aposcope-main">
        <div class="header">
            <div class="title">计划显示设置</div>
            <div class="type">
                <div class="item last" @click="openPlan">新建计划类型模版</div>
                <div :class="{item:true, activeTab: item.active}" v-for="(item,index) in planData" @click="changePlanData(item,index)">
                    <span style="margin-right: 12px;cursor: pointer;">{{item.templateName}}</span>
                    <el-popover placement="right-start" :width="30" trigger="click" :hide-after="0" :show-after="0">
                        <template #reference>...</template>
                        <template #default>
                            <span class="popvoer-title" @click="table_edit(item,index)">编辑</span>
                            <span  class="popvoer-title" style="margin-left: 12px" v-if="index != 0" @click="del_tab(item)">删除</span>
                        </template>
                    </el-popover>
                </div>
            </div>
        </div>
        <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
            <el-tab-pane label="新建页设置" name="first">
                <div>
                    <div class="add-field">+ 添加字段</div>
                    <div class="field-title">基础字段</div>
                    <el-table ref="multipleTableRef" :data="tableData0" border style="width: 100%" class="multipleTableRef">
                        <el-table-column prop="fieldName" label="字段名"></el-table-column>
                        <el-table-column prop="fieldDescription" label="提示文字"></el-table-column>
                        <el-table-column prop="defaultValue" label="默认值"></el-table-column>
                        <el-table-column prop="mustField" label="是否必填"></el-table-column>
                        <el-table-column fixed="right" label="操作">
                            <template #default="scope">
                                <el-button text type="primary" :disabled="scope.row.systemFieldLabel == '是'?true: false" size="small" @click="table_del(scope.row, scope.$index)">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </div>
            </el-tab-pane>
            <el-tab-pane label="编辑页设置" name="second">
                <div class="add-field">+ 添加字段</div>
                <div class="field-title">基础字段</div>
                <el-table ref="multipleTableRef" :data="tableData1" border style="width: 100%" class="multipleTableRef">
                    <el-table-column prop="fieldName" label="字段名"></el-table-column>
                    <el-table-column prop="fieldDescription" label="支持编辑"></el-table-column>
                    <el-table-column fixed="right" label="操作">
                        <template #default="scope">
                            <el-button text type="primary" :disabled="scope.row.systemFieldLabel == '是'?true: false" size="small" @click="table_del(scope.row, scope.$index)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="field-title">扩展字段</div>
            </el-tab-pane>
            <el-tab-pane label="查看页设置" name="third">
                <div class="field-title">基础字段</div>
                <el-table ref="multipleTableRef" :data="tableData2" border style="width: 100%" class="multipleTableRef">
                    <el-table-column prop="fieldName" label="字段名"></el-table-column>
                    <el-table-column fixed="right" label="操作">
                        <template #default="scope">
                            <el-button text type="primary" :disabled="scope.row.systemFieldLabel == '是'?true: false" size="small" @click="table_del(scope.row, scope.$index)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="field-title">扩展字段</div>
            </el-tab-pane>
        </el-tabs>
    </div>
    <save-dialog v-if="dialog.save" ref="saveDialog" @success="addPlanSuccess" @closed="dialog.save=false"></save-dialog>
</template>
<script>
    import saveDialog from './addPlan'
    export default {
        name: "custom",
        data(){
            return {
                id: "",
                dialog: {
                    save: false
                },
                planData: [],
                activeName: "first",
                tableData0: [],
                tableData1: [],
                tableData2: []
            }
        },
        created(){
            
        },
        mounted(){
            this.getBaseData();
            this.gitProduct();
        },
        components: {
            saveDialog
        },
        methods: {
            gitProduct() {
                this.$HTTP.get(`/api/blade-cps/product-type/list`).then(res=> {
                    if(res.code == 200) {
                        this.productList= res.data;
                    }
                })
            },
            getBaseData() {
                this.$HTTP.get(`/api/blade-system/custom-template/list?businessType=${this.$route.query.type}`).then(res=> {
                    if(res.code == 200) {
                        this.planData = res.data.reverse();
                        this.id = this.planData[0].id;
                        this.planData[0].active = true;
                        this.getTableList();
                    }
                })
            },
            changePlanData(row,index) {
                this.id = row.id;
                this.planData.forEach(item=> {
                    item.active = false;
                })
                this.planData[index].active = true;
                this.getTableList();
            },
            getTableList() {
                this.$HTTP.get(`/api/blade-system/custom-template-field/listField?configType=1&templateId=${this.id}`).then(res=> {
                    if(res.code == 200) {
                        this.tableData0 = res.data.systemFieldList;
                    }
                })
            },
            table_edit(row) {
                this.dialog.save = true
                this.$nextTick(() => {
                    this.$refs.saveDialog.open(this.productList,this.planData,'edit').setData(row);
                })
            },
            del_tab(row) {
                this.$HTTP.delete(`/api/blade-system/custom-template/remove`,[row.id]).then(res=> {
                    if(res.code == 200) {
                        this.$message.success("操作成功");
                        this.getBaseData();
                    }
                })
            },
            openPlan() {
                this.dialog.save = true
                this.$nextTick(() => {
                    this.$refs.saveDialog.open(this.productList,this.planData)
                })
            },
            addPlanSuccess() {
                this.getBaseData();
            },
            table_del(row,index) {
 
            },
            handleClick(text) {
 
            }
        }
    }
</script>
 
<style scoped>
.aposcope-main {
    min-height: 100%;
    margin: 8px;
    padding:20px;
    background: #fff;
}
.header {
    margin-bottom: 8px;
    background-color: #fff;
    font-size: 14px;
    font-weight: 700;
    color: #333;
}
.title {
    color: #000;
    margin-bottom: 21px;
}
.type {
    padding-bottom: 15px;
    display: flex;
    width: 100%;
    overflow: auto;
}
.item {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #409eff;
    cursor: pointer;
    padding: 18px 12px;
    margin-right: 24px;
    border: 1px solid #ccc;
    width: 260px;
}
.activeTab {
    border: 1px solid #409eff;
}
.add-field {
    color: #409eff;
    font-weight: 400;
    font-size: 14px;
    cursor: pointer;
    padding-left: 8px;
    margin: 0;
}
.field-title {
    font-weight: 700;
    font-size: 14px;
    color: #000;
    margin: 14px 0;
}
.popvoer-title {
    cursor: pointer;
</style>