info.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. <?php
  2. $people = function()
  3. {
  4. $array = array();
  5. $data = Dever::db('clue/user_set')->state();
  6. if($data)
  7. {
  8. $array += $data;
  9. }
  10. return $array;
  11. };
  12. $source = function()
  13. {
  14. $array = array();
  15. $data = Dever::db('clue/source')->state(array('type'=>1));
  16. if($data)
  17. {
  18. $array += $data;
  19. }
  20. return $array;
  21. };
  22. $status = function()
  23. {
  24. $array = array();
  25. $data = Dever::db('clue/sale_status')->state();
  26. if($data)
  27. {
  28. $array += $data;
  29. }
  30. return $array;
  31. };
  32. // $selepeople = function()
  33. // {
  34. // $array = array();
  35. // $data = Dever::db('clue/salepeople')->state();
  36. // if($data)
  37. // {
  38. // foreach ($data as $k => $v) {
  39. // $data[$k]['name'] = $v['group'];
  40. // }
  41. // $array += $data;
  42. // }
  43. // return $array;
  44. // };
  45. $sex = array
  46. (
  47. 1 => '未知',
  48. 2 => '男',
  49. 3 => '女',
  50. );
  51. $type = array
  52. (
  53. 1 => '待分派',
  54. 2 => '待跟进',
  55. 3 => '已跟进',
  56. 4 => '已完成',
  57. 5 => '已关闭',
  58. 6 => '未跟进',
  59. );
  60. $out_type = array
  61. (
  62. 1 => '否',
  63. 2 => '是',
  64. );
  65. $admin = Dever::load("manage/auth.info");
  66. $admin_id = '';
  67. if ($admin) {
  68. $admin_id = $admin['id'];
  69. }
  70. $search_auth = Dever::input('search_option_dever_auth', 1);
  71. if ($search_auth ==2) {
  72. $company = Dever::load('manage/company.get');
  73. $admin = Dever::db('manage/admin')->find($admin_id);
  74. if ($admin) {
  75. $admin['group'] = explode(',',$admin['group']);
  76. foreach ($admin['group'] as $k =>$v) {
  77. $group = Dever::db('manage/group')->find(array('company_id'=>$company,'id'=>$v));
  78. }
  79. if ($group) {
  80. $work = Dever::db('work/branch')->find(array('group_id'=>$group['id']));
  81. if ($work) {
  82. $work['group'] = explode(',',$work['group']);
  83. if (isset($work['group'][1]) && $work['group'][1] && $work['group'][1] == $admin_id) {
  84. $audit_group = Dever::setInput('search_option_follow_group_id', $group['id']);
  85. } else {
  86. $audit_admin = Dever::setInput('search_option_follow_admin_id', $admin_id);
  87. }
  88. }
  89. }
  90. }
  91. }
  92. $list_button = array();
  93. $list_button['location'] = array('查看详情',Dever::url('lib/info.show','clue'));
  94. $list_button ['fast_add'] = array('转派',Dever::url('project/database/update?project=clue&table=info&where_id={id}&col=follow', 'manage'),'{type}<4 || {type}>5');
  95. $excel[] = array('数据导出','线索列表数据导出', 'clue/lib/manage.out_info');
  96. $button = array();
  97. $button['线索导入'] = array('fast','','import&project=clue&call=clue/lib/manage.import');
  98. $col = Dever::input('col');
  99. return array
  100. (
  101. # 表名
  102. 'name' => 'info',
  103. # 显示给用户看的名称
  104. 'lang' => '创建新线索',
  105. # 后台菜单排序
  106. 'order' => 100,
  107. // 'menu' => false,
  108. // 'auto' => 100000,
  109. 'start' => array
  110. (
  111. 'insert' => 'clue/lib/info.insertInfo',
  112. // 'update' => 'clue/lib/info.insertInfo',
  113. ),
  114. 'end' => array
  115. (
  116. 'insert' => 'clue/lib/info.updateInfo',
  117. 'update' => 'clue/lib/info.updateInfo',
  118. ),
  119. 'config_type' => $type,
  120. 'config_sex' => $sex,
  121. # 数据结构
  122. 'struct' => array
  123. (
  124. 'id' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => 'ID',
  128. 'default' => '',
  129. 'desc' => '',
  130. 'match' => 'is_numeric',
  131. 'search' => 'order',
  132. 'list' => true,
  133. 'order' => 'desc',
  134. ),
  135. 'company_id' => array
  136. (
  137. 'type' => 'int-11',
  138. 'name' => '所属公司',
  139. 'default' => '1',
  140. 'desc' => '所属公司',
  141. 'match' => 'is_numeric',
  142. 'update' => 'hidden',
  143. //'search' => $company ? 'select' : false,
  144. //'list' => true,
  145. ),
  146. 'day' => array
  147. (
  148. 'type' => 'int-11',
  149. 'name' => '计划下次跟进时间',
  150. 'default' => '',
  151. 'match' => 'is_numeric',
  152. 'desc' => '',
  153. 'search' => 'sdate',
  154. 'search_buttons' => array
  155. (
  156. // 'sum' => 'buy_num,buy_cash,sell_num,sell_cash,sl_num',
  157. 'option' => array(
  158. 'day' => '按天',
  159. 'week' => '按周',
  160. 'month' => '按月',
  161. ),
  162. // 'group' => 'id',
  163. ),
  164. // 'order' => 'desc',
  165. 'list' => 'Dever::load("clue/lib/info.getNum#xdate",{id})',
  166. // 'Dever::showDay("{day}")',
  167. 'list_order' => 5,
  168. ),
  169. 'name' => array
  170. (
  171. 'type' => 'varchar-32',
  172. 'name' => '用户姓名',
  173. 'default' => '',
  174. 'desc' => '用户姓名',
  175. 'match' => 'is_string',
  176. 'update' => 'text',
  177. // 'search' => 'fulltext',
  178. // 'list' => true,
  179. ),
  180. 'mobile' => array
  181. (
  182. 'type' => 'bigint-11',
  183. 'name' => '手机号',
  184. 'default' => '',
  185. 'desc' => '请输入手机号',
  186. 'match' => Dever::rule('mobile'),
  187. 'update' => 'text',
  188. 'search' => 'fulltext',
  189. // 'value' => Dever::input('search_option_mobile'),
  190. 'list_name' => '客户信息',
  191. 'list' => 'Dever::load("clue/lib/info.getNum#user",{id})',#true,
  192. 'list_order' => 2,
  193. ),
  194. 'wechat' => array
  195. (
  196. 'type' => 'varchar-32',
  197. 'name' => '微信号',
  198. 'default' => '',
  199. 'desc' => '微信号',
  200. 'match' => 'option',
  201. 'update' => 'text',
  202. // 'search' => 'fulltext',
  203. // 'list' => true,
  204. ),
  205. 'qq' => array
  206. (
  207. 'type' => 'varchar-32',
  208. 'name' => 'QQ号',
  209. 'default' => '',
  210. 'desc' => 'QQ号',
  211. 'match' => 'option',
  212. 'update' => 'text',
  213. // 'search' => 'fulltext',
  214. // 'list' => true,
  215. ),
  216. 'source' => array
  217. (
  218. 'type' => 'int-11',
  219. 'name' => '来源',
  220. 'default' => '1',
  221. 'desc' => '来源',
  222. 'match' => 'is_string',
  223. 'option' => $source,
  224. 'update' => 'radio',
  225. 'search' => 'select',
  226. 'list' => true,
  227. ),
  228. 'area' => array
  229. (
  230. 'type' => 'varchar-32',
  231. 'name' => '所在城市',
  232. 'default' => '',
  233. 'desc' => '所在城市',
  234. 'match' => 'option',
  235. 'search' => 'linkage',
  236. 'update' => 'linkage',
  237. 'option' => Dever::url('api.get?level_total=2', 'area'),
  238. 'list' => 'Dever::load("clue/lib/info.getNum#area",{id})',
  239. ),
  240. 'clue_num' => array
  241. (
  242. 'type' => 'varchar-50',
  243. 'name' => '线索编号',
  244. 'default' => '',
  245. 'desc' => '线索编号',
  246. 'match' => 'is_string',
  247. 'update' => 'hidden',
  248. // 'search' => 'fulltext',
  249. // 'list' => true,
  250. ),
  251. 'sex' => array
  252. (
  253. 'type' => 'int-11',
  254. 'name' => '性别',
  255. 'default' => '1',
  256. 'desc' => '性别',
  257. 'match' => 'is_string',
  258. 'option' => $sex,
  259. 'update' => 'radio',
  260. // 'search' => 'select',
  261. // 'list' => true,
  262. ),
  263. 'age' => array
  264. (
  265. 'type' => 'varchar-32',
  266. 'name' => '年龄',
  267. 'default' => '',
  268. 'desc' => '年龄',
  269. 'match' => 'option',
  270. 'update' => 'text',
  271. // 'search' => 'fulltext',
  272. // 'list' => true,
  273. ),
  274. 'trade' => array
  275. (
  276. 'type' => 'varchar-50',
  277. 'name' => '行业',
  278. 'default' => '',
  279. 'desc' => '行业',
  280. 'match' => 'option',
  281. 'update' => 'text',
  282. // 'search' => 'fulltext',
  283. // 'list_name' => '计划下次跟进时间',
  284. // 'list' => 'Dever::load("clue/lib/info.getNum#xdate",{id})',
  285. // 'list_order' => 5,
  286. ),
  287. 'desc' => array
  288. (
  289. 'type' => 'text-100',
  290. 'name' => '竞品了解',
  291. 'default' => '',
  292. 'desc' => '竞品了解',
  293. 'match' => 'option',
  294. 'update' => 'textarea',
  295. // 'list_name' => '跟进次数',
  296. // 'list' => 'Dever::load("clue/lib/info.getNum#num",{id})',
  297. // 'list_order' => 4,
  298. ),
  299. 'num' => array
  300. (
  301. 'type' => 'int-11',
  302. 'name' => '跟进次数',
  303. 'default' => '0',
  304. 'desc' => '数量',
  305. 'match' => 'option',
  306. 'update' => 'hidden',
  307. 'list' => 'Dever::load("clue/lib/info.getNum#num",{id})',
  308. 'list_order' => 4,
  309. ),
  310. 'userset_id' => array
  311. (
  312. 'type' => 'int-11',
  313. 'name' => '客户等级',
  314. 'default' => '-1',
  315. 'desc' => '客户等级',
  316. 'match' => 'is_string',
  317. 'search' => 'select',
  318. 'update' => 'select',
  319. 'option' => $people,
  320. 'list' => true,
  321. 'list_order' => 3,
  322. ),
  323. 'status_id' => array
  324. (
  325. 'type' => 'int-11',
  326. 'name' => '线索状态',
  327. 'default' => '1',
  328. 'desc' => '线索状态',
  329. 'match' => 'is_string',
  330. 'option' => $status,
  331. 'update' => 'select',
  332. // 'search' => $search_auth == 1 ? 'select' : false,
  333. // 'list' => true,
  334. 'control' => 'status_id',
  335. ),
  336. 'out_type' => array
  337. (
  338. 'type' => 'int-11',
  339. 'name' => '是否导入',
  340. 'default' => '1',
  341. 'desc' => '是否导入',
  342. 'match' => 'is_string',
  343. 'option' => $out_type,
  344. // 'update' => 'select',
  345. // 'search' => $search_auth == 1 ? 'select' : false,
  346. // 'list' => true,
  347. // 'control' => 'status_id',
  348. ),
  349. 'status_desc' => array
  350. (
  351. 'type' => 'text-255',
  352. 'name' => '结论备注',
  353. 'default' => '',
  354. 'desc' => '结论备注',
  355. 'match' => 'is_string',
  356. 'update' => 'textarea',
  357. 'update' => $col ? 'textarea' : false,
  358. 'show' => 'status_id=5,6',
  359. // 'list' => true,
  360. ),
  361. 'follow_id' => array
  362. (
  363. 'type' => 'int-11',
  364. 'name' => '跟进人表id',
  365. 'default' => '-1',
  366. 'desc' => '跟进人',
  367. 'match' => 'is_string',
  368. // 'option' => $priority,
  369. // 'update' => 'select',
  370. // 'search' => 'select',
  371. // 'list' => true,
  372. ),
  373. 'follow' => array
  374. (
  375. 'type' => 'varchar-32',
  376. 'name' => $col ? '选择队友' : '分派销售员',
  377. 'default' => '',
  378. 'desc' => '分派销售员',
  379. 'match' => 'option',
  380. // 'search' => 'linkage',
  381. 'update' => 'linkage',
  382. 'option' => Dever::url('lib/salepeople.get?level_total=2', 'clue'),
  383. // $salepeople,
  384. 'list_name' => '跟进人',
  385. 'list' => 'Dever::load("clue/lib/info.getNum#people",{id})',
  386. ),
  387. 'follow_admin_id' => array
  388. (
  389. 'type' => 'int-11',
  390. 'name' => '跟进人',
  391. 'default' => '-1',
  392. 'desc' => '跟进人',
  393. 'match' => 'is_string',
  394. // 'value' => $audit_admin,
  395. // 'option' => $priority,
  396. // 'update' => 'select',
  397. // 'search' => 'select',
  398. // 'list' => true,
  399. ),
  400. 'follow_group_id' => array
  401. (
  402. 'type' => 'int-11',
  403. 'name' => '部门',
  404. 'default' => '',
  405. 'desc' => '部门',
  406. 'match' => 'option',
  407. // 'search' => 'linkage',
  408. 'update' => 'hidden',
  409. // 'option' => Dever::url('lib/appoint.get?level_total=2', 'work'),
  410. ),
  411. 'create_group_id' => array
  412. (
  413. 'type' => 'int-11',
  414. 'name' => '创建人部门',
  415. 'default' => '',
  416. 'desc' => '部门',
  417. 'match' => 'option',
  418. // 'search' => 'linkage',
  419. 'update' => 'hidden',
  420. // 'option' => Dever::url('lib/appoint.get?level_total=2', 'work'),
  421. ),
  422. 'create_admin_id' => array
  423. (
  424. 'type' => 'int-11',
  425. 'name' => '创建人',
  426. 'default' => '',
  427. 'desc' => '部门',
  428. 'match' => 'option',
  429. // 'search' => 'linkage',
  430. 'update' => 'hidden',
  431. // 'option' => Dever::url('lib/appoint.get?level_total=2', 'work'),
  432. ),
  433. 'fdate' => array
  434. (
  435. 'type' => 'int-11',
  436. 'name' => '完成时间',
  437. 'default' => '',
  438. 'match' => 'is_numeric',
  439. // 'search' => 'date',
  440. 'list_name' => '创建时间<br/>最近跟进时间',
  441. // 'desc' => '',
  442. 'list' => 'Dever::load("clue/lib/info.getNum#time",{id})',
  443. 'list_order' => 1,
  444. ),
  445. 'gdate' => array
  446. (
  447. 'type' => 'int-11',
  448. 'name' => '跟进时间',
  449. 'default' => '',
  450. 'match' => 'is_numeric',
  451. // 'search' => 'date',
  452. ),
  453. 'type' => array
  454. (
  455. 'type' => 'int-11',
  456. 'name' => '跟进状态',
  457. 'default' => '1',
  458. 'desc' => '跟进状态',
  459. 'match' => 'is_string',
  460. 'option' => $type,
  461. // 'update' => 'select',
  462. 'search' => 'select',
  463. 'list' => true,
  464. // 'list_order' => 22,
  465. ),
  466. 'audit_admin' => array
  467. (
  468. 'type' => 'int-11',
  469. 'name' => '创建人',
  470. 'default' => '',
  471. 'match' => 'is_numeric',
  472. 'desc' => '创建人',
  473. 'update' => 'hidden',
  474. 'value' => $admin_id,
  475. // 'list' => 'Dever::load("active/lib/manage.active#admin_name",{id})',
  476. ),
  477. 'dever_auth' => array
  478. (
  479. 'name' => '搜索',
  480. 'default' => '',
  481. 'desc' => '类型',
  482. 'match' => 'is_string',
  483. 'search' => 'hidden',
  484. ),
  485. 'remark' => array
  486. (
  487. 'type' => 'text-255',
  488. 'name' => '备注',
  489. 'default' => '',
  490. 'desc' => '备注',
  491. 'match' => 'option',
  492. 'update' => 'textarea',
  493. // 'list' => true,
  494. ),
  495. 'reorder' => array
  496. (
  497. 'type' => 'int-11',
  498. 'name' => '排序-数值越大越靠前',
  499. 'default' => '1',
  500. 'desc' => '请输入排序',
  501. 'match' => 'option',
  502. // 'update' => 'text',
  503. // 'search' => 'order',
  504. // 'list' => true,
  505. // 'order' => 'desc',
  506. // 'edit' => true,
  507. ),
  508. 'state' => array
  509. (
  510. 'type' => 'tinyint-1',
  511. 'name' => '状态',
  512. 'default' => '1',
  513. 'desc' => '请选择状态',
  514. 'match' => 'is_numeric',
  515. ),
  516. 'cdate' => array
  517. (
  518. 'type' => 'int-11',
  519. 'name' => '创建时间',
  520. 'match' => array('is_numeric', time()),
  521. 'desc' => '',
  522. # 只有insert时才生效
  523. 'insert' => true,
  524. 'search' => 'date',
  525. // 'order' => 'desc',
  526. // 'list' => 'date("Y-m-d H:i:s", {cdate})',
  527. ),
  528. ),
  529. 'manage' => array
  530. (
  531. // 'insert' => true,
  532. 'delete' => false,
  533. 'edit' => false,
  534. 'list_button' => $list_button,
  535. // 'data' => $data,
  536. 'button' => $button,
  537. 'excel' => $excel,
  538. # 设置公司权限
  539. 'company' => 'company_id',
  540. ),
  541. 'request' => array
  542. (
  543. 'list_option' => array
  544. (
  545. 'col' => 'yes-follow_admin_id,follow_group_id',
  546. 'type' => array('yes', 'in'),
  547. 'state' =>1,
  548. ),
  549. 'list' => array
  550. (
  551. # 匹配的正则或函数 选填项
  552. 'option' => array
  553. (
  554. 'id' => 'yes',
  555. 'area' => array('yes','like'),
  556. 'name' => array('yes','like'),
  557. 'mobile' => 'yes',
  558. 'source' => 'yes',
  559. 'userset_id' => 'yes',
  560. 'type' => 'yes',
  561. 'out_type' =>'yes',
  562. 'start_cdate'=>array('yes-cdate','>='),
  563. 'end_cdate' => array('yes-cdate','<='),
  564. 'follow_admin_id' => 'yes',
  565. 'follow_group_id' => 'yes',
  566. // 'area' => array('yes', 'like'),
  567. 'start_day' => array('yes-day', '>='),
  568. 'end_day' => array('yes-day', '<='),
  569. 'state' => 1,
  570. ),
  571. 'type' => 'all',
  572. 'order' => array('cdate' => 'desc'),
  573. 'page' => array(20, 'list'),
  574. // 'group' => 'shop_id',
  575. 'col' => '*',
  576. ),
  577. 'getAll' => array
  578. (
  579. # 匹配的正则或函数 选填项
  580. 'option' => array
  581. (
  582. 'start' => array('yes-cdate','>='),
  583. 'end'=>array('yes-cdate','<='),
  584. 'follow_group_id' =>'yes',
  585. 'create_group_id' => 'yes',
  586. // 'type' =>array('yes','in'),
  587. 'state' => 1,
  588. ),
  589. 'type' => 'all',
  590. // 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  591. // 'page' => array(5,'list'),
  592. 'col' => '*|follow_admin_id',
  593. ),
  594. 'getHAll' => array
  595. (
  596. # 匹配的正则或函数 选填项
  597. 'option' => array
  598. (
  599. 'start' => array('yes-cdate','>='),
  600. 'end'=>array('yes-cdate','<='),
  601. 'follow_group_id' =>'yes',
  602. 'gstart' => array('yes-gdate','>='),
  603. 'gend' => array('yes-gdate','<='),
  604. 'fstart' => array('yes-fdate','>='),
  605. 'fend' => array('yes-fdate','<='),
  606. 'type' =>array('yes','in'),
  607. 'state' => 1,
  608. ),
  609. 'type' => 'count',
  610. // 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  611. // 'page' => array(5,'list'),
  612. 'col' => '*',
  613. ),
  614. ),
  615. );