patrolDetails.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view>
  3. <view
  4. style="box-shadow: 0px 0px 8px 0px rgba(165, 189, 251, 0.4);width: 96%;border-top-right-radius: 10rpx;margin: 10rpx auto;padding-top: 10rpx;">
  5. <span
  6. style="width: 10rpx;height: 40rpx;background-color: #2979ff;display: block;float: left;margin-top: 20rpx;"></span>
  7. <!-- <h4 style="width: 140rpx;border-radius: 200rpx;text-align: center;color: #2979ff;border: 2rpx solid #1785FF;float: right;margin-right: 10rpx;margin-top: 10rpx;">2222222</h4> -->
  8. <view style="width: 92%;margin: 0 auto;margin: 0 auto;">
  9. <view
  10. style="display: flex;justify-content: space-between;height: 80rpx;line-height: 80rpx;border-bottom: 1rpx solid #eff4ff;">
  11. <h3>基本信息</h3>
  12. </view>
  13. <view>
  14. <view style="width: 100%;height: 60rpx;line-height: 60rpx;">
  15. <view style="float: left;">仓库</view>
  16. <view style="float: right;">{{form.fWarehouseName}}</view>
  17. </view>
  18. <view style="width: 100%;height: 60rpx;line-height: 60rpx;">
  19. <view style="float: left;">计划日期</view>
  20. <view style="float: right;">{{form.fInspectionDatetime}}</view>
  21. </view>
  22. <view style="width: 100%;height: 60rpx;line-height: 60rpx;">
  23. <view style="float: left;">最新巡查日期</view>
  24. <view style="float: right;">{{form.fUpdateTime}}</view>
  25. </view>
  26. <view style="width: 100%;height: 60rpx;line-height: 60rpx;">
  27. <view style="float: left;">巡检员</view>
  28. <view style="float: right;">{{form.fInspectorName}}</view>
  29. </view>
  30. <view style="width: 100%;height: 60rpx;line-height: 60rpx;">
  31. <view style="float: left;">备注</view>
  32. <view style="float: right;">{{form.fRemark}}</view>
  33. </view>
  34. </view>
  35. <!-- <view style="width: 100%;margin: 0 auto;height: 80rpx;margin: 0 auto;line-height: 80rpx;border-top: 1rpx solid #eff4ff;" @click="expenseDetails(item)">
  36. <view style="float: left;"><h3>立即巡检</h3></view>
  37. <view style="float: right;"><u-icon name="arrow-right"></u-icon></view>
  38. </view> -->
  39. </view>
  40. </view>
  41. <view
  42. style="box-shadow: 0px 0px 8px 0px rgba(165, 189, 251, 0.4);width: 96%;border-top-right-radius: 10rpx;margin: 10rpx auto;padding-top: 10rpx;">
  43. <span
  44. style="width: 10rpx;height: 40rpx;background-color: #2979ff;display: block;float: left;margin-top: 20rpx;"></span>
  45. <!-- <h4 style="width: 140rpx;border-radius: 200rpx;text-align: center;color: #2979ff;border: 2rpx solid #1785FF;float: right;margin-right: 10rpx;margin-top: 10rpx;">2222222</h4> -->
  46. <view style="width: 92%;margin: 0 auto;margin: 0 auto;">
  47. <view
  48. style="display: flex;justify-content: space-between;height: 80rpx;line-height: 80rpx;border-bottom: 1rpx solid #eff4ff;">
  49. <h3>{{deptName == '外部用户'?fileList.length == 0?'暂无附件':'附件':'上传附件'}}</h3>
  50. </view>
  51. <view>
  52. <u-upload style="width: 100%;" :action="action" @on-success="success" @on-remove="remove" :file-list="fileList" :header="headers" :deletable="deptName == '外部用户'?false:true" :max-count="deptName == '外部用户'?fileList.length:99"></u-upload>
  53. </view>
  54. </view>
  55. </view>
  56. <view
  57. style="width: 100%;position:fixed; bottom:0;background-color: #FFFFFF;padding-left: 20px;padding-right: 20px;padding-bottom: 30rpx;">
  58. <u-button type="primary" @click="submit" v-if="deptName != '外部用户'">确认保存</u-button>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. export default {
  64. data() {
  65. return {
  66. action: this.$u.http.config.baseUrl + '/common/upload',
  67. headers: {
  68. Authorization: 'Bearer ' + this.$store.state.vuex_token
  69. },
  70. form: {},
  71. deptName:'',
  72. fileList: [],
  73. pictureEist: [],
  74. twarehousecheckdetailList: {}
  75. }
  76. },
  77. onLoad(option) {
  78. this.deptName = uni.getStorageSync('deptName')
  79. this.form = JSON.parse(option.form)
  80. let scope = {
  81. row:JSON.parse(option.form)
  82. }
  83. this.$u.get(this.deptName != '外部用户'?'/warehouse/checkitemsdetails/list':'/warehouse/checkitemsdetails/appList', {
  84. fItemFid: this.form.fId
  85. }).then(res => {
  86. console.log(res)
  87. let data = res.rows
  88. if (data.length === 0) {
  89. this.twarehousecheckdetailList = {
  90. fCheckFid: scope.row.fCheckFid,
  91. fItemFid: scope.row.fId,
  92. fWarehouseid: scope.row.fWarehouseFid, //仓库名称
  93. fCreateTime: '',
  94. fInspectorid: '',
  95. fRemark: '',
  96. fPhotoUrl: []
  97. }
  98. } else {
  99. this.twarehousecheckdetailList = res.rows[0]
  100. this.twarehousecheckdetailList.fWarehouseid = scope.row.fWarehouseFid
  101. this.fileList = []
  102. for (let item in JSON.parse(res.rows[0].fPhotoUrl)) {
  103. this.fileList.push(JSON.parse(res.rows[0].fPhotoUrl)[item])
  104. }
  105. this.pictureEist = this.fileList
  106. }
  107. })
  108. },
  109. created() {},
  110. methods: {
  111. submit() {
  112. // console.log(this.twarehousecheckdetailList)
  113. // console.log(this.fileList)
  114. // console.log(this.pictureEist)
  115. this.twarehousecheckdetailList.fPhotoUrl = []
  116. for (let item in this.pictureEist) {
  117. if (this.pictureEist[item].response) {
  118. this.twarehousecheckdetailList.fPhotoUrl.push({
  119. url: this.pictureEist[item].response.url
  120. })
  121. } else {
  122. this.twarehousecheckdetailList.fPhotoUrl.push({
  123. url: this.pictureEist[item].url
  124. })
  125. }
  126. }
  127. this.twarehousecheckdetailList.fPhotoUrl = JSON.stringify(this.twarehousecheckdetailList.fPhotoUrl)
  128. if (!this.twarehousecheckdetailList.fId) {
  129. this.$u.post('warehouse/checkitemsdetails', this.twarehousecheckdetailList).then(res => {
  130. uni.showToast({
  131. icon: 'none',
  132. title: '保存成功',
  133. position: "bottom"
  134. })
  135. })
  136. } else {
  137. this.$u.put('warehouse/checkitemsdetails', this.twarehousecheckdetailList).then(res => {
  138. uni.showToast({
  139. icon: 'none',
  140. title: '保存成功',
  141. position: "bottom"
  142. })
  143. })
  144. }
  145. },
  146. success(data, index, lists, name) {
  147. // console.log(lists)
  148. this.pictureEist = lists
  149. },
  150. remove(index, lists, name) {
  151. // console.log(index,lists)
  152. this.pictureEist = lists
  153. }
  154. }
  155. }
  156. </script>
  157. <style>
  158. </style>