{"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/system/setting/components/form.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/views/system/setting/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/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 _interopRequireWildcard = 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 _regeneratorRuntime2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/regeneratorRuntime.js\"));\nrequire(\"core-js/modules/es6.function.name\");\nrequire(\"regenerator-runtime/runtime\");\nvar _asyncToGenerator2 = _interopRequireDefault(require(\"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar API = _interopRequireWildcard(require(\"@/api/setting\"));\nvar RoleAPI = _interopRequireWildcard(require(\"@/api/role\"));\nvar _lodash = _interopRequireDefault(require(\"lodash\"));\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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  components: {},\n  data: function data() {\n    return {\n      dialogFormVisible: false,\n      textMap: {\n        add: \"新增\",\n        update: \"编辑\"\n      },\n      // 新增更新相关\n      dialogStatus: \"add\",\n      disabled: false,\n      form: {},\n      userRoleList: []\n    };\n  },\n  props: {\n    typeList: {\n      type: Array,\n      default: []\n    }\n  },\n  computed: {},\n  created: function created() {\n    this.$forceUpdate();\n    this.picbase = process.env.VUE_APP_BASE_PIC;\n  },\n  methods: {\n    imageChange: function imageChange(src) {\n      var form = this.form;\n      form.content = src;\n      this.form = {};\n      this.form = form;\n    },\n    lotteryImageChange: function lotteryImageChange(src) {\n      var form = this.form;\n      form.image = src;\n      this.form = {};\n      this.form = form;\n    },\n    pdfChange: function pdfChange(pdf) {\n      var form = this.form;\n      form.content = pdf;\n      this.form = {};\n      this.form = form;\n    },\n    cnChange: function cnChange(e) {\n      console.log(\"e\", e);\n      // this.type=e\n      // this.order=e\n    },\n    resetForm: function resetForm() {\n      this.form = {};\n    },\n    change: function change(e) {\n      this.$forceUpdate();\n    },\n    getRoleList: function () {\n      var _getRoleList = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {\n        var resData, list, userRoleList;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {\n          while (1) switch (_context.prev = _context.next) {\n            case 0:\n              _context.next = 2;\n              return RoleAPI.getValidList();\n            case 2:\n              resData = _context.sent;\n              list = resData.result.list;\n              if (list && list.length > 0) {\n                userRoleList = [];\n                list.map(function (v) {\n                  var item = {\n                    label: v.name,\n                    value: v._id\n                  };\n                  userRoleList.push(item);\n                });\n                this.userRoleList = [];\n                this.userRoleList = userRoleList;\n              }\n              console.log(resData);\n            case 6:\n            case \"end\":\n              return _context.stop();\n          }\n        }, _callee, this);\n      }));\n      function getRoleList() {\n        return _getRoleList.apply(this, arguments);\n      }\n      return getRoleList;\n    }(),\n    init: function () {\n      var _init = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(id) {\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {\n          while (1) switch (_context2.prev = _context2.next) {\n            case 0:\n              this.resetForm();\n              this.getRoleList();\n              if (id) {\n                this.handleUpdate(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(_x) {\n        return _init.apply(this, arguments);\n      }\n      return init;\n    }(),\n    /** 处理更新 */handleUpdate: function () {\n      var _handleUpdate = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3(_id) {\n        var _this = this;\n        var resData, content;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {\n          while (1) switch (_context3.prev = _context3.next) {\n            case 0:\n              _context3.next = 2;\n              return API.detail(_id);\n            case 2:\n              resData = _context3.sent;\n              console.log(\"_id++++++++++=:\", _id);\n              this.form = Object.assign(this.form, resData.result.detail);\n              if (this.form.type == 10) {\n                content = JSON.parse(this.form.content);\n                this.form = Object.assign(this.form, content);\n              }\n              this.dialogStatus = \"update\";\n              this.disabled = true;\n              this.dialogFormVisible = true;\n              this.$nextTick(function () {\n                _this.$refs[\"dataForm\"].clearValidate();\n              });\n            case 10:\n            case \"end\":\n              return _context3.stop();\n          }\n        }, _callee3, this);\n      }));\n      function handleUpdate(_x2) {\n        return _handleUpdate.apply(this, arguments);\n      }\n      return handleUpdate;\n    }(),\n    /** 处理新增 */handleAdd: function () {\n      var _handleAdd = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {\n        var _this2 = this;\n        return (0, _regeneratorRuntime2.default)().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 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee6() {\n        var _this3 = this;\n        return (0, _regeneratorRuntime2.default)().wrap(function _callee6$(_context6) {\n          while (1) switch (_context6.prev = _context6.next) {\n            case 0:\n              _context6.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 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee5(valid) {\n                  var tempData, res;\n                  return (0, _regeneratorRuntime2.default)().wrap(function _callee5$(_context5) {\n                    while (1) switch (_context5.prev = _context5.next) {\n                      case 0:\n                        if (!valid) {\n                          _context5.next = 19;\n                          break;\n                        }\n                        tempData = _lodash.default.cloneDeep(_this3.form);\n                        tempData.type = _this3.form.type;\n                        console.log(\"input info : \", tempData);\n                        if (!(_this3.dialogStatus === \"update\")) {\n                          _context5.next = 11;\n                          break;\n                        }\n                        tempData.id = _this3.form._id;\n                        _context5.next = 8;\n                        return API.update(tempData);\n                      case 8:\n                        res = _context5.sent;\n                        _context5.next = 15;\n                        break;\n                      case 11:\n                        if (!(_this3.dialogStatus === \"add\")) {\n                          _context5.next = 15;\n                          break;\n                        }\n                        _context5.next = 14;\n                        return API.create(tempData);\n                      case 14:\n                        res = _context5.sent;\n                      case 15:\n                        console.log(\"res: \", res);\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 19:\n                      case \"end\":\n                        return _context5.stop();\n                    }\n                  }, _callee5);\n                }));\n                return function (_x3) {\n                  return _ref.apply(this, arguments);\n                };\n              }());\n            case 3:\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  }\n};",null]}