wupengfei 2 years ago
parent
commit
b40a883dc0

+ 5 - 3
.idea/workspace.xml

@@ -3,8 +3,10 @@
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/operate/controller/SupplierGoods.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/operate/controller/SupplierGoods.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/operate/view/supplier_goods/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/operate/view/supplier_goods/index.html" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/operate/controller/Company.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/operate/controller/Company.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/operate/controller/Supplier.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/operate/controller/Supplier.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/operate/view/company/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/operate/view/company/index.html" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/operate/view/supplier/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/operate/view/supplier/index.html" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -290,7 +292,7 @@
       <workItem from="1681174490906" duration="23334000" />
       <workItem from="1681260946292" duration="27381000" />
       <workItem from="1681348081818" duration="22448000" />
-      <workItem from="1681434523223" duration="19098000" />
+      <workItem from="1681434523223" duration="19276000" />
     </task>
     <servers />
   </component>

+ 30 - 0
application/operate/controller/Company.php

@@ -78,6 +78,36 @@ class Company extends Controller
         $this->_save($this->table, ['is_deleted' => '1']);
     }
 
+
+    /**
+     * 启用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function enable()
+    {
+        $this->_save($this->table, ['status' => 1]);
+        $this->success('已启用!');
+    }
+
+    /**
+     * 禁用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function forbidden()
+    {
+        $this->_save($this->table, ['status' => 0]);
+        $this->success('已禁用!');
+    }
+
     /**
      * 表单数据处理
      * @param array $data

+ 29 - 0
application/operate/controller/Supplier.php

@@ -78,6 +78,35 @@ class Supplier extends Controller
         $this->_save($this->table, ['is_deleted' => '1']);
     }
 
+
+    /**
+     * 启用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function enable()
+    {
+        $this->_save($this->table, ['status' => 1]);
+        $this->success('已上架!');
+    }
+
+    /**
+     * 禁用
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function forbidden()
+    {
+        $this->_save($this->table, ['status' => 0]);
+        $this->success('已下架!');
+    }
     /**
      * 表单数据处理
      * @param array $data

+ 5 - 0
application/operate/view/company/index.html

@@ -31,6 +31,11 @@
             <td class='text-left'>{$vo.create_at|default='--'}</td>
             <td class='text-left' style="width: 20%">
                 <a data-title="编辑" class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm  layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn  layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
                 <a data-title="产品合集" class="layui-btn layui-btn-sm" data-open='{:url("/operate/supplier_goods/index")}?company_id={$vo.id}&source=2'>产品合集</a>
                 <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
             </td>

+ 5 - 0
application/operate/view/supplier/index.html

@@ -31,6 +31,11 @@
             <td class='text-left'>{$vo.create_at|default='--'}</td>
             <td class='text-left' style="width: 20%">
                 <a data-title="编辑" class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
+                {if $vo.status == 1}
+                <span class="layui-btn layui-btn-sm  layui-btn-warm"  onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
+                {else}
+                <span class="layui-btn  layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
+                {/if}
                 <a data-title="产品合集" class="layui-btn layui-btn-sm" data-open='{:url("/operate/supplier_goods/index")}?supplier_id={$vo.id}&source=1'>产品合集</a>
                 <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
             </td>