Sfoglia il codice sorgente

Merge branch '20201109_pc_vue_new_branch' of http://git.shengws.com/csx/Vue_New into 20201109_pc_vue_new_branch

XMLWAN 3 anni fa
parent
commit
ebd4857e06

+ 116 - 47
src/xt_pages/supply/components/addSupply.vue Vedi File

@@ -35,7 +35,10 @@
35 35
           </el-col>
36 36
           <el-col span="6">
37 37
             <el-form-item label="增值税税率" prop="vatRate">
38
-              <el-input v-model="supplier.vatRate"></el-input>
38
+              <el-input
39
+                v-model="supplier.vatRate"
40
+                @keyup.native="supplier.vatRate = oninput(supplier.vatRate)"
41
+              ></el-input>
39 42
             </el-form-item>
40 43
           </el-col>
41 44
         </el-row>
@@ -111,6 +114,13 @@
111 114
               <div style="visibility: hidden">/</div>
112 115
             </template>
113 116
           </el-table-column>
117
+          <!-- id填写======================================================= -->
118
+          <el-table-column label="id" v-if="false">
119
+            <template slot-scope="scope">
120
+              <el-input v-model="scope.row.id" style="width: 80px"></el-input>
121
+              <div style="visibility: hidden">/</div>
122
+            </template>
123
+          </el-table-column>
114 124
           <!-- 联系地址填写 -->
115 125
           <el-table-column label="联系地址" align="center" width="130px">
116 126
             <template slot-scope="scope">
@@ -130,7 +140,7 @@
130 140
               <el-form-item :prop="'contacts.' + scope.$index + '.name'">
131 141
                 <!-- :prop="'contacts.' + scope.$index + '.name'"  如需添加可在上方标签加入 -->
132 142
                 <el-select
133
-                  v-model="scope.row.isfirst"
143
+                  v-model="scope.row.is_first"
134 144
                   style="width: 90px"
135 145
                   placeholder="请选择"
136 146
                   @change="changeName($event, scope)"
@@ -207,6 +217,7 @@ import {
207 217
   delcontactone,
208 218
   savesupply,
209 219
   updatesupply,
220
+  getexporthistory,
210 221
 } from "@/api/supply";
211 222
 import Template from "../../data/template.vue";
212 223
 export default {
@@ -253,6 +264,7 @@ export default {
253 264
       },
254 265
       tableData: [
255 266
         {
267
+          id: "",
256 268
           contacts: "",
257 269
           phone: "",
258 270
           address: "",
@@ -264,8 +276,8 @@ export default {
264 276
       supplier: {
265 277
         supplierName: "",
266 278
         supplierCode: "gsy001",
267
-        supplierType: "",
268
-        vatRate: "",
279
+        supplierType: 0,
280
+        vatRate: 0,
269 281
         number: "",
270 282
         bank: "",
271 283
         bankAccount: "",
@@ -287,6 +299,7 @@ export default {
287 299
         this.title = "新增供应商";
288 300
         this.dialogVisible = true;
289 301
       } else if (type == 2) {
302
+        // console.log(data,'oop')
290 303
         this.show_type = 2;
291 304
         this.supplier_ids = data.ID;
292 305
         this.title = "编辑供应商";
@@ -301,6 +314,32 @@ export default {
301 314
         this.dialogVisible = true;
302 315
       }
303 316
     },
317
+
318
+    oninput(num) {
319
+      var str = num;
320
+      var len1 = str.substr(0, 1);
321
+      var len2 = str.substr(1, 1);
322
+      //如果第一位是0,第二位不是点,就用数字把点替换掉
323
+      if (str.length > 1 && len1 == 0 && len2 != ".") {
324
+        str = str.substr(1, 1);
325
+      }
326
+      //第一位不能是.
327
+      if (len1 == ".") {
328
+        str = "";
329
+      }
330
+      //限制只能输入一个小数点
331
+      if (str.indexOf(".") != -1) {
332
+        var str_ = str.substr(str.indexOf(".") + 1);
333
+        if (str_.indexOf(".") != -1) {
334
+          str = str.substr(0, str.indexOf(".") + str_.indexOf(".") + 1);
335
+        }
336
+      }
337
+      //正则替换
338
+      str = str.replace(/[^\d^\.]+/g, ""); // 保留数字和小数点
339
+      str = str.replace(/\.\d\d\d\d$/, ""); // 小数点后只能输两位
340
+      return str;
341
+    },
342
+
304 343
     closePop() {
305 344
       this.dialogVisible = false;
306 345
       this.supply_code = [];
@@ -367,27 +406,43 @@ export default {
367 406
           if (valid) {
368 407
             this.$refs[formName].validate((valid) => {
369 408
               if (valid) {
409
+                this.recordInfo.contacts.forEach((el) => {
410
+                  if (!el.phone) {
411
+                    el.phone = "";
412
+                  }
413
+                  if (!el.address) {
414
+                    el.address = "";
415
+                  }
416
+                  if (!el.id) {
417
+                    el.id = 0;
418
+                  }
419
+                });
370 420
                 let params = {
371
-                  suppliercode: this.supplier.supplierCode,
372
-                  suppliername: this.supplier.supplierName,
373
-                  // ...this.recordInfo
374
-                  id: parseInt(this.supplier_ids),
375
-                  // id:JSON.parse(this.supplier_ids),
376
-                  suppliertype: "",
377
-                  vatrate: "",
378
-                  number: "",
379
-                  bank: "",
380
-                  bankaccount: "",
421
+                  suppliercode: this.supplier.supplierCode || "",
422
+                  suppliername: this.supplier.supplierName || "",
423
+                  suppliertype: this.supplier.supplierType || 0,
424
+                  vatrate: this.supplier.vatRate || 0,
425
+                  number: this.supplier.number || "",
426
+                  bank: this.supplier.bank || "",
427
+                  bankaccount: this.supplier.bankAccount || "",
381 428
                   contacts: [...this.recordInfo.contacts],
382 429
                 };
383
-                console.log(params, "dhas");
384
-                savesupply(params).then((res) => {});
430
+                savesupply(params).then((res) => {
431
+                  if (res.data.state == 1) {
432
+                    this.$message.success("修改成功");
433
+                    this.closePop();
434
+                    this.$emit("init");
435
+                  } else {
436
+                    this.$message.error("修改失败");
437
+                    setTimeout(() => {
438
+                      this.closePop();
439
+                    }, 2000);
440
+                  }
441
+                });
385 442
               } else {
386 443
                 return false;
387 444
               }
388 445
             });
389
-
390
-            this.dialogVisible = false;
391 446
           } else {
392 447
             return false;
393 448
           }
@@ -397,30 +452,45 @@ export default {
397 452
           if (valid) {
398 453
             this.$refs[formName].validate((valid) => {
399 454
               if (valid) {
455
+                this.recordInfo.contacts.forEach((el) => {
456
+                  if (!el.phone) {
457
+                    el.phone = "";
458
+                  }
459
+                  if (!el.address) {
460
+                    el.address = "";
461
+                  }
462
+                  if (!el.id) {
463
+                    el.id = 0;
464
+                  }
465
+                });
400 466
                 let params = {
401
-                  suppliercode: this.supplier.supplierCode,
402
-                  suppliername: this.supplier.supplierName,
403
-                  // ...this.recordInfo
404
-                  id: parseInt(this.supplier_ids),
405
-                  // id:JSON.parse(this.supplier_ids),
406
-                  suppliertype: "",
407
-                  vatrate: "",
408
-                  number: "",
409
-                  bank: "",
410
-                  bankaccount: "",
467
+                  suppliercode: this.supplier.supplierCode || "",
468
+                  suppliername: this.supplier.supplierName || "",
469
+                  id: this.supplier.id|| 0,
470
+                  suppliertype: this.supplier.supplierType || "",
471
+                  vatrate: this.supplier.vatRate || 0,
472
+                  number: this.supplier.number || "",
473
+                  bank: this.supplier.bank || "",
474
+                  bankaccount: this.supplier.bankAccount || "",
411 475
                   contacts: [...this.recordInfo.contacts],
412 476
                 };
413
-                console.log(this.recordInfo, "dhas");
414
-                console.log(typeof this.supplier_ids, "oo");
477
+
415 478
                 updatesupply(params).then((res) => {
416
-                  console.log(res, "oo");
479
+                  if (res.data.state == 1) {
480
+                    this.$message.success("修改成功");
481
+                    this.closePop();
482
+                    this.$emit("init");
483
+                  } else {
484
+                    this.$message.error("修改失败");
485
+                    setTimeout(() => {
486
+                      this.closePop();
487
+                    }, 2000);
488
+                  }
417 489
                 });
418 490
               } else {
419 491
                 return false;
420 492
               }
421 493
             });
422
-
423
-            this.dialogVisible = false;
424 494
           } else {
425 495
             return false;
426 496
           }
@@ -429,10 +499,10 @@ export default {
429 499
       this.contactsinfo();
430 500
     },
431 501
 
432
-    // 首次打开新增页面判断是否有首要联系人
502
+    //  获取供应商与联系人  首次打开新增页面判断是否有首要联系人
433 503
     getcontacts(val) {
434 504
       let data = {
435
-        value: 0,
505
+        value: 1,
436 506
         label: "是",
437 507
       };
438 508
       getsupplyandcontactone({ id: val }).then((res) => {
@@ -440,22 +510,21 @@ export default {
440 510
           this.recordInfo.contacts = res.data.data.contact;
441 511
           if (this.recordInfo.contacts.length == 0) {
442 512
             this.recordInfo.contacts = [{}];
443
-            this.recordInfo.contacts[0].isfirst = data;
513
+            this.recordInfo.contacts[0].is_first = data.value;
444 514
           } else if (this.recordInfo.contacts.length == 1) {
445 515
             let val = res.data.data.contact[0];
446
-            this.recordInfo.contacts[0].isfirst = data;
516
+            this.recordInfo.contacts[0].is_first = data.value;
447 517
             this.recordInfo.contacts[0] = {
518
+              id: val.id,
448 519
               name: val.name,
449 520
               address: val.address,
450 521
               phone: val.phone,
451
-              isfirst: val.is_first,
452 522
             };
523
+            this.$forceUpdate();
453 524
           } else {
454 525
             this.recordInfo.contacts.forEach((o) => {
455 526
               if (o.isfirst == 0) {
456
-                this.tabList.label = "否";
457 527
               } else if (o.isfirst == 1) {
458
-                this.tabList.label = "是";
459 528
               }
460 529
             });
461 530
           }
@@ -475,21 +544,20 @@ export default {
475 544
       };
476 545
       let arr = [];
477 546
       if (this.recordInfo.contacts.length <= 1) {
478
-        this.recordInfo.contacts[0].isfirst = data2.value;
547
+        this.recordInfo.contacts[0].is_first = data2.value;
479 548
       } else {
480 549
         this.recordInfo.contacts.forEach((el, index) => {
481
-          console.log(scope.$index, index, "oo");
482 550
           if (scope.$index == index) {
483
-            el.isfirst = data;
551
+            el.is_first = data;
484 552
           } else {
485
-            el.isfirst = data1.value;
553
+            el.is_first = data1.value;
486 554
           }
487
-          arr.push(el.isfirst);
555
+          arr.push(el.is_first);
488 556
         });
489 557
         if (arr.includes(1)) {
490 558
           return;
491 559
         } else {
492
-          this.recordInfo.contacts[0].isfirst = data2.value;
560
+          this.recordInfo.contacts[0].is_first = data2.value;
493 561
         }
494 562
       }
495 563
     },
@@ -535,6 +603,7 @@ export default {
535 603
           if (
536 604
             i.contacts != "" &&
537 605
             i.phone != "" &&
606
+            i.id != "" &&
538 607
             i.address != "" &&
539 608
             i.FirstConcats != ""
540 609
           ) {
@@ -593,4 +662,4 @@ export default {
593 662
 /deep/ .el-form-item__error {
594 663
   // display: none !important;
595 664
 }
596
-</style>
665
+</style>

+ 97 - 10
src/xt_pages/supply/components/purchaseOrderPrint.vue Vedi File

@@ -106,17 +106,98 @@
106 106
               <div style="width: 100px">供应商签字:</div>
107 107
               <div style="width: 100px"><span></span></div>
108 108
             </div> -->
109
-            <div class="description">
110
-              <div class="content">折扣额:</div>
111
-              <div class="content">折扣金额:</div>
112
-              <div class="content">本次付款:</div>
113
-              <div class="content">本次欠款:</div>
114
-              <div class="content_1">备注:</div>
115
-              <div class="content">制单人:</div>
116
-              <div class="content">收货人签字:</div>
117
-              <div class="content">供应商签字:</div>
109
+          </div>
110
+          <div
111
+            style="
112
+              width: 100%;
113
+              display: flex;
114
+              flex: 1;
115
+              justify-content: flex-start;
116
+              flex-wrap: wrap;
117
+            "
118
+          >
119
+            <div
120
+              style="
121
+                width: 25%;
122
+                text-align: left;
123
+                margin-bottom: 1px;
124
+                font-size: 18px;
125
+              "
126
+            >
127
+              供应商:
128
+            </div>
129
+            <div
130
+              style="
131
+                width: 25%;
132
+                text-align: left;
133
+                margin-bottom: 1px;
134
+                font-size: 18px;
135
+              "
136
+            >
137
+              折扣金额:
138
+            </div>
139
+            <div
140
+              style="
141
+                width: 25%;
142
+                text-align: left;
143
+                margin-bottom: 1px;
144
+                font-size: 18px;
145
+              "
146
+            >
147
+              本次付款:
148
+            </div>
149
+            <div
150
+              style="
151
+                width: 25%;
152
+                text-align: left;
153
+                margin-bottom: 1px;
154
+                font-size: 18px;
155
+              "
156
+            >
157
+              本次欠款:
158
+            </div>
159
+            <div
160
+              style="
161
+                width: 100%;
162
+                text-align: left;
163
+                margin-bottom: 1px;
164
+                font-size: 18px;
165
+              "
166
+            >
167
+              备注:
168
+            </div>
169
+            <div
170
+              style="
171
+                width: 25%;
172
+                text-align: left;
173
+                margin-bottom: 1px;
174
+                font-size: 18px;
175
+              "
176
+            >
177
+              制单人:
178
+            </div>
179
+            <div
180
+              style="
181
+                width: 25%;
182
+                text-align: left;
183
+                margin-bottom: 1px;
184
+                font-size: 18px;
185
+              "
186
+            >
187
+              收货人签字:
188
+            </div>
189
+            <div
190
+              style="
191
+                width: 25%;
192
+                text-align: left;
193
+                margin-bottom: 1px;
194
+                font-size: 18px;
195
+              "
196
+            >
197
+              供应商签字:
118 198
             </div>
119 199
           </div>
200
+     
120 201
         </div>
121 202
       </div>
122 203
     </div>
@@ -177,7 +258,7 @@ export default {
177 258
     btnClickPrint: function () {
178 259
       let LODOP = getLodop(); //调用getLodop获取LODOP对象
179 260
       LODOP.PRINT_INIT("打印控件功能演示_Lodop功能_整页缩放打印输出");
180
-      
261
+
181 262
       LODOP.ADD_PRINT_BARCODE(15, 15, 300, 300, "QRCode", "xxxxxxxxxxxxx");
182 263
       LODOP.SET_PRINT_STYLEA(0, "Stretch", 1); //(可变形)扩展缩放模式
183 264
       LODOP.PREVIEW(); //预览(预览打印无脚标)
@@ -347,9 +428,15 @@ export default {
347 428
   flex-wrap: wrap;
348 429
   .content {
349 430
     width: 25%;
431
+    text-align: left;
432
+    margin-bottom: 1px;
433
+    font-size: 18px;
350 434
   }
351 435
   .content_1 {
352 436
     width: 100%;
437
+    text-align: left;
438
+    margin-bottom: 1px;
439
+    font-size: 18px;
353 440
   }
354 441
   // .content_2{
355 442
   //   width: 33%;

+ 15 - 3
src/xt_pages/supply/supplyQuery.vue Vedi File

@@ -28,20 +28,28 @@
28 28
             </el-option>
29 29
           </el-select>
30 30
 
31
+          <el-input
32
+            size="small"
33
+            style="width: 200px; margin-left: 10px"
34
+            class="filter-item"
35
+            v-model.trim="keywords"
36
+            placeholder="按供应商编号,供应商名称,联系人搜索"
37
+          />
38
+
31 39
           <el-button
32 40
             size="small"
33 41
             class="filter-item"
34 42
             type="primary"
35 43
             icon="el-icon-search"
36 44
             @click="search"
37
-            >搜索</el-button
45
+            >查询</el-button
38 46
           >
39 47
         </div>
40 48
         <div>
41 49
           <el-button size="small" type="primary" @click="toAdd(1)"
42 50
             >新增</el-button
43 51
           >
44
-          <addSupply ref="addSupply"></addSupply>
52
+          <addSupply ref="addSupply" @init="initData"></addSupply>
45 53
         </div>
46 54
       </div>
47 55
 
@@ -201,9 +209,11 @@ export default {
201 209
         limit: this.limit,
202 210
         page: this.page,
203 211
         ctype: this.type_name,
212
+        keyword:this.keywords,
204 213
       };
205 214
       getexporthistory(params).then((res) => {
206 215
         if (res.data.state == 1) {
216
+          console.log(res.data.data.list, "res.data.data.list");
207 217
           this.tableList = res.data.data.list;
208 218
           this.total = res.data.data.total;
209 219
         }
@@ -245,7 +255,9 @@ export default {
245 255
     },
246 256
     startTimeChange() {},
247 257
     endTimeChange() {},
248
-    search() {},
258
+    search() {
259
+      this.initData();
260
+    },
249 261
     handleSizeChange(val) {
250 262
       this.limit = val;
251 263
       this.initData();