{"remainingRequest":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xypm-web\\src\\components\\ImportExportData\\ImportFile.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\src\\components\\ImportExportData\\ImportFile.vue","mtime":1679946713780},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\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//\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\r\nimport projectContractSelector from '@/components/selector/ProjectContractSelector.vue'\r\nimport PriceLimitDialog from '@/components/dialog/PriceLimitDialog.vue'\r\nimport req from '@/request.js'\r\nimport HtFormItem from '../control/HtFormItem.vue'\r\nexport default {\r\n  name: 'importFile',\r\n  components: {projectContractSelector, PriceLimitDialog},\r\n  props: {\r\n    importData: {\r\n      type: Object,\r\n      default: () => {\r\n        return []\r\n      }\r\n    }\r\n  },\r\n  data() {\r\n    return {\r\n      options:[],\r\n      disabled: false,\r\n      form: {},\r\n      importDataParams: {},\r\n      dialogImportVisible: false,\r\n      fullscreenLoading: false,\r\n    }\r\n  },\r\n  created () {\r\n    console.log(this.importData,'importData');\r\n    if(this.importData.title=='年度计划导入'){\r\n      this.importData.showProject = false\r\n    }\r\n  },\r\n  computed: {\r\n    uploadHeaders: function() {\r\n      return {\r\n        Authorization:\r\n          this.$store.state.login.currentUser &&\r\n          'Bearer ' + this.$store.state.login.currentUser.token\r\n      }\r\n    }\r\n  },\r\n  // watch:{\r\n  //    importDataParams(){\r\n  //      return this.importDataParams=this.importData\r\n  //    }\r\n  // },\r\n  methods: {\r\n    //打开清单名称\r\n    handleFocusPriceLimit() {\r\n      this.$refs.price.open(this.form.projectId)\r\n    },\r\n    //获取清单\r\n    handleSelectPrice(data) {\r\n      this.form = {\r\n        projectId: this.form.projectId,\r\n        priceLimitId: data.id,\r\n        priceLimitName: data.name\r\n      }\r\n    },\r\n    // selectContract(cid, obj) {\r\n    //   this.form.contractId = cid\r\n    //   this.form.contractName = obj.name\r\n    // },\r\n    changeContrant(val){\r\n      this.form.contractId=val\r\n      this.options.forEach(item => {\r\n        if(item.id==val){\r\n          this.form.contractName = item.name\r\n        }\r\n      });\r\n    },\r\n    // changed(pid) {\r\n    //   this.form.projectId = pid\r\n    //   this.$refs.contract.getProjectData(this.importData.projectId)\r\n    //   if (this.importData.showContract) {\r\n    //     this.$refs.contract.contractId = ''\r\n    //     this.$refs.contract.getProjectData(pid)\r\n    //   }\r\n    // },\r\n    openDialog() {\r\n      this.dialogImportVisible = true\r\n      // if(this.importData.projectId && this.importData.contractId){\r\n      //   this.form = {\r\n      //     projectId: this.importData.projectId,\r\n      //     contractId: this.importData.contractId\r\n      //   }\r\n      // }else if (this.importData.projectId) {\r\n      //   this.form = {\r\n      //     projectId: this.importData.projectId\r\n      //   }\r\n      // } else if (this.importData.contractId) {\r\n      //   this.form = {\r\n      //     contractId: this.importData.contractId\r\n      //   }\r\n      // }\r\n      this.form = {\r\n          projectId: this.importData.projectId,\r\n          contractId: this.importData.contractId,\r\n          contractName: this.form.contractName,\r\n          title:this.importData.title\r\n        }\r\n        if(this.importData.showContract){\r\n          this.getProjectData(this.importData.projectId)\r\n        }\r\n    },\r\n     getProjectData(val) {\r\n      let param={\r\n    pageBean: {\r\n\t\tpage: 1,\r\n\t\tpageSize: -1,\r\n\t\tshowTotal: true\r\n\t},\r\n  \tquerys: [\r\n\t\t{\r\n\t\t\tgroup: \"main\",\r\n\t\t\toperation: \"EQUAL\",\r\n\t\t\tparentGroup: \"\",\r\n\t\t\tproperty: \"pm.ID_\",\r\n\t\t\trelation: \"AND\",\r\n\t\t\tvalue: val\r\n\t\t}\r\n\t],\r\n      }\r\n      //  let param = {\r\n      //   'pm.ID_': val.projectId,\r\n      //   register_date_: this.searchForm.registerDate,\r\n      //   register_person_name_: this.searchForm.registerPersonName,\r\n      // }\r\n\r\n      this.$http.post('${cqxy}/biz/contract/v1/page',param).then(res => {\r\n        let resp= res.data.value.rows  \r\n        let newArr=[]\r\n        resp.forEach(item=>{\r\n          let obj=item.contract\r\n          newArr.push(obj)\r\n        })\r\n        this.options=newArr\r\n      })\r\n    },\r\n    cancelConfirm() {\r\n      this.$refs.upload.clearFiles()\r\n      this.dialogImportVisible = false\r\n      this.$refs.upload.uploadFiles = []\r\n    },\r\n    submitImport() {\r\n      console.log(this.importData.showProject,'this.importData.showProject');\r\n      if (\r\n        !this.$refs.upload.uploadFiles ||\r\n        this.$refs.upload.uploadFiles.length == 0\r\n      ) {\r\n        this.$message.warning('请选择要导入的数据文件!')\r\n        return false\r\n      }\r\n       else if (\r\n        this.importData.showProject == true &&\r\n        (this.form.projectId == '' || this.form.projectId == undefined)\r\n      ) {\r\n        this.$message.warning('请选择一条项目')\r\n        return false\r\n      }\r\n      else if(this.importData.showContract && this.form.contractId==''){\r\n        this.$message.warning('请选择一条合同')\r\n         return false\r\n      }\r\n      else if (\r\n        this.importData.showPriceName == true &&\r\n        this.form.priceLimitId == ''\r\n      ) {\r\n        this.$message.warning('请选择一条清单信息')\r\n        return false\r\n      }\r\n      this.$refs.upload.submit()\r\n      // this.form.projectId = ''\r\n      // this.form.contractId = ''\r\n      // this.form.priceLimitId = ''\r\n      // this.form.priceLimitName = ''\r\n    },\r\n    hadleUploadResult(response) {\r\n      this.fullscreenLoading = false\r\n      if (response.state) {\r\n        this.$message.success(response.message)\r\n        this.dialogImportVisible = false\r\n        // this.$parent.$refs.AtTable.load()\r\n        this.$emit('load', response.value)\r\n      } else {\r\n        this.$message.error(response.message)\r\n      }\r\n    },\r\n    onExceed() {\r\n      this.$message.warning('只能选择一个Excel文件!')\r\n    },\r\n    beforeUpload(file) {\r\n      this.fileInfo = file\r\n      if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.xls')) {\r\n        this.$message.warning('只能导入Excel文件!')\r\n        return false\r\n      }\r\n      this.fullscreenLoading = true\r\n    }\r\n  }\r\n}\r\n",null]}