Browse Source

Merge commit 'edcfa09c2e7cc1af3b4ff104bba2b44a5107f571' into gzb

gzb
guozhongbo 1 year ago
parent
commit
052cc9b318
5 changed files with 278 additions and 189 deletions
  1. 7
    0
      src/api/index.js
  2. 87
    146
      src/views/history/index.vue
  3. 8
    2
      src/views/layout.vue
  4. 139
    4
      src/views/log/index.vue
  5. 37
    37
      src/views/users/index.vue

+ 7
- 0
src/api/index.js View File

@@ -91,3 +91,10 @@ export const dh_remove = (data) =>
91 91
     method: "post",
92 92
     data
93 93
   });
94
+// 登录日志
95
+export const list_log = (data) =>
96
+  request({
97
+    url: window._config.baseUrl + "log/list_log",
98
+    method: "post",
99
+    data
100
+  });

+ 87
- 146
src/views/history/index.vue View File

@@ -6,6 +6,7 @@
6 6
           type="year"
7 7
           placeholder="请选择年份"
8 8
           v-model="historySearch.dhyear"
9
+          @on-change="searchList()"
9 10
           style="margin-right: 16px; width: 200px"
10 11
           :clearable="false"
11 12
         />
@@ -53,77 +54,87 @@
53 54
       ></Page>
54 55
     </div>
55 56
     <Modal
56
-      v-model="userAddForm.show"
57
+      v-model="historyAddForm.show"
57 58
       class="modal1"
58 59
       :mask-closable="false"
59
-      title="添加用户信息"
60
+      title="添加发展历程"
60 61
     >
61 62
       <Form
62 63
         :label-width="90"
63 64
         label-position="right"
64
-        ref="userAddForm"
65
+        ref="historyAddForm"
65 66
         :rules="addFormRules"
66
-        :model="userAddForm"
67
+        :model="historyAddForm"
67 68
       >
68
-        <FormItem label="用户姓名" prop="username">
69
-          <Input v-model="userAddForm.username" placeholder="请输入用户姓名" />
69
+        <FormItem label="语言" prop="date">
70
+          <RadioGroup v-model="historyAddForm.ltype">
71
+            <Radio :label="1">中文</Radio>
72
+            <Radio :label="2">英文</Radio>
73
+          </RadioGroup>
70 74
         </FormItem>
71
-        <FormItem label="登录账号" prop="loginname">
72
-          <Input v-model="userAddForm.loginname" placeholder="请输入登录账号" />
73
-        </FormItem>
74
-        <FormItem label="登录密码" prop="loginpwd">
75
-          <Input v-model="userAddForm.loginpwd" placeholder="请输入登录密码" />
75
+        <FormItem label="日期" prop="date">
76
+          <DatePicker
77
+            type="month"
78
+            placeholder="请选择日期"
79
+            v-model="historyAddForm.date"
80
+            style="margin-right: 16px; width: 200px"
81
+            :clearable="false"
82
+          />
76 83
         </FormItem>
77
-        <FormItem label="手机号" prop="userphone">
78
-          <Input v-model="userAddForm.userphone" placeholder="请输入手机号" />
84
+        <FormItem label="内容" prop="content">
85
+          <Input
86
+            v-model="historyAddForm.content"
87
+            type="textarea"
88
+            :rows="4"
89
+            placeholder="请输入内容"
90
+          />
79 91
         </FormItem>
80 92
       </Form>
81 93
       <div slot="footer" style="text-align: right">
82
-        <Button @click="userAddForm.show = false">取消</Button>
94
+        <Button @click="historyAddForm.show = false">取消</Button>
83 95
         <Button @click="toSaveAdd()" type="primary">保存</Button>
84 96
       </div>
85 97
     </Modal>
86 98
     <Modal
87
-      v-model="userModifyForm.show"
99
+      v-model="historyModifyForm.show"
88 100
       class="modal1"
89 101
       :mask-closable="false"
90
-      title="修改用户信息"
102
+      title="修改发展历程"
91 103
     >
92 104
       <Form
93 105
         :label-width="90"
94 106
         label-position="right"
95
-        ref="userModifyForm"
107
+        ref="historyModifyForm"
96 108
         :rules="modifyFormRules"
97
-        :model="userModifyForm"
109
+        :model="historyModifyForm"
98 110
       >
99
-        <FormItem label="用户姓名" prop="username">
100
-          <Input
101
-            v-model="userModifyForm.username"
102
-            placeholder="请输入用户姓名"
103
-          />
104
-        </FormItem>
105
-        <FormItem label="登录账号" prop="loginname">
106
-          <Input
107
-            v-model="userModifyForm.loginname"
108
-            placeholder="请输入登录账号"
109
-          />
111
+        <FormItem label="语言" prop="date">
112
+          <RadioGroup v-model="historyModifyForm.ltype">
113
+            <Radio :label="1">中文</Radio>
114
+            <Radio :label="2">英文</Radio>
115
+          </RadioGroup>
110 116
         </FormItem>
111
-        <FormItem label="登录密码" prop="loginpwd">
112
-          <Input
113
-            v-model="userModifyForm.loginpwd"
114
-            placeholder="请输入登录密码"
117
+        <FormItem label="日期" prop="date">
118
+          <DatePicker
119
+            type="month"
120
+            placeholder="请选择日期"
121
+            v-model="historyModifyForm.date"
122
+            style="margin-right: 16px; width: 200px"
123
+            :clearable="false"
115 124
           />
116 125
         </FormItem>
117
-        <FormItem label="手机号" prop="userphone">
126
+        <FormItem label="内容" prop="content">
118 127
           <Input
119
-            v-model="userModifyForm.userphone"
120
-            placeholder="请输入手机号"
128
+            v-model="historyModifyForm.content"
129
+            type="textarea"
130
+            :rows="4"
131
+            placeholder="请输入内容"
121 132
           />
122 133
         </FormItem>
123 134
       </Form>
124 135
       <div slot="footer" style="text-align: right">
125
-        <Button @click="userModifyForm.show = false">取消</Button>
126
-        <Button @click="toSaveModifyUser()" type="primary">保存</Button>
136
+        <Button @click="historyModifyForm.show = false">取消</Button>
137
+        <Button @click="toSaveModifyHistory()" type="primary">保存</Button>
127 138
       </div>
128 139
     </Modal>
129 140
   </div>
@@ -134,17 +145,6 @@ import { dh_list, dh_save, dh_update, dh_remove } from "@/api";
134 145
 import { dateFormat } from "@/utils";
135 146
 export default {
136 147
   data() {
137
-    // 手机号验证
138
-    const phoneCheck = async (rule, value, callback) => {
139
-      var filter = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
140
-      if (!value) {
141
-        return;
142
-      }
143
-      let blnTest = filter.test(value);
144
-      if (!blnTest) {
145
-        return callback(new Error("手机号码格式不正确"));
146
-      }
147
-    };
148 148
     return {
149 149
       dateFormat,
150 150
       historySearch: {
@@ -179,7 +179,7 @@ export default {
179 179
           width: 90
180 180
         },
181 181
         {
182
-          title: "状态",
182
+          title: "语言",
183 183
           slot: "ltypeSlot",
184 184
           width: 90
185 185
         },
@@ -203,91 +203,34 @@ export default {
203 203
           width: 150
204 204
         }
205 205
       ],
206
-      userAddForm: {
206
+      historyAddForm: {
207 207
         show: false,
208
-        username: "",
209
-        loginname: "",
210
-        loginpwd: "",
211
-        userphone: null
208
+        date: new Date(),
209
+        content: "",
210
+        ltype: 1
212 211
       },
213 212
       addFormRules: {
214
-        username: [
213
+        content: [
215 214
           {
216 215
             required: true,
217
-            message: "用户姓名不能为空",
216
+            message: "内容不能为空",
218 217
             trigger: "blur"
219 218
           }
220
-        ],
221
-        loginname: [
222
-          {
223
-            required: true,
224
-            message: "登录账号不能为空",
225
-            trigger: "blur"
226
-          },
227
-          {
228
-            min: 4,
229
-            max: 18,
230
-            message: "登录账号长度为4~18个字符",
231
-            trigger: "blur"
232
-          }
233
-        ],
234
-        loginpwd: [
235
-          {
236
-            required: true,
237
-            message: "登录密码不能为空",
238
-            trigger: "blur"
239
-          },
240
-          {
241
-            min: 6,
242
-            max: 16,
243
-            message: "登录密码长度为6~16个字符",
244
-            trigger: "blur"
245
-          }
246
-        ],
247
-        userphone: [{ validator: phoneCheck, trigger: "blur" }]
219
+        ]
248 220
       },
249
-      userModifyForm: {
221
+      historyModifyForm: {
250 222
         show: false,
251
-        dhid: null,
252
-        username: "",
253
-        loginname: "",
254
-        loginpwd: "",
255
-        userphone: null
223
+        date: null,
224
+        content: ""
256 225
       },
257 226
       modifyFormRules: {
258
-        username: [
227
+        content: [
259 228
           {
260 229
             required: true,
261
-            message: "用户姓名不能为空",
262
-            trigger: "blur"
263
-          }
264
-        ],
265
-        loginname: [
266
-          {
267
-            required: true,
268
-            message: "登录账号不能为空",
269
-            trigger: "blur"
270
-          },
271
-          {
272
-            min: 4,
273
-            max: 18,
274
-            message: "登录账号长度为4~18个字符"
275
-          }
276
-        ],
277
-        loginpwd: [
278
-          // {
279
-          //   required: true,
280
-          //   message: "登录密码不能为空",
281
-          //   trigger: "blur",
282
-          // },
283
-          {
284
-            min: 6,
285
-            max: 16,
286
-            message: "登录密码长度为6~16个字符",
230
+            message: "内容不能为空",
287 231
             trigger: "blur"
288 232
           }
289
-        ],
290
-        userphone: [{ validator: phoneCheck, trigger: "blur" }]
233
+        ]
291 234
       },
292 235
       userInfo: {}
293 236
     };
@@ -336,26 +279,25 @@ export default {
336 279
       });
337 280
     },
338 281
     toAdd() {
339
-      this.userAddForm = {
282
+      this.historyAddForm = {
340 283
         show: true,
341
-        username: "",
342
-        loginname: "",
343
-        loginpwd: "",
344
-        userphone: null
284
+        date: new Date(),
285
+        content: "",
286
+        ltype: 1
345 287
       };
346 288
     },
347 289
     toSaveAdd() {
348
-      this.$refs.userAddForm.validate((valid) => {
290
+      this.$refs.historyAddForm.validate((valid) => {
349 291
         if (valid) {
350 292
           dh_save({
351
-            username: this.userAddForm.username,
352
-            loginname: this.userAddForm.loginname,
353
-            loginpwd: this.userAddForm.loginpwd,
354
-            createid: this.userInfo.dhid,
355
-            userphone: this.userAddForm.userphone
293
+            dhyear: this.historyAddForm.date.getFullYear(),
294
+            dhmonth: this.historyAddForm.date.getMonth() + 1 + "月",
295
+            content: this.historyAddForm.content,
296
+            ltype: this.historyAddForm.ltype,
297
+            createid: this.userInfo.userid
356 298
           }).then((data) => {
357 299
             if (data.code === 0) {
358
-              this.userAddForm.show = false;
300
+              this.historyAddForm.show = false;
359 301
               this.$Message.success(data.msg);
360 302
               this.searchList();
361 303
             } else {
@@ -366,28 +308,27 @@ export default {
366 308
       });
367 309
     },
368 310
     toModifyHistory(user) {
369
-      this.userModifyForm = {
311
+      let _date = new Date();
312
+      _date.setFullYear(user.dhyear);
313
+      _date.setMonth(parseInt(user.dhmonth) - 1);
314
+      this.historyModifyForm = {
370 315
         show: true,
371 316
         dhid: user.dhid,
372
-        username: user.username,
373
-        loginname: user.loginname,
374
-        loginpwd: user.loginpwd,
375
-        userphone: user.userphone
317
+        content: user.content,
318
+        date: _date
376 319
       };
377 320
     },
378
-    toSaveModifyUser() {
379
-      this.$refs.userModifyForm.validate((valid) => {
321
+    toSaveModifyHistory() {
322
+      this.$refs.historyModifyForm.validate((valid) => {
380 323
         if (valid) {
381 324
           dh_update({
382
-            username: this.userModifyForm.username,
383
-            loginname: this.userModifyForm.loginname,
384
-            loginpwd: this.userModifyForm.loginpwd,
385
-            createid: this.userInfo.dhid,
386
-            userphone: this.userModifyForm.userphone,
387
-            dhid: this.userModifyForm.dhid
325
+            dhyear: this.historyModifyForm.date.getFullYear(),
326
+            dhmonth: this.historyModifyForm.date.getMonth() + 1 + "月",
327
+            content: this.historyModifyForm.content,
328
+            dhid: this.historyModifyForm.dhid
388 329
           }).then((data) => {
389 330
             if (data.code === 0) {
390
-              this.userModifyForm.show = false;
331
+              this.historyModifyForm.show = false;
391 332
               this.$Message.success(data.msg);
392 333
               this.searchList();
393 334
             } else {

+ 8
- 2
src/views/layout.vue View File

@@ -25,8 +25,10 @@
25 25
         >
26 26
       </div>
27 27
     </div>
28
-    <div class="layout_main">
29
-      <router-view></router-view>
28
+    <div class="layout_out">
29
+      <div class="layout_main">
30
+        <router-view></router-view>
31
+      </div>
30 32
     </div>
31 33
   </div>
32 34
 </template>
@@ -67,6 +69,10 @@ body {
67 69
 .header_html_root .header_html_item.router-link-active {
68 70
   border-bottom: 4px solid #2d8cf0;
69 71
 }
72
+.layout_out {
73
+  max-height: calc(100vh - 54px);
74
+  overflow: auto;
75
+}
70 76
 .layout_main {
71 77
   margin: 0 auto;
72 78
   width: 1200px;

+ 139
- 4
src/views/log/index.vue View File

@@ -1,14 +1,149 @@
1 1
 <template>
2
-  <div>user</div>
2
+  <div>
3
+    <div class="searchBox">
4
+      <div>
5
+        <RadioGroup v-model="logSearch.userstate" @on-change="searchList()">
6
+          <Radio :label="0">全部</Radio>
7
+          <Radio :label="1">正常</Radio>
8
+          <Radio :label="10">已删除</Radio>
9
+        </RadioGroup>
10
+        <Input
11
+          v-model="logSearch.username"
12
+          @on-enter="searchList()"
13
+          placeholder="请输入用户姓名"
14
+          style="margin: 0 16px; width: 200px"
15
+          clearable
16
+        />
17
+        <Button type="primary" @click="searchList()">搜索</Button>
18
+      </div>
19
+    </div>
20
+    <Table border :columns="logColumns" :data="logSearch.list">
21
+      <template slot-scope="{ row }" slot="loginstateSlot">
22
+        <span>{{ row.loginstate === 1 ? "成功" : "失败" }}</span>
23
+      </template>
24
+      <template slot-scope="{ row }" slot="logtimeSlot">
25
+        <span>{{ dateFormat(row.logtime) }}</span>
26
+      </template>
27
+    </Table>
28
+    <div class="foot_page" v-if="logSearch.total > 0">
29
+      <Page
30
+        :total="logSearch.total"
31
+        @on-change="changePage"
32
+        :current="logSearch.page"
33
+        show-total
34
+      ></Page>
35
+    </div>
36
+  </div>
3 37
 </template>
4 38
 
5 39
 <script>
40
+import { list_log } from "@/api";
41
+import { dateFormat } from "@/utils";
6 42
 export default {
7 43
   data() {
8
-    return {};
44
+    return {
45
+      dateFormat,
46
+      logSearch: {
47
+        loginname: "",
48
+        logtime: null,
49
+        endtime: null,
50
+        page: 1,
51
+        size: 10,
52
+        total: 0,
53
+        list: []
54
+      },
55
+      logColumns: [
56
+        {
57
+          title: "序号",
58
+          width: 70,
59
+          render: (h, params) => {
60
+            return h(
61
+              "span",
62
+              params.index + (this.logSearch.page - 1) * this.logSearch.size + 1
63
+            );
64
+          }
65
+        },
66
+        {
67
+          title: "用户姓名",
68
+          key: "username",
69
+          width: 100
70
+        },
71
+        {
72
+          title: "登录账号",
73
+          key: "loginname",
74
+          width: 140
75
+        },
76
+        {
77
+          title: "登录状态",
78
+          slot: "loginstateSlot",
79
+          width: 100
80
+        },
81
+        {
82
+          title: "登录地址",
83
+          key: "logaddress"
84
+        },
85
+        {
86
+          title: "登录IP",
87
+          key: "logip",
88
+          width: 140
89
+        },
90
+        {
91
+          title: "登录时间",
92
+          slot: "logtimeSlot",
93
+          width: 200
94
+        },
95
+        {
96
+          title: "备注",
97
+          key: "logtxt"
98
+        }
99
+      ],
100
+      userInfo: {}
101
+    };
9 102
   },
10
-  methods: {}
103
+  created() {
104
+    this.userInfo = JSON.parse(localStorage.getItem("xhWebAdminUser"));
105
+    this.getLogList();
106
+  },
107
+  methods: {
108
+    searchList() {
109
+      this.logSearch.page = 1;
110
+      this.getLogList();
111
+    },
112
+    getLogList() {
113
+      list_log({
114
+        page: this.logSearch.page,
115
+        size: this.logSearch.size,
116
+        userstate: this.logSearch.userstate,
117
+        username: this.logSearch.username
118
+      })
119
+        .then((data) => {
120
+          if (data.code === 0) {
121
+            this.logSearch.total = data.obj.total;
122
+            this.logSearch.list = data.obj.list;
123
+          } else {
124
+            this.logSearch.total = 0;
125
+            this.logSearch.list = [];
126
+            this.$Message.error(data.msg);
127
+          }
128
+        })
129
+        .catch(() => {});
130
+    },
131
+    changePage(page) {
132
+      this.logSearch.page = page;
133
+      this.getLogList();
134
+    }
135
+  }
11 136
 };
12 137
 </script>
13 138
 
14
-<style scoped lang="less"></style>
139
+<style scoped lang="less">
140
+.searchBox {
141
+  display: flex;
142
+  justify-content: space-between;
143
+  padding: 16px 0;
144
+}
145
+.foot_page {
146
+  padding: 16px 0;
147
+  text-align: right;
148
+}
149
+</style>

+ 37
- 37
src/views/users/index.vue View File

@@ -152,7 +152,7 @@ export default {
152 152
         userstate: 0,
153 153
         username: "",
154 154
         total: 0,
155
-        list: [],
155
+        list: []
156 156
       },
157 157
       userColumns: [
158 158
         {
@@ -165,83 +165,83 @@ export default {
165 165
                 (this.userSearch.page - 1) * this.userSearch.size +
166 166
                 1
167 167
             );
168
-          },
168
+          }
169 169
         },
170 170
         {
171 171
           title: "用户姓名",
172
-          key: "username",
172
+          key: "username"
173 173
         },
174 174
         {
175 175
           title: "登录账号",
176
-          key: "loginname",
176
+          key: "loginname"
177 177
         },
178 178
         {
179 179
           title: "手机号",
180
-          key: "userphone",
180
+          key: "userphone"
181 181
         },
182 182
         {
183 183
           title: "状态",
184 184
           slot: "userstateSlot",
185
-          width: 90,
185
+          width: 90
186 186
         },
187 187
         {
188 188
           title: "创建人",
189 189
           key: "createname",
190
-          width: 120,
190
+          width: 120
191 191
         },
192 192
         {
193 193
           title: "创建时间",
194 194
           slot: "createtimeSlot",
195
-          width: 200,
195
+          width: 200
196 196
         },
197 197
         {
198 198
           title: "操作",
199 199
           slot: "actionSlot",
200
-          width: 150,
201
-        },
200
+          width: 150
201
+        }
202 202
       ],
203 203
       userAddForm: {
204 204
         show: false,
205 205
         username: "",
206 206
         loginname: "",
207 207
         loginpwd: "",
208
-        userphone: null,
208
+        userphone: null
209 209
       },
210 210
       addFormRules: {
211 211
         username: [
212 212
           {
213 213
             required: true,
214 214
             message: "用户姓名不能为空",
215
-            trigger: "blur",
216
-          },
215
+            trigger: "blur"
216
+          }
217 217
         ],
218 218
         loginname: [
219 219
           {
220 220
             required: true,
221 221
             message: "登录账号不能为空",
222
-            trigger: "blur",
222
+            trigger: "blur"
223 223
           },
224 224
           {
225 225
             min: 4,
226 226
             max: 18,
227 227
             message: "登录账号长度为4~18个字符",
228
-            trigger: "blur",
229
-          },
228
+            trigger: "blur"
229
+          }
230 230
         ],
231 231
         loginpwd: [
232 232
           {
233 233
             required: true,
234 234
             message: "登录密码不能为空",
235
-            trigger: "blur",
235
+            trigger: "blur"
236 236
           },
237 237
           {
238 238
             min: 6,
239 239
             max: 16,
240 240
             message: "登录密码长度为6~16个字符",
241
-            trigger: "blur",
242
-          },
241
+            trigger: "blur"
242
+          }
243 243
         ],
244
-        userphone: [{ validator: phoneCheck, trigger: "blur" }],
244
+        userphone: [{ validator: phoneCheck, trigger: "blur" }]
245 245
       },
246 246
       userModifyForm: {
247 247
         show: false,
@@ -249,27 +249,27 @@ export default {
249 249
         username: "",
250 250
         loginname: "",
251 251
         loginpwd: "",
252
-        userphone: null,
252
+        userphone: null
253 253
       },
254 254
       modifyFormRules: {
255 255
         username: [
256 256
           {
257 257
             required: true,
258 258
             message: "用户姓名不能为空",
259
-            trigger: "blur",
260
-          },
259
+            trigger: "blur"
260
+          }
261 261
         ],
262 262
         loginname: [
263 263
           {
264 264
             required: true,
265 265
             message: "登录账号不能为空",
266
-            trigger: "blur",
266
+            trigger: "blur"
267 267
           },
268 268
           {
269 269
             min: 4,
270 270
             max: 18,
271
-            message: "登录账号长度为4~18个字符",
272
-          },
271
+            message: "登录账号长度为4~18个字符"
272
+          }
273 273
         ],
274 274
         loginpwd: [
275 275
           // {
@@ -281,12 +281,12 @@ export default {
281 281
             min: 6,
282 282
             max: 16,
283 283
             message: "登录密码长度为6~16个字符",
284
-            trigger: "blur",
285
-          },
284
+            trigger: "blur"
285
+          }
286 286
         ],
287
-        userphone: [{ validator: phoneCheck, trigger: "blur" }],
287
+        userphone: [{ validator: phoneCheck, trigger: "blur" }]
288 288
       },
289
-      userInfo: {},
289
+      userInfo: {}
290 290
     };
291 291
   },
292 292
   created() {
@@ -303,7 +303,7 @@ export default {
303 303
         page: this.userSearch.page,
304 304
         size: this.userSearch.size,
305 305
         userstate: this.userSearch.userstate,
306
-        username: this.userSearch.username,
306
+        username: this.userSearch.username
307 307
       })
308 308
         .then((data) => {
309 309
           if (data.code === 0) {
@@ -329,7 +329,7 @@ export default {
329 329
             }
330 330
           });
331 331
         },
332
-        onCancel: () => {},
332
+        onCancel: () => {}
333 333
       });
334 334
     },
335 335
     toAdd() {
@@ -338,7 +338,7 @@ export default {
338 338
         username: "",
339 339
         loginname: "",
340 340
         loginpwd: "",
341
-        userphone: null,
341
+        userphone: null
342 342
       };
343 343
     },
344 344
     toSaveAdd() {
@@ -349,7 +349,7 @@ export default {
349 349
             loginname: this.userAddForm.loginname,
350 350
             loginpwd: this.userAddForm.loginpwd,
351 351
             createid: this.userInfo.userid,
352
-            userphone: this.userAddForm.userphone,
352
+            userphone: this.userAddForm.userphone
353 353
           }).then((data) => {
354 354
             if (data.code === 0) {
355 355
               this.userAddForm.show = false;
@@ -369,7 +369,7 @@ export default {
369 369
         username: user.username,
370 370
         loginname: user.loginname,
371 371
         loginpwd: user.loginpwd,
372
-        userphone: user.userphone,
372
+        userphone: user.userphone
373 373
       };
374 374
     },
375 375
     toSaveModifyUser() {
@@ -397,8 +397,8 @@ export default {
397 397
     changePage(page) {
398 398
       this.userSearch.page = page;
399 399
       this.getUsersList();
400
-    },
401
-  },
400
+    }
401
+  }
402 402
 };
403 403
 </script>
404 404
 

Loading…
Cancel
Save