您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

305 行
13 KiB

  1. <?php
  2. use yii\helpers\Html;
  3. use common\components\zGridView;
  4. use backend\modules\motorcade\models\BusDepartment;
  5. use yii\helpers\ArrayHelper;
  6. use backend\modules\zzcs\models\BaseSupplier;
  7. foreach (Yii::$app->session->getAllFlashes() as $key => $message) {
  8. echo "<script>window.onload = function(){pjaxFinish(\"$message\")}</script>";
  9. }
  10. ?>
  11. <style type="text/css">
  12. .combo-select {
  13. width: 141px;
  14. margin-bottom: 0px;
  15. }
  16. </style>
  17. <?php
  18. $dp = '';
  19. if ($data['op'] == 'customer') {
  20. $dp = zGridView::widget(['dataProvider' => $dataProvider,
  21. 'tableOptions' => ['class' => 'table table-striped table-hover'],
  22. 'emptyText' => '没有匹配的记录',
  23. 'showPageSummary' => false,
  24. 'showEmpty' => true,
  25. 'pagerFixed' => true,
  26. 'pagerButtons' => [
  27. Html::button('<span class="glyphicon glyphicon-plus"></span> 添加客户', ['class' => 'btn btn-primary', 'onclick' => "zNewWin('',\"/motorcade/customer/add-customer\",169,181)"]),
  28. ],
  29. 'columns' => [
  30. [
  31. 'width' => '55px',
  32. 'class' => 'kartik\grid\CheckboxColumn',
  33. 'rowSelectedClass' => '',
  34. ],
  35. [
  36. 'width' => '36%',
  37. 'attribute' => 'depart_name',
  38. ],
  39. [
  40. 'width' => '20%',
  41. 'attribute' => 'departType.TYPE_NAME',
  42. ],
  43. [
  44. 'width' => '10%',
  45. 'attribute' => 'departStatus.TYPE_NAME',
  46. ],
  47. [
  48. 'width' => '10%',
  49. 'attribute' => 'salesName.TRUE_NAME',
  50. 'header' => '业务员',
  51. ],
  52. [
  53. 'class' => 'kartik\grid\ActionColumn',
  54. 'width' => '20%',
  55. 'template' => '{button1}{button2}{button3}',
  56. 'header' => '操作',
  57. 'buttons' => ['button1' => function ($url, $model, $key) {
  58. if ($model->status == 610) {
  59. $label = '审核';
  60. $options = [
  61. 'class' => 'btn btn-link btn-sm-width',
  62. 'data-pjax' => '0',
  63. 'onclick' => " zNewWin('',\"/motorcade/customer/update-customer?id=$model->ID&op=review\",169,181)"
  64. ];
  65. } else {
  66. $label = '查看';
  67. $options = [
  68. 'class' => 'btn btn-link btn-sm-width',
  69. 'data-pjax' => '0',
  70. 'onclick' => " zNewWin('',\"/motorcade/customer/update-customer?id=$model->ID&op=view\",169,181)"
  71. ];
  72. }
  73. return Html::button($label, $options);
  74. },
  75. 'button2' => function ($url, $model, $key) {
  76. $options = [
  77. 'class' => 'btn btn-link btn-sm-width',
  78. 'data-pjax' => '0',
  79. 'onclick' => " zNewWin('',\"/motorcade/customer/update-customer?id=$model->ID&op=modify\",169,181)"
  80. ];
  81. return Html::button('修改', $options);
  82. },
  83. 'button3' => function ($url, $model, $key) {
  84. if ($model->status == 610) {
  85. $label = '删除';
  86. $options = [
  87. 'class' => 'btn btn-link btn-sm-width',
  88. 'data-pjax' => '0',
  89. 'onclick' => "ret('确认要{$label}吗!',$model->ID,3,'customer')",
  90. ];
  91. } elseif ($model->status == 611) {
  92. $label = '停用';
  93. $options = [
  94. 'class' => 'btn btn-link btn-sm-width',
  95. 'data-pjax' => '0',
  96. 'onclick' => "ret('确认要{$label}吗!',$model->ID,1,'customer');",
  97. ];
  98. } else {
  99. $label = '启用';
  100. $options = [
  101. 'class' => 'btn btn-link btn-sm-width',
  102. 'data-pjax' => '0',
  103. 'onclick' => "ret('确认要{$label}吗!',$model->ID,2,'customer');",
  104. ];
  105. }
  106. if ($model->status != 610) {
  107. return Html::button($label, $options);
  108. } else {
  109. return false;
  110. }
  111. },
  112. ],
  113. ],
  114. ],
  115. ]);
  116. } else {
  117. $dp = zGridView::widget(['dataProvider' => $dataProvider,
  118. 'tableOptions' => ['class' => 'table table-striped table-hover'],
  119. 'emptyText' => '没有匹配的记录',
  120. 'showPageSummary' => false,
  121. 'showEmpty' => true,
  122. 'pagerFixed' => true,
  123. 'pagerButtons' => [
  124. Html::button(
  125. '<span class="glyphicon glyphicon-plus"></span> 添加供应商',
  126. ['class' => 'btn btn-primary',
  127. // 'onclick' => 'window.location.href = "/motorcade/supplier/add-supplier";'
  128. 'onclick' => "zNewWin('',\"/motorcade/supplier/add-supplier\",169,180)"]),
  129. ],
  130. 'columns' => [
  131. ['width' => '55px',
  132. 'class' => 'kartik\grid\CheckboxColumn',
  133. 'rowSelectedClass' => '',],
  134. [
  135. 'width' => '36%',
  136. 'attribute' => 'base_supplier.SUPPLIER_NAME',
  137. ],
  138. [
  139. 'width' => '20%',
  140. 'attribute' => 'dict_type.TYPE_NAME',
  141. ],
  142. [
  143. 'width' => '20%',
  144. 'attribute' => 'base_supplier.depart_status.TYPE_NAME',
  145. ],
  146. ['class' => 'kartik\grid\ActionColumn',
  147. 'width' => '20%',
  148. 'template' => '{button1}{button2}{button3}',
  149. 'header' => '操作',
  150. 'buttons' => ['button1' => function ($url, $model, $key) {
  151. if ($model->base_supplier->STATUS == 610) {
  152. $label = '审核';
  153. $options = [
  154. 'class' => 'btn btn-link btn-sm-width',
  155. 'data-pjax' => '0',
  156. 'onclick' => " zNewWin('',\"/motorcade/supplier/update-supplier?id=$model->SUPPLIER_ID&op=review\",169,180)"
  157. ];
  158. } else {
  159. $label = '查看';
  160. $options = [
  161. 'class' => 'btn btn-link btn-sm-width',
  162. 'data-pjax' => '0',
  163. 'onclick' => " zNewWin('',\"/motorcade/supplier/update-supplier?id=$model->SUPPLIER_ID&op=view\",169,180)"
  164. ];
  165. }
  166. return Html::button($label, $options);
  167. },
  168. 'button2' => function ($url, $model, $key) {
  169. $options = ['class' => 'btn btn-link btn-sm-width',
  170. 'data-pjax' => '0',
  171. 'onclick' => " zNewWin('',\"/motorcade/supplier/update-supplier?id=$model->SUPPLIER_ID&op=modify\",169,180)"
  172. ];
  173. return Html::button('修改', $options);
  174. },
  175. 'button3' => function ($url, $model, $key) {
  176. if ($model->base_supplier->STATUS == 610) {
  177. $label = '删除';
  178. $options = [
  179. 'class' => 'btn btn-link btn-sm-width',
  180. 'data-pjax' => '0',
  181. 'onclick' => "ret('确认要{$label}吗!',$model->SUPPLIER_ID,3,'supplier')",
  182. ];
  183. } elseif ($model->base_supplier->STATUS == 611) {
  184. $label = '停用';
  185. $options = [
  186. 'class' => 'btn btn-link btn-sm-width',
  187. 'data-pjax' => '0',
  188. 'onclick' => "ret('确认要{$label}吗!',$model->SUPPLIER_ID,1,'supplier')",
  189. ];
  190. } else {
  191. $label = '启用';
  192. $options = [
  193. 'class' => 'btn btn-link btn-sm-width',
  194. 'data-pjax' => '0',
  195. 'onclick' => "ret('确认要{$label}吗!',$model->SUPPLIER_ID,2,'supplier')",
  196. ];
  197. }
  198. if ($model->base_supplier->STATUS != 610) {
  199. return Html::button($label, $options);
  200. } else {
  201. return false;
  202. }
  203. },
  204. ],
  205. ],
  206. ],
  207. ]);
  208. }
  209. ?>
  210. <div class="iframe_box">
  211. <?= Html::beginForm("", 'post', ['id' => 'form']); ?>
  212. <div class="dis_search">
  213. <div class="form-inline search_first">
  214. <span class="search_name_width"><?php echo $data['op'] == 'customer' ? '客户名称:' : '供应商名称:' ?></span>
  215. <?= Html::textInput('depart_name', '', ['placeholder' => $data['op'] == 'customer' ? '请输入客户名称' : '请输入供应商名称', 'class' => 'form-control', 'style' => 'width:180px']) ?>
  216. <span class="search_name_width">类型:</span>
  217. <?php if ($data['op'] == 'customer'): ?>
  218. <?= Html::dropDownList('depart_type', 0, [0 => '类型', 469 => '企业', 470 => '个人'], ['class' => 'form-control ', 'style' => 'width:100px']) ?>
  219. <?php else: ?>
  220. <?= Html::dropDownList('BusOrder[]', 0, [0 => '请选择', 259 => '车队'], ['class' => 'form-control select_screen', 'style' => 'width:100px']) ?>
  221. <?php endif ?>
  222. <?php if ($data['op'] == 'customer'): ?>
  223. <span class="search_name_width">业务员:</span>
  224. <?= Html::dropDownList('sales_man_id', 0, [0 => '全部'] + ArrayHelper::map(BusDepartment::getSales(), 'sales_man_id', 'TRUE_NAME'), ['class' => 'form-control select_screen', 'style' => 'width:100px']) ?>
  225. <?php endif; ?>
  226. <button type="button" class="btn btn-primary" style="margin-left: 20px" id="submit"
  227. onclick="index_search(-1)">
  228. <span class="glyphicon glyphicon-search"></span>
  229. 查&nbsp;询
  230. </button>
  231. <?= Html::hiddenInput('status', 0, ['id' => 'status']) ?>
  232. </div>
  233. </div>
  234. <?= Html::endForm(); ?>
  235. <div class="tab-content" style="padding-top: 0;margin-top: 30px">
  236. <ul class="nav nav-tabs choose_op nav_title">
  237. <li class="active" id="" onclick="">
  238. <a data-toggle="tab" href="#tab1" onclick="index_search(0)">全&nbsp;&nbsp;&nbsp;部</a>
  239. </li>
  240. <li class="" id="" onclick="">
  241. <a data-toggle="tab" href="#tab1" onclick="index_search(610)">&nbsp;待审核&nbsp;</a>
  242. </li>
  243. <li class="" id="" onclick="">
  244. <a data-toggle="tab" href="#tab1" onclick="index_search(611)">&nbsp;已审核&nbsp;</a>
  245. </li>
  246. <li class="" id="" onclick="">
  247. <a data-toggle="tab" href="#tab1" onclick="index_search(612)">&nbsp;已停用&nbsp;</a>
  248. </li>
  249. </ul>
  250. <?php \yii\widgets\Pjax::begin(['id' => 'list', 'timeout' => false]) ?>
  251. <div class="tab-pane active " id="tab1">
  252. <?= $dp ?>
  253. </div>
  254. <?php \yii\widgets\Pjax::end() ?>
  255. </div>
  256. </div>
  257. <?php \yii\widgets\Pjax::begin(['id' => 'pjax-model', 'timeout' => false]) ?>
  258. <?php \yii\widgets\Pjax::end() ?>
  259. <script>
  260. function index_search(status) {
  261. if (typeof status == 'undefined') {
  262. status = -1;
  263. }
  264. if (status != -1) {
  265. $("#status").val(status);
  266. }
  267. var depart_name = $("*[name='depart_name']").val();
  268. var depart_type = $("*[name='depart_type']").val();
  269. var sales_man_id = $("*[name='sales_man_id']").val();
  270. $.pjax.reload({
  271. container: '#list',
  272. data: {
  273. depart_name: depart_name,
  274. depart_type: depart_type,
  275. sales_man_id: sales_man_id,
  276. status: $("#status").val()
  277. },
  278. replace: false,
  279. timeout: false
  280. })
  281. }
  282. function ret(info, id, type, op) {
  283. var url = '';
  284. if (op == 'customer') {
  285. url = '/motorcade/customer/do-customer';
  286. } else {
  287. url = '/motorcade/supplier/do-supplier';
  288. }
  289. ZZAlertInfo(info);
  290. $('.ok').on('click', function () {
  291. loading();
  292. z.showModal('#pjax-model', url + '?id=' + id + '&type=' + type, '', index_search)
  293. })
  294. }
  295. </script>