houzhongjian
2024-07-23 8501060c4f921d1e744c477e4dc08eb47b52693c
提交 | 用户 | 时间
850106 1 <template>
H 2   <el-dialog
3       title="token详情"
4       :close-on-click-modal="false"
5       :visible.sync="visible"
6       append-to-body
7   >
8     <el-form
9         :model="dataForm"
10         ref="dataForm"
11         @keyup.enter.native="dataFormSubmit()"
12         label-width="120px"
13     >
14       <el-row :gutter="20">
15         <el-col :span="24">
16           <el-form-item label="URL" prop="loginUrl">
17             <el-input v-model="dataForm.loginUrl" placeholder="URL" readonly></el-input>
18           </el-form-item>
19         </el-col>
20       </el-row>
21       <el-row :gutter="20">
22         <el-col :span="12">
23           <el-form-item label="ClientId" prop="clientId">
24             <el-input v-model="dataForm.clientId" placeholder="ClientId" readonly></el-input>
25           </el-form-item>
26         </el-col>
27         <el-col :span="12">
28           <el-form-item label="ClientSecret" prop="clientSecret">
29             <el-input v-model="dataForm.clientSecret" placeholder="ClientSecret" readonly></el-input>
30           </el-form-item>
31         </el-col>
32       </el-row>
33       <el-row :gutter="20">
34         <el-col :span="12">
35           <el-form-item label="用户名" prop="username">
36             <el-input v-model="dataForm.username" placeholder="用户名" readonly></el-input>
37           </el-form-item>
38         </el-col>
39         <el-col :span="12">
40           <el-form-item label="密码" prop="password">
41             <el-input v-model="dataForm.password" placeholder="密码" readonly></el-input>
42           </el-form-item>
43         </el-col>
44       </el-row>
45       <el-row :gutter="20">
46         <el-col :span="12">
47           <el-form-item label="更新时间" prop="updateTime">
48             <el-input v-model="dataForm.updateTime" placeholder="更新时间" readonly></el-input>
49           </el-form-item>
50         </el-col>
51         <el-col :span="12">
52           <el-form-item label="过期时间" prop="expireTime">
53             <el-input v-model="dataForm.expireTime" placeholder="过期时间" readonly></el-input>
54           </el-form-item>
55         </el-col>
56       </el-row>
57       <el-row :gutter="20">
58         <el-col :span="24">
59           <el-form-item label="token" prop="token">
60             <el-input
61                 v-model="dataForm.token"
62                 placeholder="token"
63                 type="textarea"
64                 readonly
65                 :autosize="{ minRows: 6, maxRows: 8}"
66             ></el-input>
67           </el-form-item>
68         </el-col>
69       </el-row>
70     </el-form>
71   </el-dialog>
72 </template>
73
74 <script>
75   import DictSelectTag from "@/components/dict/dict-select-tag";
76
77   export default {
78     components: {
79       DictSelectTag,
80     },
81     data() {
82       return {
83         loading: false,
84         visible: false,
85         dataForm: {
86           id: '',
87           apiId: '',
88           loginUrl: '',
89           clientId: '',
90           clientSecret: '',
91           username: '',
92           password: '',
93           token: '',
94           expireTime: '',
95           updateTime: '',
96         },
97       };
98     },
99     methods: {
100       init(apiId) {
101         this.dataForm.apiId = apiId || 0;
102         this.visible = true;
103         this.$nextTick(() => {
104           this.$refs["dataForm"].resetFields();
105           if (this.dataForm.apiId) {
106             this.getInfo()
107           }
108         });
109       },
110       // 获取信息
111       getInfo() {
112         this.$http.get(`/data/http/token/api-id/${this.dataForm.apiId}`).then(({data: res}) => {
113           if (res.code !== 0) {
114             return this.$message.error(res.msg)
115           }
116           this.dataForm = {
117             ...this.dataForm,
118             ...res.data
119           }
120         }).catch(() => {
121         })
122       },
123     },
124   };
125 </script>
126 <style>
127   .el-select {
128     width: 100%;
129   }
130
131   .el-input-group__append {
132     padding: 0 5px 0 5px;
133   }
134
135   .el-input-group__prepend {
136     padding: 0 5px 0 5px;
137   }
138 </style>