{"remainingRequest":"/Users/admin/projects/dms/src/dealer_admin/node_modules/babel-loader/lib/index.js!/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/admin/projects/dms/src/dealer_admin/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/admin/projects/dms/src/dealer_admin/src/views/data_strategy/index.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/views/data_strategy/index.vue","mtime":1713161556000},{"path":"/Users/admin/projects/dms/src/dealer_admin/babel.config.js","mtime":1713161556000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["\"use strict\";\n\nvar _interopRequireWildcard3 = require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime/helpers/interopRequireWildcard.js\");\nvar _interopRequireDefault = require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = void 0;\nvar _objectSpread2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/objectSpread2.js\"));\nvar _interopRequireWildcard2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/interopRequireWildcard.js\"));\nvar _defineProperty2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _regeneratorRuntime2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/regeneratorRuntime.js\"));\nrequire(\"regenerator-runtime/runtime\");\nvar _asyncToGenerator2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar echarts = _interopRequireWildcard3(require(\"echarts\"));\nvar OrderAPI = _interopRequireWildcard3(require(\"@/api/order.js\"));\nvar SalesAPI = _interopRequireWildcard3(require(\"@/api/sales_amis.js\"));\nvar SalesOpportunityAPI = _interopRequireWildcard3(require(\"@/api/sales_opportunity.js\"));\nvar _DashBoardFilterModal = _interopRequireDefault(require(\"../dashboard/admin/components/DashBoardFilterModal.vue\"));\nvar _lodash = _interopRequireDefault(require(\"lodash\"));\nvar _index = require(\"@/filters/index.js\");\nvar _g2plot = require(\"@antv/g2plot\");\nvar _index2 = require(\"@/utils/index.js\");\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nvar _default = exports.default = {\n  name: \"DashboardAdmin\",\n  components: {\n    DashBoardFilterModal: _DashBoardFilterModal.default\n  },\n  data: function data() {\n    return {\n      statisticData: {\n        invoiceMonthMoney: 0,\n        invoiceYearMoney: 0,\n        orderBookMoney: 0,\n        salesOpportunityMoney: 0,\n        nowMonthAmisMoney: 0,\n        nowYearAmisMoney: 0,\n        monthPercent: 0.00,\n        yearPercent: 0.00\n      },\n      orderChart: null,\n      orderDateList: [],\n      orderList: [],\n      orderQueryParams: {\n        startDate: '',\n        endDate: ''\n      },\n      salesChart: null,\n      salesDateList: [],\n      salesList: [],\n      salesQueryParams: {\n        startDate: '',\n        endDate: ''\n      },\n      dealer_str: '全部',\n      filterQuery: {\n        dealerId: ''\n      },\n      winValue: 100,\n      salesMapPlot: null,\n      salesMapData: [],\n      salesTotalMoney: 0,\n      salesShowType: 1,\n      //销售额显示情况 1:图表模式 2:表格模式\n      exportSalesLoading: false //是否正在导出\n    };\n  },\n  methods: (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({\n    init: function init() {\n      this.getDataStatistic();\n      //this.getOrderStatisticList();\n      this.getSalesStatisticList();\n      this.getTotalPieStatistic();\n    },\n    selectOrderList: function selectOrderList() {\n      var orderDateList = this.orderDateList;\n      if (!orderDateList || orderDateList.length <= 1) {\n        return;\n      }\n      var startDate = orderDateList[0];\n      var endDate = orderDateList[1];\n      if (startDate == '' || endDate == '') {\n        return;\n      }\n      this.orderQueryParams.startDate = startDate;\n      this.orderQueryParams.endDate = endDate;\n      this.getOrderStatisticList();\n    },\n    selectSalesList: function selectSalesList() {\n      var salesDateList = this.salesDateList;\n      if (!salesDateList || salesDateList.length <= 1) {\n        return;\n      }\n      var startDate = salesDateList[0];\n      var endDate = salesDateList[1];\n      if (startDate == '' || endDate == '') {\n        return;\n      }\n      this.salesQueryParams.startDate = startDate;\n      this.salesQueryParams.endDate = endDate;\n      this.getSalesStatisticList();\n    },\n    getDataStatistic: function () {\n      var _getDataStatistic = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {\n        var query, res;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {\n          while (1) switch (_context.prev = _context.next) {\n            case 0:\n              query = {};\n              query = Object.assign(query, this.filterQuery);\n              _context.next = 4;\n              return OrderAPI.getDataStatistic(query);\n            case 4:\n              res = _context.sent;\n              this.statisticData = res.result;\n            case 6:\n            case \"end\":\n              return _context.stop();\n          }\n        }, _callee, this);\n      }));\n      function getDataStatistic() {\n        return _getDataStatistic.apply(this, arguments);\n      }\n      return getDataStatistic;\n    }(),\n    getSalesStatisticList: function () {\n      var _getSalesStatisticList = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {\n        var query, res;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {\n          while (1) switch (_context2.prev = _context2.next) {\n            case 0:\n              query = _lodash.default.cloneDeep(this.salesQueryParams);\n              query = Object.assign(query, this.filterQuery);\n              _context2.next = 4;\n              return SalesAPI.getSalesAmisStatisticList(query);\n            case 4:\n              res = _context2.sent;\n              this.salesList = res.result.list;\n              this.initSalesChart();\n            case 7:\n            case \"end\":\n              return _context2.stop();\n          }\n        }, _callee2, this);\n      }));\n      function getSalesStatisticList() {\n        return _getSalesStatisticList.apply(this, arguments);\n      }\n      return getSalesStatisticList;\n    }(),\n    initSalesChart: function initSalesChart() {\n      var _this = this;\n      var list = this.salesList;\n      var xList = []; //日期\n      var yList = []; //预测销售额\n      var zList = []; //目标销售额\n      var kList = []; //实际销售额\n      list.map(function (v) {\n        xList.push(v.date);\n        v.predict = Math.floor((0, _index2.numAdd)((0, _index2.numAdd)(v.actual, v.orderAmount), (0, _index2.numDiv)((0, _index2.numMul)(v.amis, _this.winValue), 100)));\n        yList.push(v.predict);\n        zList.push(v.amis);\n        kList.push(v.actual);\n      });\n      if (!this.salesChart) {\n        this.salesChart = echarts.init(document.getElementById('salesChatMain'));\n      }\n      this.salesChart.setOption((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({\n        tooltip: {\n          formatter: function formatter(params) {\n            return params.data + \"元\";\n          }\n        },\n        grid: {\n          left: '1%',\n          right: '1%',\n          bottom: '4%',\n          containLabel: true\n        },\n        legend: {\n          data: ['实际销售额', '目标销售额', '预测销售额']\n        }\n      }, \"tooltip\", {}), \"xAxis\", {\n        type: 'category',\n        data: xList\n      }), \"yAxis\", {\n        type: 'value'\n      }), \"series\", [{\n        name: '实际销售额',\n        data: kList,\n        smooth: true,\n        type: 'bar',\n        barWidth: '10%',\n        itemStyle: {\n          color: '#4EC478'\n        },\n        areaStyle: {}\n      }, {\n        name: '目标销售额',\n        data: zList,\n        smooth: true,\n        barWidth: '10%',\n        type: 'bar',\n        itemStyle: {\n          color: '#FBA33F'\n        },\n        areaStyle: {}\n      }, {\n        name: '预测销售额',\n        data: yList,\n        smooth: true,\n        type: 'bar',\n        barWidth: '10%',\n        itemStyle: {\n          color: '#51B3E0'\n        },\n        areaStyle: {}\n      }]), \"dataZoom\", [{\n        show: true,\n        start: 0,\n        end: 100\n      }]));\n    },\n    filterChoice: function filterChoice(e) {\n      var dealerId = e.dealerId,\n        dealer_name = e.dealer_name,\n        industry = e.industry;\n      if (dealerId && dealerId != undefined) {\n        this.dealer_str = dealer_name;\n      } else {\n        this.dealer_str = \"全部\";\n      }\n      var filterQuery = this.filterQuery;\n      filterQuery.dealerId = dealerId;\n      if (industry) {\n        filterQuery.industry = industry;\n      }\n      this.filterQuery = {};\n      this.filterQuery = filterQuery;\n      this.init();\n    },\n    showFilter: function showFilter() {\n      var _this2 = this;\n      this.$nextTick(function () {\n        _this2.$refs.dashBoardFilterModal.init();\n      });\n    },\n    winChange: function winChange(e) {\n      this.initSalesChart();\n    },\n    getTotalPieStatistic: function () {\n      var _getTotalPieStatistic = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {\n        var query, res;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {\n          while (1) switch (_context3.prev = _context3.next) {\n            case 0:\n              query = _lodash.default.cloneDeep(this.orderQueryParams);\n              query = Object.assign(query, this.filterQuery);\n              _context3.next = 4;\n              return SalesOpportunityAPI.getTotalPieStatistic(query);\n            case 4:\n              res = _context3.sent;\n              console.log(\"list:\", res.result);\n              this.salesMapData = [];\n              this.salesMapData = res.result.list;\n              this.salesTotalMoney = (0, _index.priceNumFilter)(res.result.totalMoney);\n              this.initSalesMap();\n            case 10:\n            case \"end\":\n              return _context3.stop();\n          }\n        }, _callee3, this);\n      }));\n      function getTotalPieStatistic() {\n        return _getTotalPieStatistic.apply(this, arguments);\n      }\n      return getTotalPieStatistic;\n    }(),\n    initSalesMap: function initSalesMap() {\n      var _this3 = this;\n      if (this.salesMapPlot) {\n        this.salesMapPlot.changeData(this.salesMapData);\n        this.salesMapPlot.render();\n        return false;\n      }\n      this.salesMapPlot = new _g2plot.Pie('salesMap', {\n        appendPadding: 10,\n        data: this.salesMapData,\n        angleField: 'money',\n        colorField: 'type',\n        color: [\"#51B3E0\", \"#4EC478\", \"#FBA33F\"],\n        radius: 1,\n        innerRadius: 0.7,\n        legend: {\n          layout: 'horizontal',\n          position: 'bottom',\n          itemName: {\n            style: {\n              fontSize: 14,\n              fill: \"#000000\",\n              fontWeight: 500\n            },\n            formatter: function formatter(text, item, index) {\n              return \"\".concat(_this3.salesMapData[index].value, \"%\");\n            }\n          },\n          itemValue: {\n            style: {\n              fontSize: 14,\n              fill: \"#BEC0C6\",\n              textAlign: \"center\"\n            },\n            formatter: function formatter(text, item, index) {\n              if (text == 'In Progress') {\n                return \"\\n\\n\".concat(text);\n              } else if (text == 'Won') {\n                return \"\\n\\n\".concat(text, \"        \");\n              } else if (text == 'Lost') {\n                return \"\\n\\n\".concat(text, \"        \");\n              }\n              return \"\\n\\n\".concat(text);\n            }\n          }\n        },\n        pieStyle: function pieStyle(item) {\n          if (item.type == \"In Progress\") {\n            return {\n              fill: \"#51B3E0\",\n              shadowColor: \"#51B3E0\",\n              shadowBlur: 10,\n              shadowOffsetX: 0,\n              shadowOffsetY: 0\n            };\n          } else if (item.type == \"Won\") {\n            return {\n              fill: \"#4EC478\",\n              shadowColor: \"#4EC478\",\n              shadowBlur: 10,\n              shadowOffsetX: 0,\n              shadowOffsetY: 0\n            };\n          } else if (item.type == \"Lost\") {\n            return {\n              fill: \"#FBA33F\",\n              shadowColor: \"#FBA33F\",\n              shadowBlur: 10,\n              shadowOffsetX: 0,\n              shadowOffsetY: 0\n            };\n          }\n        },\n        statistic: {\n          title: {\n            formatter: function formatter() {\n              return '总金额';\n            }\n          },\n          content: {\n            formatter: function formatter() {\n              return _this3.salesTotalMoney;\n            }\n          }\n        }\n      });\n      this.salesMapPlot.render();\n    }\n  }, \"filterChoice\", function filterChoice(e) {\n    console.log(\"e:\", e);\n    var dealerId = e.dealerId,\n      dealer_name = e.dealer_name,\n      industry = e.industry,\n      industryList = e.industryList;\n    if (dealerId && dealerId != undefined) {\n      this.dealer_str = dealer_name;\n    } else {\n      this.dealer_str = \"全部\";\n    }\n    var filterQuery = this.filterQuery;\n    filterQuery.dealerId = dealerId;\n    if (industry) {\n      filterQuery.industry = industry;\n    }\n    if (industryList) {\n      filterQuery.industryList = JSON.stringify(industryList);\n    }\n    this.filterQuery = {};\n    this.filterQuery = filterQuery;\n    this.init();\n  }), \"showFilter\", function showFilter() {\n    var _this4 = this;\n    this.$nextTick(function () {\n      _this4.$refs.dashBoardFilterModal.init();\n    });\n  }), \"toggleSalesShow\", function toggleSalesShow() {\n    this.salesShowType = this.salesShowType == 1 ? 2 : 1;\n  }), \"exportSalesExcel\", function exportSalesExcel() {\n    var _this5 = this;\n    this.exportSalesLoading = true;\n    Promise.resolve().then(function () {\n      return (0, _interopRequireWildcard2.default)(require(\"@/vendor/Export2Excel\"));\n    }).then(function (excel) {\n      var tHeader = [\"日期\", \"实际销售额\", \"目标销售额\", \"预测销售额\"];\n      var filterVal = [\"date\", \"actual\", \"amis\", \"predict\"];\n      var newList = _this5.salesList.map(function (e) {\n        //console.log(e);\n        return (0, _objectSpread2.default)({}, e);\n      });\n      var data = _this5.formatJson(filterVal, newList);\n      excel.export_json_to_excel({\n        header: tHeader,\n        data: data,\n        filename: \"销售额列表\"\n      });\n      _this5.exportSalesLoading = false;\n    });\n  }), \"formatJson\", function formatJson(filterVal, jsonData) {\n    return jsonData.map(function (v) {\n      return filterVal.map(function (j) {\n        if (j == \"predict\" || j == \"actual\" || j == \"amis\") {\n          return (0, _index.priceNumFilter)(v[j]);\n        } else {\n          return v[j];\n        }\n      });\n    });\n  }),\n  created: function created() {\n    this.init();\n  }\n};",null]}