planDetail.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view>
  3. <form action="" >
  4. <view style="height:30rpx"></view>
  5. <view class="form-item ">
  6. <view class="title">
  7. <text class="necessary">*</text>
  8. 上报名称:
  9. </view>
  10. <input type="text">
  11. </view>
  12. <view class="form-item margin-top">
  13. <view class="title">
  14. <text class="necessary">*</text>
  15. 维保状态:
  16. </view>
  17. <radio-group name="gender" @change="radioChange">
  18. <label class="margin-right-xs">
  19. <radio value="2" checked /><text>正常</text>
  20. </label>
  21. <label class="margin-right-xs">
  22. <radio value="3" /><text>异常</text>
  23. </label>
  24. <label class="margin-right-xs">
  25. <radio value="2" /><text>故障</text>
  26. </label>
  27. <label>
  28. <radio value="3" /><text>其他</text>
  29. </label>
  30. </radio-group>
  31. </view>
  32. <view class="form-item margin-top">
  33. <view class="title">
  34. <text class="necessary">*</text>
  35. 上传图片:
  36. </view>
  37. <view style="width:500rpx">
  38. <view class="cu-form-group">
  39. <view class="grid col-4 grid-square flex-sub">
  40. <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
  41. <image :src="imgList[index]" mode="aspectFill"></image>
  42. <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
  43. <text class='cuIcon-close'></text>
  44. </view>
  45. </view>
  46. <view class="solids" @tap="ChooseImage" v-if="imgList.length<4">
  47. <text class='cuIcon-cameraadd'></text>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="form-item margin-top">
  54. <view class="title">
  55. <text class="necessary">*</text>
  56. 维保描述:
  57. </view>
  58. <textarea maxlength="-1" @input="textareaAInput" placeholder="" width="250"></textarea>
  59. </view>
  60. <view class="btn-area submitBottomBtn padding-lr-sm">
  61. <button class="bg-blue round margin-top" @click="addSubmit">提 交 </button>
  62. </view>
  63. </form>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. data() {
  69. return {
  70. imgList: [],
  71. }
  72. },
  73. methods: {
  74. radioChange(e) {
  75. console.log('type:' + e.detail.value);
  76. this.radioOne = e.detail.value;
  77. },
  78. ChooseImage() {
  79. uni.chooseImage({
  80. count: 4, //默认9
  81. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  82. sourceType: ['album'], //从相册选择
  83. success: (res) => {
  84. if (this.imgList.length != 0) {
  85. this.imgList = this.imgList.concat(res.tempFilePaths)
  86. } else {
  87. this.imgList = res.tempFilePaths
  88. }
  89. }
  90. });
  91. },
  92. ViewImage(e) {
  93. uni.previewImage({
  94. urls: this.imgList,
  95. current: e.currentTarget.dataset.url
  96. });
  97. },
  98. DelImg(e) {
  99. uni.showModal({
  100. title: '删除',
  101. content: '确定要删除此图片吗?',
  102. cancelText: '取消',
  103. confirmText: '确定',
  104. success: res => {
  105. if (res.confirm) {
  106. this.imgList.splice(e.currentTarget.dataset.index, 1)
  107. }
  108. }
  109. })
  110. },
  111. }
  112. }
  113. </script>
  114. <style lang="scss">
  115. </style>