{"remainingRequest":"/Users/admin/projects/dms/src/dealer_admin/node_modules/thread-loader/dist/cjs.js!/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/dealer/apply/components/dealer_list.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/views/dealer/apply/components/dealer_list.vue","mtime":1745506085888},{"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/thread-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":["import \"core-js/modules/es6.function.name\";\nimport _objectSpread from \"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/esm/objectSpread2.js\";\nimport _regeneratorRuntime from \"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/esm/regeneratorRuntime.js\";\nimport \"regenerator-runtime/runtime\";\nimport _asyncToGenerator from \"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/esm/asyncToGenerator.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//\n\nimport * as API from \"@/api/dealer.js\";\nimport * as SalesAmisAPI from \"@/api/sales_amis.js\";\nimport waves from \"@/directive/waves\"; // waves directive\nimport { parseTime } from \"@/utils\";\nimport Form from \"./form\";\nimport Pagination from \"@/components/Pagination\";\nimport Dealer from \"./dealer.vue\";\nimport ReviewLog from \"./review_log.vue\";\nimport Account from \"./account.vue\";\nimport SalesAmis from \"./sales_amis.vue\";\nimport XLSX from 'xlsx';\nimport Review from \"./review.vue\";\nimport ReviewManager from \"./reviewManagerModal.vue\";\nexport default {\n  name: \"DealerInvite\",\n  components: {\n    Form: Form,\n    Pagination: Pagination,\n    Dealer: Dealer,\n    ReviewLog: ReviewLog,\n    Account: Account,\n    SalesAmis: SalesAmis,\n    Review: Review,\n    ReviewManager: ReviewManager\n  },\n  directives: {\n    waves: waves\n  },\n  data: function data() {\n    return {\n      list: [],\n      total: 0,\n      listLoading: false,\n      listQuery: {\n        page: 1,\n        limit: 10,\n        search: '',\n        status: -1\n      },\n      userid: '',\n      exportLoading: false,\n      animImportLoading: false\n    };\n  },\n  props: {\n    dealerReviewStatusMap: {\n      type: Object,\n      default: {}\n    },\n    reviewStepMap: {\n      type: Object,\n      default: {}\n    },\n    reviewStepKey: {\n      type: Object,\n      default: {}\n    },\n    showAnimImport: {\n      type: Boolean,\n      default: false\n    }\n  },\n  computed: {\n    is_super: function is_super() {\n      return this.$store.state.user.is_super;\n    }\n  },\n  created: function created() {\n    this.$forceUpdate();\n  },\n  methods: {\n    init: function () {\n      var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(status) {\n        return _regeneratorRuntime().wrap(function _callee$(_context) {\n          while (1) switch (_context.prev = _context.next) {\n            case 0:\n              this.listQuery = {\n                page: 1,\n                limit: 10,\n                status: status\n              };\n              _context.next = 3;\n              return this.getList();\n            case 3:\n            case \"end\":\n              return _context.stop();\n          }\n        }, _callee, this);\n      }));\n      function init(_x) {\n        return _init.apply(this, arguments);\n      }\n      return init;\n    }(),\n    getList: function () {\n      var _getList = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n        var res, _res$result, total, list, userid, is_super;\n        return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n          while (1) switch (_context2.prev = _context2.next) {\n            case 0:\n              this.listLoading = true;\n              _context2.next = 3;\n              return API.list(this.listQuery);\n            case 3:\n              res = _context2.sent;\n              _res$result = res.result, total = _res$result.total, list = _res$result.list, userid = _res$result.userid, is_super = _res$result.is_super;\n              this.total = total;\n              this.userid = userid;\n              this.list = [];\n              this.list = list;\n              this.listLoading = false;\n            case 10:\n            case \"end\":\n              return _context2.stop();\n          }\n        }, _callee2, this);\n      }));\n      function getList() {\n        return _getList.apply(this, arguments);\n      }\n      return getList;\n    }(),\n    delHandle: function () {\n      var _delHandle = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(id) {\n        var _this2 = this;\n        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n          while (1) switch (_context4.prev = _context4.next) {\n            case 0:\n              this.$confirm(\"确认删除???\", \"提示\").then(/*#__PURE__*/function () {\n                var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_) {\n                  var res;\n                  return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n                    while (1) switch (_context3.prev = _context3.next) {\n                      case 0:\n                        console.log(\"确认\");\n                        _context3.next = 3;\n                        return API.del(id);\n                      case 3:\n                        res = _context3.sent;\n                        if (res.__error === 0) {\n                          _this2.$message({\n                            message: \"成功\",\n                            type: \"success\"\n                          });\n                          _this2.getList();\n                        }\n                      case 5:\n                      case \"end\":\n                        return _context3.stop();\n                    }\n                  }, _callee3);\n                }));\n                return function (_x3) {\n                  return _ref.apply(this, arguments);\n                };\n              }()).catch(function (_) {\n                console.log(\"取消\");\n              });\n            case 1:\n            case \"end\":\n              return _context4.stop();\n          }\n        }, _callee4, this);\n      }));\n      function delHandle(_x2) {\n        return _delHandle.apply(this, arguments);\n      }\n      return delHandle;\n    }(),\n    fromHandle: function fromHandle(id) {\n      var _this3 = this;\n      this.$nextTick(function () {\n        _this3.$refs.fromType.init(id);\n      });\n    },\n    lookDetail: function lookDetail(id) {\n      var _this4 = this;\n      this.$nextTick(function () {\n        _this4.$refs.dealer.init(id);\n      });\n    },\n    salesUserReview: function salesUserReview(id) {\n      var _this5 = this;\n      this.$nextTick(function () {\n        _this5.$refs.salesUserReview.init(id);\n      });\n    },\n    managerReview: function managerReview(id) {\n      var _this6 = this;\n      this.$nextTick(function () {\n        _this6.$refs.managerReview.init(id);\n      });\n    },\n    lookReviewLog: function lookReviewLog(id) {\n      var _this7 = this;\n      this.$nextTick(function () {\n        _this7.$refs.reviewLog.init(id);\n      });\n    },\n    editAccount: function editAccount(id) {\n      var _this8 = this;\n      this.$nextTick(function () {\n        _this8.$refs.account.init(id);\n      });\n    },\n    handleFilter: function handleFilter() {\n      this.listQuery.page = 1;\n      this.getList();\n    },\n    saleAmis: function saleAmis(id) {\n      var _this9 = this;\n      this.$nextTick(function () {\n        _this9.$refs.salesAmis.init(id);\n      });\n    },\n    exportExcel: function exportExcel() {\n      var _this10 = this;\n      this.exportLoading = true;\n      import(\"@/vendor/Export2Excel\").then(function (excel) {\n        var tHeader = [\"公司中文名称\", \"公司英文名称\", \"状态\", \"专属销售人员\", \"省份\", \"城市\", \"区域\", \"成立时间\", \"法人代表\", \"总经理\", \"员工人数\", \"注册资金(元)\", \"年销售额(元)\", \"申请日期\", \"到期时间\"];\n        var filterVal = [\"china_name\", \"en_name\", \"review_status\", \"dealer_invite\", \"province\", \"city\", \"district\", \"build_date\", \"legal_person\", \"manager\", \"employees_number\", \"register_capital\", \"year_sales\", \"create_at\", \"expire_date\"];\n        var newList = _this10.list.map(function (e) {\n          //console.log(e);\n          return _objectSpread({}, e);\n        });\n        console.log(\"newList:\", newList);\n        var data = _this10.formatJson(filterVal, newList);\n        console.log(\"data:\", data);\n        excel.export_json_to_excel({\n          header: tHeader,\n          data: data,\n          filename: \"经销商申请列表\"\n        });\n        _this10.exportLoading = false;\n      });\n    },\n    formatJson: function formatJson(filterVal, jsonData) {\n      var _this11 = this;\n      return jsonData.map(function (v) {\n        return filterVal.map(function (j) {\n          if (j === \"review_status\") {\n            return _this11.dealerReviewStatusMap[v[j]] && _this11.dealerReviewStatusMap[v[j]] != undefined ? _this11.dealerReviewStatusMap[v[j]] : '';\n          } else if (j === \"build_date\" || j == 'expire_date') {\n            if (v[j] && v[j] != undefined) {\n              return parseTime(v[j], \"{y}-{m}-{d} {h}:{i}\");\n            }\n            return \"\";\n          } else if (j == 'create_at') {\n            if (v[j] && v[j] != undefined) {\n              return parseTime(v[j], \"{y}-{m}-{d}\");\n            }\n            return \"\";\n          } else if (j == \"sales_user\") {\n            return v.sales_user ? v.sales_user.name : \"\";\n          } else if (j == \"sales_manager\") {\n            return v.sales_manager ? v.sales_manager.name : \"\";\n          } else if (j == \"dealer_invite\") {\n            if (v.dealer_invite && v.dealer_invite.invite_user && v.dealer_invite.invite_user != undefined) {\n              return v.dealer_invite.invite_user.name;\n            } else {\n              return \"\";\n            }\n          } else {\n            return v[j];\n          }\n        });\n      });\n    },\n    downAnimImportTemp: function downAnimImportTemp() {\n      var a = document.createElement('a');\n      a.href = \"https://imi-dealer.oss-cn-shanghai.aliyuncs.com/dealer_anims_temp.xlsx\";\n      a.download = \"dealer_anims_temp.xlsx\";\n      a.click();\n      a.remove();\n    },\n    uploadFileChange: function () {\n      var _uploadFileChange = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e) {\n        var _this12 = this;\n        return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n          while (1) switch (_context6.prev = _context6.next) {\n            case 0:\n              this.$nextTick(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n                var file, data, list, i, l, dataInfo;\n                return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                  while (1) switch (_context5.prev = _context5.next) {\n                    case 0:\n                      if (!(_this12.$refs.animUploadInput.files.length <= 0 || _this12.$refs.animUploadInput.files[0] == null || _this12.$refs.animUploadInput.files[0] == undefined)) {\n                        _context5.next = 2;\n                        break;\n                      }\n                      return _context5.abrupt(\"return\");\n                    case 2:\n                      if (!_this12.animImportLoading) {\n                        _context5.next = 4;\n                        break;\n                      }\n                      return _context5.abrupt(\"return\");\n                    case 4:\n                      _this12.animImportLoading = true;\n                      file = _this12.$refs.animUploadInput.files[0];\n                      _context5.prev = 6;\n                      _context5.next = 9;\n                      return _this12.beforeUpload(file);\n                    case 9:\n                      data = _context5.sent;\n                      if (!data) {\n                        _context5.next = 27;\n                        break;\n                      }\n                      list = [];\n                      data.map(function (v) {\n                        list.push({\n                          ID: v['ID'],\n                          Year: v['Year'],\n                          months: [{\n                            value: v['Jan']\n                          }, {\n                            value: v['Feb']\n                          }, {\n                            value: v['Mar']\n                          }, {\n                            value: v['Apr']\n                          }, {\n                            value: v['May']\n                          }, {\n                            value: v['Jun']\n                          }, {\n                            value: v['Jul']\n                          }, {\n                            value: v['Aug']\n                          }, {\n                            value: v['Sept']\n                          }, {\n                            value: v['Oct']\n                          }, {\n                            value: v['Nov']\n                          }, {\n                            value: v['Dec']\n                          }]\n                        });\n                      });\n                      //console.log(\"list:\",list);\n                      if (!(list && list.length > 0)) {\n                        _context5.next = 25;\n                        break;\n                      }\n                      i = 0, l = list.length;\n                    case 15:\n                      if (!(i < l)) {\n                        _context5.next = 22;\n                        break;\n                      }\n                      dataInfo = list[i];\n                      _context5.next = 19;\n                      return _this12.uploadAnim(dataInfo, Math.ceil(i / l));\n                    case 19:\n                      i++;\n                      _context5.next = 15;\n                      break;\n                    case 22:\n                      _this12.$message.success(\"导入完成\");\n                      _context5.next = 26;\n                      break;\n                    case 25:\n                      _this12.$message.error(\"没有数据可导入\");\n                    case 26:\n                      _this12.animImportLoading = false;\n                    case 27:\n                      _context5.next = 32;\n                      break;\n                    case 29:\n                      _context5.prev = 29;\n                      _context5.t0 = _context5[\"catch\"](6);\n                      console.log(\"e:\", _context5.t0);\n                    case 32:\n                      _this12.animImportLoading = false;\n                    case 33:\n                    case \"end\":\n                      return _context5.stop();\n                  }\n                }, _callee5, null, [[6, 29]]);\n              })));\n            case 1:\n            case \"end\":\n              return _context6.stop();\n          }\n        }, _callee6, this);\n      }));\n      function uploadFileChange(_x4) {\n        return _uploadFileChange.apply(this, arguments);\n      }\n      return uploadFileChange;\n    }(),\n    beforeUpload: function beforeUpload(file) {\n      var _this = this;\n      // 使返回的值变成Promise对象，如果校验不通过，则reject，校验通过，则resolve\n      return new Promise(function (resolve, reject) {\n        // readExcel方法也使用了Promise异步转同步，此处使用then对返回值进行处理\n        _this.readExcel(file).then(function (result) {\n          // 此时标识校验成功，为resolve返回\n          var isLt2M = file.size / 1024 / 1024 < 20;\n          if (!isLt2M) {\n            _this.$message.error('文件大小不能超过20MB!');\n          }\n          if (isLt2M && result) {\n            resolve(result);\n          } else {\n            reject(false);\n          }\n        }, function (error) {\n          // 此时为校验失败，为reject返回\n          _this.$message.error(error);\n          reject(false);\n        });\n      });\n    },\n    readExcel: function readExcel(file) {\n      // 解析Excel\n      var _this = this;\n      return new Promise(function (resolve, reject) {\n        // 返回Promise对象\n        var reader = new FileReader();\n        var binary = '';\n        reader.onload = function (e) {\n          // 异步执行\n          console.log(\"e:\", e);\n          try {\n            // 以二进制流方式读取得到整份excel表格对象\n            var data = e.target.result,\n              workbook = XLSX.read(data, {\n                type: 'binary'\n              });\n          } catch (e) {\n            return reject(e.message);\n          } // 表格的表格范围，可用于判断表头是否数量是否正确\n          var fromTo = '';\n          // 遍历每张表读取\n          for (var sheet in workbook.Sheets) {\n            var sheetInfos = workbook.Sheets[sheet];\n            if (sheetInfos['A1'].v != 'ID') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['B1'].v != 'Year') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['C1'].v != 'Jan') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['D1'].v != 'Feb') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['E1'].v != 'Mar') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['F1'].v != 'Apr') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['G1'].v != 'May') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['H1'].v != 'Jun') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['I1'].v != 'Jul') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['J1'].v != 'Aug') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['K1'].v != 'Sept') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['L1'].v != 'Oct') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['M1'].v != 'Nov') {\n              return reject('文件内容不符合规范');\n            }\n            if (sheetInfos['N1'].v != 'Dec') {\n              return reject('文件内容不符合规范');\n            }\n            var json = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);\n            return resolve(json);\n          }\n        };\n        reader.readAsBinaryString(file);\n      });\n    },\n    uploadAnim: function () {\n      var _uploadAnim = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(data, percent) {\n        var postData, res;\n        return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n          while (1) switch (_context7.prev = _context7.next) {\n            case 0:\n              postData = JSON.parse(JSON.stringify(data));\n              postData.months = JSON.stringify(postData.months);\n              _context7.next = 4;\n              return SalesAmisAPI.uploadYearAnim(postData);\n            case 4:\n              res = _context7.sent;\n              this.$message.success(\"导入成功 \" + percent + \"%\");\n            case 6:\n            case \"end\":\n              return _context7.stop();\n          }\n        }, _callee7, this);\n      }));\n      function uploadAnim(_x5, _x6) {\n        return _uploadAnim.apply(this, arguments);\n      }\n      return uploadAnim;\n    }(),\n    showReview: function showReview(id) {\n      var _this13 = this;\n      this.$nextTick(function () {\n        _this13.$refs.review.init(id);\n      });\n    },\n    showReviewManager: function showReviewManager(id) {\n      var _this14 = this;\n      this.$nextTick(function () {\n        _this14.$refs.reviewManager.init(id);\n      });\n    }\n  }\n};",null]}