index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <normalLayout>
  3. <template #refresh>
  4. <i class="el-icon-refresh-right" @click="refresh" v-loading.fullscreen.lock="fullscreenLoading"></i>
  5. </template>
  6. <template #content>
  7. <div style="padding: 20px;" >
  8. <div class="mt-10 inline-16">
  9. <label class="search__label" >部门:</label>
  10. <el-cascader 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>
  11. </div>
  12. <div class="mt-10 inline-16">
  13. <label class="search__label" >业务员:</label>
  14. <el-select v-model="person" filterable placeholder="请选择" size="small" clearable @change="selectPerson">
  15. <el-option
  16. v-for="item in personnelList"
  17. :key="item.index"
  18. :label="item.name"
  19. :value="item.userid">
  20. </el-option>
  21. </el-select>
  22. </div>
  23. <div class="mt-10 inline-16">
  24. <p class="search__label">状态:</p>
  25. <el-select v-model="isleave" clearable style="margin-right:10px" size="small" placeholder="请选择状态" @change="leaveChange" >
  26. <el-option label="在职" value="1"></el-option>
  27. <el-option label="离职" value="2"></el-option>
  28. </el-select>
  29. </div>
  30. <div style="margin: auto;">
  31. <div class="content" >
  32. 作业数据
  33. <assignmentData ref="assignment" style="padding: 16px 2px 0px 2px" :param="dataParam" :isDep="isDep" :dataid="dataid" :isPerson="isPerson" @clickFull="clickFull"></assignmentData>
  34. </div>
  35. <div class="content" >
  36. 销售数据
  37. <salesData style="padding: 16px 2px 0px 2px" ref="sales" :param="dataParam" :isDep="isDep" :dataid="dataid" :isPerson="isPerson"></salesData>
  38. </div>
  39. <div class="content" >
  40. 业绩数据
  41. <performanceData style="padding: 0px 2px 0px 2px" ref="performance" :param="dataParam" :isDep="isDep" :dataid="dataid" :isPerson="isPerson"></performanceData>
  42. </div>
  43. <el-tabs v-model="tabName" @tab-click="handleClickTab" style="margin-top: 16px;">
  44. <el-tab-pane label="线索" name="线索">
  45. <clue ref="clue" :param="tableParam" :isDep="isDep" :dataid="dataid" :isPerson="isPerson"></clue>
  46. </el-tab-pane>
  47. <el-tab-pane label="客户" name="客户">
  48. <customer ref="customer" :param="tableParam" :isDep="isDep" :dataid="dataid" :isPerson="isPerson"></customer>
  49. </el-tab-pane>
  50. <el-tab-pane label="项目商机" name="项目商机">
  51. <project ref="project" :param="tableParam" :isDep="isDep" :dataid="dataid" :isPerson="isPerson"></project>
  52. </el-tab-pane>
  53. <el-tab-pane label="作业单据" name="作业单据">
  54. <documents ref="documents" :param="tableParam" :isDep="isDep" :dataid="dataid" :isPerson="isPerson"></documents>
  55. </el-tab-pane>
  56. </el-tabs>
  57. </div>
  58. </div>
  59. </template>
  60. </normalLayout>
  61. </template>
  62. <script>
  63. import assignmentData from './modules/assignmentData'
  64. import salesData from './modules/salesData'
  65. import performanceData from './modules/performanceData'
  66. import clue from './modules/clue'
  67. import customer from './modules/customer'
  68. import project from './modules/project'
  69. import documents from './modules/documents'
  70. import normalLayout from '@/components/normal-basic-layout/normalData'
  71. export default {
  72. name: "index",
  73. data(){
  74. return {
  75. fullscreenLoading: false,
  76. tabName: '线索',
  77. isDep:false,
  78. isPerson:false,
  79. activeName: '部门',
  80. dataid:'',
  81. range:'',
  82. pointValue:'',
  83. visible:false,
  84. person:'',
  85. depment:'',
  86. deplist:[],
  87. personnelList:[],
  88. isleave:'1',
  89. depmentParam:{
  90. "id": 20230620102004,
  91. "content": {
  92. "isleave":1
  93. }
  94. },
  95. dataParam:{
  96. "id": 20230616131404,
  97. "content": {
  98. "dataType":"", // 1 作业数据 2 销售数据 3业绩数据
  99. "type":'', // 0 按人搜素 1 按部门搜索
  100. "dataid":"", // 人员id或部门id
  101. "where":{
  102. "isleave":"1",
  103. }
  104. }
  105. },
  106. tableParam:{
  107. "id": 20230617143104,
  108. "content": {
  109. "pageNumber": 1,
  110. "pageSize": 10,
  111. "dataType":"",//1 线索新增列表 2 线索更新列表 3 线索跟进列表4 客户新增列表 5 客户更新列表 6 客户跟进列表 7 项目新增列表8 项目更新列表 9 项目跟进列表 10 报价单列表 11 合同列表
  112. "type":'',//0 按人搜素 1 按部门搜索
  113. "dataid":"",// 人员id或部门id
  114. "dateType":'',
  115. "where":{
  116. "begindate":"",
  117. "enddate":"",
  118. "isleave":"1"
  119. }
  120. }
  121. }
  122. }
  123. },
  124. components:{
  125. assignmentData,salesData,performanceData,clue,customer,project,documents,normalLayout
  126. },
  127. methods:{
  128. async departmentrtment() {
  129. const res = await this.$api.requested(this.depmentParam)
  130. this.deplist = this.createMenu(res.data.dep)
  131. this.personnelList = res.data.hr
  132. this.person = JSON.parse(window.sessionStorage.getItem('active_account')).name
  133. this.$refs.assignment.queryList()
  134. this.$refs.sales.queryList()
  135. this.$refs.performance.queryList()
  136. this.$refs.clue.queryAdd()
  137. this.$refs.clue.queryUpdate()
  138. this.$refs.clue.queryFollow()
  139. },
  140. refresh(){
  141. this.fullscreenLoading = true;
  142. this.$refs.assignment.queryList()
  143. this.$refs.sales.queryList()
  144. this.$refs.performance.queryList()
  145. this.$refs.clue.queryAdd()
  146. this.$refs.clue.queryUpdate()
  147. this.$refs.clue.queryFollow()
  148. setTimeout(() => {
  149. this.fullscreenLoading = false;
  150. }, 2000);
  151. },
  152. createMenu (array) {
  153. var that = this
  154. let arr = []
  155. function convertToElementTree(node) {
  156. // 新节点
  157. if (node.subdep.length === 0){
  158. var elNode = {
  159. label: node["depname"],
  160. parentid:node['parentid'],
  161. parentname:node['parentname'],
  162. departmentid:node["departmentid"],
  163. value:node["departmentid"],
  164. remarks:node["remarks"],
  165. isused:node["isused"],
  166. changedate:node['changedate'],
  167. changeby:node['changeby'],
  168. createdate:node['createdate'],
  169. createby:node['createby'],
  170. depno:node['depno'],
  171. disabled:that.pageOnlyRead,
  172. }
  173. }else {
  174. var elNode = {
  175. label: node["depname"],
  176. parentid:node['parentid'],
  177. parentname:node['parentname'],
  178. departmentid:node["departmentid"],
  179. value:node["departmentid"],
  180. remarks:node["remarks"],
  181. isused:node["isused"],
  182. changedate:node['changedate'],
  183. changeby:node['changeby'],
  184. createdate:node['createdate'],
  185. createby:node['createby'],
  186. depno:node['depno'],
  187. disabled:that.pageOnlyRead,
  188. children: []
  189. }
  190. }
  191. if (node.subdep && node.subdep.length > 0) {
  192. // 如果存在子节点
  193. for (var index = 0; index < node.subdep.length; index++) {
  194. // 遍历子节点, 把每个子节点看做一颗独立的树, 传入递归构造子树, 并把结果放回到新node的children中
  195. elNode.children.push(convertToElementTree(node.subdep[index]));
  196. }
  197. }
  198. return elNode;
  199. }
  200. array.forEach((element) => {
  201. arr.push(convertToElementTree(element))
  202. });
  203. return arr
  204. },
  205. selectDep(val) {
  206. this.person = ''
  207. this.isDep = true
  208. this.dataid = val[val.length -1]
  209. this.dataParam.content.type = 1
  210. this.dataParam.content.dataid = this.dataid
  211. this.tableParam.content.type = 1
  212. this.tableParam.content.dataid = this.dataid
  213. this.$nextTick(()=>{
  214. this.$refs.assignment.queryList()
  215. this.$refs.sales.queryList()
  216. this.$refs.performance.queryList()
  217. this.$refs.clue.queryAdd()
  218. this.$refs.clue.queryUpdate()
  219. this.$refs.clue.queryFollow()
  220. })
  221. /*this.$refs.selectPerson.clearCheckedNodes()*/
  222. },
  223. selectPerson(val){
  224. this.depment = ''
  225. this.dataid = val
  226. this.isDep = false
  227. this.dataParam.content.type = 0
  228. this.dataParam.content.dataid = this.dataid
  229. this.tableParam.content.type = 0
  230. this.tableParam.content.dataid = this.dataid
  231. this.$nextTick(()=>{
  232. this.$refs.assignment.queryList()
  233. this.$refs.sales.queryList()
  234. this.$refs.performance.queryList()
  235. this.$refs.clue.queryAdd()
  236. this.$refs.clue.queryUpdate()
  237. this.$refs.clue.queryFollow()
  238. })
  239. /*this.$refs.selectdep.clearCheckedNodes()*/
  240. },
  241. async personData(){
  242. const res = await this.$api.requested(this.depmentParam)
  243. this.personnelList = res.data.hr
  244. },
  245. leaveChange(){
  246. this.dataParam.content.where.isleave = this.isleave
  247. this.dataParam.content.dataid = this.dataParam.content.type == 0 ? -1 : this.dataParam.content.dataid
  248. this.tableParam.content.where.isleave = this.isleave
  249. this.tableParam.content.dataid = this.tableParam.content.type == 0 ? -1 : this.tableParam.content.dataid
  250. this.depmentParam.content.isleave = this.isleave
  251. this.depmentParam.content.dataid = this.depmentParam.content.type == 0 ? -1 : this.depmentParam.content.dataid
  252. this.person = ''
  253. this.personData()
  254. this.$refs.assignment.queryList()
  255. this.$refs.sales.queryList()
  256. this.$refs.performance.queryList()
  257. this.$refs.clue.queryAdd()
  258. this.$refs.clue.queryUpdate()
  259. this.$refs.clue.queryFollow()
  260. },
  261. handleClick(tab, event) {
  262. console.log(tab, event);
  263. },
  264. handleClickTab() {
  265. console.log(this.tabName);
  266. if (this.tabName === '线索'){
  267. this.$refs.clue.queryAdd()
  268. this.$refs.clue.queryUpdate()
  269. this.$refs.clue.queryFollow()
  270. }else if (this.tabName === '客户'){
  271. this.$refs.customer.queryAdd()
  272. this.$refs.customer.queryUpdate()
  273. this.$refs.customer.queryFollow()
  274. }else if (this.tabName === '项目商机'){
  275. this.$refs.project.queryAdd()
  276. this.$refs.project.queryUpdate()
  277. this.$refs.project.queryFollow()
  278. }else if (this.tabName === '作业单据'){
  279. this.$refs.documents.queryQuotation()
  280. this.$refs.documents.queryContract()
  281. }
  282. },
  283. clickFull(type,time){
  284. if (type == '新增线索'){
  285. this.tabName = '线索'
  286. this.$refs.clue.disabled = true
  287. this.$refs.clue.selectAdd = time
  288. this.$refs.clue.$refs.quickAdd.select = time
  289. this.$refs.clue.$refs.addFullRef.enterFullscreen()
  290. }else if (type == '跟进线索'){
  291. this.tabName = '线索'
  292. this.$refs.clue.disabled = true
  293. this.$refs.clue.selectFow = time
  294. this.$refs.clue.$refs.quickFow.select = time
  295. this.$refs.clue.$refs.fowFullRef.enterFullscreen()
  296. }else if (type == '新增客户'){
  297. this.tabName = '客户'
  298. this.$refs.customer.disabled = true
  299. this.$refs.customer.selectAdd = time
  300. this.$refs.customer.$refs.quickAdd.select = time
  301. this.$refs.customer.$refs.addFullRef.enterFullscreen()
  302. }else if (type == '客户跟进'){
  303. this.tabName = '客户'
  304. this.$refs.customer.disabled = true
  305. this.$refs.customer.selectFow = time
  306. this.$refs.customer.$refs.quickFow.select = time
  307. this.$refs.customer.$refs.fowFullRef.enterFullscreen()
  308. }else if (type == '新增项目'){
  309. this.tabName = '项目商机'
  310. this.$refs.project.disabled = true
  311. this.$refs.project.selectAdd = time
  312. this.$refs.project.$refs.quickAdd.select = time
  313. this.$refs.project.$refs.addFullRef.enterFullscreen()
  314. }else if (type == '项目跟进'){
  315. this.tabName = '项目商机'
  316. this.$refs.project.disabled = true
  317. this.$refs.project.selectFow = time
  318. this.$refs.project.$refs.quickFow.select = time
  319. this.$refs.project.$refs.fowFullRef.enterFullscreen()
  320. }
  321. }
  322. },
  323. mounted() {
  324. this.departmentrtment()
  325. }
  326. }
  327. </script>
  328. <style scoped>
  329. /deep/.content {
  330. padding: 0px;
  331. box-sizing: border-box;
  332. margin-bottom: 10px;
  333. }
  334. </style>