1
lzhe
2024-05-29 6f92c97e2b488542559046cc603153afa38cfb9e
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
<!--
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-05-29 17:32:55
 * @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:index == 0?true:false}" v-for="(item,index) in planData">{{item.templateName}}<span>...</span></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 {
                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.getTableList();
                    }
                })
            },
            getTableList() {
                this.$HTTP.get(`/api/blade-system/custom-template-field/listField?configType=1&templateId=${this.planData[0].id}`).then(res=> {
                    if(res.code == 200) {
                        this.tableData0 = res.data.systemFieldList;
                    }
                })
            },
            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;
}
</style>