tearOldPipe.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="background">
  3. <view class="uni-list">
  4. <view class="container">
  5. <view>
  6. 小区
  7. </view>
  8. <view class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('xq')">
  9. <span>{{attributeXQ}}</span>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="uni-list">
  14. <view class="container">
  15. <view class="uni-list-cell-left">
  16. 楼栋
  17. </view>
  18. <view class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('ld')">
  19. <span>{{attributeLD}}</span>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="uni-list" style="margin-top: 10;">
  24. <view class="container">
  25. <view class="uni-list-cell-left">
  26. 单元
  27. </view>
  28. <view class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('dy')">
  29. <span>{{attributeDY}}</span>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="uni-list">
  34. <view class="container">
  35. <view class="uni-list-cell-left">
  36. 房间
  37. </view>
  38. <view class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('fj')">
  39. <span>{{attributeFJ}}</span>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="container">
  44. <view class="title">是否按照施工图纸施工</view>
  45. <switch checked @change="switch2Change" />
  46. </view>
  47. <SelectPicker :list="selectList" @change="changeSelect" v-if="open" @close="close" titleKey="name"
  48. subtitleKey="id" v-model="name"></SelectPicker>
  49. </view>
  50. </template>
  51. <script>
  52. import SelectPicker from '../../../components/selectPicker/select_picker.vue'
  53. import {
  54. getAreaList,
  55. getBuildingList,
  56. getUnitList,
  57. getHousesList
  58. } from '@/api/common'
  59. export default {
  60. components: {
  61. SelectPicker
  62. },
  63. data() {
  64. return {
  65. type: '',
  66. open: false,
  67. selectList: [],
  68. XQValue: {},
  69. LDValue: {},
  70. DYValue: {},
  71. FJValue: {},
  72. XQList: '',
  73. index: 0,
  74. address: null,
  75. title: 'picker',
  76. transformerValue: '请选择楼栋',
  77. LDList: '',
  78. DYList: '',
  79. FJList: '',
  80. }
  81. },
  82. created() {
  83. getAreaList().then(res => {
  84. this.XQList = res;
  85. })
  86. },
  87. onLoad() {
  88. uni.setNavigationBarTitle({
  89. title: '旧改工程-室内'
  90. })
  91. },
  92. computed: {
  93. attributeXQ() {
  94. return this.XQValue.name ? this.XQValue.name : "请选择小区"
  95. },
  96. attributeLD() {
  97. return this.LDValue.name ? this.LDValue.name : "请选择楼栋"
  98. },
  99. attributeDY() {
  100. return this.DYValue.name ? this.DYValue.name : "请选择单元"
  101. },
  102. attributeFJ() {
  103. return this.FJValue.name ? this.FJValue.name : "请选择房间"
  104. }
  105. },
  106. methods: {
  107. //判断是否选择
  108. isEmpty(str) {
  109. return (!str || 0 === str.length);
  110. },
  111. pickerShow(e) {
  112. this.type = e; //赋值类型
  113. if (e == 'xq') {
  114. this.open = true;
  115. this.selectList = this.XQList;
  116. } else if (e == 'ld') {
  117. if (this.isEmpty(this.XQValue.id)) {
  118. uni.showToast({
  119. title: '请选择小区',
  120. icon: 'error',
  121. duration: 1000
  122. });
  123. } else {
  124. this.open = true;
  125. this.selectList = this.LDList;
  126. }
  127. } else if (e == 'dy') {
  128. if (this.isEmpty(this.LDValue.id)) {
  129. uni.showToast({
  130. title: '请选择楼栋',
  131. icon: 'error',
  132. duration: 1000
  133. });
  134. } else {
  135. this.open = true;
  136. this.selectList = this.DYList;
  137. }
  138. } else if (e == 'fj') {
  139. if (this.isEmpty(this.DYValue.id)) {
  140. uni.showToast({
  141. title: '请选择单元',
  142. icon: 'error',
  143. duration: 1000
  144. });
  145. } else {
  146. this.open = true;
  147. this.selectList = this.FJList;
  148. }
  149. }
  150. },
  151. bindPickerChange(e) {
  152. console.log('picker发送选择改变,携带值为', e.detail.value)
  153. this.index = e.detail.value
  154. },
  155. bindDateChange(e) {
  156. this.date = e.detail.value
  157. },
  158. switch2Change(e) {
  159. console.log('switch2 发生 change 事件,携带值为', e.detail.value)
  160. },
  161. changeSelect(item, index) {
  162. this.index = index;
  163. this.address = item.communityName;
  164. this.open = false;
  165. if (this.type == 'xq') {
  166. this.XQValue = item;
  167. //根据小区id 获取楼栋数据
  168. this.LDValue.name = ''; //重置楼栋数据
  169. this.DYValue.name = ''; //重置单元数据
  170. this.FJValue.name = ''; //重置房间数据
  171. getBuildingList(item.id).then(res => {
  172. this.LDList = res
  173. // console.log("楼栋=", res)
  174. })
  175. } else if (this.type == 'ld') {
  176. this.LDValue = item;
  177. //根据楼栋ID 获取单元数据
  178. this.DYValue.name = ''; //重置单元数据
  179. this.FJValue.name = ''; //重置房间数据
  180. getUnitList(item.id).then(res => {
  181. this.DYList = res
  182. // console.log("单元=", res)
  183. })
  184. } else if (this.type == 'dy') {
  185. this.DYValue = item;
  186. //根据单元数据 获取房间数据
  187. this.FJValue.name = ''; //重置房间数据
  188. getHousesList(item.id).then(res => {
  189. this.FJList = res
  190. // console.log("房间=", res)
  191. })
  192. } else if (this.type == 'fj') {
  193. this.FJValue = item;
  194. }
  195. },
  196. //关闭弹窗
  197. close(e) {
  198. this.open = false
  199. }
  200. }
  201. }
  202. </script>
  203. <style>
  204. .container {
  205. display: flex;
  206. margin-left: 10px;
  207. margin-top: 10px;
  208. margin-right: 10px;
  209. align-items: flex-start;
  210. justify-content: space-between;
  211. }
  212. .text {
  213. font-size: 16px;
  214. color: #333;
  215. }
  216. .background {
  217. border: 15px solid hsla(0, 0%, 100%, .5);
  218. background: white;
  219. background-clip: padding-box;
  220. /*从padding开始往外面裁剪背景*/
  221. }
  222. </style>