faultAdd.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="故障信息"
  4. @clickLeft="back">
  5. </uni-nav-bar>
  6. <u-cell-group>
  7. <u-cell title="故障类型" arrow-direction="down">
  8. <uni-data-picker v-model="form.type" slot="value" placeholder="请选择" :localdata="typeOptions"
  9. @change="sourceCodeOnchange">
  10. </uni-data-picker>
  11. </u-cell>
  12. <u-cell title="故障现象" arrow-direction="down">
  13. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.faultPhenomenon"></u--input>
  14. </u-cell>
  15. <u-cell title="故障原因" arrow-direction="down">
  16. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.faultReason"></u--input>
  17. </u-cell>
  18. <u-cell title="维修过程" arrow-direction="down">
  19. <u--input slot="value" placeholder="请输入" border="surround" v-model="form.maintenanceProcess"></u--input>
  20. </u-cell>
  21. <view class="footerButton">
  22. <u-button type="default" text="返回" @click="back"></u-button>
  23. <u-button type="primary" @click="save" text="保存"></u-button>
  24. </view>
  25. </u-cell-group>
  26. <u-toast ref="uToast"></u-toast>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. components: {},
  32. data() {
  33. return {
  34. form: {
  35. type: '',
  36. faultPhenomenon: '',
  37. faultReason: '',
  38. maintenanceProcess: '',
  39. },
  40. type: '',
  41. infoIdx:'',
  42. typeOptions: [{
  43. text: '维修',
  44. value: '1'
  45. },
  46. {
  47. text: '保养',
  48. value: '2'
  49. },
  50. {
  51. text: '安装',
  52. value: '3'
  53. }
  54. ],
  55. }
  56. },
  57. async onLoad(data) {
  58. this.infoIdx = data.index;
  59. this.type = data.type
  60. if (data.data) {
  61. this.form = JSON.parse(data.data)
  62. }
  63. },
  64. methods: {
  65. save() {
  66. if (!this.form.type) {
  67. this.$refs.uToast.show({
  68. type: "warning",
  69. message: "故障类型不能为空",
  70. })
  71. return
  72. }
  73. if (!this.form.faultPhenomenon) {
  74. this.$refs.uToast.show({
  75. type: "warning",
  76. message: "故障现象不能为空",
  77. })
  78. return
  79. }
  80. uni.$emit('updateFaultList', {
  81. data: this.form,
  82. type: this.type,
  83. index:this.infoIdx
  84. })
  85. this.back()
  86. },
  87. sourceCodeOnchange(e){
  88. console.log(e);
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. /deep/.u-cell__body__content {
  95. flex: none;
  96. margin-right: 16rpx;
  97. }
  98. .mainBox {
  99. padding-bottom: 84rpx;
  100. }
  101. .footerButton {
  102. width: 100%;
  103. height: 84rpx;
  104. display: flex;
  105. position: fixed;
  106. bottom: 0;
  107. /deep/.u-button {
  108. height: 100%;
  109. }
  110. >view {
  111. flex: 1;
  112. }
  113. }
  114. // /deep/.u-button {
  115. // height: 100%;
  116. // }
  117. /deep/.u-subsection__item__text {
  118. font-size: 28rpx !important;
  119. }
  120. </style>