index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div ref="pointStep" class="h100 saga-maintenance">
  3. <!-- <bread class="bread-view"></bread> -->
  4. <div class="saga-btns-view">
  5. <template v-for="(item,index) in jsonTitle">
  6. <div
  7. :key="index"
  8. @click="changeStep(index)"
  9. class="saga-steps-btn pointer saga-size3"
  10. :class="{
  11. 'active-steps': activeStep == index + 1
  12. }"
  13. >
  14. <div class="border-view">
  15. <div class="point-step">{{index + 1}}</div>
  16. <div class="jiao"></div>
  17. <div class="point-title">{{item}}</div>
  18. </div>
  19. </div>
  20. </template>
  21. </div>
  22. <div class="main-view">
  23. <step1 ref="step" v-if="activeStep == 1"></step1>
  24. <step2 ref="step" v-if="activeStep == 2"></step2>
  25. <step3 ref="step" v-if="activeStep == 3"></step3>
  26. <step4 ref="step" v-if="activeStep == 4"></step4>
  27. </div>
  28. </div>
  29. </template>
  30. <script>
  31. // import bread from "components/common/bread_crumb"
  32. import step1 from "./step1"
  33. import step2 from "./step2"
  34. import step3 from "./step3"
  35. import step4 from "./step4"
  36. import {
  37. mapGetters,
  38. mapActions
  39. } from "vuex";
  40. export default {
  41. data() {
  42. return {
  43. activeStep: 1, //活跃的step
  44. jsonTitle: [
  45. "原始点位表收集", "原始点位描述关键内容识别", "原始点位描述标准化", "点位表处理结果检查"
  46. ],
  47. activeHeight: 0
  48. }
  49. },
  50. computed: {
  51. ...mapGetters("project", [
  52. "dataName"
  53. ]),
  54. ...mapGetters("layout", [
  55. "projectId"
  56. ])
  57. },
  58. created() {
  59. this.$store.dispatch('setBreadcrumb', [{
  60. label: '系统集成',
  61. path: '/point/pointsetting'
  62. }, {
  63. label: '子系统点表整理工具',
  64. path: '/point/pointsetting'
  65. }, {
  66. label: `点位收集(${this.dataName})`
  67. }])
  68. },
  69. mounted() {
  70. // console.log(this.$refs.pointStep.parentElement.parentElement.offsetHeight,'pointStep')
  71. this.resize()
  72. // document.addEventListener("resize",this.resize)
  73. window.onresize = this.resize
  74. },
  75. methods: {
  76. resize() {
  77. this.activeHeight = this.$refs.pointStep.parentElement.parentElement.parentElement.offsetHeight - 10
  78. },
  79. stepClick() {
  80. console.log("test")
  81. },
  82. changeStep(index) {
  83. // console.log()
  84. let step = this.$refs.step
  85. let flag = step.hasOwnProperty('noSaveData') ? step.noSaveData() : false
  86. if (flag || this.activeStep == 4 || this.activeStep == 3) {
  87. this.activeStep = index + 1
  88. } else {
  89. this.$confirm('存在数据未保存, 是否继续?', '提示', {
  90. confirmButtonText: '确定',
  91. cancelButtonText: '取消',
  92. type: 'warning'
  93. }).then(() => {
  94. this.activeStep = index + 1
  95. }).catch(() => {
  96. return false
  97. });
  98. }
  99. }
  100. },
  101. components: {
  102. // bread,
  103. step1,
  104. step2,
  105. step3,
  106. step4
  107. },
  108. watch: {
  109. projectId(){
  110. this.$router.push({
  111. path: '/point/pointsetting'
  112. })
  113. }
  114. },
  115. //路由切换提示
  116. beforeRouteLeave(to, from, next) {
  117. let step = this.$refs.step
  118. let flag = step.hasOwnProperty('noSaveData') ? step.noSaveData() : false
  119. if(flag || this.activeStep == 4 || this.activeStep == 3){
  120. next()
  121. }else{
  122. this.$confirm('存在数据未保存, 是否继续?', '提示', {
  123. confirmButtonText: '确定',
  124. cancelButtonText: '取消',
  125. type: 'warning'
  126. }).then(() => {
  127. next()
  128. }).catch(() => {
  129. next(false)
  130. });
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss">
  136. .h100 {
  137. background-color: #fff; // padding: 0 10px;
  138. box-sizing: border-box;
  139. display: flex;
  140. flex-flow: column;
  141. .bread-view {
  142. height: 45px;
  143. }
  144. .main-view {
  145. flex: 1;
  146. display: flex;
  147. flex-flow: column;
  148. }
  149. .saga-btns-view {
  150. background-color: #fff; // display: flex;
  151. // justify-content: space-around;
  152. padding: 20px 0;
  153. box-sizing: border-box;
  154. height: 80px;
  155. text-align: center;
  156. .saga-steps-btn {
  157. display: inline-block;
  158. width: 250px;
  159. margin-right: 20px;
  160. height: 40px;
  161. background: #EEFAFF;
  162. box-shadow: 0 0 2px 0 #DDD;
  163. border-radius: 6px;
  164. font-size: 14px;
  165. line-height: 40px;
  166. color: #666;
  167. box-sizing: border-box;
  168. .border-view {
  169. border: 1px solid #C2CEDB;
  170. border-radius: 6px;
  171. height: 34px;
  172. line-height: 34px;
  173. overflow: hidden;
  174. margin: 2px 5px;
  175. box-sizing: border-box;
  176. position: relative;
  177. flex: 1;
  178. .jiao {
  179. display: inline-block;
  180. border-top: 17px solid transparent;
  181. border-left: 17px solid #C2CEDB;
  182. border-bottom: 17px solid transparent;
  183. position: relative;
  184. float: left;
  185. &::after {
  186. content: '';
  187. position: absolute;
  188. top: -17px;
  189. left: -18px;
  190. border-top: 17px solid transparent;
  191. border-left: 17px solid #EEFAFF;
  192. border-bottom: 17px solid transparent;
  193. }
  194. }
  195. .point-step {
  196. font-size: 24px;
  197. padding: 0 9px;
  198. float: left;
  199. }
  200. .point-title {
  201. float: left; // padding-left: 10px;
  202. // padding-right: 22px;
  203. width: 168px;
  204. }
  205. } // height: 80px;
  206. // text-align: center;
  207. // /*设置文本水平居中*/
  208. // display: table-cell;
  209. // vertical-align: middle;
  210. // padding: 0 30px;
  211. }
  212. .active-steps {
  213. background-color: rgb(179, 216, 255);
  214. .border-view {
  215. border-color: #5BA7FF;
  216. .point-step {
  217. background-color: #5BA7FF;
  218. color: #fff;
  219. }
  220. .jiao {
  221. border-left-color: #5BA7FF;
  222. &::after {
  223. border-left-color: #5BA7FF;
  224. }
  225. }
  226. }
  227. }
  228. }
  229. }
  230. </style>