{"remainingRequest":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js!E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js!E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!E:\\hz-zhhq-web\\src\\views\\property\\questionnaire\\addQuestion\\index.vue?vue&type=script&lang=js","dependencies":[{"path":"E:\\hz-zhhq-web\\src\\views\\property\\questionnaire\\addQuestion\\index.vue","mtime":1737610069443},{"path":"E:\\hz-zhhq-web\\babel.config.js","mtime":1737610069371},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/web.dom.iterable\";\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//\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 { updateQuestionnaireById, addQuestionnaire, getQuestionnaireById as _getQuestionnaireById, importFile } from \"@/api/getdata\";\nimport Popup from \"@/views/estate/examine/dialog/popup.vue\";\nimport { constants } from \"crypto\";\nexport default {\n components: {\n Popup: Popup\n },\n data: function data() {\n return {\n indexCall: this.$route.query.index ? this.$route.query.index : window.localStorage.getItem(\"pageIndex\"),\n validation: false,\n completeTitle: \"\",\n nav: \"\",\n imgData: {},\n dialogImageUrl: \"\",\n dialogVisible: false,\n timeUpdate: \"\",\n questionList: [{\n topIc: \"\",\n number: \"1\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"2\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"3\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"4\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"5\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"6\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"7\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"8\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"9\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"10\",\n topIcType: \"1\"\n }, {\n topIc: \"\",\n number: \"11\",\n topIcType: \"0\"\n }],\n //10题选择1题简答\n radioList: '',\n view: false,\n ruleForm: {\n isAnonymous: '0',\n title: \"\",\n describe: \"\",\n questionTime: '',\n state: ''\n },\n til: \"新增\",\n id: \"\",\n rules: {\n title: [{\n required: true,\n message: \"请输入问卷主题\",\n trigger: \"blur\"\n }],\n describe: [{\n required: true,\n message: \"请输入问卷描述\",\n trigger: \"blur\"\n }],\n isAnonymous: [{\n required: true,\n message: \"请选择是否匿名\",\n trigger: \"blur\"\n }],\n questionTime: [{\n required: true,\n message: \"请选择时间范围\",\n trigger: \"blur\"\n }]\n },\n houseType: [],\n status: [],\n device: [],\n parentData: [],\n state: '0',\n fileList: [],\n formDate: new FormData()\n };\n },\n created: function created() {},\n mounted: function mounted() {\n var data = this.$route.query.rowdata;\n if (data) {\n this.id = data.ID;\n this.til = data.til;\n //仅适用查看\n this.view = data ? data.view : false;\n this.getQuestionnaireById();\n }\n },\n methods: {\n // 模板下载\n downLoad: function downLoad() {\n var url = process.env.VUE_APP_BASE_API + \"/greenH5/greenWebmodul/rest/greenQuestionnaire/exportQuestModel\";\n window.location.href = url;\n },\n getQuestionnaireById: function getQuestionnaireById() {\n var _this = this;\n var Content = {\n id: this.id\n };\n _getQuestionnaireById(Content).then(function (res) {\n if (res.returnCode == \"1\") {\n // console.log(res.returnData)\n var data = res.returnData.list[0];\n _this.ruleForm.isAnonymous = data.IS_ANONYMOUS;\n _this.ruleForm.title = data.TITLE;\n _this.ruleForm.describe = data.DESCRIBE;\n _this.ruleForm.state = data.STATE;\n _this.ruleForm.questionTime = [data.START_TIME, data.END_TIME];\n _this.questionList = res.returnData.listTopIc.map(function (item) {\n return {\n id: item.ID,\n topIc: item.TOPIC,\n number: item.NUMBER,\n topIcType: item.TOPIC_TYPE\n };\n });\n // console.log(this.questionList)\n // this.$message({\n // message: res.returnMsg,\n // type: \"success\"\n // });\n } else {\n _this.$message({\n message: res.returnMsg,\n type: \"warning\"\n });\n }\n }).catch(function (err) {\n console.log(err);\n });\n },\n submitForm: function submitForm(formName, type) {\n var _this2 = this;\n this.state = type;\n this.$refs[formName].validate(function (valid) {\n if (valid) {\n var questionValid = true;\n _this2.questionList.forEach(function (item) {\n if (item.topIc == '') {\n questionValid = false;\n }\n });\n // console.log(questionValid)\n if (questionValid) {\n if (_this2.til == \"编辑\") {\n if (type == '1') {\n _this2.validation = true;\n _this2.completeTitle = \"编辑\";\n _this2.nav = \"是否发布?\";\n } else {\n _this2.validation = true;\n _this2.completeTitle = \"编辑\";\n _this2.nav = \"是否编辑?\";\n }\n } else {\n if (type == '1') {\n _this2.validation = true;\n _this2.completeTitle = \"新增\";\n _this2.nav = \"是否发布?\";\n } else {\n _this2.validation = true;\n _this2.completeTitle = \"新增\";\n _this2.nav = \"是否新增?\";\n }\n }\n } else {\n _this2.$message({\n message: '问卷题目未填写完整',\n type: \"warning\"\n });\n }\n }\n });\n },\n closeDialogDel: function closeDialogDel(val) {\n var _this3 = this;\n console.log(val);\n if (val == \"2\") {\n var Content = {\n title: this.ruleForm.title,\n describe: this.ruleForm.describe,\n isAnonymous: this.ruleForm.isAnonymous,\n startTime: this.ruleForm.questionTime ? this.ruleForm.questionTime[0] : '',\n endTime: this.ruleForm.questionTime ? this.ruleForm.questionTime[1] : '',\n topIc: this.questionList,\n state: this.state,\n userId: window.localStorage.getItem(\"userId\"),\n userName: window.localStorage.getItem(\"userName\"),\n id: this.id\n };\n updateQuestionnaireById(Content).then(function (res) {\n if (res.returnCode == \"1\") {\n _this3.$message({\n message: res.returnMsg,\n type: \"success\"\n });\n _this3.$router.push({\n name: \"property-questionnaire-index\",\n params: {\n index: _this3.indexCall\n }\n });\n } else {\n _this3.$message({\n message: res.returnMsg,\n type: \"warning\"\n });\n }\n }).catch(function (err) {\n console.log(err);\n });\n } else if (val == \"3\") {\n var _Content = {\n title: this.ruleForm.title,\n describe: this.ruleForm.describe,\n isAnonymous: this.ruleForm.isAnonymous,\n startTime: this.ruleForm.questionTime ? this.ruleForm.questionTime[0] : '',\n endTime: this.ruleForm.questionTime ? this.ruleForm.questionTime[1] : '',\n topIc: this.questionList,\n state: this.state,\n userId: window.localStorage.getItem(\"userId\"),\n userName: window.localStorage.getItem(\"userName\")\n };\n addQuestionnaire(_Content).then(function (res) {\n if (res.returnCode == \"1\") {\n _this3.$message({\n message: res.returnMsg,\n type: \"success\"\n });\n if (_this3.completeTitle == \"新增\") {\n _this3.$router.push({\n name: \"property-questionnaire-index\",\n params: {\n index: 1\n }\n });\n }\n } else {\n _this3.$message({\n message: res.returnMsg,\n type: \"warning\"\n });\n }\n }).catch(function (err) {\n console.log(err);\n });\n }\n // \n this.validation = false;\n // this.getQuestionnaireById()\n },\n /**返回上一级 */comeBack: function comeBack() {\n this.$router.push({\n name: \"property-questionnaire-index\",\n params: {\n index: this.indexCall\n }\n });\n },\n resetForm: function resetForm(formName) {\n this.$refs[formName].resetFields();\n this.$router.push({\n name: \"property-questionnaire-index\",\n params: {\n index: this.indexCall\n }\n });\n this.$message({\n message: \"取消成功\",\n type: \"success\"\n });\n },\n //导入\n handlePreview: function handlePreview() {\n this.formDate = new FormData();\n this.$refs.upload.clearFiles();\n },\n onchange: function onchange(file) {\n var _this4 = this;\n this.fileList = [];\n this.formDate = new FormData();\n this.formDate.append(\"file\", file.raw);\n this.fileList.push(file);\n var flag = false;\n if (this.fileList.length > 0) {\n flag = false;\n var Lastindex = this.fileList[0].name.lastIndexOf(\".\");\n if (this.fileList[0].name.slice(Lastindex) != \".xls\" && this.fileList[0].name.slice(Lastindex) != \".xlsx\") {\n flag = false;\n this.$message({\n message: \"请选择正确的Excel格式\",\n type: \"warning\"\n });\n return false;\n } else {\n flag = true;\n }\n } else {\n flag = true;\n }\n this.bs64(file.raw).then(function (bs64) {\n _this4.formDate = {\n file: bs64\n };\n if (flag) {\n // console.log(this.formDate,259)\n importFile(_this4.formDate).then(function (res) {\n if (res.returnCode == \"1\") {\n _this4.$message({\n message: res.returnMsg,\n type: \"success\"\n });\n console.log(res.returnData);\n res.returnData.forEach(function (item, index) {\n _this4.questionList[index].topIc = item.topIc;\n });\n // this.getlist();\n } else {\n _this4.$message({\n message: res.returnMsg,\n type: \"warning\"\n });\n }\n }).catch(function (err) {\n console.log(\"error\");\n });\n }\n });\n },\n bs64: function bs64(_bs) {\n var reader = new FileReader();\n reader.readAsDataURL(_bs);\n return new Promise(function (resolve) {\n reader.onload = function (e) {\n resolve(e.target.result);\n };\n });\n }\n }\n};",null]}