222
schangxiang@126.com
2025-06-13 6a8393408d8cefcea02b7a598967de8dc1e565c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<template>
  <div ref="container" class="page-list-container">
    <!--数据Table-->
    <yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes" :load-data-before="loadDataBefore">
      <div slot="datalist-customer-area">
        总单量:{{ sumQuantity }},剩余单量:{{ surplusQuantity }}
      </div>
    </yrt-data-list>
 
    <!--数据编辑器Editor-->
    <yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes" @on-change="onChange"></yrt-editor>
  </div>
</template>
 
<script>
import baseLayout from "@/components/common/base-layout.vue";
 
export default {
  name: "api-internal-spare-code",
  components: {},
  mixins: [baseLayout],
  data() {
    return {
      sumQuantity: 0,
      surplusQuantity: "0"
    };
  },
  methods: {
    onChange(ref, val, field, formData) {
      if (field.options.prop === "expressCorpType") {
        this.$set(formData, "expressCorpName", null);
        this.$set(formData, "expressCorpCode", null);
        this.$set(formData, "expressCorp_Id", null);
 
        var url = "/api/basicInfo/base/expressCorp/getList";
        var params = {
          expressCorpType: formData.expressCorpType
        };
        var callBack = res => {
          this.common.showMsg(res);
          if (res.result) {
            var data = res.data.map(item => {
              item.label = item.expressCorpName;
              item.value = item.expressCorp_Id;
              return item;
            });
            this.editor.setDropdownData(568, data);
          }
        };
        this.common.ajax(url, params, callBack);
      }
    },
    // 加载前事件,获取统计数据
    loadDataBefore(params) {
      const where = params.where;
      var url = "/api/express/spareCode/getStatInfo";
      params = {
        idField: "expressSpareCode_Id",
        where: where
      };
      var callBack = res => {
        this.common.showMsg(res);
        if (res.result) {
          this.sumQuantity = res.data.sumQuantity;
          this.surplusQuantity = res.data.surplusQuantity;
        }
      };
      this.common.ajax(url, params, callBack);
    }
  }
};
</script>