jinlin
2024-01-15 1a7af6fff5185bb257c16b0445140c93263a3331
web/src/views/modules/testCheckOrder/TestCheckOrder-AddOrUpdate.vue
@@ -47,7 +47,7 @@
                  <!--                    <el-input v-model="row.checkContent" placeholder="主要检查内容"></el-input>-->
                  <!--                  </template>-->
                </el-table-column>
                <el-table-column prop="checkResult" align="center" width="180" label="检查结果">
                <el-table-column prop="checkResult" align="center" width="200" label="检查结果">
                  <template v-slot="{ row }">
                    <zt-dict :disabled="stepMarker!=='csjcd_first'" v-model="row.checkResult" :dict="getDict"
                             :radio="true"></zt-dict>
@@ -121,193 +121,191 @@
    <template v-slot:footer>
      <el-button v-if="dataForm.disabled" type="primary" @click="print()">打印</el-button>
    </template>
    <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";
  import qs from "qs";
  import Cookies from "js-cookie";
export default {
  data() {
    return {
      pageCode: '',
      stepMarker: '',
      configDetailRow: null,
      subtitle: '',
      pageName: {
        plan: '软件测试计划', explain: '软件测试说明', record: '软件测试记录', report: '软件测试报告',
        contract: '合同评审阶段', require: '测试需求分析与策划'
      },
      dataForm: {
        id: '',
        projectId: '',
        project: {
          softwareIdentity: '',
          softwareName: '',
  export default {
    data() {
      return {
        pageCode: '',
        stepMarker: '',
        configDetailRow: null,
        subtitle: '',
        pageName: {
          plan: '软件测试计划', explain: '软件测试说明', record: '软件测试记录', report: '软件测试报告',
          contract: '合同评审阶段', require: '测试需求分析与策划阶段', execute: '测试设计与实现、执行阶段', summary: '测试总结阶段'
        },
        checkOrder: {
          code: '',
          examiner: '',
          examDate: '',
          problemDescription: '',
          problemProcess: '',
          processor: '',
          verifier: '',
        },
        checkOrderList: []
        dataForm: {
          id: '',
          projectId: '',
          project: {
            softwareIdentity: '',
            softwareName: '',
          },
          checkOrder: {
            code: '',
            examiner: '',
            examDate: '',
            problemDescription: '',
            problemProcess: '',
            processor: '',
            verifier: '',
          },
          checkOrderList: []
        }
      }
    }
  },
  computed: {
    getDict() {
      if (this.pageCode && (this.pageCode === 'plan' || this.pageCode === 'explain' || this.pageCode === 'record' || this.pageCode === 'report')) {
    },
    computed: {
      getDict() {
        if (this.pageCode && (this.pageCode === 'plan' || this.pageCode === 'explain' || this.pageCode === 'record' || this.pageCode === 'report')) {
          return 'tristate1'
        } else {
          return 'tristate2'
        }
      }
  },
  methods: {
    init(id, row) {
      this.configDetailRow = row
      if (row.checkId) {
        console.log('配置项入库审核进来的 TestCheckOrder-AddOrUpdate.vue init row.checkId')
        if (row.checkId != -1) {
          this.dataForm.id = row.checkId
        }
      } else if (id) {
        this.dataForm.id = id
      } else {
        this.dataForm.id = row.id
      }
      this.pageCode = row.pageCode
      this.subtitle = this.pageName[this.pageCode]
      if (row.projectId) {
        this.dataForm.projectId = row.projectId
      }
      if (this.configDetailRow) {
        if (!row.stepMarker) {
          this.stepMarker = 'csjcd_first'
          this.title = '发起测试检查单'
    },
    methods: {
      init(id, row) {
        this.configDetailRow = row
        if (row.checkId) {
          console.log('配置项入库审核进来的 TestCheckOrder-AddOrUpdate.vue init row.checkId')
          if (row.checkId != -1) {
            this.dataForm.id = row.checkId
          }
        } else if (id) {
          this.dataForm.id = id
        } else {
          this.title = row.stepName
          this.stepMarker = row.stepMarker
          this.dataForm.id = row.id
        }
      }
      //this.dataForm.disabled
      this.getInfo()
        this.pageCode = row.pageCode
        this.subtitle = this.pageName[this.pageCode]
      //console.log(this.dataForm.id, this.dataForm.projectId, this.stepMarker, 'this.dataForm.id, this.dataForm.projectId,this.stepMarker')
    },
    indexFormat(index) {
      return index += 1
    },
    // 获取信息
    async getInfo() {
      let params = {
        checkId: this.dataForm.id,
        projectId: this.dataForm.projectId,
        pageCode: this.pageCode
      }
      console.log(this.pageCode, "getInfo pageCode")
      let res = await this.$http.get(`/testCheckOrder/TestCheckOrder/getDto`, {params: params})
      this.dataForm = {
        ...this.dataForm,
        ...res.data
      }
      console.log(this.dataForm, 'this.dataForm this.dataForm')
    },
    async print() {
      var params = qs.stringify({
        token: Cookies.get('token'),
        id: this.dataForm.id,
        pageCode: this.pageCode
      })
      let apiURL = `/testCheckOrder/TestCheckOrder/exportCheckOrder`
      window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${params}`
    },
    // 表单提交
    async formSubmit(submitType) {
      let isFlow = false
      if (submitType == 'tj') {
        for (let item of this.dataForm.checkOrderList) {
          if (!item.checkResult) {
            this.$alert("有未填写的数据")
            return
          } else if (item.checkResult == "2") {
            isFlow = true
        if (row.projectId) {
          this.dataForm.projectId = row.projectId
        }
        if (this.configDetailRow) {
          if (!row.stepMarker) {
            this.stepMarker = 'csjcd_first'
            this.title = '发起测试检查单'
          } else {
            this.title = row.stepName
            this.stepMarker = row.stepMarker
          }
        }
        if (submitType == 'tj' && !isFlow) {
          submitType == ''
        //this.dataForm.disabled
        this.getInfo()
        //console.log(this.dataForm.id, this.dataForm.projectId, this.stepMarker, 'this.dataForm.id, this.dataForm.projectId,this.stepMarker')
      },
      indexFormat(index) {
        return index += 1
      },
      // 获取信息
      async getInfo() {
        let params = {
          checkId: this.dataForm.id,
          projectId: this.dataForm.projectId,
          pageCode: this.pageCode
        }
      }
      if (submitType == 'bl') {
        isFlow = true
      }
      if (submitType == 'tj' && isFlow || submitType == 'bl' && isFlow) {
        let flowInfo = {
          flowCode: 'csjcd',
          stepIdMark: this.stepMarker,
          submitType: submitType
        console.log(this.pageCode, "getInfo pageCode")
        let res = await this.$http.get(`/testCheckOrder/TestCheckOrder/getDto`, {params: params})
        this.pageCode = res.data.checkOrder.pageCode
        this.dataForm = {
          ...this.dataForm,
          ...res.data
        }
        this.dataForm.flowInfoDto = flowInfo;
      }
      console.log(this.dataForm, "this.dataForm formSubmit(submitType)")
      let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/testCheckOrder/TestCheckOrder/', this.dataForm)
      if (res.success) {
        await this.$tip.success()
        this.$refs.dialog.close()
        this.$emit('recall', res.data, this.configDetailRow)
        this.$emit('refreshDataList')
        console.log(this.dataForm, 'this.dataForm this.dataForm')
      },
      async print() {
        var params = qs.stringify({
          token: Cookies.get('token'),
          id: this.dataForm.id,
          pageCode: this.pageCode
        })
        let apiURL = `/testCheckOrder/TestCheckOrder/exportCheckOrder`
        window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${params}`
      },
      // 表单提交
      async formSubmit(submitType) {
        let isFlow = false
        if (submitType == 'tj') {
          for (let item of this.dataForm.checkOrderList) {
            if (!item.checkResult) {
              this.$alert("有未填写的数据")
              return
            } else if (item.checkResult == "2") {
              isFlow = true
            }
          }
          if (submitType == 'tj' && !isFlow) {
            submitType == ''
          }
        }
        if (submitType == 'bl') {
          isFlow = true
        }
        if (submitType == 'tj' && isFlow || submitType == 'bl' && isFlow) {
          let flowInfo = {
            flowCode: 'csjcd',
            stepIdMark: this.stepMarker,
            submitType: submitType
          }
          this.dataForm.flowInfoDto = flowInfo;
        }
        console.log(this.dataForm, "this.dataForm formSubmit(submitType)")
        let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/testCheckOrder/TestCheckOrder/', this.dataForm)
        if (res.success) {
          await this.$tip.success()
          this.$refs.dialog.close()
          this.$emit('recall', res.data, this.configDetailRow)
          this.$emit('refreshDataList')
        }
      }
    }
  }
}
</script>
<style>
.el-flexCirculationDialog {
  display: flex;
  align-items: center
}
  .el-flexCirculationDialog {
    display: flex;
    align-items: center
  }
.testCheckFormAuto .acceptDate > .el-form-item > .el-form-item__content {
  width: 100%;
}
  .testCheckFormAuto .acceptDate > .el-form-item > .el-form-item__content {
    width: 100%;
  }
.testCheckFormAuto .acceptDate1 > .el-form-item > .el-form-item__content {
  width: 100%;
}
  .testCheckFormAuto .acceptDate1 > .el-form-item > .el-form-item__content {
    width: 100%;
  }
.testCheckFormAuto .marginTopAndMarginBottom {
  margin-top: 10px !important;
  margin-bottom: 0 !important;
}
  .testCheckFormAuto .marginTopAndMarginBottom {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
  }
.testCheckFormAuto .marginTopAndMarginBottom2 {
  margin-top: -10px !important;
  margin-bottom: 10px !important;
}
  .testCheckFormAuto .marginTopAndMarginBottom2 {
    margin-top: -10px !important;
    margin-bottom: 10px !important;
  }
.testCheckFormAuto .marginTopAndMarginBottom3 {
  margin-top: 0 !important;
  margin-bottom: 10px !important;
}
  .testCheckFormAuto .marginTopAndMarginBottom3 {
    margin-top: 0 !important;
    margin-bottom: 10px !important;
  }
.testCheckFormAuto .acceptDate > .el-form-item > .el-form-item__content {
  line-height: 78px;
}
  .testCheckFormAuto .acceptDate > .el-form-item > .el-form-item__content {
    line-height: 78px;
  }
.testCheckContentWidth > .el-form-item > .el-form-item__content {
  width: calc(100% - 120px);
}
  .testCheckContentWidth > .el-form-item > .el-form-item__content {
    width: calc(100% - 120px);
  }
.testCheckFormAuto .el-radio {
  margin-right: 10px;
}
  .testCheckFormAuto .el-radio {
    margin-right: 10px;
  }
</style>