ソースを参照

Merge remote-tracking branch 'origin/gzb' into wzl

gzb
wangzhonglu 1年前
コミット
4922532a19
3個のファイルの変更167行の追加26行の削除
  1. 8
    2
      src/views/school/index.vue
  2. 2
    0
      src/views/service/index.vue
  3. 157
    24
      src/views/trial/index.vue

+ 8
- 2
src/views/school/index.vue ファイルの表示

@@ -20,7 +20,12 @@
20 20
     <div>
21 21
       <Table border :data="school.list" :columns="columns">
22 22
         <template slot-scope="{ row }" slot="schoollogo">
23
-          <img class="img" v-if="row.schoollogo" :src="$api.showImageUrl +row.schoollogo" v-viewer />
23
+          <img
24
+            class="img"
25
+            v-if="row.schoollogo"
26
+            :src="$api.showImageUrl + row.schoollogo"
27
+            v-viewer
28
+          />
24 29
         </template>
25 30
       </Table>
26 31
       <div class="foot_page" v-if="school.total > 0">
@@ -243,6 +248,7 @@ export default {
243 248
                   class: "theme_color",
244 249
                   on: {
245 250
                     click: () => {
251
+                      this.$refs["reForm"].resetFields();
246 252
                       this.revise_data = {
247 253
                         show: true,
248 254
                         data: params.row
@@ -350,13 +356,13 @@ export default {
350 356
             return v;
351 357
           });
352 358
           this.school.total = res.obj.total;
353
-          console.log(res.obj)
354 359
         } else {
355 360
           this.$Message.error(res.msg);
356 361
         }
357 362
       });
358 363
     },
359 364
     add() {
365
+      this.$refs["AddForm"].resetFields();
360 366
       this.add_form.show = true;
361 367
       this.add_form.slorder = this.school.total + 1;
362 368
     },

+ 2
- 0
src/views/service/index.vue ファイルの表示

@@ -243,6 +243,7 @@ export default {
243 243
                   class: "theme_color",
244 244
                   on: {
245 245
                     click: () => {
246
+                      this.$refs["reForm"].resetFields();
246 247
                       this.revise_data = {
247 248
                         show: true,
248 249
                         data: params.row
@@ -356,6 +357,7 @@ export default {
356 357
       });
357 358
     },
358 359
     add() {
360
+      this.$refs["AddForm"].resetFields();
359 361
       this.add_form.show = true;
360 362
       this.add_form.scorder = this.service.total + 1;
361 363
     },

+ 157
- 24
src/views/trial/index.vue ファイルの表示

@@ -15,10 +15,19 @@
15 15
           v-model="form_search.account"
16 16
         />
17 17
       </div>
18
-      <Button @click="add" type="primary"> 添加 </Button>
18
+      <Button @click="add" type="primary">
19
+        {{ form_search.ltype == 1 ? "添加" : "修改" }}
20
+      </Button>
19 21
     </div>
20 22
     <div>
21
-      <Table border :data="userinfo.list" :columns="columns"> </Table>
23
+      <Table
24
+        v-if="form_search.ltype == 1"
25
+        border
26
+        :data="userinfo.list"
27
+        :columns="columns"
28
+      >
29
+      </Table>
30
+      <Table v-else border :data="userinfo.list" :columns="columns1"> </Table>
22 31
       <div class="foot_page" v-if="userinfo.total > 0">
23 32
         <Page
24 33
           :total="userinfo.total"
@@ -56,7 +65,7 @@
56 65
             placeholder="请输入电话"
57 66
           />
58 67
         </FormItem>
59
-        <FormItem label="邮箱">
68
+        <FormItem label="邮箱" prop="mailbox">
60 69
           <Input
61 70
             v-model="add_form.mailbox"
62 71
             maxlength="64"
@@ -77,6 +86,40 @@
77 86
         <Button @click="toSaveAdd()" type="primary">保存</Button>
78 87
       </div>
79 88
     </Modal>
89
+    <!--    修改-->
90
+    <Modal
91
+      v-model="revise_form.show"
92
+      class="modal1"
93
+      :mask-closable="false"
94
+      title="修改负责人"
95
+    >
96
+      <Form
97
+        :label-width="90"
98
+        label-position="right"
99
+        ref="reForm"
100
+        :rules="addFormRules"
101
+        :model="revise_form"
102
+      >
103
+        <FormItem label="联系人" prop="account">
104
+          <Input
105
+            v-model="revise_form.account"
106
+            maxlength="32"
107
+            placeholder="请输入联系人"
108
+          />
109
+        </FormItem>
110
+        <FormItem label="电话" prop="phone">
111
+          <Input
112
+            v-model="revise_form.phone"
113
+            maxlength="16"
114
+            placeholder="请输入电话"
115
+          />
116
+        </FormItem>
117
+      </Form>
118
+      <div slot="footer" style="text-align: right">
119
+        <Button @click="revise_form.show = false">取消</Button>
120
+        <Button @click="toSavere()" type="primary">保存</Button>
121
+      </div>
122
+    </Modal>
80 123
     <!-- 等待窗 -->
81 124
     <Spin fix v-if="showLoading" style="background-color: transparent">
82 125
       <Icon type="ios-loading" size="18" class="demo-spin-icon-load"></Icon>
@@ -87,14 +130,7 @@
87 130
 
88 131
 <script>
89 132
 import axios from "axios";
90
-import {
91
-  sl_list,
92
-  sl_save,
93
-  sl_update,
94
-  sl_del,
95
-  fc_list,
96
-  fc_add
97
-} from "@/api/index";
133
+import { fcu_add, fc_list, fc_add, fcu_get_user } from "@/api/index";
98 134
 import { dateFormat } from "@/utils/index";
99 135
 export default {
100 136
   data() {
@@ -102,13 +138,25 @@ export default {
102 138
     const phoneCheck = async (rule, value, callback) => {
103 139
       var filter = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
104 140
       if (!value) {
105
-        return;
141
+        return callback(new Error("手机号码不能为空"));
106 142
       }
107 143
       let blnTest = filter.test(value);
108 144
       if (!blnTest) {
109 145
         return callback(new Error("手机号码格式不正确"));
110 146
       }
111 147
     };
148
+    // 邮箱验证
149
+    const mailboxCheck = async (rule, value, callback) => {
150
+      var filter =
151
+        /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
152
+      if (!value) {
153
+        return;
154
+      }
155
+      let blnTest = filter.test(value);
156
+      if (!blnTest) {
157
+        return callback(new Error("邮箱格式不正确"));
158
+      }
159
+    };
112 160
     return {
113 161
       userInfo: {},
114 162
       showLoading: false,
@@ -167,13 +215,49 @@ export default {
167 215
           align: "center"
168 216
         }
169 217
       ], //列表表格
218
+      columns1: [
219
+        {
220
+          title: "序号",
221
+          align: "center",
222
+          key: "slorder",
223
+          width: 70,
224
+          render: (h, params) => {
225
+            return h(
226
+              "span",
227
+              params.index +
228
+                (this.form_search.page - 1) * this.form_search.size +
229
+                1
230
+            );
231
+          }
232
+        },
233
+        {
234
+          title: "联系人",
235
+          key: "account",
236
+          align: "center"
237
+        },
238
+        {
239
+          title: "联系电话",
240
+          key: "phone",
241
+          align: "center"
242
+        },
243
+        {
244
+          title: "提交时间",
245
+          key: "backtime",
246
+          align: "center"
247
+        }
248
+      ], //列表表格
170 249
       add_form: {
171
-        show: true,
250
+        show: false,
172 251
         account: "",
173 252
         phone: "",
174 253
         mailbox: "",
175 254
         comm: ""
176 255
       },
256
+      revise_form: {
257
+        show: false,
258
+        account: "",
259
+        phone: ""
260
+      },
177 261
       addFormRules: {
178 262
         account: [
179 263
           {
@@ -182,7 +266,8 @@ export default {
182 266
             trigger: "blur"
183 267
           }
184 268
         ],
185
-        phone: [{ validator: phoneCheck, trigger: "blur" }]
269
+        phone: [{ validator: phoneCheck, required: true, trigger: "blur" }],
270
+        mailbox: [{ validator: mailboxCheck, trigger: "blur" }]
186 271
       }
187 272
     };
188 273
   },
@@ -193,7 +278,26 @@ export default {
193 278
   methods: {
194 279
     seach() {
195 280
       this.form_search.page = 1;
196
-      this.init();
281
+      //ltype 1申请试用/2申请试用负责人
282
+      if (this.form_search.ltype == 1) {
283
+        this.init();
284
+      } else {
285
+        this.getuser();
286
+      }
287
+    },
288
+    getuser() {
289
+      fcu_get_user().then((res) => {
290
+        if (res.code == 0) {
291
+          this.userinfo.list = [res.obj];
292
+          this.userinfo.list[0].backtime = dateFormat(
293
+            this.userinfo.list[0].createtime
294
+          );
295
+          this.userinfo.list[0].account = this.userinfo.list[0].username;
296
+          this.userinfo.total = Object.keys(res.obj).length;
297
+        } else {
298
+          this.$Message.error(res.msg);
299
+        }
300
+      });
197 301
     },
198 302
     init() {
199 303
       fc_list(this.form_search).then((res) => {
@@ -203,21 +307,49 @@ export default {
203 307
             return v;
204 308
           });
205 309
           this.userinfo.total = res.obj.total;
206
-          console.log(res.obj);
207 310
         } else {
208 311
           this.$Message.error(res.msg);
209 312
         }
210 313
       });
211 314
     },
212 315
     add() {
213
-      this.add_form = {
214
-        show: true,
215
-        account: "",
216
-        phone: "",
217
-        mailbox: "",
218
-        comm: ""
219
-      };
220
-      console.log(this.add_form);
316
+      if (this.form_search.ltype == 1) {
317
+        this.$refs["AddForm"].resetFields();
318
+        this.add_form = {
319
+          show: true,
320
+          account: "",
321
+          phone: "",
322
+          mailbox: "",
323
+          comm: ""
324
+        };
325
+      } else {
326
+        this.$refs["reForm"].resetFields();
327
+        var data = JSON.parse(JSON.stringify(this.userinfo.list[0]));
328
+        this.revise_form = {
329
+          show: true,
330
+          account: data.account,
331
+          phone: data.phone
332
+        };
333
+      }
334
+    },
335
+    //修改负责人
336
+    toSavere() {
337
+      this.$refs["reForm"].validate((valid) => {
338
+        if (valid) {
339
+          fcu_add({
340
+            username: this.revise_form.account,
341
+            phone: this.revise_form.phone
342
+          }).then((res) => {
343
+            if (res.code == 0) {
344
+              this.revise_form.show = false;
345
+              this.$Message.success(res.msg);
346
+              this.getuser();
347
+            } else {
348
+              this.$Message.error(res.msg);
349
+            }
350
+          });
351
+        }
352
+      });
221 353
     },
222 354
     //确定添加
223 355
     toSaveAdd() {
@@ -231,6 +363,7 @@ export default {
231 363
           }).then((res) => {
232 364
             if (res.code == 0) {
233 365
               this.add_form.show = false;
366
+              this.$Message.success(res.msg);
234 367
               this.init();
235 368
             } else {
236 369
               this.$Message.error(res.msg);

読み込み中…
キャンセル
保存