statistics.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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="left"></uni-th>
  80. <uni-th width="20" align="right">预计用量</uni-th>
  81. <uni-th width="20" align="right">实际用量</uni-th>
  82. </uni-tr>
  83. <uni-tr v-for="(item, index) in materialUsageList" :key="index">
  84. <uni-td>
  85. <view class="name">{{ item.materialQuality }}</view>
  86. </uni-td width="20" align="left">
  87. <uni-td width="20" align="right">{{ item.estimatedSize }}</uni-td>
  88. <uni-td width="20" align="right">{{ item.realitySize }}</uni-td>
  89. </uni-tr>
  90. </uni-table>
  91. </view>
  92. <view class="view-bg">
  93. <text class="title-txt">工程进度统计</text>
  94. <view>
  95. <view class="uni-list-cell">
  96. <view class="uni-list-cell-left">工程周期</view>
  97. <view class="uni-list-cell-db">
  98. <view v-if="this.isEmpty(this.projectValue2.dictValue)" style="margin-top: 10;"
  99. @click="pickerShow('gczq2')">
  100. <span style="color: darkgray;">请选择工程周期</span>
  101. </view>
  102. <view v-else style="margin-top: 10;" @click="pickerShow('gczq2')">
  103. <span style="color: black;">{{projectValue2.dictLabel}}</span>
  104. </view>
  105. </view>
  106. </view>
  107. <view class="uni-list-cell">
  108. <view class="uni-list-cell-left">
  109. 行政区
  110. </view>
  111. <view class="uni-list-cell-db">
  112. <view v-if="this.isEmpty(this.XZQValue2.dictValue)" style="margin-top: 10;"
  113. @click="pickerShow('xzq2')">
  114. <span style="color: darkgray;">请选择行政区</span>
  115. </view>
  116. <view v-else style="margin-top: 10;" @click="pickerShow('xzq2')">
  117. <span style="color: black;">{{XZQValue2.dictLabel}}</span>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="uni-list-cell">
  122. <view class="uni-list-cell-left"> 小区</view>
  123. <view class="uni-list-cell-db">
  124. <view v-if="this.isEmpty(this.XQValue2.id)" style="margin-top: 10;" @click="pickerShow('xq2')">
  125. <span style="color: darkgray;">请选择小区</span>
  126. </view>
  127. <view v-else style="margin-top: 10;" @click="pickerShow('xq2')">
  128. <span style="color: black;">{{XQValue2.name}}</span>
  129. </view>
  130. </view>
  131. </view>
  132. <view class="uni-list-cell">
  133. <view class="uni-list-cell-left">楼栋</view>
  134. <view class="uni-list-cell-db">
  135. <view v-if="this.isEmpty(this.LDValue2.id)" style="margin-top: 10;" @click="pickerShow('ld2')">
  136. <span style="color: darkgray;">请选择楼栋</span>
  137. </view>
  138. <view style="margin-top: 10;" @click="pickerShow('ld2')">
  139. <span style="color: black;">{{LDValue2.name}}</span>
  140. </view>
  141. </view>
  142. </view>
  143. <view class="uni-list-cell">
  144. <view class="uni-list-cell-left">单元</view>
  145. <view class="uni-list-cell-db">
  146. <view v-if="this.isEmpty(this.DYValue2.id)" style="margin-top: 10;" @click="pickerShow('dy2')">
  147. <span style="color: darkgray;">请选择单元</span>
  148. </view>
  149. <view v-else style="margin-top: 10;" @click="pickerShow('dy2')">
  150. <span style="color: black;">{{DYValue2.name}}</span>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. <uni-divider></uni-divider>
  156. <view class="view_bg_build" v-if="roomList.length > 0">
  157. <view v-for="(item,index) in roomList" :key="index">
  158. <uni-grid :border="false" :column="roomCount" :highlight="true" @change="change">
  159. <uni-grid-item v-for="(item2, index2) in roomList[index]" :index="index2" :key="index2">
  160. <view :style="{backgroundColor: getColorByStatus(item2.roomStatus)}">
  161. <text class="grid-text">{{item2.roomName}}</text>
  162. </view>
  163. </uni-grid-item>
  164. </uni-grid>
  165. </view>
  166. </view>
  167. <view v-if="roomList.length == 0">暂无数据</view>
  168. <view style="align-items: center;">
  169. <view style="display: flex;align-items: center;">
  170. <image class="block-iv" src="../../static/images/ic_legend.png"></image>
  171. <text style="margin-right: 20px;margin-left: 5px;">图例: </text>
  172. <div class="block-iv" style="background-color: #80d9ae;"></div>
  173. <text style="margin-right: 20px;margin-left: 5px;">完工</text>
  174. <div class="block-iv" style="background-color: #5bd3ff;"></div>
  175. <text style="margin-right: 20px;margin-left: 5px;">未完工</text>
  176. <div class="block-iv" style="background-color: #ffc881;"></div>
  177. <text style="margin-right: 20px;margin-left: 5px;">未开工</text>
  178. </view>
  179. </view>
  180. </view>
  181. <SelectPicker :list="selectList" @change="changeSelect" v-if="open" @close="close" titleKey="name"
  182. subtitleKey="id" v-model="name"></SelectPicker>
  183. <SelectPicker :list="dictOptions" @change="changeSelect" v-if="openDict" @close="closeDict" titleKey="dictLabel"
  184. subtitleKey="dictValue" v-model="dictLabel"></SelectPicker>
  185. </view>
  186. </template>
  187. <script>
  188. import SelectPicker from '../../components/selectPicker/select_picker.vue'
  189. import {
  190. getDicts
  191. } from "@/api/system/dict/data";
  192. import {
  193. getAreaList,
  194. getBuildingList,
  195. getUnitList,
  196. getHousesList,
  197. getEnginMaterialQualityList,
  198. getEnginSpecificationsList,
  199. getMunicipalStatisticsData,
  200. getObtainRoomcCompletionInformationList,
  201. } from '@/api/common'
  202. export default {
  203. components: {
  204. SelectPicker
  205. },
  206. data() {
  207. return {
  208. villageIndex: 0,
  209. specificationIndex: 0,
  210. materialIndex: 0,
  211. villageIndex2: 0,
  212. buildIndex: 0,
  213. unitIndex: 0,
  214. open: false,
  215. openDict: false,
  216. selectList: [],
  217. dictOptions: [],
  218. XQList: [],
  219. LDList: [],
  220. DYList: [],
  221. projectValue: {},
  222. XZQValue: {},
  223. XQValue: {},
  224. XQList2: [],
  225. LDList2: [],
  226. DYList2: [],
  227. projectValue2: {},
  228. XZQValue2: {},
  229. XQValue2: {},
  230. LDValue2: {},
  231. DYValue2: {},
  232. specificationValue: {},
  233. specificationList: [],
  234. materialValue: {},
  235. materialList: [],
  236. materialUsageList: [],
  237. roomList: [],
  238. roomCount: 4
  239. }
  240. },
  241. created() {},
  242. methods: {
  243. isEmpty(str) {
  244. return (!str || 0 === str.length);
  245. },
  246. pickerShow(e) {
  247. this.type = e; //赋值类型
  248. if (e == 'gczq') { //工程周期
  249. this.openDict = true;
  250. getDicts("engin_cycle").then(response => {
  251. this.dictOptions = response.data;
  252. });
  253. } else if (e == 'xzq') {
  254. if (this.isEmpty(this.projectValue.dictValue)) {
  255. this.$modal.msg('请选择工程周期')
  256. } else {
  257. this.openDict = true;
  258. getDicts("district").then(response => {
  259. this.dictOptions = response.data;
  260. });
  261. }
  262. } else if (e == 'xq') { //小区
  263. if (this.isEmpty(this.XZQValue.dictValue)) {
  264. this.$modal.msg('请选择行政区')
  265. } else {
  266. this.open = true;
  267. this.selectList = this.XQList;
  268. }
  269. } else if (e == 'ld') { //楼栋
  270. if (this.isEmpty(this.XQValue.id)) {
  271. this.$modal.msg('请选择小区')
  272. } else {
  273. this.open = true;
  274. this.selectList = this.LDList;
  275. }
  276. } else if (e == 'dy') { //单元
  277. if (this.isEmpty(this.LDValue.id)) {
  278. this.$modal.msg('请选择楼栋')
  279. } else {
  280. this.open = true;
  281. this.selectList = this.DYList;
  282. }
  283. } else if (e == 'gczq2') { //工程周期
  284. this.openDict = true;
  285. getDicts("engin_cycle").then(response => {
  286. this.dictOptions = response.data;
  287. });
  288. } else if (e == 'xzq2') { //行政区2
  289. if (this.isEmpty(this.projectValue2.dictValue)) {
  290. this.$modal.msg('请选择工程周期')
  291. } else {
  292. this.openDict = true;
  293. getDicts("district").then(response => {
  294. this.dictOptions = response.data;
  295. });
  296. }
  297. } else if (e == 'xq2') { //小区2
  298. if (this.isEmpty(this.XZQValue2.dictValue)) {
  299. this.$modal.msg('请选择行政区')
  300. } else {
  301. this.open = true;
  302. this.selectList = this.XQList2;
  303. }
  304. } else if (e == 'ld2') { //楼栋2
  305. if (this.isEmpty(this.XQValue2.id)) {
  306. this.$modal.msg('请选择小区')
  307. } else {
  308. this.open = true;
  309. this.selectList = this.LDList2;
  310. }
  311. } else if (e == 'dy2') { //单元2
  312. if (this.isEmpty(this.LDValue2.id)) {
  313. this.$modal.msg('请选择楼栋')
  314. } else {
  315. this.open = true;
  316. this.selectList = this.DYList2;
  317. }
  318. } else if (e == 'gg') { //规格
  319. if (this.isEmpty(this.materialValue.id)) {
  320. this.$modal.msg('请选择材料')
  321. } else {
  322. this.open = true;
  323. this.selectList = this.materialList;
  324. }
  325. } else if (e == 'cz') { //材料
  326. this.open = true;
  327. getEnginMaterialQualityList("民用工程").then(response => {
  328. this.selectList = response.data;
  329. });
  330. }
  331. },
  332. changeSelect(item, index) {
  333. // this.index = index;
  334. // this.address = item.communityName;
  335. this.open = false;
  336. this.openDict = false;
  337. if (this.type == 'xzq') {
  338. this.XZQValue = item;
  339. //根据行政区id获取小区数据
  340. this.XQValue = ''; //重置小区数据
  341. this.LDValue = ''; //重置楼栋数据
  342. this.DYValue = ''; //重置单元数据
  343. this.FJValue = ''; //重置房间数据
  344. getAreaList(item.dictValue).then(res => {
  345. this.XQList = res.data;
  346. })
  347. } else if (this.type == 'gczq') {
  348. this.projectValue = item
  349. } else if (this.type == 'xq') {
  350. this.XQValue = item;
  351. //根据小区id 获取楼栋数据
  352. this.LDValue = ''; //重置楼栋数据
  353. this.DYValue = ''; //重置单元数据
  354. this.FJValue = ''; //重置房间数据
  355. // getBuildingList(item.id).then(res => {
  356. // this.LDList = res.data
  357. // // console.log("楼栋=", res)
  358. // })
  359. this.queryMaterialsUsedList();
  360. } else if (this.type == 'ld') {
  361. this.LDValue = item;
  362. //根据楼栋ID 获取单元数据
  363. this.DYValue = ''; //重置单元数据
  364. this.FJValue = ''; //重置房间数据
  365. getUnitList(item.id).then(res => {
  366. this.DYList = res.data
  367. // console.log("单元=", res)
  368. })
  369. } else if (this.type == 'dy') {
  370. this.DYValue = item;
  371. } else if (this.type == 'gczq2') {
  372. this.projectValue2 = item
  373. } else if (this.type == 'xzq2') {
  374. this.XZQValue2 = item;
  375. //根据行政区id获取小区数据
  376. this.XQValue2 = ''; //重置小区数据
  377. this.LDValue2 = ''; //重置楼栋数据
  378. this.DYValue2 = ''; //重置单元数据
  379. this.FJValue2 = ''; //重置房间数据
  380. getAreaList(item.dictValue).then(res => {
  381. this.XQList2 = res.data;
  382. })
  383. } else if (this.type == 'xq2') { //小区2
  384. this.XQValue2 = item;
  385. //根据小区id 获取楼栋数据
  386. this.LDValue2 = ''; //重置楼栋数据
  387. this.DYValue2 = ''; //重置单元数据
  388. this.FJValue2 = ''; //重置房间数据
  389. getBuildingList(item.id).then(res => {
  390. this.LDList2 = res.data
  391. // console.log("楼栋=", res)
  392. })
  393. } else if (this.type == 'ld2') {
  394. this.LDValue2 = item;
  395. //根据楼栋ID 获取单元数据
  396. this.DYValue2 = ''; //重置单元数据
  397. this.FJValue2 = ''; //重置房间数据
  398. getUnitList(item.id).then(res => {
  399. this.DYList2 = res.data
  400. // console.log("单元=", res)
  401. })
  402. } else if (this.type == 'dy2') {
  403. this.DYValue2 = item;
  404. this.queryProjectStatisticsList();
  405. } else if (this.type == 'gg') { //规格
  406. this.specificationValue = item;
  407. this.queryMaterialsUsedList();
  408. } else if (this.type == 'cz') { //材料
  409. this.materialValue = item;
  410. this.specificationValue = ''; //重置规格
  411. //根据材质ID 获取规格数据
  412. getEnginSpecificationsList(item.id).then(res => {
  413. this.materialList = res.data
  414. })
  415. }
  416. },
  417. //关闭弹窗
  418. close(e) {
  419. this.open = false
  420. },
  421. //关闭弹窗
  422. closeDict(e) {
  423. this.openDict = false
  424. },
  425. queryMaterialsUsedList() {
  426. if (this.isEmpty(this.XQValue.id)) {
  427. this.$modal.msg('请选择小区')
  428. return;
  429. }
  430. if (this.isEmpty(this.specificationValue.id)) {
  431. this.$modal.msg('请选择规格')
  432. return;
  433. }
  434. let param = {
  435. enginCycle: this.projectValue.dictValue, //工程周期
  436. areaId: this.XQValue.id,
  437. realityQuality: this.materialValue.id,
  438. realitySpecifications: this.specificationValue.id,
  439. };
  440. getMunicipalStatisticsData(param).then(res => {
  441. this.materialUsageList = res.data;
  442. })
  443. },
  444. queryProjectStatisticsList() {
  445. let param = {
  446. enginCycle: this.projectValue.dictValue, //工程周期
  447. areaId: this.XQValue2.id,
  448. buildingId: this.LDValue2.id,
  449. unitId: this.DYValue2.id,
  450. };
  451. getObtainRoomcCompletionInformationList(param).then(res => {
  452. this.roomList = res.data[0].roomStatusVoList;
  453. this.roomCount = res.data[0].roomStatusVoList.length;
  454. })
  455. },
  456. getColorByStatus(status) {
  457. if (this.isEmpty(status)) {
  458. return "#fff";
  459. }
  460. if (status == '未完工') {
  461. return "#5bd3ff";
  462. } else if (status == '未开工') {
  463. return "#ffc881";
  464. } else if (status == '完工') {
  465. return "#80d9ae";
  466. }
  467. }
  468. }
  469. }
  470. </script>
  471. <style>
  472. .marginLeft5 {
  473. margin-left: 5px;
  474. }
  475. .title-txt {
  476. font-size: 15px;
  477. font-weight: bold;
  478. color: black;
  479. }
  480. .content-txt {
  481. font-size: 10px;
  482. font-weight: bold;
  483. color: black;
  484. }
  485. .view-bg {
  486. margin-left: 8px;
  487. margin-right: 8px;
  488. margin-top: 8px;
  489. padding: 10px;
  490. background-color: #fff;
  491. border-radius: 5px;
  492. }
  493. .uni-list
  494. /* {
  495. background-color: #FFFFFF;
  496. position: relative;
  497. width: 100%;
  498. display: flex;
  499. flex-direction: column;
  500. } */
  501. .uni-list-cell-db,
  502. .uni-list-cell {
  503. position: relative;
  504. display: flex;
  505. flex-direction: row;
  506. justify-content: space-between;
  507. align-items: center;
  508. }
  509. .uni-list-cell-left {
  510. white-space: nowrap;
  511. font-size: 28rpx;
  512. }
  513. .centered {
  514. text-align: center;
  515. background-color: #e2f4ff;
  516. }
  517. .text {
  518. background-color: #e2f4ff;
  519. height: 20rpx;
  520. }
  521. .view_bg_build {
  522. background-color: #e2f4ff;
  523. padding: 10rpx;
  524. margin: 20rpx;
  525. }
  526. .grid-text {
  527. font-size: 14px;
  528. color: #000000;
  529. text-align: center;
  530. padding-left: 30rpx;
  531. padding-right: 30rpx;
  532. padding-top: 20rpx;
  533. padding-bottom: 20rpx;
  534. }
  535. .name {
  536. flex: 0;
  537. font-size: 14px;
  538. color: #000000;
  539. overflow: hidden;
  540. text-overflow: ellipsis;
  541. white-space: nowrap;
  542. }
  543. .table-item {
  544. overflow: hidden;
  545. text-overflow: ellipsis;
  546. white-space: nowrap;
  547. }
  548. .block-iv{
  549. width: 10px;
  550. height: 10px;
  551. }
  552. </style>