company.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?php
  2. # 常用的col
  3. $col = '*';
  4. $is_project = array
  5. (
  6. 1 => '全部可用',
  7. 2 => '部分可用',
  8. );
  9. $project = function()
  10. {
  11. $array = array();
  12. $data = Dever::db('manage/menu_group')->state();
  13. if($data)
  14. {
  15. $array += $data;
  16. }
  17. return $array;
  18. };
  19. return array
  20. (
  21. # 表名
  22. 'name' => 'company',
  23. # 显示给用户看的名称
  24. 'lang' => '公司管理',
  25. 'order' => 7,
  26. 'menu' => false,
  27. //'auto' => 10000000,
  28. 'end' => array
  29. (
  30. 'update' => 'manage/company.update',
  31. ),
  32. # 数据结构
  33. 'struct' => array
  34. (
  35. 'id' => array
  36. (
  37. 'type' => 'int-11',
  38. 'name' => 'ID',
  39. 'default' => '',
  40. 'desc' => '',
  41. 'match' => 'is_numeric',
  42. 'list' => true,
  43. ),
  44. 'name' => array
  45. (
  46. 'type' => 'varchar-80',
  47. 'name' => '公司名称',
  48. 'default' => '',
  49. 'desc' => '公司名称',
  50. 'match' => 'is_string',
  51. 'update' => 'text',
  52. 'list' => true,
  53. 'search' => 'fulltext',
  54. ),
  55. 'is_project' => array
  56. (
  57. 'type' => 'tinyint-1',
  58. 'name' => '项目可用状态',
  59. 'default' => '1',
  60. 'desc' => '项目可用状态',
  61. 'match' => 'is_numeric',
  62. 'option' => $is_project,
  63. 'update' => 'radio',
  64. 'list' => true,
  65. 'control' => 'is_project',
  66. ),
  67. 'project' => array
  68. (
  69. 'type' => 'varchar-2000',
  70. 'name' => '可用项目',
  71. 'default' => '',
  72. 'desc' => '选择项目',
  73. 'match' => 'is_string',
  74. 'option' => $project,
  75. 'update' => 'checkbox',
  76. 'show' => 'is_project=2',
  77. //'list' => true,
  78. ),
  79. 'manage/group'=> array
  80. (
  81. 'name' => '部门设置',
  82. 'default' => '',
  83. 'desc' => '部门设置',
  84. 'match' => 'option',
  85. # 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
  86. 'sync' => array('company_id' => 'id'),
  87. 'update' => array(1),
  88. 'update_type' => 2,
  89. ),
  90. 'state' => array
  91. (
  92. 'type' => 'tinyint-1',
  93. 'name' => '状态',
  94. 'default' => '1',
  95. 'desc' => '请选择状态',
  96. 'match' => 'is_numeric',
  97. ),
  98. 'cdate' => array
  99. (
  100. 'type' => 'int-11',
  101. 'name' => '录入时间',
  102. 'match' => array('is_numeric', time()),
  103. 'desc' => '',
  104. # 只有insert时才生效
  105. 'insert' => true,
  106. 'list' => 'date("Y-m-d H:i", {cdate})',
  107. ),
  108. ),
  109. 'default' => array
  110. (
  111. 'col' => 'id,name,state,cdate',
  112. 'value' => array
  113. (
  114. '1,"默认公司", 1,' . DEVER_TIME,
  115. ),
  116. ),
  117. # 管理功能
  118. 'manage' => array
  119. (
  120. 'insert_check' => 'manage/group',
  121. 'update_check' => 'manage/group',
  122. 'delete' => false,
  123. 'insert' => false,
  124. 'edit' => false,
  125. # 自定义快捷新增和编辑
  126. 'button' => array
  127. (
  128. '新增' => array('fast'),
  129. ),
  130. # 快捷更新
  131. 'list_button' => array
  132. (
  133. 'edit' => array('编辑'),
  134. ),
  135. ),
  136. 'request' => array
  137. (
  138. 'getIds' => array
  139. (
  140. 'type' => 'all',
  141. 'option' => array
  142. (
  143. 'ids' => array('yes-id', 'in'),
  144. 'state' => 1,
  145. ),
  146. 'order' => array('id' => 'desc'),
  147. 'col' => '*|id',
  148. ),
  149. 'getOld' => array
  150. (
  151. 'type' => 'all',
  152. 'option' => array
  153. (
  154. 'ids' => array('yes-id', 'in'),
  155. 'state' => 1,
  156. ),
  157. 'order' => array('id' => 'asc'),
  158. 'col' => '*',
  159. ),
  160. 'getAll' => array
  161. (
  162. # 匹配的正则或函数 选填项
  163. 'option' => array
  164. (
  165. 'ids' => array('yes-id', 'in'),
  166. 'noid' => array('yes-id', 'not in'),
  167. 'state' => 1,
  168. ),
  169. 'type' => 'all',
  170. 'order' => array('id' => 'desc'),
  171. 'col' => 'id,id as value, name',
  172. ),
  173. ),
  174. );