6
jinlin
2023-12-03 c8d8a511f45c96ed3a5123a88e48de2ffdbf632a
web/src/views/modules/project/Environ-AddOrUpdate.vue
@@ -211,10 +211,16 @@
        </div>
      </div>
    </el-form>
    <template v-slot:footer>
      <el-button v-if="dataForm.disabled" type="primary" @click="print()">打印</el-button>
    </template>
  </zt-dialog>
</template>
<script>
  import qs from "qs";
  import Cookies from "js-cookie";
  export default {
    data() {
      return {
@@ -251,11 +257,11 @@
    },
    methods: {
      init(id, row) {
        console.log(row, 'row')
        this.dataForm.id = row.id
        this.dataForm.projectId = row.projectId
        // this.dataForm.disabled
        this.dataForm.disabled
        this.getInfo()
        this.getImageUrl()
        console.log(this.dataForm.id, this.dataForm.projectId, 'params params')
      },
      // 获取信息
@@ -265,11 +271,13 @@
          projectId: this.dataForm.projectId
        }
        let res = await this.$http.get(`/project/Environ/getDto`, {params: params})
        if (res.data) {
        this.dataForm = {
          ...this.dataForm,
          ...res.data
        }
        console.log(this.dataForm, 'this.dataForm')
          this.getImageUrl()
        }
      },
      indexFormat(index) {
        return index += 1
@@ -296,7 +304,7 @@
        })
      },
      getImageUrl() {
        let pictureId = this.getFirstImageId(this.dataForm.files, 'test_environt_diagram')
         let pictureId = this.getFirstImageId(this.dataForm.files)
        this.dataForm.url = `${window.SITE_CONFIG['apiURL']}/sys/oss/content2?fileId=${pictureId}`
        console.log(this.dataForm.url, ' this.dataForm.url')
      },
@@ -317,6 +325,15 @@
        }
        return fileId
      },
      async print() {
        console.log(this.dataForm)
        let params = qs.stringify({
          token: Cookies.get('token'),
          id: this.dataForm.id
        })
        let apiURL = `/project/Environ/exportEnviron/`
        window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${params}`
      },
      // 表单提交
      async formSubmit() {
        let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/project/Environ/', this.dataForm)