riskPiontForm.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="risk-Form">
  3. <uni-forms :modelValue="formData" label-width="120">
  4. <uni-forms-item label="检查结果" name="cardNo">
  5. <div class="check-result">
  6. <div class="tag-item" @click="inspectResultChange(1)" :class="form.checkResult===1?'active':''">通过</div>
  7. <div class="tag-item" @click="inspectResultChange(-1)" :class="form.checkResult===-1?'active':''">不通过</div>
  8. <div class="tag-item" @click="inspectResultChange(0)" :class="form.checkResult===0?'active':''">不涉及</div>
  9. </div>
  10. </uni-forms-item>
  11. <uni-forms-item name="remark" label="说明">
  12. <uni-easyinput type="textarea" autoHeight v-model="form.checkDesc" placeholder="请输入说明信息" trim="all"></uni-easyinput>
  13. </uni-forms-item>
  14. </uni-forms>
  15. <button class="submit-BT" type="primary" @click="submit">提交</button>
  16. </view>
  17. </template>
  18. <script>
  19. import { updateCheckTaskDoingItem } from '@/api/system/checkTaskDoingApi.js'
  20. export default {
  21. name:"riskPiontForm",
  22. data(){
  23. return{
  24. fileList:[],
  25. form:{
  26. taskId: undefined,
  27. checkRecordId: undefined,
  28. checkResult: 1,
  29. checkDesc: '',
  30. dangerId: undefined,
  31. attachList: []
  32. }
  33. }
  34. },
  35. methods:{
  36. inspectResultChange(result){
  37. this.form.checkResult=result
  38. },
  39. submit(){
  40. const taskId=this.taskId
  41. const checkRecordId=this.checkRecordId
  42. let form={
  43. taskId: taskId,
  44. checkRecordId: checkRecordId,
  45. checkResult:this.form.checkResult,
  46. checkDesc:this.form.checkDesc,
  47. dangerId:this.form.dangerId,
  48. attachList:this.form.attachList
  49. }
  50. if(this.form.checkResult===-1){
  51. if(this.isEmpty(this.form.checkDesc)){
  52. uni.showToast({
  53. icon:'none',
  54. title: '请填写不通过理由'
  55. });
  56. return
  57. }
  58. }
  59. updateCheckTaskDoingItem(form).then(()=>{
  60. uni.showToast({
  61. icon:'none',
  62. title: '提交成功!'
  63. });
  64. })
  65. },
  66. validate(callback){
  67. var rulesKeys=Object.keys(this.rules)
  68. for(let i=0;i<rulesKeys.length;i++){
  69. if(this.isEmpty(this.form[rulesKeys[i]])){
  70. uni.showToast({
  71. icon:'none',
  72. title: this.rules[rulesKeys[i]][0].message||'请检查表单'
  73. });
  74. return false
  75. }
  76. }
  77. callback()
  78. },
  79. isEmpty(val){
  80. if(val!==undefined&&val!=="undefined"&&val!==null&&val!==""){
  81. return false
  82. }
  83. return true
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. .risk-Form{
  90. padding: 20rpx;
  91. .check-result{
  92. &{
  93. display: flex;
  94. justify-content: flex-start;
  95. flex-wrap: wrap;
  96. }
  97. .tag-item{
  98. width: 180rpx;
  99. height: 64rpx;
  100. background: #E5E5E5;
  101. border-radius: 4px;
  102. font-size: 32rpx;
  103. font-family: PingFang SC;
  104. font-weight: 500;
  105. color: #555555;
  106. text-align: center;
  107. line-height: 64rpx;
  108. margin-right: 20rpx;
  109. margin-bottom: 33rpx;
  110. &.active{
  111. background: #11C786;
  112. color: #fff;
  113. }
  114. }
  115. }
  116. .submit-BT{
  117. color: #fff;
  118. background-color: #007aff !important;
  119. margin-top: 60upx;
  120. }
  121. }
  122. </style>