statistics.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. <template>
  2. <view>
  3. <view class="view-bg">
  4. <text class="title-txt">工程用料统计</text>
  5. <view>
  6. <view class="uni-list-cell">
  7. <view class="uni-list-cell-left">
  8. 工程周期
  9. </view>
  10. <view class="uni-list-cell-db">
  11. <view v-if="this.isEmpty(this.projectValue.dictValue)" style="margin-top: 10;"
  12. @click="pickerShow('gczq')">
  13. <span style="color: darkgray;">请选择工程周期</span>
  14. </view>
  15. <view v-else style="margin-top: 10;" @click="pickerShow('gczq')">
  16. <span style="color: black;">{{projectValue.dictLabel}}</span>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="uni-list-cell">
  21. <view class="uni-list-cell-left">
  22. 行政区
  23. </view>
  24. <view class="uni-list-cell-db">
  25. <view v-if="this.isEmpty(this.XZQValue.dictValue)" style="margin-top: 10;"
  26. @click="pickerShow('xzq')">
  27. <span style="color: darkgray;">请选择行政区</span>
  28. </view>
  29. <view v-else style="margin-top: 10;" @click="pickerShow('xzq')">
  30. <span style="color: black;">{{XZQValue.dictLabel}}</span>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="uni-list-cell">
  35. <view class="uni-list-cell-left">
  36. 小区
  37. </view>
  38. <view class="uni-list-cell-db">
  39. <view v-if="this.isEmpty(this.XQValue.id)" style="margin-top: 10;" @click="pickerShow('xq')">
  40. <span style="color: darkgray;">请选择小区</span>
  41. </view>
  42. <view v-else style="margin-top: 10;" @click="pickerShow('xq')">
  43. <span style="color: black;">{{XQValue.name}}</span>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="uni-list-cell">
  48. <view class="uni-list-cell-left">
  49. 材料
  50. </view>
  51. <view class="uni-list-cell-db">
  52. <view v-if="this.isEmpty(this.materialValue.name)" style="margin-top: 10;"
  53. @click="pickerShow('cz')">
  54. <span style="color: darkgray;">请选择材料</span>
  55. </view>
  56. <view v-else style="margin-top: 10;" @click="pickerShow('cz')">
  57. <span style="color: black;">{{materialValue.name}}</span>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="uni-list-cell">
  62. <view class="uni-list-cell-left">
  63. 规格
  64. </view>
  65. <view class="uni-list-cell-db">
  66. <view v-if="this.isEmpty(this.specificationValue.name)" style="margin-top: 10;"
  67. @click="pickerShow('gg')">
  68. <span style="color: darkgray;">请选择规格</span>
  69. </view>
  70. <view v-else style="margin-top: 10;" @click="pickerShow('gg')">
  71. <span style="color: black;">{{specificationValue.name}}</span>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <uni-divider></uni-divider>
  77. <uni-table ref="table">
  78. <uni-tr>
  79. <uni-th width="20" align="center"></uni-th>
  80. <uni-th width="20" align="center">预计用量</uni-th>
  81. <uni-th width="20" align="center">实际用量</uni-th>
  82. </uni-tr>
  83. <uni-tr v-for="(item, index) in materialUsageList" :key="index">
  84. <uni-td>{{ item.name }}</uni-td>
  85. <uni-td>{{ item.estimatedUsage }}</uni-td>
  86. <uni-td>{{ item.actualUsage }}</uni-td>
  87. </uni-tr>
  88. </uni-table>
  89. </view>
  90. <view class="view-bg">
  91. <text class="title-txt">工程进度统计</text>
  92. <view>
  93. <view class="uni-list-cell">
  94. <view class="uni-list-cell-left">工程周期</view>
  95. <view class="uni-list-cell-db">
  96. <view v-if="this.isEmpty(this.projectValue2.dictValue)" style="margin-top: 10;"
  97. @click="pickerShow('gczq2')">
  98. <span style="color: darkgray;">请选择工程周期</span>
  99. </view>
  100. <view v-else style="margin-top: 10;" @click="pickerShow('gczq2')">
  101. <span style="color: black;">{{projectValue2.dictLabel}}</span>
  102. </view>
  103. </view>
  104. </view>
  105. <view class="uni-list-cell">
  106. <view class="uni-list-cell-left">
  107. 行政区
  108. </view>
  109. <view class="uni-list-cell-db">
  110. <view v-if="this.isEmpty(this.XZQValue2.dictValue)" style="margin-top: 10;"
  111. @click="pickerShow('xzq2')">
  112. <span style="color: darkgray;">请选择行政区</span>
  113. </view>
  114. <view v-else style="margin-top: 10;" @click="pickerShow('xzq2')">
  115. <span style="color: black;">{{XZQValue2.dictLabel}}</span>
  116. </view>
  117. </view>
  118. </view>
  119. <view class="uni-list-cell">
  120. <view class="uni-list-cell-left"> 小区</view>
  121. <view class="uni-list-cell-db">
  122. <view v-if="this.isEmpty(this.XQValue2.id)" style="margin-top: 10;" @click="pickerShow('xq2')">
  123. <span style="color: darkgray;">请选择小区</span>
  124. </view>
  125. <view v-else style="margin-top: 10;" @click="pickerShow('xq2')">
  126. <span style="color: black;">{{XQValue2.name}}</span>
  127. </view>
  128. </view>
  129. </view>
  130. <view class="uni-list-cell">
  131. <view class="uni-list-cell-left">楼栋</view>
  132. <view class="uni-list-cell-db">
  133. <view v-if="this.isEmpty(this.LDValue2.id)" style="margin-top: 10;" @click="pickerShow('ld2')">
  134. <span style="color: darkgray;">请选择楼栋</span>
  135. </view>
  136. <view style="margin-top: 10;" @click="pickerShow('ld2')">
  137. <span style="color: black;">{{LDValue2.name}}</span>
  138. </view>
  139. </view>
  140. </view>
  141. <view class="uni-list-cell">
  142. <view class="uni-list-cell-left">单元</view>
  143. <view class="uni-list-cell-db">
  144. <view v-if="this.isEmpty(this.DYValue2.id)" style="margin-top: 10;" @click="pickerShow('dy2')">
  145. <span style="color: darkgray;">请选择单元</span>
  146. </view>
  147. <view v-else style="margin-top: 10;" @click="pickerShow('dy2')">
  148. <span style="color: black;">{{DYValue2.name}}</span>
  149. </view>
  150. </view>
  151. </view>
  152. <!-- xx -->
  153. </view>
  154. <uni-divider></uni-divider>
  155. <view class="view_bg_build">
  156. <uni-grid :column="roomCount" :highlight="true" @change="change">
  157. <uni-grid-item v-for="(item, index) in roomList" :index="index" :key="index">
  158. <view class="centered" style="background-color: #fff;">
  159. <!-- <uni-icons type="image" :size="30" color="#777" /> -->
  160. <text>{{item.roomNumber}}</text>
  161. </view>
  162. </uni-grid-item>
  163. </uni-grid>
  164. </view>
  165. </view>
  166. <SelectPicker :list="selectList" @change="changeSelect" v-if="open" @close="close" titleKey="name"
  167. subtitleKey="id" v-model="name"></SelectPicker>
  168. <SelectPicker :list="dictOptions" @change="changeSelect" v-if="openDict" @close="closeDict" titleKey="dictLabel"
  169. subtitleKey="dictValue" v-model="dictLabel"></SelectPicker>
  170. </view>
  171. </template>
  172. <script>
  173. import SelectPicker from '../../components/selectPicker/select_picker.vue'
  174. import {
  175. getDicts
  176. } from "@/api/system/dict/data";
  177. import {
  178. getAreaList,
  179. getBuildingList,
  180. getUnitList,
  181. getHousesList,
  182. getEnginMaterialQualityList,
  183. getEnginSpecificationsList,
  184. getMunicipalStatisticsData,
  185. getObtainRoomcCompletionInformationList,
  186. } from '@/api/common'
  187. export default {
  188. components: {
  189. SelectPicker
  190. },
  191. data() {
  192. return {
  193. villageIndex: 0,
  194. specificationIndex: 0,
  195. materialIndex: 0,
  196. villageIndex2: 0,
  197. buildIndex: 0,
  198. unitIndex: 0,
  199. open: false,
  200. openDict: false,
  201. selectList: [],
  202. dictOptions: [],
  203. XQList: [],
  204. LDList: [],
  205. DYList: [],
  206. projectValue: {},
  207. XZQValue: {},
  208. XQValue: {},
  209. XQList2: [],
  210. LDList2: [],
  211. DYList2: [],
  212. projectValue2: {},
  213. XZQValue2: {},
  214. XQValue2: {},
  215. LDValue2: {},
  216. DYValue2: {},
  217. specificationValue: {},
  218. specificationList: [],
  219. materialValue: {},
  220. materialList: [],
  221. // specificationList: [{
  222. // name: '规格001'
  223. // }, {
  224. // name: '规格002'
  225. // }, {
  226. // name: '规格003'
  227. // }, {
  228. // name: '规格004'
  229. // }],
  230. // materialList: [{
  231. // name: '材料001'
  232. // }, {
  233. // name: '材料002'
  234. // }, {
  235. // name: '材料003'
  236. // }, {
  237. // name: '材料004'
  238. // }],
  239. // buildList: [{
  240. // name: '楼栋001'
  241. // }, {
  242. // name: '楼栋002'
  243. // }, {
  244. // name: '楼栋003'
  245. // }, {
  246. // name: '楼栋004'
  247. // }],
  248. // unitList: [{
  249. // name: '单元001'
  250. // }, {
  251. // name: '单元002'
  252. // }, {
  253. // name: '单元003'
  254. // }, {
  255. // name: '单元004'
  256. // }],
  257. materialUsageList: [
  258. // {
  259. // name: '0.5cm钢',
  260. // estimatedUsage: 1210,
  261. // actualUsage: 6852
  262. // }, {
  263. // name: '1.0cm钢',
  264. // estimatedUsage: 1680,
  265. // actualUsage: 6852
  266. // }, {
  267. // name: '1.5cm钢',
  268. // estimatedUsage: 1503,
  269. // actualUsage: 6852
  270. // },
  271. ],
  272. roomList: [{
  273. roomNumber: '601',
  274. status: '0'
  275. }, {
  276. roomNumber: '602',
  277. status: '0'
  278. }, {
  279. roomNumber: '603',
  280. status: '0'
  281. }, {
  282. roomNumber: '604',
  283. status: '0'
  284. }, {
  285. roomNumber: '501',
  286. status: '0'
  287. }, {
  288. roomNumber: '502',
  289. status: '0'
  290. }, {
  291. roomNumber: '503',
  292. status: '0'
  293. }, {
  294. roomNumber: '504',
  295. status: '0'
  296. }, {
  297. roomNumber: '401',
  298. status: '0'
  299. }, {
  300. roomNumber: '402',
  301. status: '0'
  302. }, {
  303. roomNumber: '403',
  304. status: '0'
  305. }, {
  306. roomNumber: '404',
  307. status: '0'
  308. }, {
  309. roomNumber: '301',
  310. status: '0'
  311. }, {
  312. roomNumber: '302',
  313. status: '0'
  314. }, {
  315. roomNumber: '303',
  316. status: '0'
  317. }, {
  318. roomNumber: '304',
  319. status: '0'
  320. }, {
  321. roomNumber: '201',
  322. status: '0'
  323. }, {
  324. roomNumber: '202',
  325. status: '0'
  326. }, {
  327. roomNumber: '203',
  328. status: '0'
  329. }, {
  330. roomNumber: '204',
  331. status: '0'
  332. }, {
  333. roomNumber: '101',
  334. status: '0'
  335. }, {
  336. roomNumber: '102',
  337. status: '0'
  338. }, {
  339. roomNumber: '103',
  340. status: '0'
  341. }, {
  342. roomNumber: '104',
  343. status: '0'
  344. }],
  345. roomCount: 4
  346. }
  347. },
  348. created() {
  349. },
  350. methods: {
  351. isEmpty(str) {
  352. return (!str || 0 === str.length);
  353. },
  354. pickerShow(e) {
  355. this.type = e; //赋值类型
  356. if (e == 'gczq') { //工程周期
  357. this.openDict = true;
  358. getDicts("engin_cycle").then(response => {
  359. this.dictOptions = response.data;
  360. });
  361. } else if (e == 'xzq') {
  362. if (this.isEmpty(this.projectValue.dictValue)) {
  363. this.$modal.msg('请选择工程周期')
  364. } else {
  365. this.openDict = true;
  366. getDicts("district").then(response => {
  367. this.dictOptions = response.data;
  368. });
  369. }
  370. } else if (e == 'xq') { //小区
  371. if (this.isEmpty(this.XZQValue.dictValue)) {
  372. this.$modal.msg('请选择行政区')
  373. } else {
  374. this.open = true;
  375. this.selectList = this.XQList;
  376. }
  377. } else if (e == 'ld') { //楼栋
  378. if (this.isEmpty(this.XQValue.id)) {
  379. this.$modal.msg('请选择小区')
  380. } else {
  381. this.open = true;
  382. this.selectList = this.LDList;
  383. }
  384. } else if (e == 'dy') { //单元
  385. if (this.isEmpty(this.LDValue.id)) {
  386. this.$modal.msg('请选择楼栋')
  387. } else {
  388. this.open = true;
  389. this.selectList = this.DYList;
  390. }
  391. } else if (e == 'gczq2') { //工程周期
  392. this.openDict = true;
  393. getDicts("engin_cycle").then(response => {
  394. this.dictOptions = response.data;
  395. });
  396. } else if (e == 'xzq2') { //行政区2
  397. if (this.isEmpty(this.projectValue2.dictValue)) {
  398. this.$modal.msg('请选择工程周期')
  399. } else {
  400. this.openDict = true;
  401. getDicts("district").then(response => {
  402. this.dictOptions = response.data;
  403. });
  404. }
  405. } else if (e == 'xq2') { //小区2
  406. if (this.isEmpty(this.XZQValue2.dictValue)) {
  407. this.$modal.msg('请选择行政区')
  408. } else {
  409. this.open = true;
  410. this.selectList = this.XQList2;
  411. }
  412. } else if (e == 'ld2') { //楼栋2
  413. if (this.isEmpty(this.XQValue2.id)) {
  414. this.$modal.msg('请选择小区')
  415. } else {
  416. this.open = true;
  417. this.selectList = this.LDList2;
  418. }
  419. } else if (e == 'dy2') { //单元2
  420. if (this.isEmpty(this.LDValue2.id)) {
  421. this.$modal.msg('请选择楼栋')
  422. } else {
  423. this.open = true;
  424. this.selectList = this.DYList2;
  425. }
  426. } else if (e == 'gg') { //规格
  427. if (this.isEmpty(this.materialValue.id)) {
  428. this.$modal.msg('请选择材料')
  429. } else {
  430. this.open = true;
  431. this.selectList = this.materialList;
  432. }
  433. } else if (e == 'cz') { //材料
  434. this.open = true;
  435. getEnginMaterialQualityList("民用工程").then(response => {
  436. this.selectList = response.data;
  437. });
  438. }
  439. },
  440. changeSelect(item, index) {
  441. // this.index = index;
  442. // this.address = item.communityName;
  443. this.open = false;
  444. this.openDict = false;
  445. if (this.type == 'xzq') {
  446. this.XZQValue = item;
  447. //根据行政区id获取小区数据
  448. this.XQValue = ''; //重置小区数据
  449. this.LDValue = ''; //重置楼栋数据
  450. this.DYValue = ''; //重置单元数据
  451. this.FJValue = ''; //重置房间数据
  452. getAreaList(item.dictValue).then(res => {
  453. this.XQList = res.data;
  454. })
  455. } else if (this.type == 'gczq') {
  456. this.projectValue = item
  457. } else if (this.type == 'xq') {
  458. this.XQValue = item;
  459. //根据小区id 获取楼栋数据
  460. this.LDValue = ''; //重置楼栋数据
  461. this.DYValue = ''; //重置单元数据
  462. this.FJValue = ''; //重置房间数据
  463. // getBuildingList(item.id).then(res => {
  464. // this.LDList = res.data
  465. // // console.log("楼栋=", res)
  466. // })
  467. this.queryMaterialsUsedList();
  468. } else if (this.type == 'ld') {
  469. this.LDValue = item;
  470. //根据楼栋ID 获取单元数据
  471. this.DYValue = ''; //重置单元数据
  472. this.FJValue = ''; //重置房间数据
  473. getUnitList(item.id).then(res => {
  474. this.DYList = res.data
  475. // console.log("单元=", res)
  476. })
  477. } else if (this.type == 'dy') {
  478. this.DYValue = item;
  479. } else if (this.type == 'gczq2') {
  480. this.projectValue2 = item
  481. } else if (this.type == 'xzq2') {
  482. this.XZQValue2 = item;
  483. //根据行政区id获取小区数据
  484. this.XQValue2 = ''; //重置小区数据
  485. this.LDValue2 = ''; //重置楼栋数据
  486. this.DYValue2 = ''; //重置单元数据
  487. this.FJValue2 = ''; //重置房间数据
  488. getAreaList(item.dictValue).then(res => {
  489. this.XQList2 = res.data;
  490. })
  491. } else if (this.type == 'xq2') { //小区2
  492. this.XQValue2 = item;
  493. //根据小区id 获取楼栋数据
  494. this.LDValue2 = ''; //重置楼栋数据
  495. this.DYValue2 = ''; //重置单元数据
  496. this.FJValue2 = ''; //重置房间数据
  497. getBuildingList(item.id).then(res => {
  498. this.LDList2 = res.data
  499. // console.log("楼栋=", res)
  500. })
  501. } else if (this.type == 'ld2') {
  502. this.LDValue2 = item;
  503. //根据楼栋ID 获取单元数据
  504. this.DYValue2 = ''; //重置单元数据
  505. this.FJValue2 = ''; //重置房间数据
  506. getUnitList(item.id).then(res => {
  507. this.DYList2 = res.data
  508. // console.log("单元=", res)
  509. })
  510. } else if (this.type == 'dy2') {
  511. this.DYValue2 = item;
  512. } else if (this.type == 'gg') { //规格
  513. this.specificationValue = item;
  514. this.queryMaterialsUsedList();
  515. } else if (this.type == 'cz') { //材料
  516. this.materialValue = item;
  517. this.specificationValue = ''; //重置规格
  518. //根据材质ID 获取规格数据
  519. getEnginSpecificationsList(item.id).then(res => {
  520. this.materialList = res.data
  521. })
  522. }
  523. },
  524. //关闭弹窗
  525. close(e) {
  526. this.open = false
  527. },
  528. //关闭弹窗
  529. closeDict(e) {
  530. this.openDict = false
  531. },
  532. queryMaterialsUsedList(){
  533. debugger
  534. if(this.isEmpty(this.XQValue.id)){
  535. this.$modal.msg('请选择小区')
  536. return;
  537. }
  538. debugger
  539. if (this.isEmpty(this.specificationValue.id)) {
  540. this.$modal.msg('请选择规格')
  541. return;
  542. }
  543. let param={
  544. areaId:this.XQValue.id,
  545. realityQuality:this.materialValue.id,
  546. realitySpecifications:this.specificationValue.id,
  547. };
  548. getMunicipalStatisticsData(param).then(res=>{
  549. this.materialUsageList=res.data;
  550. })
  551. },
  552. }
  553. }
  554. </script>
  555. <style>
  556. .marginLeft5 {
  557. margin-left: 5px;
  558. }
  559. .title-txt {
  560. font-size: 15px;
  561. font-weight: bold;
  562. color: black;
  563. }
  564. .content-txt {
  565. font-size: 10px;
  566. font-weight: bold;
  567. color: black;
  568. }
  569. .view-bg {
  570. margin-left: 8px;
  571. margin-right: 8px;
  572. margin-top: 8px;
  573. padding: 10px;
  574. background-color: #fff;
  575. border-radius: 5px;
  576. }
  577. .uni-list
  578. /* {
  579. background-color: #FFFFFF;
  580. position: relative;
  581. width: 100%;
  582. display: flex;
  583. flex-direction: column;
  584. } */
  585. .uni-list-cell-db,
  586. .uni-list-cell {
  587. position: relative;
  588. display: flex;
  589. flex-direction: row;
  590. justify-content: space-between;
  591. align-items: center;
  592. }
  593. .uni-list-cell-left {
  594. white-space: nowrap;
  595. font-size: 28rpx;
  596. }
  597. .centered {
  598. text-align: center;
  599. background-color: #e2f4ff;
  600. }
  601. .text {
  602. background-color: #e2f4ff;
  603. height: 20rpx;
  604. }
  605. .view_bg_build {
  606. background-color: #e2f4ff;
  607. padding: 10rpx;
  608. margin: 20rpx;
  609. }
  610. </style>