flowviewAction.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <?php
  2. /**
  3. * 可视化模块设计
  4. * 开发者:雨中磐石
  5. * 官网:www.rockoa.com
  6. * 禁止乱修改头部信息,请保留尊重开发者
  7. * 修改时间:2021-10-14
  8. */
  9. class flowviewClassAction extends Action
  10. {
  11. public function defaultAction()
  12. {
  13. $ybarr = $this->option->authercheck();
  14. if(is_string($ybarr))return $ybarr;
  15. $this->title = '可视化模块设计';
  16. $this->assign('modearr', m('mode')->getmodearr("and (`type`<>'系统' or `num`='demo')"));
  17. }
  18. //加载字段信息
  19. public function getziduanAction()
  20. {
  21. $num = $this->get('num');
  22. $fid = $this->get('fid');
  23. $moders = m('flow_set')->getone("`num`='$num'");
  24. $tables = $moders['table'];
  25. $ziduan = m('flow_element')->getone('mid='.$moders['id'].' and `iszb`=0 and `fields`=\''.$fid.'\'','*','`iszb` asc,`sort` asc');
  26. $fiedar = $this->db->gettablefields('[Q]'.$tables.'','',"and `COLUMN_NAME`='$fid'");
  27. if($fiedar){
  28. $fieda = $fiedar[0];
  29. if($fieda['type']=='decimal'){
  30. $ziduan['lens'] = $fieda['xslen1'];
  31. $ziduan['xiaoshu'] = $fieda['xslen2'];
  32. }
  33. }
  34. return array(
  35. 'ziduan' => $ziduan,
  36. 'fiedar' => $fiedar,
  37. 'typedata' => $this->option->getdata('flowinputtype'),
  38. );
  39. }
  40. //加载字段信息
  41. public function getziduansAction()
  42. {
  43. $num = $this->get('num');
  44. $name = $this->rock->xssrepstr($this->post('name'));
  45. $fields = c('pingyin')->get($name,1);
  46. if(!$fields || strlen($fields)<4)$fields = 'a'.$this->db->ranknum('flow_element','fields');
  47. if(strlen($fields)>20)$fields = 'a'.substr($fields,0,19);
  48. $ziduan['name'] = $name;
  49. $ziduan['fields'] = $fields;
  50. $ziduan['fieldstype'] = 'text';
  51. $ziduan['id'] = '0';
  52. $ziduan['dev'] = '';
  53. $ziduan['lens'] = '0';
  54. $ziduan['islu'] = '1';
  55. $ziduan['issou'] = '1';
  56. $ziduan['xiaoshu'] = '0';
  57. return array(
  58. 'ziduan' => $ziduan,
  59. 'typedata' => $this->option->getdata('flowinputtype'),
  60. );
  61. }
  62. //保存字段
  63. public function saveziduanAction()
  64. {
  65. $id = (int)$this->post('id','0');
  66. $num = $this->post('modenum');
  67. $moders = m('flow_set')->getone("`num`='$num'");
  68. $mid = $moders['id'];
  69. $sarr['name'] = $this->post('name');
  70. $sarr['fieldstype'] = $this->post('fieldstype');
  71. $sarr['dev'] = $this->post('dev');
  72. $sarr['placeholder'] = $this->post('placeholder');
  73. $sarr['data'] = $this->post('data');
  74. $sarr['lens'] = (int)$this->post('lens','0');
  75. $sarr['isbt'] = (int)$this->post('isbt','0');
  76. $sarr['islu'] = (int)$this->post('islu','0');
  77. $sarr['issou'] = (int)$this->post('issou','0');
  78. $sarr['fields'] = $this->post('fields');
  79. $sarr['attr'] = $this->post('attr');
  80. $sarr['xiaoshu']= (int)$this->post('xiaoshu','0'); //小数点
  81. $sarr['mid'] = $mid;
  82. $sarr['iszb'] = 0;
  83. if(substr($sarr['fieldstype'],0,6)=='change' && isempt($sarr['data'])){
  84. $sarr['data'] = ''.$sarr['fields'].'id';
  85. }
  86. include_once('webmain/main/flow/flowAction.php');
  87. $obj = new flowClassAction();
  88. $strs= $obj->elemensavefieldsbefore('flow_element', $sarr, $id);
  89. if($strs)return returnerror($strs);
  90. $where = '`id`='.$id.'';
  91. if($id==0)$where = '';
  92. $bo = m('flow_element')->record($sarr, $where);
  93. if($bo)$obj->elemensavefields('', $sarr);
  94. //一键布局PC录入
  95. $path = 'webmain/flow/page/input_'.$num.'.html';
  96. $isscl = false;
  97. $xgwj = 0;
  98. $base = 0;
  99. if(!file_exists($path)){
  100. $isscl = true;
  101. }else{
  102. $ofile = file_get_contents($path);
  103. if(contain($ofile,'{file_content}'))$xgwj = 1;
  104. if(contain($ofile,'{base_name}'))$base = 1;
  105. if(contain($ofile,'autoyijianview'))$isscl = true;
  106. }
  107. if($isscl){
  108. $obj->yinruonearr = array(
  109. 'modeid' => $mid,
  110. 'xgwj' => $xgwj,
  111. 'base' => $base,
  112. );
  113. $str = $obj->yinruoneAjax();
  114. $this->rock->createtxt($path, $str);
  115. }
  116. return returnsuccess();
  117. }
  118. //删除字段
  119. public function delziduanAction()
  120. {
  121. $id = (int)$this->get('id','0');
  122. m('flow_element')->delete($id);
  123. return returnsuccess();
  124. }
  125. //创建模块
  126. public function createmodeAction()
  127. {
  128. $name = $this->rock->xssrepstr($this->post('name'));
  129. $fields = c('pingyin')->get($name,1);
  130. if(!$fields || strlen($fields)<4)$fields = $this->db->ranknum('flow_set','num');
  131. if(strlen($fields)>20)$fields = substr($fields,0,18);
  132. $num = 'zz'.$fields.'';
  133. if(m('flow_set')->rows("`num`='$num'")>0){
  134. $fields = $this->db->ranknum('flow_set','num');
  135. $num = 'zz'.$fields.'';
  136. }
  137. $id = 0;
  138. $uarr['name'] = $name;
  139. $uarr['num'] = $num;
  140. $uarr['table'] = $num;
  141. $uarr['isflow'] = 0;
  142. $uarr['tables'] = '';
  143. $uarr['names'] = '';
  144. $uarr['sort'] = '0';
  145. $uarr['type'] = '新增';
  146. $uarr['receid'] = 'all';
  147. $uarr['recename'] = '全体人员';
  148. $uarr['optdt'] = $this->now;
  149. $uarr['isup'] = 0;
  150. $uarr['isscl'] = 1;
  151. $uarr['pctx'] = 1;
  152. $uarr['status'] = 1;
  153. $uarr['istxset'] = 0;
  154. $uarr['ispl'] = 0;
  155. $id = m('flow_set')->insert($uarr);
  156. include_once('webmain/main/flow/flowAction.php');
  157. $obj = new flowClassAction();
  158. $obj->flowsetsaveafter('flow_set', $uarr);
  159. $obj->setinputid = $id;
  160. $obj->inputAction();
  161. $wherestr = $this->jm->base64encode('`optid`={uid}');
  162. m('flow_where')->insert(array(
  163. 'setid' => $id,
  164. 'num' => 'my',
  165. 'name' => '我添加数据',
  166. 'wheresstr' => $wherestr,
  167. 'sort' => 0,
  168. 'islb' => 1,
  169. 'status' => 1,
  170. ));
  171. m('flow_where')->insert(array(
  172. 'setid' => $id,
  173. 'num' => 'all',
  174. 'pnum' => 'all',
  175. 'name' => '所有数据',
  176. 'wheresstr' => $this->jm->base64encode('1=1'),
  177. 'sort' => 0,
  178. 'islb' => 1,
  179. 'status' => 1,
  180. ));
  181. $uarr = array(
  182. 'recename' => '全体人员',
  183. 'receid' => 'all',
  184. 'modeid' => $id,
  185. 'type' => 2,
  186. 'wherestr' => $wherestr,
  187. );
  188. m('flow_extent')->insert($uarr);
  189. $uarr['type'] = 3;
  190. m('flow_extent')->insert($uarr);
  191. m('mode')->createlistpage($id); //生成列表页
  192. return returnsuccess(array(
  193. 'name' => ''.$id.'.'.$name.'('.$num.')',
  194. 'id' => $id,
  195. 'num' => $num
  196. ));
  197. }
  198. }
粤ICP备19079148号