Ver código fonte

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

XMLWAN 3 anos atrás
pai
commit
ebd4857e06

+ 116 - 47
src/xt_pages/supply/components/addSupply.vue Ver arquivo

35
           </el-col>
35
           </el-col>
36
           <el-col span="6">
36
           <el-col span="6">
37
             <el-form-item label="增值税税率" prop="vatRate">
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
             </el-form-item>
42
             </el-form-item>
40
           </el-col>
43
           </el-col>
41
         </el-row>
44
         </el-row>
111
               <div style="visibility: hidden">/</div>
114
               <div style="visibility: hidden">/</div>
112
             </template>
115
             </template>
113
           </el-table-column>
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
           <el-table-column label="联系地址" align="center" width="130px">
125
           <el-table-column label="联系地址" align="center" width="130px">
116
             <template slot-scope="scope">
126
             <template slot-scope="scope">
130
               <el-form-item :prop="'contacts.' + scope.$index + '.name'">
140
               <el-form-item :prop="'contacts.' + scope.$index + '.name'">
131
                 <!-- :prop="'contacts.' + scope.$index + '.name'"  如需添加可在上方标签加入 -->
141
                 <!-- :prop="'contacts.' + scope.$index + '.name'"  如需添加可在上方标签加入 -->
132
                 <el-select
142
                 <el-select
133
-                  v-model="scope.row.isfirst"
143
+                  v-model="scope.row.is_first"
134
                   style="width: 90px"
144
                   style="width: 90px"
135
                   placeholder="请选择"
145
                   placeholder="请选择"
136
                   @change="changeName($event, scope)"
146
                   @change="changeName($event, scope)"
207
   delcontactone,
217
   delcontactone,
208
   savesupply,
218
   savesupply,
209
   updatesupply,
219
   updatesupply,
220
+  getexporthistory,
210
 } from "@/api/supply";
221
 } from "@/api/supply";
211
 import Template from "../../data/template.vue";
222
 import Template from "../../data/template.vue";
212
 export default {
223
 export default {
253
       },
264
       },
254
       tableData: [
265
       tableData: [
255
         {
266
         {
267
+          id: "",
256
           contacts: "",
268
           contacts: "",
257
           phone: "",
269
           phone: "",
258
           address: "",
270
           address: "",
264
       supplier: {
276
       supplier: {
265
         supplierName: "",
277
         supplierName: "",
266
         supplierCode: "gsy001",
278
         supplierCode: "gsy001",
267
-        supplierType: "",
268
-        vatRate: "",
279
+        supplierType: 0,
280
+        vatRate: 0,
269
         number: "",
281
         number: "",
270
         bank: "",
282
         bank: "",
271
         bankAccount: "",
283
         bankAccount: "",
287
         this.title = "新增供应商";
299
         this.title = "新增供应商";
288
         this.dialogVisible = true;
300
         this.dialogVisible = true;
289
       } else if (type == 2) {
301
       } else if (type == 2) {
302
+        // console.log(data,'oop')
290
         this.show_type = 2;
303
         this.show_type = 2;
291
         this.supplier_ids = data.ID;
304
         this.supplier_ids = data.ID;
292
         this.title = "编辑供应商";
305
         this.title = "编辑供应商";
301
         this.dialogVisible = true;
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
     closePop() {
343
     closePop() {
305
       this.dialogVisible = false;
344
       this.dialogVisible = false;
306
       this.supply_code = [];
345
       this.supply_code = [];
367
           if (valid) {
406
           if (valid) {
368
             this.$refs[formName].validate((valid) => {
407
             this.$refs[formName].validate((valid) => {
369
               if (valid) {
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
                 let params = {
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
                   contacts: [...this.recordInfo.contacts],
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
               } else {
442
               } else {
386
                 return false;
443
                 return false;
387
               }
444
               }
388
             });
445
             });
389
-
390
-            this.dialogVisible = false;
391
           } else {
446
           } else {
392
             return false;
447
             return false;
393
           }
448
           }
397
           if (valid) {
452
           if (valid) {
398
             this.$refs[formName].validate((valid) => {
453
             this.$refs[formName].validate((valid) => {
399
               if (valid) {
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
                 let params = {
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
                   contacts: [...this.recordInfo.contacts],
475
                   contacts: [...this.recordInfo.contacts],
412
                 };
476
                 };
413
-                console.log(this.recordInfo, "dhas");
414
-                console.log(typeof this.supplier_ids, "oo");
477
+
415
                 updatesupply(params).then((res) => {
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
               } else {
490
               } else {
419
                 return false;
491
                 return false;
420
               }
492
               }
421
             });
493
             });
422
-
423
-            this.dialogVisible = false;
424
           } else {
494
           } else {
425
             return false;
495
             return false;
426
           }
496
           }
429
       this.contactsinfo();
499
       this.contactsinfo();
430
     },
500
     },
431
 
501
 
432
-    // 首次打开新增页面判断是否有首要联系人
502
+    //  获取供应商与联系人  首次打开新增页面判断是否有首要联系人
433
     getcontacts(val) {
503
     getcontacts(val) {
434
       let data = {
504
       let data = {
435
-        value: 0,
505
+        value: 1,
436
         label: "是",
506
         label: "是",
437
       };
507
       };
438
       getsupplyandcontactone({ id: val }).then((res) => {
508
       getsupplyandcontactone({ id: val }).then((res) => {
440
           this.recordInfo.contacts = res.data.data.contact;
510
           this.recordInfo.contacts = res.data.data.contact;
441
           if (this.recordInfo.contacts.length == 0) {
511
           if (this.recordInfo.contacts.length == 0) {
442
             this.recordInfo.contacts = [{}];
512
             this.recordInfo.contacts = [{}];
443
-            this.recordInfo.contacts[0].isfirst = data;
513
+            this.recordInfo.contacts[0].is_first = data.value;
444
           } else if (this.recordInfo.contacts.length == 1) {
514
           } else if (this.recordInfo.contacts.length == 1) {
445
             let val = res.data.data.contact[0];
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
             this.recordInfo.contacts[0] = {
517
             this.recordInfo.contacts[0] = {
518
+              id: val.id,
448
               name: val.name,
519
               name: val.name,
449
               address: val.address,
520
               address: val.address,
450
               phone: val.phone,
521
               phone: val.phone,
451
-              isfirst: val.is_first,
452
             };
522
             };
523
+            this.$forceUpdate();
453
           } else {
524
           } else {
454
             this.recordInfo.contacts.forEach((o) => {
525
             this.recordInfo.contacts.forEach((o) => {
455
               if (o.isfirst == 0) {
526
               if (o.isfirst == 0) {
456
-                this.tabList.label = "否";
457
               } else if (o.isfirst == 1) {
527
               } else if (o.isfirst == 1) {
458
-                this.tabList.label = "是";
459
               }
528
               }
460
             });
529
             });
461
           }
530
           }
475
       };
544
       };
476
       let arr = [];
545
       let arr = [];
477
       if (this.recordInfo.contacts.length <= 1) {
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
       } else {
548
       } else {
480
         this.recordInfo.contacts.forEach((el, index) => {
549
         this.recordInfo.contacts.forEach((el, index) => {
481
-          console.log(scope.$index, index, "oo");
482
           if (scope.$index == index) {
550
           if (scope.$index == index) {
483
-            el.isfirst = data;
551
+            el.is_first = data;
484
           } else {
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
         if (arr.includes(1)) {
557
         if (arr.includes(1)) {
490
           return;
558
           return;
491
         } else {
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
           if (
603
           if (
536
             i.contacts != "" &&
604
             i.contacts != "" &&
537
             i.phone != "" &&
605
             i.phone != "" &&
606
+            i.id != "" &&
538
             i.address != "" &&
607
             i.address != "" &&
539
             i.FirstConcats != ""
608
             i.FirstConcats != ""
540
           ) {
609
           ) {
593
 /deep/ .el-form-item__error {
662
 /deep/ .el-form-item__error {
594
   // display: none !important;
663
   // display: none !important;
595
 }
664
 }
596
-</style>
665
+</style>

+ 97 - 10
src/xt_pages/supply/components/purchaseOrderPrint.vue Ver arquivo

106
               <div style="width: 100px">供应商签字:</div>
106
               <div style="width: 100px">供应商签字:</div>
107
               <div style="width: 100px"><span></span></div>
107
               <div style="width: 100px"><span></span></div>
108
             </div> -->
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
             </div>
198
             </div>
119
           </div>
199
           </div>
200
+     
120
         </div>
201
         </div>
121
       </div>
202
       </div>
122
     </div>
203
     </div>
177
     btnClickPrint: function () {
258
     btnClickPrint: function () {
178
       let LODOP = getLodop(); //调用getLodop获取LODOP对象
259
       let LODOP = getLodop(); //调用getLodop获取LODOP对象
179
       LODOP.PRINT_INIT("打印控件功能演示_Lodop功能_整页缩放打印输出");
260
       LODOP.PRINT_INIT("打印控件功能演示_Lodop功能_整页缩放打印输出");
180
-      
261
+
181
       LODOP.ADD_PRINT_BARCODE(15, 15, 300, 300, "QRCode", "xxxxxxxxxxxxx");
262
       LODOP.ADD_PRINT_BARCODE(15, 15, 300, 300, "QRCode", "xxxxxxxxxxxxx");
182
       LODOP.SET_PRINT_STYLEA(0, "Stretch", 1); //(可变形)扩展缩放模式
263
       LODOP.SET_PRINT_STYLEA(0, "Stretch", 1); //(可变形)扩展缩放模式
183
       LODOP.PREVIEW(); //预览(预览打印无脚标)
264
       LODOP.PREVIEW(); //预览(预览打印无脚标)
347
   flex-wrap: wrap;
428
   flex-wrap: wrap;
348
   .content {
429
   .content {
349
     width: 25%;
430
     width: 25%;
431
+    text-align: left;
432
+    margin-bottom: 1px;
433
+    font-size: 18px;
350
   }
434
   }
351
   .content_1 {
435
   .content_1 {
352
     width: 100%;
436
     width: 100%;
437
+    text-align: left;
438
+    margin-bottom: 1px;
439
+    font-size: 18px;
353
   }
440
   }
354
   // .content_2{
441
   // .content_2{
355
   //   width: 33%;
442
   //   width: 33%;

+ 15 - 3
src/xt_pages/supply/supplyQuery.vue Ver arquivo

28
             </el-option>
28
             </el-option>
29
           </el-select>
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
           <el-button
39
           <el-button
32
             size="small"
40
             size="small"
33
             class="filter-item"
41
             class="filter-item"
34
             type="primary"
42
             type="primary"
35
             icon="el-icon-search"
43
             icon="el-icon-search"
36
             @click="search"
44
             @click="search"
37
-            >搜索</el-button
45
+            >查询</el-button
38
           >
46
           >
39
         </div>
47
         </div>
40
         <div>
48
         <div>
41
           <el-button size="small" type="primary" @click="toAdd(1)"
49
           <el-button size="small" type="primary" @click="toAdd(1)"
42
             >新增</el-button
50
             >新增</el-button
43
           >
51
           >
44
-          <addSupply ref="addSupply"></addSupply>
52
+          <addSupply ref="addSupply" @init="initData"></addSupply>
45
         </div>
53
         </div>
46
       </div>
54
       </div>
47
 
55
 
201
         limit: this.limit,
209
         limit: this.limit,
202
         page: this.page,
210
         page: this.page,
203
         ctype: this.type_name,
211
         ctype: this.type_name,
212
+        keyword:this.keywords,
204
       };
213
       };
205
       getexporthistory(params).then((res) => {
214
       getexporthistory(params).then((res) => {
206
         if (res.data.state == 1) {
215
         if (res.data.state == 1) {
216
+          console.log(res.data.data.list, "res.data.data.list");
207
           this.tableList = res.data.data.list;
217
           this.tableList = res.data.data.list;
208
           this.total = res.data.data.total;
218
           this.total = res.data.data.total;
209
         }
219
         }
245
     },
255
     },
246
     startTimeChange() {},
256
     startTimeChange() {},
247
     endTimeChange() {},
257
     endTimeChange() {},
248
-    search() {},
258
+    search() {
259
+      this.initData();
260
+    },
249
     handleSizeChange(val) {
261
     handleSizeChange(val) {
250
       this.limit = val;
262
       this.limit = val;
251
       this.initData();
263
       this.initData();