question.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <?php
  2. $cate = function()
  3. {
  4. $array = array();
  5. $data = Dever::db('work/q_cate')->state();
  6. if($data)
  7. {
  8. $array += $data;
  9. }
  10. return $array;
  11. };
  12. $branch = function()
  13. {
  14. $array = array();
  15. $data = Dever::db('work/branch')->state();
  16. if($data)
  17. {
  18. foreach ($data as $k => $v) {
  19. $group = Dever::db('manage/group')->find($v['group_id']);
  20. $data[$k]['id'] = $v['group_id'];
  21. $data[$k]['name'] = $group['name'];
  22. }
  23. $array += $data;
  24. }
  25. return $array;
  26. };
  27. $product = function()
  28. {
  29. $array = array();
  30. $data = Dever::db('work/product')->state();
  31. if($data)
  32. {
  33. $array += $data;
  34. }
  35. return $array;
  36. };
  37. $type = array
  38. (
  39. 1 => '上架',
  40. 2 => '下架',
  41. );
  42. $button = false;
  43. if (Dever::load('manage/auth')->checkFunc('work.question', 'qcate', '问题分类设置'))
  44. {
  45. $button['问题分类设置'] = array('location', 'l=project/database/list&project=work&table=q_cate&&oper_table=question');
  46. }
  47. if (Dever::load('manage/auth')->checkFunc('work.question', 'qsource', '问题来源设置'))
  48. {
  49. $button['问题来源设置'] = array('location', 'l=project/database/list&project=work&table=q_source&&oper_table=question');
  50. }
  51. if (Dever::load('manage/auth')->checkFunc('work.question', 'qpriority', '优先级设置'))
  52. {
  53. $button['优先级设置'] = array('location', 'l=project/database/list&project=work&table=priority&&oper_table=question');
  54. }
  55. return array
  56. (
  57. # 表名
  58. 'name' => 'question',
  59. # 显示给用户看的名称
  60. 'lang' => '问题设置',
  61. # 后台菜单排序
  62. 'order' => 98,
  63. // 'menu' => false,
  64. // 'auto' => 100000,
  65. # 数据结构
  66. 'struct' => array
  67. (
  68. 'id' => array
  69. (
  70. 'type' => 'int-11',
  71. 'name' => 'ID',
  72. 'default' => '',
  73. 'desc' => '',
  74. 'match' => 'is_numeric',
  75. 'search' => 'order',
  76. 'list' => true,
  77. 'order' => 'desc',
  78. ),
  79. 'company_id' => array
  80. (
  81. 'type' => 'int-11',
  82. 'name' => '所属公司',
  83. 'default' => '1',
  84. 'desc' => '所属公司',
  85. 'match' => 'is_numeric',
  86. 'update' => 'hidden',
  87. //'search' => $company ? 'select' : false,
  88. //'list' => true,
  89. ),
  90. 'name' => array
  91. (
  92. 'type' => 'varchar-200',
  93. 'name' => '名称',
  94. 'default' => '',
  95. 'desc' => '名称',
  96. 'match' => 'is_string',
  97. 'update' => 'text',
  98. 'search' => 'fulltext',
  99. 'list' => true,
  100. ),
  101. 'cate_id' => array
  102. (
  103. 'type' => 'int-11',
  104. 'name' => '选择所属分类',
  105. 'default' => '-1',
  106. 'desc' => '选择所属分类',
  107. 'match' => 'is_string',
  108. 'option' => $cate,
  109. 'update' => 'select',
  110. 'search' => 'select',
  111. 'list' => true,
  112. ),
  113. 'branch_id' => array
  114. (
  115. 'type' => 'int-11',
  116. 'name' => '关联部门',
  117. 'default' => '-1',
  118. 'desc' => '关联部门',
  119. 'match' => 'is_string',
  120. 'search' => 'select',
  121. 'update' => 'select',
  122. 'option' => $branch,
  123. // Dever::url('lib/appoint.get?level_total=1', 'work'),
  124. 'list' => 'Dever::load("work/lib/manage.branch",{branch_id})',
  125. ),
  126. 'product_id' => array
  127. (
  128. 'type' => 'int-11',
  129. 'name' => '相关系统产品',
  130. 'default' => '-1',
  131. 'desc' => '相关系统产品',
  132. 'match' => 'is_string',
  133. 'option' => $product,
  134. 'update' => 'select',
  135. 'list' => true,
  136. ),
  137. 'type' => array
  138. (
  139. 'type' => 'tinyint-1',
  140. 'name' => '上下架状态',
  141. 'default' => '1',
  142. 'desc' => '上下架状态',
  143. 'match' => 'is_numeric',
  144. 'update' => 'radio',
  145. 'option' => $type,
  146. 'search' => 'select',
  147. 'list' => true,
  148. ),
  149. 'reorder' => array
  150. (
  151. 'type' => 'int-11',
  152. 'name' => '排序-数值越大越靠前',
  153. 'default' => '1',
  154. 'desc' => '请输入排序',
  155. 'match' => 'option',
  156. 'update' => 'text',
  157. 'search' => 'order',
  158. 'list' => true,
  159. 'order' => 'desc',
  160. 'edit' => true,
  161. ),
  162. 'state' => array
  163. (
  164. 'type' => 'tinyint-1',
  165. 'name' => '状态',
  166. 'default' => '1',
  167. 'desc' => '请选择状态',
  168. 'match' => 'is_numeric',
  169. ),
  170. 'cdate' => array
  171. (
  172. 'type' => 'int-11',
  173. 'name' => '创建时间',
  174. 'match' => array('is_numeric', time()),
  175. 'desc' => '',
  176. # 只有insert时才生效
  177. 'insert' => true,
  178. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  179. ),
  180. ),
  181. 'manage' => array
  182. (
  183. //'insert' => false,
  184. 'delete' => false,
  185. // 'edit' => false,
  186. 'button' => $button,
  187. # 设置公司权限
  188. 'company' => 'company_id',
  189. ),
  190. 'request' => array
  191. (
  192. // 'getData' => array
  193. // (
  194. // # 匹配的正则或函数 选填项
  195. // 'option' => array
  196. // (
  197. // //'id' => array('yes', '!='),
  198. // 'state' => 1,
  199. // ),
  200. // 'type' => 'all',
  201. // 'order' => array('id' => 'desc'),
  202. // 'col' => '*|id',
  203. // ),
  204. 'getAll' => array
  205. (
  206. # 匹配的正则或函数 选填项
  207. 'option' => array
  208. (
  209. 'branch_id' => 'yes',
  210. // 'id' => array('yes','>'),
  211. 'state' => 1,
  212. ),
  213. 'type' => 'all',
  214. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  215. 'col' => '*',
  216. ),
  217. 'getSearchAll' => array
  218. (
  219. # 匹配的正则或函数 选填项
  220. 'option' => array
  221. (
  222. 'cate_id'=>'yes',
  223. 'state' => 1,
  224. 'type' => 1,
  225. ),
  226. 'type' => 'all',
  227. 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  228. 'col' => 'id as value, name',
  229. ),
  230. 'getTotal' => array
  231. (
  232. # 匹配的正则或函数 选填项
  233. 'option' => array
  234. (
  235. 'branch_id'=>'yes',
  236. 'state' => 1,
  237. 'type' => 1,
  238. ),
  239. 'type' => 'count',
  240. // 'order' => array('reorder' => 'desc', 'id' => 'asc'),
  241. 'col' => '*',
  242. ),
  243. ),
  244. );