{"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/product/index.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/views/product/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/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 _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\nimport * as API from \"@/api/product.js\";\nimport waves from \"@/directive/waves\";\nimport Pagination from \"@/components/Pagination\";\nimport { parseTime } from \"@/utils\";\nexport default {\n  name: \"ProductList\",\n  components: {\n    Pagination: Pagination\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      },\n      exportLoading: false\n    };\n  },\n  created: function created() {\n    this.init();\n  },\n  methods: {\n    init: function () {\n      var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\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                search: ''\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() {\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;\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.getList(this.listQuery);\n            case 3:\n              res = _context2.sent;\n              _res$result = res.result, total = _res$result.total, list = _res$result.list;\n              this.total = total;\n              this.list = [];\n              this.list = list;\n              this.listLoading = false;\n            case 9:\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    handle: function handle(id) {\n      var _this = this;\n      this.$nextTick(function () {\n        _this.$refs.handle.init(id);\n      });\n    },\n    lookDetail: function lookDetail(id) {\n      var _this2 = this;\n      this.$nextTick(function () {\n        _this2.$refs.dealer.init(id);\n      });\n    },\n    handleFilter: function handleFilter() {\n      this.listQuery.page = 1;\n      this.getList();\n    },\n    exportExcel: function exportExcel() {\n      var _this3 = this;\n      this.exportLoading = true;\n      import(\"@/vendor/Export2Excel\").then(function (excel) {\n        var tHeader = [\"产品编号\", \"产品名称\", \"面价\", \"可用库存\"];\n        var filterVal = [\"product_no\", \"productname\", \"unit_price\", \"qtyearly\"];\n        var newList = _this3.list.map(function (e) {\n          //console.log(e);\n          return _objectSpread({}, e);\n        });\n        console.log(\"newList:\", newList);\n        var data = _this3.formatJson(filterVal, newList);\n        console.log(\"data:\", data);\n        excel.export_json_to_excel({\n          header: tHeader,\n          data: data,\n          filename: \"产品列表\"\n        });\n        _this3.exportLoading = false;\n      });\n    },\n    formatJson: function formatJson(filterVal, jsonData) {\n      return jsonData.map(function (v) {\n        return filterVal.map(function (j) {\n          return v[j];\n        });\n      });\n    }\n  }\n};",null]}