statistics.vue 19 KB

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