vue的pythonflask方式前后台交互在新医保的实战

vue

<template>
  <div>

    <el-form :inline="true"
             :model="formInline"
             class="demo-form-inline">
      <el-select v-model="formInline.pyaction"
                 placeholder="请选择">
        <el-option v-for="item in mypyaction"
                   :key="item.jobname"
                   :label="item.jobdesc"
                   :value="item.jobname">
        </el-option>
      </el-select>

      <el-form-item label="被合并人psnno">
        <el-input v-model="formInline.oldpsnno"
                  placeholder="被合并人psnno"></el-input>
      </el-form-item>
      <el-form-item label="合并到psnno">
        <el-input v-model="formInline.newpsnno"
                  placeholder="合并到psnno"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary"
                   @click="pysend(formInline)">开始测试</el-button>
      </el-form-item>
    </el-form>

    <ul>
      <li v-for="g in my_value"
          :key="g">{{g}}</li>
    </ul>

  </div>
</template>

<style>
* {
  margin-bottom: 0px;
  margin-top: 0px;
}
.dataxsend {
  background-color: rgb(214, 243, 205);
  font-size: 12px;
}
.dataxget {
  height: 200pt;
  background-color: rgb(224, 217, 240);
}
.dataxbutton {
  margin-left: 100 px;
}
</style>
 

<script>
export default {
  data () {
    return {
      mypyaction: [
        { jobname: 'test', jobdesc: '连接测试' },
        { jobname: 'certno2psnno', jobdesc: '身份证查人' },
        { jobname: 'psnnoquery', jobdesc: 'psnno查人' },
        { jobname: 'hebing', jobdesc: '合并同身份证' },
        { jobname: 'hebingnocheck', jobdesc: '合并不同身份证' },
        { jobname: 'hbrollback', jobdesc: '合并回滚' }],
      formInline: {
        pyaction: '',
        oldpsnno: '',
        newpsnno: ''
      },

      my_value: []
    }
  },
  methods: {
    onSubmit () {
      console.log('submit!')
    }, pysend (data) {
      console.log('pydo called', data.pyaction)
      if (!data.newpsnno || !data.oldpsnno) {
        console.log('无参数')
        this.$message({
          type: 'error',
          message: '无参数'
        })
        return -1
      }
      this.$confirm(
        '此操作将永久操作【' +
        data.oldpsnno +
        '】【' +
        data.newpsnno +
        '】, 是否继续?',
        '提示',
        {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }
      )
        .then(() => {
          if (!data.newpsnno) {
            data.newpsnno = data.oldpsnno
          }

          this.getRequest(
            '/do/' + data.pyaction + '/' + data.oldpsnno + '/' + data.newpsnno
          ).then(resp => {
            if (resp) {
              // console.log(this)
              console.log('pydo succ', resp.data.loginfo)

              this.my_value = resp.data.loginfo
            }
          })
        })
        .catch(err => {
          console.log('pydo err', err)
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
    }

  }
}
</script>

上一篇:学习TypeScript25(TS进阶用法Record & Readonly)


下一篇:Spark Core简介