personBase.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <view>
  3. <scroll-view scroll-y class="">
  4. <!-- 头部 -->
  5. <cu-custom bgColor="bg-blue" :isBack="true" :backNum="2">
  6. <block slot="backText">资料管理</block>
  7. <block slot="content"></block>
  8. <block slot="right">
  9. <view class=" flex justify-center" >
  10. <button @click="search()" class="cu-btn round line-blue text-white" style="width: 160rpx;height: 66rpx;padding: 0;">
  11. <image src="/static/index/search-white.png" style="width: 32rpx;height: 32rpx;margin-right: 16rpx;"></image>搜索
  12. </button>
  13. </view>
  14. </block>
  15. </cu-custom>
  16. <!-- 上级选择的内容 -->
  17. <view class="goback_b">
  18. <image @click="backTo()" src="../../static/task/show.png" style="width: 80rpx;height: 80rpx;margin-right: 20rpx;"></image>
  19. <view style="font-size: 34rpx;color: #101010;font-weight: bold;">{{nodeName}}</view>
  20. </view>
  21. <!-- 内容 -->
  22. <view v-for="(item,index) in treeData" class="treeData_b" :key="item.id">
  23. <view class="treeData_1" @click="treeTap(index+1,item)">
  24. <view style="font-weight: bold;font-size: 34rpx;" :class="item.selected?'indexColor':''">{{item.name}}</view>
  25. <view v-if="item.children.length>0">
  26. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="show == index + 1"></image>
  27. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="show != index + 1 || show == 0"></image>
  28. </view>
  29. </view>
  30. <view v-for="(second,seconds) in item.children" :key="second.id" v-if="show == index + 1">
  31. <view class="treeData_1s treeData_2" @click="secondTap(seconds + 1,second)">
  32. <view :class="second.selected?'indexColor':''">{{second.name}}</view>
  33. <view v-if="second.children.length>0">
  34. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showsecond == seconds + 1"></image>
  35. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showsecond != seconds + 1 || showsecond == 0"></image>
  36. </view>
  37. </view>
  38. <view v-if="showsecond == seconds + 1" :style="{'padding-bottom': second.children.length>0 ? '22rpx':''}">
  39. <view v-for="(three,threes) in second.children" :key="three.id" class="treeData_three">
  40. <view class="treeData_1s treeData_3" @click="threeTap(threes + 1,three)">
  41. <view :class="three.selected?'indexColor':''">{{three.name}}</view>
  42. <view v-if="three.children.length>0">
  43. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showthree == threes + 1"></image>
  44. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showthree != threes + 1 || showthree == 0"></image>
  45. </view>
  46. </view>
  47. <view v-if="showthree == threes + 1" v-for="(four,fours) in three.children" :key="four.id">
  48. <view class="treeData_1s treeData_3" @click="fourTap(fours + 1,four)">
  49. <view style="padding-left: 22rpx;" :class="four.selected?'indexColor':''"><text style="margin-right: 10rpx;">◈</text>{{four.name}}</view>
  50. <view v-if="four.children.length>0">
  51. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showfour == fours + 1"></image>
  52. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showfour != fours + 1 || showfour == 0"></image>
  53. </view>
  54. </view>
  55. <view v-if="showfour == fours + 1" v-for="(five,fives) in four.children" :key="five.id">
  56. <view class="treeData_1s treeData_3" @click="fiveTap(fives + 1,five)">
  57. <view style="padding-left: 44rpx;" :class="five.selected?'indexColor':''"><text style="margin-right: 10rpx;">➣</text>{{five.name}}</view>
  58. <view v-if="five.children.length>0">
  59. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showfive == fives + 1"></image>
  60. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showfive != fives + 1 || showfive == 0"></image>
  61. </view>
  62. </view>
  63. <view v-if="showfive == fives + 1" v-for="(six,sixs) in five.children" :key="six.id">
  64. <view class="treeData_1s treeData_3" @click="sixTap(sixs + 1,six)">
  65. <view style="padding-left: 66rpx;" :class="six.selected?'indexColor':''"><text style="margin-right: 10rpx;">•</text>{{six.name}}</view>
  66. <view v-if="six.children.length>0">
  67. <image src="/static/information/shang.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showsix == sixs + 1"></image>
  68. <image src="/static/information/xia.png" style="width: 40rpx;height: 40rpx;vertical-align: middle;" v-if="showsix != sixs + 1 || showsix == 0"></image>
  69. </view>
  70. </view>
  71. <view v-if="showsix == sixs + 1" v-for="(seven,sevens) in six.children" :key="seven.id">
  72. <view class="treeData_1s treeData_3" @click="sevenTap(sevens + 1,seven)">
  73. <view style="padding-left: 88rpx;" :class="seven.selected?'indexColor':''">{{seven.name}}</view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. <!-- <ly-tree :tree-data="treeData"
  84. ref="tree"
  85. node-key="id"
  86. :ready="true"
  87. :accordion="true"
  88. :filter-node-method="filterNode"
  89. :highlightCurrent="true"
  90. :checkOnlyLeaf="true"
  91. @node-click="handleNodeClick">
  92. </ly-tree> -->
  93. </scroll-view>
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. data() {
  99. return {
  100. nodeName:"",
  101. id:"",
  102. treeData:[],
  103. show: 0, //一级状态
  104. showsecond: 0, //二级状态
  105. showthree: 0, //三级状态
  106. showfour: 0, //四级状态
  107. showfive: 0, //五级状态
  108. showsix: 0, //六级状态
  109. showseven: 0, //七级状态
  110. engineeringType:'',//6为隐蔽工程
  111. }
  112. },
  113. onLoad(e){
  114. this.nodeName =e.name;
  115. this.id=e.id;
  116. this.engineeringType=e.type;
  117. this.findTree(e.id);
  118. },
  119. methods: {
  120. findTree(id){
  121. var that =this;
  122. let obj = {id:id}
  123. if(this.engineeringType){
  124. obj.type = this.engineeringType
  125. }
  126. that.http.request('/app/divideClient/findDivideClientById',obj).then((result)=>{
  127. if(result){
  128. that.treeData=result;
  129. that.text(that.treeData);
  130. }else{
  131. that.$prompt.Error("暂无数据")
  132. }
  133. })
  134. },
  135. search(){
  136. uni.setStorageSync("pageType",0);//区分搜索页面跳转
  137. uni.navigateTo({
  138. url:"/pages/search/search"
  139. })
  140. },
  141. handleNodeClick(obj) {
  142. /* console.log("子节点信息:",obj);
  143. console.log("子节点路径:",this.$refs.tree.getNodePath(obj)) */
  144. if(obj.type==4){//判断是否为工序文件
  145. uni.navigateTo({
  146. url:"/pages/personBaseIndex/personBaseIndex?id="+obj.id
  147. })
  148. }else if(obj.type == 26){
  149. //隐蔽工程
  150. uni.navigateTo({
  151. url:"/pages/personBaseIndex/personBaseIndex?id="+obj.id
  152. })
  153. }
  154. /* else{
  155. this.$prompt.none("不是工序文件")
  156. } */
  157. },
  158. filterNode(value, data) {
  159. if (!value) return true;
  160. return data.label.indexOf(value) !== -1;
  161. },
  162. backTo(){
  163. uni.navigateBack({
  164. delta: 1
  165. });
  166. },
  167. treeTap(e,r) {
  168. this.text(this.treeData)
  169. r.selected = true;
  170. if (this.show == e) {
  171. this.show = 0
  172. } else {
  173. this.show = e
  174. }
  175. this.handleNodeClick(r);
  176. },
  177. secondTap(e,r) {
  178. this.text(this.treeData)
  179. r.selected = true;
  180. if (this.showsecond == e) {
  181. this.showsecond = 0
  182. } else {
  183. this.showsecond = e
  184. }
  185. this.handleNodeClick(r);
  186. },
  187. threeTap(e,r) {
  188. this.text(this.treeData)
  189. r.selected = true;
  190. if (this.showthree == e) {
  191. this.showthree = 0
  192. } else {
  193. this.showthree = e
  194. }
  195. this.handleNodeClick(r);
  196. },
  197. fourTap(e,r) {
  198. this.text(this.treeData);
  199. this.$set(r,"selected",true);
  200. if (this.showfour == e) {
  201. this.showfour = 0
  202. } else {
  203. this.showfour = e
  204. }
  205. this.handleNodeClick(r);
  206. },
  207. fiveTap(e,r) {
  208. this.text(this.treeData);
  209. this.$set(r,"selected",true);
  210. if (this.showfive == e) {
  211. this.showfive = 0
  212. } else {
  213. this.showfive = e
  214. }
  215. this.handleNodeClick(r);
  216. },
  217. sixTap(e,r) {
  218. this.text(this.treeData)
  219. r.selected = true;
  220. if (this.showsix == e) {
  221. this.showsix = 0
  222. } else {
  223. this.showsix = e
  224. }
  225. this.handleNodeClick(r);
  226. },
  227. sevenTap(e,r) {
  228. this.text(this.treeData)
  229. r.selected = true;
  230. if (this.showseven == e) {
  231. this.showseven = 0
  232. } else {
  233. this.showseven = e
  234. }
  235. this.handleNodeClick(r);
  236. },
  237. text(data) {
  238. var that = this;
  239. data.forEach((item) => {
  240. item.selected = false;
  241. if (item.children.length > 0) {
  242. that.text(item.children);
  243. }
  244. })
  245. that.treeData = data;
  246. }
  247. }
  248. }
  249. </script>
  250. <style>
  251. .goback_b{display: flex;align-items: center;height: 120rpx;background-color: #fff;padding: 0 22rpx;border-radius: 0 0 20rpx 20rpx;margin-bottom: 22rpx;box-shadow: 0px 1px 4px #D0D0D0;}
  252. .treeData_b {
  253. margin:0 22rpx 12rpx ;
  254. background-color: #fff;
  255. border-radius: 10rpx;
  256. padding: 0 22rpx;
  257. }
  258. .treeData_1 {
  259. font-size: 30rpx;
  260. color: #101010;
  261. height: 88rpx;
  262. display: flex;
  263. justify-content: space-between;
  264. align-items: center;
  265. }
  266. .treeData_1s {
  267. font-size: 30rpx;
  268. color: #101010;
  269. display: flex;
  270. justify-content: space-between;
  271. align-items: center;
  272. padding: 22upx 0;
  273. min-height: 88rpx;
  274. }
  275. .treeData_2 {
  276. border-top: 1upx dashed #E3E1E1;
  277. }
  278. .treeData_3 {
  279. border-top: 1upx dashed #E3E1E1;
  280. }
  281. .treeData_three {
  282. background-color: #F7F7F7;
  283. padding: 0 22rpx;
  284. border-radius: 10rpx;
  285. margin-bottom: 22;
  286. }
  287. .treeData_three:first-child {
  288. border-radius: 10rpx 10rpx 0 0;
  289. }
  290. .treeData_three:last-child {
  291. border-radius: 0 0 10rpx 10rpx;
  292. }
  293. .indexColor {
  294. color: #0A8CD5;
  295. font-weight: bold;
  296. }
  297. </style>