conSchedule.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <view>
  3. <!-- 头部 -->
  4. <cu-custom bgColor="bg-blue" :isBack="true">
  5. <block slot="backText">施工进度</block>
  6. <block slot="content"></block>
  7. <block slot="right">
  8. <view class=" flex justify-center" >
  9. <button @click="search()" class="cu-btn round line-blue text-white" style="width: 160rpx;height: 66rpx;padding: 0;">
  10. <image src="/static/index/search-white.png" style="width: 32rpx;height: 32rpx;margin-right: 16rpx;"></image>搜索
  11. </button>
  12. </view>
  13. </block>
  14. </cu-custom>
  15. <scroll-view scroll-y="true" style="padding-bottom: 300rpx;">
  16. <view class="cu-list menu card-menu margin-top-sm">
  17. <view class="cu-item" @click="allData()">
  18. <view class="content">
  19. <text style="font-size: 34rpx;font-weight: bold;" :class="allSelect?'indexColor':''">全部工程</text>
  20. </view>
  21. </view>
  22. </view>
  23. <view v-for="(item,index) in treeData" :key="item.id" class="treeData_b">
  24. <view class="treeData_1" @click="treeTap(index+1,item)">
  25. <view style="font-weight: bold;font-size: 34rpx;" :class="item.selected&&!allSelect?'indexColor':''">{{item.name}}</view>
  26. <view v-if="item.children.length>0">
  27. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="show == index + 1"></image>
  28. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="show != index + 1 || show == 0"></image>
  29. </view>
  30. </view>
  31. <view v-for="(second,seconds) in item.children" :key="second.id" v-if="show == index + 1">
  32. <view class="treeData_1s treeData_2" @click="secondTap(seconds + 1,second)">
  33. <view :class="second.selected&&!allSelect?'indexColor':''">{{second.name}}</view>
  34. <view v-if="second.children.length>0">
  35. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showsecond == seconds + 1"></image>
  36. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showsecond != seconds + 1 || showsecond == 0"></image>
  37. </view>
  38. </view>
  39. <view v-if="showsecond == seconds + 1" :style="{'padding-bottom': second.children.length>0 ? '22rpx':''}">
  40. <view v-for="(three,threes) in second.children" :key="three.id" class="treeData_three">
  41. <view class="treeData_1s treeData_3" @click="threeTap(threes + 1,three)">
  42. <view :class="three.selected&&!allSelect?'indexColor':''">{{three.name}}</view>
  43. <view v-if="three.children.length>0">
  44. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showthree == threes + 1"></image>
  45. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showthree != threes + 1 || showthree == 0"></image>
  46. </view>
  47. </view>
  48. <view v-if="showthree == threes + 1" v-for="(four,fours) in three.children" :key="four.id">
  49. <view class="treeData_1s treeData_3" @click="fourTap(fours + 1,four)">
  50. <view style="padding-left: 22rpx;" :class="four.selected&&!allSelect?'indexColor':''"><text style="margin-right: 10rpx;">◈</text>{{four.name}}</view>
  51. <view v-if="four.children.length>0">
  52. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showfour == fours + 1"></image>
  53. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showfour != fours + 1 || showfour == 0"></image>
  54. </view>
  55. </view>
  56. <view v-if="showfour == fours + 1" v-for="(five,fives) in four.children" :key="five.id">
  57. <view class="treeData_1s treeData_3" @click="fiveTap(fives + 1,five)">
  58. <view style="padding-left: 44rpx;" :class="five.selected&&!allSelect?'indexColor':''"><text style="margin-right: 10rpx;">➣</text>{{five.name}}</view>
  59. <view v-if="five.children.length>0">
  60. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showfive == fives + 1"></image>
  61. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showfive != fives + 1 || showfive == 0"></image>
  62. </view>
  63. </view>
  64. <view v-if="showfive == fives + 1" v-for="(six,sixs) in five.children" :key="six.id">
  65. <view class="treeData_1s treeData_3" @click="sixTap(sixs + 1,six)">
  66. <view style="padding-left: 66rpx;" :class="six.selected&&!allSelect?'indexColor':''"><text style="margin-right: 10rpx;">•</text>{{six.name}}</view>
  67. <view v-if="six.children.length>0">
  68. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showsix == sixs + 1"></image>
  69. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showsix != sixs + 1 || showsix == 0"></image>
  70. </view>
  71. </view>
  72. <view v-if="showsix == sixs + 1" v-for="(seven,sevens) in six.children" :key="seven.id">
  73. <view class="treeData_1s treeData_3" @click="sevenTap(sevens + 1,seven)">
  74. <view style="padding-left: 88rpx;" :class="seven.selected&&!allSelect?'indexColor':''">{{seven.name}}</view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 树状 -->
  85. <!-- <ly-tree class="margin-top-sm cu-list menu card-menu text-black" :tree-data="treeData"
  86. ref="tree"
  87. node-key="id"
  88. :ready="true"
  89. :accordion="true"
  90. :filter-node-method="filterNode"
  91. :highlightCurrent="true"
  92. :checkOnlyLeaf="true"
  93. @node-click="handleNodeClick">
  94. </ly-tree> -->
  95. </scroll-view>
  96. <!-- 底部-->
  97. <view v-if="modalShow" class="shadow foot" style="background-color: #0A8CD5;color: #fff;position: fixed; z-index: 999; bottom: 0;width: 100%;padding-bottom: calc(var(--window-bottom) + 20px);">
  98. <view class="padding-sm solid-bottom-type" style="display: flex;align-items: center;position: absolute;left: 0;right: 0;top: -80rpx;height: 80rpx;opacity: 0.9;background-image: linear-gradient(#91C9E8, #0A8CD5);box-shadow: 0px -1px 2px #D0D0D0;">
  99. <image class="login-img" src="/static/index/label.png"></image>
  100. <view style="overflow-x: scroll;width: 680rpx;margin-left: 16rpx;">
  101. <view class="text-white" style="white-space : nowrap;font-weight: bold;">{{path}}</view>
  102. </view>
  103. </view>
  104. <view class="padding-sm">
  105. <view class="flex">
  106. <view class="cu-progress round" style="border: 4rpx solid #fff;background-color: #fff;margin-top: 16rpx;">
  107. <view class="bg-yellow" :style="width" style="border-radius: 0 30rpx 30rpx 0;"></view>
  108. </view>
  109. </view>
  110. <view class="flex margin-top-sm justify-between">
  111. <view class="round">
  112. 总工序 {{size}}
  113. </view>
  114. <text class="margin-left">已完成{{percentage}}%</text>
  115. </view>
  116. </view>
  117. </view>
  118. <view class="toTop">
  119. </view>
  120. </view>
  121. </template>
  122. <script>
  123. export default {
  124. data() {
  125. return {
  126. treeData: [],
  127. show: 0, //一级状态
  128. showsecond: 0, //二级状态
  129. showthree: 0, //三级状态
  130. showfour: 0, //四级状态
  131. showfive: 0, //五级状态
  132. showsix: 0, //六级状态
  133. showseven: 0, //七级状态
  134. modalShow:false,
  135. path:"",
  136. percentage:"",
  137. width:"",
  138. size:"" ,
  139. allSelect:false,//是否选中全部
  140. }
  141. },
  142. onLoad() {
  143. this.findDataProgress();
  144. },
  145. methods: {
  146. findDataProgress(){
  147. var that =this;
  148. var contractId = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id).contractId;
  149. that.http.request('/app/divideClient/findDataProgress', { contractId:contractId }).then((result)=>{
  150. if(result.datas!=null){
  151. that.treeData = result.datas[0].children;
  152. that.text(that.treeData);
  153. }
  154. })
  155. },
  156. search(){
  157. uni.setStorageSync("pageType",2);//区分搜索页面跳转
  158. uni.navigateTo({
  159. url:"/pages/search/search"
  160. })
  161. },
  162. filterNode(value, data) {
  163. if (!value) return true;
  164. return data.label.indexOf(value) !== -1;
  165. },
  166. /* 获取节点的施工进度 */
  167. handleNodeClick(data) {
  168. var that =this;
  169. that.http.request("/app/divideClient/countLedger",{ids:data.id,contractId:""}).then((res)=>{
  170. var num = res.data*100
  171. that.percentage = Math.round(num);
  172. that.width ="width:"+Math.round(num)+"%;";
  173. that.size=res.size;
  174. that.findPath(data.id);
  175. });
  176. },
  177. /* 全程工程的施工进度 */
  178. allData(){
  179. this.allSelect = true;
  180. var that =this;
  181. var project = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
  182. that.http.request("/app/divideClient/countLedger",{ids:project.contractId,contractId:project.contractId}).then((res)=>{
  183. var num = res.data*100
  184. that.percentage = Math.round(num);
  185. that.width ="width:"+Math.round(num)+"%;";
  186. that.size=res.size;
  187. that.path=" / 全部工程"
  188. that.modalShow = true
  189. });
  190. },
  191. findPath(id){
  192. /* 获取父级信息 */
  193. var that=this;
  194. that.http.request("/app/divideClient/selectNodeTreeById",{id:id}).then((res)=>{
  195. that.path="";
  196. res.datas.forEach((item)=>{
  197. if(item.parentId!=0){
  198. that.path += " / "+item.name;
  199. }
  200. });
  201. that.modalShow = true
  202. })
  203. },
  204. treeTap(e,r) {
  205. this.text(this.treeData)
  206. r.selected = true;
  207. this.allSelect = false;
  208. if (this.show == e) {
  209. this.show = 0
  210. } else {
  211. this.show = e
  212. }
  213. this.handleNodeClick(r);
  214. },
  215. secondTap(e,r) {
  216. this.text(this.treeData)
  217. r.selected = true;
  218. this.allSelect = false;
  219. if (this.showsecond == e) {
  220. this.showsecond = 0
  221. } else {
  222. this.showsecond = e
  223. }
  224. this.handleNodeClick(r);
  225. },
  226. threeTap(e,r) {
  227. this.text(this.treeData)
  228. r.selected = true;
  229. this.allSelect = false;
  230. if (this.showthree == e) {
  231. this.showthree = 0
  232. } else {
  233. this.showthree = e
  234. }
  235. this.handleNodeClick(r);
  236. },
  237. fourTap(e,r) {
  238. this.text(this.treeData);
  239. this.$set(r,"selected",true);
  240. this.allSelect = false;
  241. if (this.showfour == e) {
  242. this.showfour = 0
  243. } else {
  244. this.showfour = e
  245. }
  246. this.handleNodeClick(r);
  247. },
  248. fiveTap(e,r) {
  249. this.text(this.treeData);
  250. this.$set(r,"selected",true);
  251. this.allSelect = false;
  252. if (this.showfive == e) {
  253. this.showfive = 0
  254. } else {
  255. this.showfive = e
  256. }
  257. this.handleNodeClick(r);
  258. },
  259. sixTap(e,r) {
  260. this.text(this.treeData)
  261. r.selected = true;
  262. this.allSelect = false;
  263. if (this.showsix == e) {
  264. this.showsix = 0
  265. } else {
  266. this.showsix = e
  267. }
  268. this.handleNodeClick(r);
  269. },
  270. sevenTap(e,r) {
  271. this.text(this.treeData)
  272. r.selected = true;
  273. this.allSelect = false;
  274. if (this.showseven == e) {
  275. this.showseven = 0
  276. } else {
  277. this.showseven = e
  278. }
  279. this.handleNodeClick(r);
  280. },
  281. text(data) {
  282. var that = this;
  283. data.forEach((item) => {
  284. item.selected = false;
  285. /* console.log(item) */
  286. if (item.children.length > 0) {
  287. that.text(item.children);
  288. }
  289. })
  290. that.treeData = data;
  291. }
  292. }
  293. }
  294. </script>
  295. <style>
  296. page{background-color: #F7F7F7;}
  297. .toTop {
  298. position: fixed;
  299. bottom: 0;
  300. width: 100%;
  301. background-color: #F7F7F7;
  302. height: calc(var(--window-bottom) + 15px)
  303. }
  304. .solid-bottom-type {
  305. border-bottom: 1upx solid white;
  306. }
  307. .treeData_b {
  308. margin: 12rpx 22rpx 0;
  309. background-color: #fff;
  310. border-radius: 10rpx;
  311. padding: 0 22rpx;
  312. }
  313. .treeData_1 {
  314. font-size: 30rpx;
  315. color: #101010;
  316. height: 88rpx;
  317. display: flex;
  318. justify-content: space-between;
  319. align-items: center;
  320. }
  321. .treeData_1s {
  322. font-size: 30rpx;
  323. color: #101010;
  324. display: flex;
  325. justify-content: space-between;
  326. align-items: center;
  327. padding: 22upx 0;
  328. min-height: 88rpx;
  329. }
  330. .treeData_2 {
  331. border-top: 1upx dashed #E3E1E1;
  332. }
  333. .treeData_3 {
  334. border-top: 1upx dashed #E3E1E1;
  335. }
  336. .treeData_three {
  337. background-color: #F7F7F7;
  338. padding: 0 22rpx;
  339. border-radius: 10rpx;
  340. margin-bottom: 22;
  341. }
  342. .treeData_three:first-child {
  343. border-radius: 10rpx 10rpx 0 0;
  344. }
  345. .treeData_three:last-child {
  346. border-radius: 0 0 10rpx 10rpx;
  347. }
  348. .indexColor {
  349. color: #0A8CD5;
  350. font-weight: bold;
  351. }
  352. .padding-sm{padding:20rpx 22rpx;}
  353. </style>