{"remainingRequest":"/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/menu/components/form.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/views/system/menu/components/form.vue","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":["//\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/menu\";\nimport _ from \"lodash\";\nimport {randomNumberString} from '@/utils/index.js';\n\n\nexport default {\n  components: {},\n  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        disable: \"\"\n      },\n      disableOptions: [{\n        value: 1,\n        label: '显示'\n      }, {\n        value: 2,\n        label: '隐藏'\n      }],\n    };\n  },\n  computed: {\n    editor() {\n      return this.$refs.myQuillEditor.quill\n    }\n  },\n  \n  created() {\n    this.$forceUpdate();\n    this.picbase = process.env.VUE_APP_BASE_PIC;\n  },\n  methods: {\n    bannerImageChange(src){\n      let form = this.form;\n      form.cover = src;\n      this.form = {};\n      this.form = form;\n    },\n    onEditorReady(editor) {\n    },\n    resetForm() {\n      this.form = {};\n    },\n    change(e) {\n      this.$forceUpdate();\n    },\n    async init(id,parent_code = '',style = 1) {\n      this.resetForm();\n      this.form.style = style;\n      if (id) {\n        this.handleUpdate(id);\n      } else {\n        let prefix = '1';\n        if(parent_code && parent_code != undefined && parent_code != ''){\n          prefix = parent_code.substr(0,1);\n          prefix = parseInt(prefix) + 1;            \n        }\n        let form = this.form;\n        form.code = randomNumberString(prefix);\n        form.parent_code = parent_code;\n        console.log(form);\n        this.form = {};\n        this.form = form;\n        this.handleAdd();\n      }\n    },\n\n    /** 处理更新 */\n    async handleUpdate(_id) {\n      const resData = await API.detail(_id);\n      this.form = Object.assign(this.form, resData.result.detail);\n      this.dialogStatus = \"update\";\n      this.dialogFormVisible = true;\n      this.$nextTick(() => {\n        this.$refs[\"dataForm\"].clearValidate();\n      });\n    },\n\n    /** 处理新增 */\n    async handleAdd() {\n      this.dialogStatus = \"add\";\n      this.dialogFormVisible = true;\n      this.$nextTick(() => {\n        this.$refs[\"dataForm\"].clearValidate();\n      });\n    },\n\n    /** 表单提交，区分好 是 新增 、 更新 */\n    async dataFormSubmit() {\n      await this.$confirm(`确认？`, \"提示\", {\n        type: \"warning\"\n      });\n      this.$refs[\"dataForm\"].validate(async valid => {\n        if (valid) {\n          const tempData = _.cloneDeep(this.form);\n          tempData.time=this.value1\n          console.log(\"input info :------------------------ \", tempData);\n          let res;\n          if (this.dialogStatus === \"update\") {\n            tempData.id = this.form._id;\n            res = await API.update(tempData);\n          } else if (this.dialogStatus === \"add\") {\n            res = await API.create(tempData);\n          }\n          console.log(\"res: \", res);\n\n          this.dialogFormVisible = false;\n\n          this.$message({\n            message: `${this.textMap[this.dialogStatus]}成功`,\n            type: \"success\",\n            duration: 1501,\n            onClose: () => {\n            }\n          });\n\n          setTimeout(() => {\n            this.$emit(\"refreshDataList\");\n          }, 500);\n        }\n      });\n    }\n  }\n};\n",null]}