zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<template>
  <TableList
    :condtionConfig="condtionConfig"
    :columnConfig="columnConfig"
    :formItemsConfig="formItemsConfig"
    :defValuesConfig="defValuesConfig"
    :formRulesConfig="formRulesConfig"
    :condformdefConfig="condformdefConfig"
    :operateBtns="operateBtns"
    rowKeyName="serialNo"
    dialogTitle="管控额度"
    listApiName="quotaControlList"
    saveApiName="initControlsQuotaAdjustFlow"
  />
</template>
 
<script>
import { mapState, mapGetters, mapActions } from "vuex";
import TableList from "../components/TableList.vue";
import {
  QUOTACONTROLLISTCOND,
  QUOTACONTROLLISTCONDDEF
} from "./config/condtion.config";
import { QUOTACONTROLLISTCOLUMN } from "./config/column.config";
import { getAllCityAreaList, queryProductList } from "@/http/api";
export default {
  props: {},
  data() {
    return {
      condtionConfig: [...QUOTACONTROLLISTCOND],
      columnConfig: [...QUOTACONTROLLISTCOLUMN],
      formItemsConfig: [],
      defValuesConfig: {},
      formRulesConfig: {},
      condformdefConfig: { ...QUOTACONTROLLISTCONDDEF },
      optionsArr: ["YesNo", "IsDelete"],
      operateBtns: []
    };
  },
  computed: {
    // 获取state值
    ...mapState("rlc", {
      optionsMap: state => state.OPTIONSMAP
    }),
    // 通过getters获取值
    ...mapGetters("rlc", ["getOptionsMap"])
  },
  watch: {
    optionsMap: {
      handler(options) {
        const items = {
          controlStatus: "ControlStatus",
          quotaObjectType: "QuotaObjectType",
          quotaControlType: "QuotaControlType",
          productIdArray: "products",
          cityArray: "citys"
        };
        this.condtionConfig = [...QUOTACONTROLLISTCOND].map(form => {
          const newForm = { ...form };
          if (newForm.type === "select" || newForm.type === "multipleSelect") {
            newForm.options = options[items[newForm.name]];
          }
          return newForm;
        });
      },
      deep: true
    }
  },
  created() {
    const selectCodes = [
      "QuotaObjectType", //额度对象类型
      "QuotaControlType", //额度类型
      "ControlStatus", //额度状态
      "ApproveStatus", //修改审核状态
      "ApproveCode" //审批意见
    ];
    this.getOptionsData(selectCodes);
    this.getAllCityAreaList();
    this.getProductList();
    this.$forceUpdate();
  },
  mounted() {},
  methods: {
    ...mapActions("rlc", [
      // 将 `this.setOptionsMap()` 映射为 `this.$store.dispatch('setOptionsMap')`
      "getOptionsData",
      "getOhersOptions"
    ]),
    operateHandleClick() {
      this.$router.push({ name: "addImageDataConfig" });
    },
    async getAllCityAreaList() {
      const cityRes = await getAllCityAreaList({ queryFlag: "02" });
      if (cityRes && cityRes.code === "00") {
        this.getOhersOptions({
          citys: cityRes.result.map(({ itemname, itemno }) => {
            return { label: itemname, value: itemno };
          })
        });
      }
    },
    async getProductList() {
      const cityRes = await queryProductList({ queryProductList: "0" });
      if (cityRes && cityRes.code === "00") {
        this.getOhersOptions({
          products: cityRes.result.map(({ productName, productCode }) => {
            return { label: productName, value: productCode };
          })
        });
      }
    }
  },
  components: { TableList }
};
</script>
 
<style lang="less" scoped></style>