{"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/assessment/list/components/form.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/views/assessment/list/components/form.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 \"core-js/modules/es6.regexp.split\";\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/assessment\";\nimport _ from \"lodash\";\nimport { parseTime } from \"@/utils/index\";\nimport DealerListSelect from \"@/views/components/DealerListSelect.vue\";\nimport IndustrySelect from \"@/views/components/IndustrySelect.vue\";\nexport default {\n  components: {\n    DealerListSelect: DealerListSelect,\n    IndustrySelect: IndustrySelect\n  },\n  data: function data() {\n    return {\n      editorOption: {},\n      dialogFormVisible: false,\n      textMap: {\n        add: \"新增\",\n        update: \"编辑\"\n      },\n      value: '',\n      // 新增更新相关\n      dialogStatus: \"add\",\n      disabled: false,\n      form: {\n        name: '',\n        startDate: \"\",\n        endDate: \"\",\n        standard: 100,\n        objectType: null,\n        // 1: 群发 2:经销商列表 3:行业\n        dealerIdList: [],\n        industry: null,\n        remark: ''\n      },\n      dateTimeRange: [],\n      objectTypeList: [{\n        name: '全部经销商',\n        value: 1\n      }, {\n        name: '经销商列表',\n        value: 2\n      }, {\n        name: '行业',\n        value: 3\n      }]\n    };\n  },\n  computed: {},\n  created: function created() {\n    this.$forceUpdate();\n  },\n  methods: {\n    resetForm: function resetForm() {\n      this.form = {\n        name: '',\n        startDate: \"\",\n        endDate: \"\",\n        standard: 100,\n        objectType: null,\n        // 1: 群发 2:经销商列表 3:行业\n        dealerIdList: [],\n        industry: null,\n        remark: ''\n      };\n      this.dateTimeRange = [];\n    },\n    change: function change(e) {\n      this.$forceUpdate();\n    },\n    init: function () {\n      var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {\n        return _regeneratorRuntime().wrap(function _callee$(_context) {\n          while (1) switch (_context.prev = _context.next) {\n            case 0:\n              this.resetForm();\n              if (id) {\n                this.handleUpdate(id);\n              } else {\n                this.handleAdd();\n              }\n            case 2:\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    /** 处理更新 */handleUpdate: function () {\n      var _handleUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_id) {\n        var _this = this;\n        var resData, detail;\n        return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n          while (1) switch (_context2.prev = _context2.next) {\n            case 0:\n              _context2.next = 2;\n              return API.detail(_id);\n            case 2:\n              resData = _context2.sent;\n              detail = resData.result.detail;\n              this.form = Object.assign(this.form, detail, {\n                //dealer_list: (detail.dealer_list && detail.dealer_list != undefined ? detail.dealer_list : [])\n              });\n              if (detail.start_date && detail.end_date) {\n                this.dateTimeRange = [parseTime(detail.start_date), parseTime(detail.end_date)];\n              }\n              this.dialogStatus = \"update\";\n              this.dialogFormVisible = true;\n              this.$nextTick(function () {\n                _this.$refs[\"dataForm\"].clearValidate();\n              });\n            case 9:\n            case \"end\":\n              return _context2.stop();\n          }\n        }, _callee2, this);\n      }));\n      function handleUpdate(_x2) {\n        return _handleUpdate.apply(this, arguments);\n      }\n      return handleUpdate;\n    }(),\n    /** 处理新增 */handleAdd: function () {\n      var _handleAdd = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n        var _this2 = this;\n        return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n          while (1) switch (_context3.prev = _context3.next) {\n            case 0:\n              this.dialogStatus = \"add\";\n              this.dialogFormVisible = true;\n              this.$nextTick(function () {\n                _this2.$refs[\"dataForm\"].clearValidate();\n              });\n            case 3:\n            case \"end\":\n              return _context3.stop();\n          }\n        }, _callee3, this);\n      }));\n      function handleAdd() {\n        return _handleAdd.apply(this, arguments);\n      }\n      return handleAdd;\n    }(),\n    /** 表单提交，区分好 是 新增 、 更新 */dataFormSubmit: function () {\n      var _dataFormSubmit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n        var _this3 = this;\n        return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n          while (1) switch (_context5.prev = _context5.next) {\n            case 0:\n              _context5.next = 2;\n              return this.$confirm(\"\\u786E\\u8BA4\\uFF1F\", \"提示\", {\n                type: \"warning\"\n              });\n            case 2:\n              this.$refs[\"dataForm\"].validate(/*#__PURE__*/function () {\n                var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(valid) {\n                  var tempData, startYear, endYear, res;\n                  return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n                    while (1) switch (_context4.prev = _context4.next) {\n                      case 0:\n                        if (!valid) {\n                          _context4.next = 36;\n                          break;\n                        }\n                        tempData = _.cloneDeep(_this3.form);\n                        if (tempData.objectType) {\n                          _context4.next = 5;\n                          break;\n                        }\n                        _this3.$message({\n                          message: \"请先选择通知对象筛选\",\n                          type: \"error\"\n                        });\n                        return _context4.abrupt(\"return\");\n                      case 5:\n                        if (!(tempData.objectType == 2)) {\n                          _context4.next = 9;\n                          break;\n                        }\n                        if (!(!tempData.dealerIdList || tempData.dealerIdList.length <= 0)) {\n                          _context4.next = 9;\n                          break;\n                        }\n                        _this3.$message({\n                          message: \"请至少选择一个经销商\",\n                          type: \"error\"\n                        });\n                        return _context4.abrupt(\"return\");\n                      case 9:\n                        tempData.dealerIdList = JSON.stringify(tempData.dealerIdList);\n                        if (!(tempData.objectType == 3)) {\n                          _context4.next = 14;\n                          break;\n                        }\n                        if (tempData.industry) {\n                          _context4.next = 14;\n                          break;\n                        }\n                        _this3.$message({\n                          message: \"请选择行业\",\n                          type: \"error\"\n                        });\n                        return _context4.abrupt(\"return\");\n                      case 14:\n                        if (!(_this3.dateTimeRange && _this3.dateTimeRange.length == 2)) {\n                          _context4.next = 22;\n                          break;\n                        }\n                        tempData.startDate = _this3.dateTimeRange[0];\n                        tempData.endDate = _this3.dateTimeRange[1];\n                        startYear = tempData.startDate.split(\"-\")[0];\n                        endYear = tempData.endDate.split(\"-\")[0];\n                        if (!(startYear != endYear)) {\n                          _context4.next = 22;\n                          break;\n                        }\n                        _this3.$message({\n                          message: \"\\u5E74\\u4EFD\\u65F6\\u95F4\\u9700\\u4E00\\u81F4\",\n                          type: \"error\"\n                        });\n                        return _context4.abrupt(\"return\", false);\n                      case 22:\n                        if (!(_this3.dialogStatus === \"update\")) {\n                          _context4.next = 29;\n                          break;\n                        }\n                        tempData.id = _this3.form._id;\n                        _context4.next = 26;\n                        return API.update(tempData);\n                      case 26:\n                        res = _context4.sent;\n                        _context4.next = 33;\n                        break;\n                      case 29:\n                        if (!(_this3.dialogStatus === \"add\")) {\n                          _context4.next = 33;\n                          break;\n                        }\n                        _context4.next = 32;\n                        return API.create(tempData);\n                      case 32:\n                        res = _context4.sent;\n                      case 33:\n                        _this3.dialogFormVisible = false;\n                        _this3.$message({\n                          message: \"\".concat(_this3.textMap[_this3.dialogStatus], \"\\u6210\\u529F\"),\n                          type: \"success\",\n                          duration: 1501,\n                          onClose: function onClose() {}\n                        });\n                        setTimeout(function () {\n                          _this3.$emit(\"refreshDataList\");\n                        }, 500);\n                      case 36:\n                      case \"end\":\n                        return _context4.stop();\n                    }\n                  }, _callee4);\n                }));\n                return function (_x3) {\n                  return _ref.apply(this, arguments);\n                };\n              }());\n            case 3:\n            case \"end\":\n              return _context5.stop();\n          }\n        }, _callee5, this);\n      }));\n      function dataFormSubmit() {\n        return _dataFormSubmit.apply(this, arguments);\n      }\n      return dataFormSubmit;\n    }()\n  }\n};",null]}