index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="sassPlatform">
  3. <div class="sp_header">
  4. <!-- <div class="sp_h_logo">
  5. </div> -->
  6. <div class="sp_h_tagArea">
  7. <span :class="{tagActive:tagIndex==0}" style="margin-left: 10px;" @click="tagIndex = 0">应用中心</span>
  8. <span :class="{tagActive:tagIndex==1}" style="margin-left: 17.5px;" @click="goTestSmarter()">智能助手</span>
  9. </div>
  10. </div>
  11. <div class="sp_bottom">
  12. <div class="sp_b_left">
  13. <div class="sp_b_l_form" v-for="(item,index) in navList" :key="item.navIndex">
  14. <span @click="item.open = !item.open">{{ item.name }}<svg :style="`transform: rotate(${item.open?'180':'0'}deg);`" t="1739262423649" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7079" width="200" height="200"><path d="M52.335 261.072c-31.269 30.397-31.269 79.722 0 110.194l403.212 391.718c31.325 30.382 82.114 30.382 113.377 0l403.197-391.718c31.325-30.466 31.325-79.793 0-110.194-31.28-30.449-82.058-30.449-113.39 0l-346.497 336.64-346.457-336.64c-31.325-30.448-82.105-30.448-113.446 0l0 0z" p-id="7080"></path></svg></span>
  15. <div v-show="item.open" v-if="item.children.length>0">
  16. <span v-for="(item2,index2) in item.children" :key="item2.navIndex" @click="changeNavIndex(item2.navIndex,item2)" :class="{formActive:item2.navIndex==navIndex}">{{ item2.name }}</span>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="sp_b_right">
  21. <tableView v-if="navType == 'formManage' && navShowCardObj.id" :typeId="navShowCardObj.id" :typeList="navShowCardObj.typeList"/>
  22. <examine v-if="navType == 'annualAssessment'"/>
  23. <databoard v-if="navType == 'evaluationDataVisualization'"/>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import tableView from './view/tableView.vue';
  30. import examine from './view/examine/index'
  31. import databoard from './view/databoard.vue';
  32. export default {
  33. components:{
  34. tableView,
  35. examine,
  36. databoard
  37. },
  38. data(){
  39. return{
  40. tagIndex:0,
  41. navList:[ ],
  42. navIndex:'0-0',
  43. navType:"",
  44. userId: this.$route.query.userid,
  45. oid: this.$route.query.oid,
  46. org: this.$route.query.org,
  47. role:this.$route.query.role,
  48. userData:null
  49. }
  50. },
  51. computed:{
  52. navShowCardObj(){
  53. let _result = {
  54. id:"",
  55. typeList:[],
  56. }
  57. if(this.navType == 'formManage'){
  58. let _indexList = this.navIndex.split("-");
  59. let _data = this.navList[parseInt(_indexList[0])];
  60. _result.id = _data.id;
  61. _result.typeList = _data.typeList;
  62. }
  63. return _result;
  64. }
  65. },
  66. methods: {
  67. getNavType() {
  68. return new Promise((resolve)=>{
  69. let params = {
  70. oid: "",//this.oid
  71. };
  72. this.ajax
  73. .get(this.$store.state.api + "selectTestType", params)
  74. .then(res => {
  75. let _data = res.data[0];
  76. let _type1 = _data.filter(i => i.pid == "");
  77. _type1.forEach((i,index) => {
  78. let _typeList = [];
  79. _typeList = _data.filter(i2 => i2.pid == i.id);
  80. let _children = [{name:"表单管理",type:"formManage",typeId:i.id,navIndex:`${index}-0`}]
  81. i.open = false;
  82. if(i.id=='e18d88b3-e828-11ef-b508-005056924926'){
  83. if(this.userData && this.userData.type === 1 && this.userData.role == 1){
  84. _children.push({name:"年度考核",type:"annualAssessment",navIndex:`${index}-1`})
  85. }
  86. _children.push({name:"考核数据可视化",type:"evaluationDataVisualization",navIndex:`${index}-2`})
  87. i.open = true;
  88. }
  89. i.children = _children;
  90. i.typeList = _typeList;
  91. i.navIndex = `${index}`
  92. });
  93. this.navList = _type1;
  94. resolve()
  95. })
  96. .catch(err => {
  97. console.log(err);
  98. });
  99. })
  100. },
  101. changeNavIndex(newIndex,item){
  102. this.navIndex = newIndex;
  103. this.navType = item.type
  104. },
  105. goTestSmarter(){
  106. this.$router.push(
  107. "/testSmarter?userid=" +
  108. this.userId +
  109. "&oid=" +
  110. this.oid +
  111. "&org=" +
  112. this.org +
  113. "&role=" +
  114. this.role+
  115. "&cid=undefined"+
  116. "&back=sass"
  117. );
  118. },
  119. getUser(uid) {
  120. return new Promise(resolve => {
  121. let params = { uid: uid };
  122. this.ajax
  123. .get(this.$store.state.api + "getUser", params)
  124. .then(res => {
  125. let data = res.data[0][0];
  126. this.userData = data;
  127. resolve()
  128. })
  129. .catch(err => {
  130. console.error(err);
  131. resolve()
  132. });
  133. });
  134. },
  135. },
  136. mounted(){
  137. this.getUser(this.userId).then(()=>{
  138. this.getNavType().then(_=>{
  139. if(this.navList.length>0){
  140. let _data = this.navList[0].children[0];
  141. this.changeNavIndex(_data.navIndex,_data)
  142. }
  143. });
  144. })
  145. }
  146. }
  147. </script>
  148. <style scoped>
  149. .sassPlatform{
  150. width: 100vw;
  151. height: 100vh;
  152. margin: 0;
  153. box-sizing: border-box;
  154. background-color: white;
  155. }
  156. .sp_header{
  157. width: 100%;
  158. height: 54px;
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. box-sizing: border-box;
  163. padding: 10px 0;
  164. box-sizing: border-box;
  165. border-bottom: solid 1px #BBBBBB;
  166. }
  167. .sp_h_tagArea{
  168. width: auto;
  169. height: auto;
  170. display: flex;
  171. align-items: center;
  172. }
  173. .sp_h_tagArea>span{
  174. cursor: pointer;
  175. font-size: 20px;
  176. transition: .2s;
  177. color:#999;
  178. position: relative;
  179. padding: 0 15px;
  180. }
  181. .sp_h_tagArea>span:hover{
  182. color: #000;
  183. }
  184. .tagActive{
  185. font-weight: bold;
  186. color: #000 !important;
  187. }
  188. .tagActive::after{
  189. content: "";
  190. width: 100%;
  191. background: #3681FC;
  192. height: 2px;
  193. position: absolute;
  194. left: 0;
  195. bottom: -8px;
  196. }
  197. .sp_bottom{
  198. width: 100%;
  199. height: calc(100% - 70px);
  200. display: flex;
  201. }
  202. .sp_b_left{
  203. width: 15%;
  204. min-width: 200px;
  205. height: 100%;
  206. box-sizing: border-box;
  207. border-right:solid 1px #D5D5D5;
  208. }
  209. .sp_b_l_form{
  210. width: 100%;
  211. height: auto;
  212. background-color: white;
  213. }
  214. .sp_b_l_form>span{
  215. width: 100%;
  216. height: 60px;
  217. box-sizing: border-box;
  218. display: flex;
  219. align-items: center;
  220. justify-content: space-between;
  221. background-color: white;
  222. padding: 0 30px;
  223. cursor: pointer;
  224. transition: .3s;
  225. font-size: 18px;
  226. }
  227. .sp_b_l_form>span:hover{
  228. color: #1684FC;
  229. }
  230. .sp_b_l_form>span:hover>svg{
  231. fill: #1684FC;
  232. }
  233. .sp_b_l_form>span>svg{
  234. width: 15px;
  235. height: 15px;
  236. }
  237. .sp_b_l_form>div{
  238. width: 100%;
  239. height: auto;
  240. box-sizing: border-box;
  241. background-color: #F7F7F7;
  242. }
  243. .sp_b_l_form>div>span{
  244. width: 100%;
  245. height: 60px;
  246. display: flex;
  247. align-items: center;
  248. justify-content: space-between;
  249. box-sizing: border-box;
  250. padding: 0 0 0 45px;
  251. cursor: pointer;
  252. transition: .3s;
  253. font-size: 18px;
  254. }
  255. .sp_b_l_form>div>span:hover{
  256. color: #1684FC;
  257. }
  258. .formActive{
  259. color: #1684FC;
  260. }
  261. .sp_b_right{
  262. flex: 1;
  263. height: 100%;
  264. overflow: auto;
  265. }
  266. </style>