{"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/system/organization/components/form.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/views/system/organization/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.function.name\";\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\nimport * as API from \"@/api/organization\";\nimport * as AdminAPI from \"@/api/admin\";\nimport _ from \"lodash\";\nimport * as Utils from \"@/utils/validate\";\nexport default {\n  components: {},\n  props: {},\n  data: function data() {\n    return {\n      dateVal: \"\",\n      dialogFormVisible: false,\n      textMap: {\n        add: \"新增\",\n        update: \"编辑\"\n      },\n      picbase: \"\",\n      //记录 上传头像基础地址\n      // 新增更新相关\n      dialogStatus: \"add\",\n      form: {\n        name: '',\n        style: null,\n        parent: null,\n        account: null,\n        order: 0\n      },\n      userList: [] //用户列表\n    };\n  },\n  computed: {},\n  created: function created() {\n    this.$forceUpdate();\n  },\n  methods: {\n    resetForm: function resetForm() {\n      this.form = {\n        name: '',\n        parent: null,\n        account: null,\n        order: 0\n      };\n    },\n    change: function change(e) {\n      this.$forceUpdate();\n    },\n    getAllAdminList: function () {\n      var _getAllAdminList = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {\n        var params, res;\n        return _regeneratorRuntime().wrap(function _callee$(_context) {\n          while (1) switch (_context.prev = _context.next) {\n            case 0:\n              params = {\n                organization: id\n              };\n              _context.next = 3;\n              return AdminAPI.getAllAdminList(params);\n            case 3:\n              res = _context.sent;\n              this.userList = [];\n              this.userList = res.result.list;\n            case 6:\n            case \"end\":\n              return _context.stop();\n          }\n        }, _callee, this);\n      }));\n      function getAllAdminList(_x) {\n        return _getAllAdminList.apply(this, arguments);\n      }\n      return getAllAdminList;\n    }(),\n    init: function () {\n      var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id, parent_id) {\n        return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n          while (1) switch (_context2.prev = _context2.next) {\n            case 0:\n              this.resetForm();\n              if (parent_id) {\n                this.form.parent = parent_id;\n              }\n              if (id) {\n                this.handleUpdate(id);\n                this.getAllAdminList(id);\n              } else {\n                this.handleAdd();\n              }\n            case 3:\n            case \"end\":\n              return _context2.stop();\n          }\n        }, _callee2, this);\n      }));\n      function init(_x2, _x3) {\n        return _init.apply(this, arguments);\n      }\n      return init;\n    }(),\n    /** 处理更新 */handleUpdate: function () {\n      var _handleUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_id) {\n        var _this = this;\n        var resData;\n        return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n          while (1) switch (_context3.prev = _context3.next) {\n            case 0:\n              _context3.next = 2;\n              return API.getDetail({\n                id: _id\n              });\n            case 2:\n              resData = _context3.sent;\n              console.log(resData);\n              this.form = Object.assign(this.form, resData.result.detail, {});\n              this.dialogStatus = \"update\";\n              this.disabled = true;\n              this.dialogFormVisible = true;\n              this.$nextTick(function () {\n                _this.$refs[\"dataForm\"].clearValidate();\n              });\n            case 9:\n            case \"end\":\n              return _context3.stop();\n          }\n        }, _callee3, this);\n      }));\n      function handleUpdate(_x4) {\n        return _handleUpdate.apply(this, arguments);\n      }\n      return handleUpdate;\n    }(),\n    /** 处理新增 */handleAdd: function () {\n      var _handleAdd = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n        var _this2 = this;\n        return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n          while (1) switch (_context4.prev = _context4.next) {\n            case 0:\n              this.dialogStatus = \"add\";\n              this.disabled = false;\n              this.dialogFormVisible = true;\n              this.$nextTick(function () {\n                _this2.$refs[\"dataForm\"].clearValidate();\n              });\n            case 4:\n            case \"end\":\n              return _context4.stop();\n          }\n        }, _callee4, 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 _callee6() {\n        var _this3 = this;\n        var tempData;\n        return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n          while (1) switch (_context6.prev = _context6.next) {\n            case 0:\n              tempData = _.cloneDeep(this.form);\n              tempData.name = tempData.name.trim();\n              if (!(tempData.name == undefined)) {\n                _context6.next = 5;\n                break;\n              }\n              this.showError(\"请输入名称\");\n              return _context6.abrupt(\"return\");\n            case 5:\n              console.log(\"form - info\", tempData);\n              //点击确认再次提示\n              this.$confirm(\"确认提交???\", \"提示\").then(function (_) {\n                console.log(\"确认\");\n                _this3.$refs[\"dataForm\"].validate(/*#__PURE__*/function () {\n                  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(valid) {\n                    var res;\n                    return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n                      while (1) switch (_context5.prev = _context5.next) {\n                        case 0:\n                          if (!valid) {\n                            _context5.next = 16;\n                            break;\n                          }\n                          if (!(_this3.dialogStatus === \"update\")) {\n                            _context5.next = 8;\n                            break;\n                          }\n                          tempData.id = _this3.form._id;\n                          _context5.next = 5;\n                          return API.update(tempData);\n                        case 5:\n                          res = _context5.sent;\n                          _context5.next = 12;\n                          break;\n                        case 8:\n                          if (!(_this3.dialogStatus === \"add\")) {\n                            _context5.next = 12;\n                            break;\n                          }\n                          _context5.next = 11;\n                          return API.create(tempData);\n                        case 11:\n                          res = _context5.sent;\n                        case 12:\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                          //添加成功后,记得移出\n                          _this3.fileList = [];\n                          setTimeout(function () {\n                            _this3.$emit(\"refreshDataList\");\n                          }, 500);\n                        case 16:\n                        case \"end\":\n                          return _context5.stop();\n                      }\n                    }, _callee5);\n                  }));\n                  return function (_x5) {\n                    return _ref.apply(this, arguments);\n                  };\n                }());\n              }).catch(function (_) {});\n            case 7:\n            case \"end\":\n              return _context6.stop();\n          }\n        }, _callee6, this);\n      }));\n      function dataFormSubmit() {\n        return _dataFormSubmit.apply(this, arguments);\n      }\n      return dataFormSubmit;\n    }(),\n    showError: function showError(msg) {\n      this.$message.error(msg);\n    }\n  }\n};",null]}