index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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="display: flex;justify-content: space-between;margin: 10px 24px 20px 24px;">
  11. <div>
  12. <div class="inline-16">
  13. <label class="search__label" >部门:</label>
  14. <!-- <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>-->
  15. <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>
  16. </div>
  17. <div class="inline-16">
  18. <label class="search__label" >业务员:</label>
  19. <el-select v-model="person" filterable placeholder="请选择" size="small" clearable @change="selectPerson">
  20. <el-option
  21. v-for="item in personnelList"
  22. :key="item.index"
  23. :label="item.name"
  24. :value="item.userid">
  25. </el-option>
  26. </el-select>
  27. </div>
  28. <div class="mt-10 inline-16">
  29. <p class="search__label">状态:</p>
  30. <el-select v-model="isleave" clearable style="margin-right:10px" size="small" placeholder="请选择状态" @change="leaveChange" >
  31. <el-option label="在职" value="1"></el-option>
  32. <el-option label="离职" value="2"></el-option>
  33. </el-select>
  34. </div>
  35. </div>
  36. <div>
  37. <btnSelect :btn-title="['全部','本年','本季','本月','去年']" :date-type="dateType" @btnClick="btnClick"></btnSelect>
  38. </div>
  39. </div>
  40. <!-- 数字看板 -->
  41. <digitalSigns ref="digitalSigns" :person="person" :depment="departmentid" :dateType="dateType" :isleave="isleave" :userName="userName"></digitalSigns>
  42. <!-- 线索新增 -->
  43. <clueAdd ref="clueAdd" :dataid="departmentid" :scrollHeight="scrollData" :windowWidth="windowWidth" @backFull="backFull" ></clueAdd>
  44. <!-- 线索跟进 -->
  45. <clueFollow ref="clueFollow" :dataid="departmentid" :scrollHeight="scrollData" :windowWidth="windowWidth" @backFull="backFull"></clueFollow>
  46. <!-- 线索转化 -->
  47. <clueChange ref="clueChange" :dataid="departmentid" :scrollHeight="scrollData" :windowWidth="windowWidth" @backFull="backFull"></clueChange>
  48. <!-- 有效线索未跟进天数 -->
  49. <clueUnFollow ref="clueUnFollow" :dataid="departmentid" :scrollHeight="scrollData" :windowWidth="windowWidth" @backFull="backFull"></clueUnFollow>
  50. </div>
  51. </template>
  52. </normalLayout>
  53. </div>
  54. </template>
  55. <script>
  56. import digitalSigns from "@/views/clueData/modules/digitalSigns";
  57. import clueAdd from "@/views/clueData/modules/clueAdd";
  58. import clueFollow from "@/views/clueData/modules/clueFollow";
  59. import clueChange from "@/views/clueData/modules/clueChange";
  60. import clueUnFollow from "@/views/clueData/modules/clueUnFollow";
  61. import normalLayout from '@/components/normal-basic-layout/normalNew'
  62. import btnSelect from "@/components/btn_select/btnSelect";
  63. export default {
  64. name: "index",
  65. components:{normalLayout,digitalSigns,clueAdd,clueFollow,clueChange,clueUnFollow,btnSelect},
  66. data(){
  67. return {
  68. depment:'',
  69. departmentid:'',
  70. person:'0028',
  71. isleave:'1',
  72. deplist:[],
  73. personnelList:[],
  74. depmentParam:{
  75. "id": 20230620102004,
  76. "content": {
  77. "isleave":1
  78. }
  79. },
  80. scrollData:'',
  81. dateType:'全部',
  82. windowWidth: document.documentElement.clientWidth, //实时屏幕宽度
  83. userName:JSON.parse(window.sessionStorage.getItem('active_account')).name
  84. }
  85. },
  86. watch: {
  87. windowWidth (val) {
  88. console.log("实时屏幕宽度:",val );
  89. }
  90. },
  91. methods:{
  92. btnClick(data){
  93. this.dateType = data
  94. this.$refs.digitalSigns.listData(this.$refs.digitalSigns.param.content.dataid,data)
  95. },
  96. async departmentrtment() {
  97. const res = await this.$api.requested(this.depmentParam)
  98. this.deplist = this.createMenu(res.data.dep)
  99. this.personnelList = res.data.hr
  100. this.depment = ''
  101. this.person = JSON.parse(window.sessionStorage.getItem('active_account')).name
  102. /* this.departmentid = res.data.dep[0].departmentid*/
  103. const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
  104. this.otherMethod(userid)
  105. },
  106. /*其他页面调用*/
  107. otherMethod(dataid){
  108. const userName = JSON.parse(sessionStorage.getItem('active_account')).name
  109. /*数字看板*/
  110. this.$refs.digitalSigns.param.content.type = '0'
  111. this.$refs.digitalSigns.listData(dataid,this.dateType)
  112. /*线索新增*/
  113. this.$refs.clueAdd.$refs.departmentSalesperson.depment = ''
  114. this.$refs.clueAdd.$refs.departmentSalesperson.deplist = this.deplist
  115. this.$refs.clueAdd.$refs.departmentSalesperson.person = userName
  116. this.$refs.clueAdd.param.content.type = '0'
  117. this.$refs.clueAdd.$refs.departmentSalesperson.personnelList = this.personnelList
  118. this.$refs.clueAdd.listData(dataid)
  119. /*线索跟进*/
  120. this.$refs.clueFollow.$refs.departmentSalesperson.depment = ''
  121. this.$refs.clueFollow.$refs.departmentSalesperson.deplist = this.deplist
  122. this.$refs.clueFollow.$refs.departmentSalesperson.person = userName
  123. this.$refs.clueFollow.param.content.type = '0'
  124. this.$refs.clueFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  125. this.$refs.clueFollow.listData(dataid)
  126. /*线索转化*/
  127. this.$refs.clueChange.$refs.departmentSalesperson.depment = ''
  128. this.$refs.clueChange.$refs.departmentSalesperson.deplist = this.deplist
  129. this.$refs.clueChange.$refs.departmentSalesperson.person = userName
  130. this.$refs.clueChange.param.content.type = '0'
  131. this.$refs.clueChange.$refs.departmentSalesperson.personnelList = this.personnelList
  132. this.$refs.clueChange.listData(dataid)
  133. /*有效线索未跟进天数*/
  134. this.$refs.clueUnFollow.$refs.departmentSalesperson.depment = ''
  135. this.$refs.clueUnFollow.$refs.departmentSalesperson.deplist = this.deplist
  136. this.$refs.clueUnFollow.$refs.departmentSalesperson.person = userName
  137. this.$refs.clueUnFollow.param.content.type = '0'
  138. this.$refs.clueUnFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  139. this.$refs.clueUnFollow.listData(dataid)
  140. },
  141. /*其他页面调用图表*/
  142. otherModel(dataid,type,isleave,state){
  143. /*数字看板*/
  144. this.$refs.digitalSigns.param.content.type = type
  145. this.$refs.digitalSigns.param.content.where.isleave = isleave
  146. this.$refs.digitalSigns.listData(dataid,this.dateType)
  147. /*线索新增*/
  148. this.$refs.clueAdd.$refs.departmentSalesperson.depment = type == '1'?dataid:''
  149. this.$refs.clueAdd.$refs.departmentSalesperson.deplist = this.deplist
  150. this.$refs.clueAdd.$refs.departmentSalesperson.person = state?'':type == '0'?dataid:''
  151. this.$refs.clueAdd.param.content.type = type
  152. this.$refs.clueAdd.$refs.departmentSalesperson.personnelList = this.personnelList
  153. this.$refs.clueAdd.queryModel(dataid,isleave)
  154. /*线索跟进*/
  155. this.$refs.clueFollow.$refs.departmentSalesperson.depment = type == '1'?dataid:''
  156. this.$refs.clueFollow.$refs.departmentSalesperson.deplist = this.deplist
  157. this.$refs.clueFollow.$refs.departmentSalesperson.person = state?'':type == '0'?dataid:''
  158. this.$refs.clueFollow.param.content.type = type
  159. this.$refs.clueFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  160. this.$refs.clueFollow.queryModel(dataid,isleave)
  161. /*线索转化*/
  162. this.$refs.clueChange.$refs.departmentSalesperson.depment = type == '1'?dataid:''
  163. this.$refs.clueChange.$refs.departmentSalesperson.deplist = this.deplist
  164. this.$refs.clueChange.$refs.departmentSalesperson.person = state?'':type == '0'?dataid:''
  165. this.$refs.clueChange.param.content.type = type
  166. this.$refs.clueChange.$refs.departmentSalesperson.personnelList = this.personnelList
  167. this.$refs.clueChange.queryModel(dataid,isleave)
  168. /*有效线索未跟进天数*/
  169. this.$refs.clueUnFollow.$refs.departmentSalesperson.depment = type == '1'?dataid:''
  170. this.$refs.clueUnFollow.$refs.departmentSalesperson.deplist = this.deplist
  171. this.$refs.clueUnFollow.$refs.departmentSalesperson.person = state?'':type == '0'?dataid:''
  172. this.$refs.clueUnFollow.param.content.type = type
  173. this.$refs.clueUnFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  174. this.$refs.clueUnFollow.queryModel(dataid,isleave)
  175. },
  176. createMenu (array) {
  177. var that = this
  178. let arr = []
  179. function convertToElementTree(node) {
  180. // 新节点
  181. if (node.subdep.length === 0){
  182. var elNode = {
  183. label: node["depname"],
  184. parentid:node['parentid'],
  185. parentname:node['parentname'],
  186. departmentid:node["departmentid"],
  187. value:node["departmentid"],
  188. remarks:node["remarks"],
  189. isused:node["isused"],
  190. changedate:node['changedate'],
  191. changeby:node['changeby'],
  192. createdate:node['createdate'],
  193. createby:node['createby'],
  194. depno:node['depno'],
  195. disabled:that.pageOnlyRead,
  196. }
  197. }else {
  198. var elNode = {
  199. label: node["depname"],
  200. parentid:node['parentid'],
  201. parentname:node['parentname'],
  202. departmentid:node["departmentid"],
  203. value:node["departmentid"],
  204. remarks:node["remarks"],
  205. isused:node["isused"],
  206. changedate:node['changedate'],
  207. changeby:node['changeby'],
  208. createdate:node['createdate'],
  209. createby:node['createby'],
  210. depno:node['depno'],
  211. disabled:that.pageOnlyRead,
  212. children: []
  213. }
  214. }
  215. if (node.subdep && node.subdep.length > 0) {
  216. // 如果存在子节点
  217. for (var index = 0; index < node.subdep.length; index++) {
  218. // 遍历子节点, 把每个子节点看做一颗独立的树, 传入递归构造子树, 并把结果放回到新node的children中
  219. elNode.children.push(convertToElementTree(node.subdep[index]));
  220. }
  221. }
  222. return elNode;
  223. }
  224. array.forEach((element) => {
  225. arr.push(convertToElementTree(element))
  226. });
  227. return arr
  228. },
  229. selectDep(val) {
  230. console.log(val,'val2222')
  231. if (val.length === 0){
  232. const userid = JSON.parse(sessionStorage.getItem('active_account')).userid
  233. this.otherModel(userid,'0')
  234. }else {
  235. this.person = ''
  236. this.departmentid = val[val.length -1]
  237. this.otherModel(this.departmentid,'1',this.isleave)
  238. }
  239. },
  240. selectPerson(val){
  241. this.depment = ''
  242. this.departmentid = ''
  243. this.dataid = val
  244. this.otherModel(val,'0',this.isleave)
  245. },
  246. leaveChange(){
  247. this.person = ''
  248. const type = this.depment?'1':'0'
  249. const dataid = type == 0?-1:this.departmentid
  250. this.otherModel(dataid,type,this.isleave,'状态')
  251. this.personData()
  252. },
  253. /*获取新的业务员列表*/
  254. async personData(){
  255. let param = {
  256. id: 20230620102004,
  257. content: {
  258. isleave:this.isleave
  259. },
  260. }
  261. const res = await this.$api.requested(param)
  262. this.personnelList = res.data.hr
  263. this.$refs.clueAdd.$refs.departmentSalesperson.personnelList = this.personnelList
  264. this.$refs.clueFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  265. this.$refs.clueChange.$refs.departmentSalesperson.personnelList = this.personnelList
  266. this.$refs.clueUnFollow.$refs.departmentSalesperson.personnelList = this.personnelList
  267. },
  268. /*返回顶部*/
  269. toTop() {
  270. this.$refs.rollRef.scrollTop = 0
  271. },
  272. backFull(val){
  273. if (val){
  274. this.$refs.rollRef.scrollTop = val
  275. }
  276. },
  277. handleScroll(){
  278. this.scrollData = this.$refs.rollRef.scrollTop
  279. }
  280. },
  281. mounted() {
  282. this.departmentrtment()
  283. var that = this;
  284. // <!--把window.onresize事件挂在到mounted函数上-->
  285. window.onresize = () => {
  286. return (() => {
  287. window.fullWidth = document.documentElement.clientWidth;
  288. that.windowWidth = window.fullWidth; // 宽
  289. })()
  290. };
  291. }
  292. }
  293. </script>
  294. <style scoped>
  295. </style>