huangyw hace 3 años
padre
commit
fc491c4604

+ 32 - 16
src/xt_pages/supply/components/addSupply.vue Ver fichero

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>
311
         this.dialogVisible = true;
314
         this.dialogVisible = true;
312
       }
315
       }
313
     },
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
+
314
     closePop() {
343
     closePop() {
315
       this.dialogVisible = false;
344
       this.dialogVisible = false;
316
       this.supply_code = [];
345
       this.supply_code = [];
378
             this.$refs[formName].validate((valid) => {
407
             this.$refs[formName].validate((valid) => {
379
               if (valid) {
408
               if (valid) {
380
                 this.recordInfo.contacts.forEach((el) => {
409
                 this.recordInfo.contacts.forEach((el) => {
381
-                  console.log(el, "op");
382
                   if (!el.phone) {
410
                   if (!el.phone) {
383
                     el.phone = "";
411
                     el.phone = "";
384
                   }
412
                   }
399
                   bankaccount: this.supplier.bankAccount || "",
427
                   bankaccount: this.supplier.bankAccount || "",
400
                   contacts: [...this.recordInfo.contacts],
428
                   contacts: [...this.recordInfo.contacts],
401
                 };
429
                 };
402
-                console.log(
403
-                  this.recordInfo.contacts,
404
-                  "this.recordInfo.contacts"
405
-                );
406
                 savesupply(params).then((res) => {
430
                 savesupply(params).then((res) => {
407
-                  console.log(res, "op");
408
                   if (res.data.state == 1) {
431
                   if (res.data.state == 1) {
409
                     this.$message.success("修改成功");
432
                     this.$message.success("修改成功");
410
                     this.closePop();
433
                     this.closePop();
430
             this.$refs[formName].validate((valid) => {
453
             this.$refs[formName].validate((valid) => {
431
               if (valid) {
454
               if (valid) {
432
                 this.recordInfo.contacts.forEach((el) => {
455
                 this.recordInfo.contacts.forEach((el) => {
433
-                  console.log(el, "op");
434
                   if (!el.phone) {
456
                   if (!el.phone) {
435
                     el.phone = "";
457
                     el.phone = "";
436
                   }
458
                   }
444
                 let params = {
466
                 let params = {
445
                   suppliercode: this.supplier.supplierCode || "",
467
                   suppliercode: this.supplier.supplierCode || "",
446
                   suppliername: this.supplier.supplierName || "",
468
                   suppliername: this.supplier.supplierName || "",
447
-                  id: this.supplier_ids || "",
469
+                  id: parseInt(this.supplier_ids) || "",
448
                   suppliertype: this.supplier.supplierType || "",
470
                   suppliertype: this.supplier.supplierType || "",
449
                   vatrate: this.supplier.vatRate || 0,
471
                   vatrate: this.supplier.vatRate || 0,
450
                   number: this.supplier.number || "",
472
                   number: this.supplier.number || "",
452
                   bankaccount: this.supplier.bankAccount || "",
474
                   bankaccount: this.supplier.bankAccount || "",
453
                   contacts: [...this.recordInfo.contacts],
475
                   contacts: [...this.recordInfo.contacts],
454
                 };
476
                 };
455
-                console.log(
456
-                  this.recordInfo.contacts,
457
-                  "this.recordInfo.contacts"
458
-                );
459
-                console.log(params, "params");
477
+
460
                 updatesupply(params).then((res) => {
478
                 updatesupply(params).then((res) => {
461
-                  console.log(res, "op");
462
                   if (res.data.state == 1) {
479
                   if (res.data.state == 1) {
463
                     this.$message.success("修改成功");
480
                     this.$message.success("修改成功");
464
                     this.closePop();
481
                     this.closePop();
491
       getsupplyandcontactone({ id: val }).then((res) => {
508
       getsupplyandcontactone({ id: val }).then((res) => {
492
         if (res.data.code == 0) {
509
         if (res.data.code == 0) {
493
           this.recordInfo.contacts = res.data.data.contact;
510
           this.recordInfo.contacts = res.data.data.contact;
494
-          console.log(this.recordInfo.contacts, "supply");
495
           if (this.recordInfo.contacts.length == 0) {
511
           if (this.recordInfo.contacts.length == 0) {
496
             this.recordInfo.contacts = [{}];
512
             this.recordInfo.contacts = [{}];
497
             this.recordInfo.contacts[0].is_first = data.value;
513
             this.recordInfo.contacts[0].is_first = data.value;

+ 4 - 1
src/xt_pages/supply/supplyQuery.vue Ver fichero

209
         limit: this.limit,
209
         limit: this.limit,
210
         page: this.page,
210
         page: this.page,
211
         ctype: this.type_name,
211
         ctype: this.type_name,
212
+        keyword:this.keywords,
212
       };
213
       };
213
       getexporthistory(params).then((res) => {
214
       getexporthistory(params).then((res) => {
214
         if (res.data.state == 1) {
215
         if (res.data.state == 1) {
254
     },
255
     },
255
     startTimeChange() {},
256
     startTimeChange() {},
256
     endTimeChange() {},
257
     endTimeChange() {},
257
-    search() {},
258
+    search() {
259
+      this.initData();
260
+    },
258
     handleSizeChange(val) {
261
     handleSizeChange(val) {
259
       this.limit = val;
262
       this.limit = val;
260
       this.initData();
263
       this.initData();