|
- <?php
- use yii\helpers\Html;
- use common\components\zGridView;
- use backend\modules\motorcade\models\BusDepartment;
- use yii\helpers\ArrayHelper;
- use backend\modules\zzcs\models\BaseSupplier;
-
- foreach (Yii::$app->session->getAllFlashes() as $key => $message) {
- echo "<script>window.onload = function(){pjaxFinish(\"$message\")}</script>";
- }
-
- ?>
-
- <style type="text/css">
- .combo-select {
- width: 141px;
- margin-bottom: 0px;
- }
- </style>
- <?php
- $dp = '';
- if ($data['op'] == 'customer') {
- $dp = zGridView::widget(['dataProvider' => $dataProvider,
- 'tableOptions' => ['class' => 'table table-striped table-hover'],
- 'emptyText' => '没有匹配的记录',
- 'showPageSummary' => false,
- 'showEmpty' => true,
- 'pagerFixed' => true,
- 'pagerButtons' => [
- Html::button('<span class="glyphicon glyphicon-plus"></span> 添加客户', ['class' => 'btn btn-primary', 'onclick' => "zNewWin('',\"/motorcade/customer/add-customer\",169,181)"]),
- ],
- 'columns' => [
- [
- 'width' => '55px',
- 'class' => 'kartik\grid\CheckboxColumn',
- 'rowSelectedClass' => '',
- ],
- [
- 'width' => '36%',
- 'attribute' => 'depart_name',
- ],
- [
- 'width' => '20%',
- 'attribute' => 'departType.TYPE_NAME',
- ],
- [
- 'width' => '10%',
- 'attribute' => 'departStatus.TYPE_NAME',
- ],
- [
- 'width' => '10%',
- 'attribute' => 'salesName.TRUE_NAME',
- 'header' => '业务员',
- ],
- [
- 'class' => 'kartik\grid\ActionColumn',
- 'width' => '20%',
- 'template' => '{button1}{button2}{button3}',
- 'header' => '操作',
- 'buttons' => ['button1' => function ($url, $model, $key) {
- if ($model->status == 610) {
- $label = '审核';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => " zNewWin('',\"/motorcade/customer/update-customer?id=$model->ID&op=review\",169,181)"
- ];
- } else {
- $label = '查看';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => " zNewWin('',\"/motorcade/customer/update-customer?id=$model->ID&op=view\",169,181)"
- ];
- }
- return Html::button($label, $options);
- },
- 'button2' => function ($url, $model, $key) {
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => " zNewWin('',\"/motorcade/customer/update-customer?id=$model->ID&op=modify\",169,181)"
- ];
- return Html::button('修改', $options);
- },
- 'button3' => function ($url, $model, $key) {
- if ($model->status == 610) {
- $label = '删除';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => "ret('确认要{$label}吗!',$model->ID,3,'customer')",
- ];
- } elseif ($model->status == 611) {
- $label = '停用';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => "ret('确认要{$label}吗!',$model->ID,1,'customer');",
- ];
- } else {
- $label = '启用';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => "ret('确认要{$label}吗!',$model->ID,2,'customer');",
- ];
- }
- if ($model->status != 610) {
- return Html::button($label, $options);
- } else {
- return false;
- }
- },
- ],
- ],
- ],
- ]);
- } else {
- $dp = zGridView::widget(['dataProvider' => $dataProvider,
- 'tableOptions' => ['class' => 'table table-striped table-hover'],
- 'emptyText' => '没有匹配的记录',
- 'showPageSummary' => false,
- 'showEmpty' => true,
- 'pagerFixed' => true,
- 'pagerButtons' => [
- Html::button(
- '<span class="glyphicon glyphicon-plus"></span> 添加供应商',
- ['class' => 'btn btn-primary',
- // 'onclick' => 'window.location.href = "/motorcade/supplier/add-supplier";'
- 'onclick' => "zNewWin('',\"/motorcade/supplier/add-supplier\",169,180)"]),
- ],
- 'columns' => [
- ['width' => '55px',
- 'class' => 'kartik\grid\CheckboxColumn',
- 'rowSelectedClass' => '',],
- [
- 'width' => '36%',
- 'attribute' => 'base_supplier.SUPPLIER_NAME',
- ],
- [
- 'width' => '20%',
- 'attribute' => 'dict_type.TYPE_NAME',
- ],
- [
- 'width' => '20%',
- 'attribute' => 'base_supplier.depart_status.TYPE_NAME',
- ],
- ['class' => 'kartik\grid\ActionColumn',
- 'width' => '20%',
- 'template' => '{button1}{button2}{button3}',
- 'header' => '操作',
- 'buttons' => ['button1' => function ($url, $model, $key) {
- if ($model->base_supplier->STATUS == 610) {
- $label = '审核';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => " zNewWin('',\"/motorcade/supplier/update-supplier?id=$model->SUPPLIER_ID&op=review\",169,180)"
- ];
- } else {
- $label = '查看';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => " zNewWin('',\"/motorcade/supplier/update-supplier?id=$model->SUPPLIER_ID&op=view\",169,180)"
- ];
- }
-
- return Html::button($label, $options);
- },
- 'button2' => function ($url, $model, $key) {
- $options = ['class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => " zNewWin('',\"/motorcade/supplier/update-supplier?id=$model->SUPPLIER_ID&op=modify\",169,180)"
- ];
- return Html::button('修改', $options);
- },
- 'button3' => function ($url, $model, $key) {
- if ($model->base_supplier->STATUS == 610) {
- $label = '删除';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => "ret('确认要{$label}吗!',$model->SUPPLIER_ID,3,'supplier')",
- ];
- } elseif ($model->base_supplier->STATUS == 611) {
- $label = '停用';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => "ret('确认要{$label}吗!',$model->SUPPLIER_ID,1,'supplier')",
- ];
- } else {
- $label = '启用';
- $options = [
- 'class' => 'btn btn-link btn-sm-width',
- 'data-pjax' => '0',
- 'onclick' => "ret('确认要{$label}吗!',$model->SUPPLIER_ID,2,'supplier')",
- ];
- }
- if ($model->base_supplier->STATUS != 610) {
- return Html::button($label, $options);
- } else {
- return false;
- }
-
- },
- ],
- ],
- ],
- ]);
- }
- ?>
- <div class="iframe_box">
- <?= Html::beginForm("", 'post', ['id' => 'form']); ?>
- <div class="dis_search">
- <div class="form-inline search_first">
- <span class="search_name_width"><?php echo $data['op'] == 'customer' ? '客户名称:' : '供应商名称:' ?></span>
- <?= Html::textInput('depart_name', '', ['placeholder' => $data['op'] == 'customer' ? '请输入客户名称' : '请输入供应商名称', 'class' => 'form-control', 'style' => 'width:180px']) ?>
-
- <span class="search_name_width">类型:</span>
- <?php if ($data['op'] == 'customer'): ?>
- <?= Html::dropDownList('depart_type', 0, [0 => '类型', 469 => '企业', 470 => '个人'], ['class' => 'form-control ', 'style' => 'width:100px']) ?>
- <?php else: ?>
- <?= Html::dropDownList('BusOrder[]', 0, [0 => '请选择', 259 => '车队'], ['class' => 'form-control select_screen', 'style' => 'width:100px']) ?>
- <?php endif ?>
-
- <?php if ($data['op'] == 'customer'): ?>
- <span class="search_name_width">业务员:</span>
- <?= Html::dropDownList('sales_man_id', 0, [0 => '全部'] + ArrayHelper::map(BusDepartment::getSales(), 'sales_man_id', 'TRUE_NAME'), ['class' => 'form-control select_screen', 'style' => 'width:100px']) ?>
- <?php endif; ?>
-
- <button type="button" class="btn btn-primary" style="margin-left: 20px" id="submit"
- onclick="index_search(-1)">
- <span class="glyphicon glyphicon-search"></span>
- 查 询
- </button>
- <?= Html::hiddenInput('status', 0, ['id' => 'status']) ?>
- </div>
- </div>
- <?= Html::endForm(); ?>
- <div class="tab-content" style="padding-top: 0;margin-top: 30px">
- <ul class="nav nav-tabs choose_op nav_title">
- <li class="active" id="" onclick="">
- <a data-toggle="tab" href="#tab1" onclick="index_search(0)">全 部</a>
- </li>
- <li class="" id="" onclick="">
- <a data-toggle="tab" href="#tab1" onclick="index_search(610)"> 待审核 </a>
- </li>
- <li class="" id="" onclick="">
- <a data-toggle="tab" href="#tab1" onclick="index_search(611)"> 已审核 </a>
- </li>
- <li class="" id="" onclick="">
- <a data-toggle="tab" href="#tab1" onclick="index_search(612)"> 已停用 </a>
- </li>
- </ul>
- <?php \yii\widgets\Pjax::begin(['id' => 'list', 'timeout' => false]) ?>
- <div class="tab-pane active " id="tab1">
- <?= $dp ?>
- </div>
- <?php \yii\widgets\Pjax::end() ?>
- </div>
- </div>
- <?php \yii\widgets\Pjax::begin(['id' => 'pjax-model', 'timeout' => false]) ?>
- <?php \yii\widgets\Pjax::end() ?>
- <script>
- function index_search(status) {
- if (typeof status == 'undefined') {
- status = -1;
- }
- if (status != -1) {
- $("#status").val(status);
- }
- var depart_name = $("*[name='depart_name']").val();
- var depart_type = $("*[name='depart_type']").val();
- var sales_man_id = $("*[name='sales_man_id']").val();
- $.pjax.reload({
- container: '#list',
- data: {
- depart_name: depart_name,
- depart_type: depart_type,
- sales_man_id: sales_man_id,
- status: $("#status").val()
- },
- replace: false,
- timeout: false
- })
- }
- function ret(info, id, type, op) {
- var url = '';
- if (op == 'customer') {
- url = '/motorcade/customer/do-customer';
- } else {
- url = '/motorcade/supplier/do-supplier';
- }
- ZZAlertInfo(info);
- $('.ok').on('click', function () {
- loading();
- z.showModal('#pjax-model', url + '?id=' + id + '&type=' + type, '', index_search)
- })
- }
-
- </script>
|