index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div style="background: #f8f8f8;">
  3. <normalLayout>
  4. <template #refresh>
  5. <el-button size="mini" type="text" style="margin-right: 15px;color: #3874f6;font-size: 14px" @click="toTop">返回顶部</el-button>
  6. <!-- <i class="el-icon-refresh-right"></i>-->
  7. </template>
  8. <template #content>
  9. <div style="overflow: auto;height: calc(100vh - 220px)" ref="rollRef" @scroll="handleScroll">
  10. <div style="margin: 10px 24px 20px 24px;" >
  11. <div class="inline-16">
  12. <label class="search__label" >部门:</label>
  13. <!-- <el-cascader ref="selectdep" size="small" v-model="departmentid" :options="deplist" :props="{emitPath:true,expandTrigger:'hover',checkStrictly:true,label:'label',value:'departmentid',children:'children'}" @change="selectDep" clearable></el-cascader>-->
  14. <el-cascader class="inline-16" placement="bottom" ref="selectdep" size="small" v-model="depment" :options="deplist" :props="{emitPath:true,expandTrigger:'hover',checkStrictly:true,label:'label',value:'departmentid',children:'children'}" @change="selectDep" clearable></el-cascader>
  15. </div>
  16. </div>
  17. <!-- 数字看板 -->
  18. <digitalSigns ref="digitalSigns"></digitalSigns>
  19. <!-- 线索新增 -->
  20. <clueAdd ref="clueAdd" :dataid="departmentid" :scrollHeight="scrollData" :windowWidth="windowWidth" @backFull="backFull" ></clueAdd>
  21. <!-- 线索跟进 -->
  22. <clueFollow ref="clueFollow" :dataid="departmentid" :scrollHeight="scrollData" :windowWidth="windowWidth" @backFull="backFull"></clueFollow>
  23. <!-- 线索转化 -->
  24. <clueChange ref="clueChange" :dataid="departmentid" :scrollHeight="scrollData" :windowWidth="windowWidth" @backFull="backFull"></clueChange>
  25. <!-- 有效线索未跟进天数 -->
  26. <clueUnFollow ref="clueUnFollow" :dataid="departmentid" :scrollHeight="scrollData" :windowWidth="windowWidth" @backFull="backFull"></clueUnFollow>
  27. </div>
  28. </template>
  29. </normalLayout>
  30. </div>
  31. </template>
  32. <script>
  33. import digitalSigns from "@/views/clueData/modules/digitalSigns";
  34. import clueAdd from "@/views/clueData/modules/clueAdd";
  35. import clueFollow from "@/views/clueData/modules/clueFollow";
  36. import clueChange from "@/views/clueData/modules/clueChange";
  37. import clueUnFollow from "@/views/clueData/modules/clueUnFollow";
  38. import normalLayout from '@/components/normal-basic-layout/normalNew'
  39. export default {
  40. name: "index",
  41. components:{normalLayout,digitalSigns,clueAdd,clueFollow,clueChange,clueUnFollow},
  42. data(){
  43. return {
  44. depment:'',
  45. departmentid:'',
  46. deplist:[],
  47. personnelList:[],
  48. depmentParam:{
  49. "id": 20230620102004,
  50. "content": {
  51. }
  52. },
  53. scrollData:'',
  54. windowWidth: document.documentElement.clientWidth, //实时屏幕宽度
  55. }
  56. },
  57. watch: {
  58. windowWidth (val) {
  59. console.log("实时屏幕宽度:",val );
  60. }
  61. },
  62. methods:{
  63. async departmentrtment() {
  64. const res = await this.$api.requested(this.depmentParam)
  65. this.deplist = this.createMenu(res.data.dep)
  66. this.personnelList = res.data.hr
  67. this.depment = ''
  68. /* this.departmentid = res.data.dep[0].departmentid*/
  69. const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
  70. this.otherMethod(userid)
  71. },
  72. /*其他页面调用*/
  73. otherMethod(dataid){
  74. const userName = JSON.parse(sessionStorage.getItem('active_account')).name
  75. /*数字看板*/
  76. this.$refs.digitalSigns.param.content.type = '0'
  77. this.$refs.digitalSigns.listData(dataid)
  78. /*线索新增*/
  79. this.$refs.clueAdd.$refs.departmentSalesperson.depment = ''
  80. this.$refs.clueAdd.$refs.departmentSalesperson.deplist = this.deplist
  81. this.$refs.clueAdd.$refs.departmentSalesperson.person = userName
  82. this.$refs.clueAdd.param.content.type = '0'
  83. this.$refs.clueAdd.$refs.departmentSalesperson.personnelList = this.personnelList
  84. this.$refs.clueAdd.listData(dataid)
  85. /*线索跟进*/
  86. this.$refs.clueFollow.$refs.departmentSalesperson.depment = ''
  87. this.$refs.clueFollow.$refs.departmentSalesperson.deplist = this.deplist
  88. this.$refs.clueFollow.$refs.departmentSalesperson.person = userName
  89. this.$refs.clueFollow.param.content.type = '0'
  90. this.$refs.clueFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  91. this.$refs.clueFollow.listData(dataid)
  92. /*线索转化*/
  93. this.$refs.clueChange.$refs.departmentSalesperson.depment = ''
  94. this.$refs.clueChange.$refs.departmentSalesperson.deplist = this.deplist
  95. this.$refs.clueChange.$refs.departmentSalesperson.person = userName
  96. this.$refs.clueChange.param.content.type = '0'
  97. this.$refs.clueChange.$refs.departmentSalesperson.personnelList = this.personnelList
  98. this.$refs.clueChange.listData(dataid)
  99. /*有效线索未跟进天数*/
  100. this.$refs.clueUnFollow.$refs.departmentSalesperson.depment = ''
  101. this.$refs.clueUnFollow.$refs.departmentSalesperson.deplist = this.deplist
  102. this.$refs.clueUnFollow.$refs.departmentSalesperson.person = userName
  103. this.$refs.clueUnFollow.param.content.type = '0'
  104. this.$refs.clueUnFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  105. this.$refs.clueUnFollow.listData(dataid)
  106. },
  107. /*其他页面调用图表*/
  108. otherModel(dataid,type){
  109. /*数字看板*/
  110. this.$refs.digitalSigns.param.content.type = type
  111. this.$refs.digitalSigns.listData(dataid)
  112. /*线索新增*/
  113. this.$refs.clueAdd.$refs.departmentSalesperson.depment = type == '1'?dataid:''
  114. this.$refs.clueAdd.$refs.departmentSalesperson.deplist = this.deplist
  115. this.$refs.clueAdd.$refs.departmentSalesperson.person = type == '0'?dataid:''
  116. this.$refs.clueAdd.param.content.type = type
  117. this.$refs.clueAdd.$refs.departmentSalesperson.personnelList = this.personnelList
  118. this.$refs.clueAdd.queryModel(dataid)
  119. /*线索跟进*/
  120. this.$refs.clueFollow.$refs.departmentSalesperson.depment = type == '1'?dataid:''
  121. this.$refs.clueFollow.$refs.departmentSalesperson.deplist = this.deplist
  122. this.$refs.clueFollow.$refs.departmentSalesperson.person = type == '0'?dataid:''
  123. this.$refs.clueFollow.param.content.type = type
  124. this.$refs.clueFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  125. this.$refs.clueFollow.queryModel(dataid)
  126. /*线索转化*/
  127. this.$refs.clueChange.$refs.departmentSalesperson.depment = type == '1'?dataid:''
  128. this.$refs.clueChange.$refs.departmentSalesperson.deplist = this.deplist
  129. this.$refs.clueChange.$refs.departmentSalesperson.person = type == '0'?dataid:''
  130. this.$refs.clueChange.param.content.type = type
  131. this.$refs.clueChange.$refs.departmentSalesperson.personnelList = this.personnelList
  132. this.$refs.clueChange.queryModel(dataid)
  133. /*有效线索未跟进天数*/
  134. this.$refs.clueUnFollow.$refs.departmentSalesperson.depment = type == '1'?dataid:''
  135. this.$refs.clueUnFollow.$refs.departmentSalesperson.deplist = this.deplist
  136. this.$refs.clueUnFollow.$refs.departmentSalesperson.person = type == '0'?dataid:''
  137. this.$refs.clueUnFollow.param.content.type = type
  138. this.$refs.clueUnFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  139. this.$refs.clueUnFollow.queryModel(dataid)
  140. },
  141. createMenu (array) {
  142. var that = this
  143. let arr = []
  144. function convertToElementTree(node) {
  145. // 新节点
  146. if (node.subdep.length === 0){
  147. var elNode = {
  148. label: node["depname"],
  149. parentid:node['parentid'],
  150. parentname:node['parentname'],
  151. departmentid:node["departmentid"],
  152. value:node["departmentid"],
  153. remarks:node["remarks"],
  154. isused:node["isused"],
  155. changedate:node['changedate'],
  156. changeby:node['changeby'],
  157. createdate:node['createdate'],
  158. createby:node['createby'],
  159. depno:node['depno'],
  160. disabled:that.pageOnlyRead,
  161. }
  162. }else {
  163. var elNode = {
  164. label: node["depname"],
  165. parentid:node['parentid'],
  166. parentname:node['parentname'],
  167. departmentid:node["departmentid"],
  168. value:node["departmentid"],
  169. remarks:node["remarks"],
  170. isused:node["isused"],
  171. changedate:node['changedate'],
  172. changeby:node['changeby'],
  173. createdate:node['createdate'],
  174. createby:node['createby'],
  175. depno:node['depno'],
  176. disabled:that.pageOnlyRead,
  177. children: []
  178. }
  179. }
  180. if (node.subdep && node.subdep.length > 0) {
  181. // 如果存在子节点
  182. for (var index = 0; index < node.subdep.length; index++) {
  183. // 遍历子节点, 把每个子节点看做一颗独立的树, 传入递归构造子树, 并把结果放回到新node的children中
  184. elNode.children.push(convertToElementTree(node.subdep[index]));
  185. }
  186. }
  187. return elNode;
  188. }
  189. array.forEach((element) => {
  190. arr.push(convertToElementTree(element))
  191. });
  192. return arr
  193. },
  194. selectDep(val) {
  195. if (val.length === 0){
  196. const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
  197. this.otherModel(userid,'0')
  198. }else {
  199. this.person = ''
  200. this.departmentid = val[val.length -1]
  201. this.otherModel(this.departmentid,'1')
  202. }
  203. },
  204. /*返回顶部*/
  205. toTop() {
  206. this.$refs.rollRef.scrollTop = 0
  207. },
  208. backFull(val){
  209. if (val){
  210. this.$refs.rollRef.scrollTop = val
  211. }
  212. },
  213. handleScroll(){
  214. this.scrollData = this.$refs.rollRef.scrollTop
  215. }
  216. },
  217. mounted() {
  218. this.departmentrtment()
  219. var that = this;
  220. // <!--把window.onresize事件挂在到mounted函数上-->
  221. window.onresize = () => {
  222. return (() => {
  223. window.fullWidth = document.documentElement.clientWidth;
  224. that.windowWidth = window.fullWidth; // 宽
  225. })()
  226. };
  227. }
  228. }
  229. </script>
  230. <style scoped>
  231. </style>