hrjy 3 jaren geleden
bovenliggende
commit
cf13659980

+ 70 - 9
app/admin/controller/water/WaterMaterialScience.php

@@ -94,6 +94,8 @@ class WaterMaterialScience extends AuthController
             ['value' => 2, 'label' => '侧板'],
             ['value' => 3, 'label' => '拉筋'],
             ['value' => 4, 'label' => '底板'],
+            ['value' => 5, 'label' => '立柱'],
+            ['value' => 6, 'label' => '辅拉'],
         ])->filterable(true);
         $f[] = Form::select('th_id', '选择厚度', '')->options(
             array_merge([['value' => 0, 'label' => '请选择分类']], \app\admin\model\water\WaterThickness::order('id DESC')->field('id as value,name as label')->select()->toArray())
@@ -108,6 +110,38 @@ class WaterMaterialScience extends AuthController
         return $this->fetch('public/form-builder');
 
 
+    }
+
+
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function creates($id = 0)
+    {
+        $f = [];
+        $f[] = Form::input('name', '名称')->col(12);
+        $f[] = Form::select('type', '选择分类', '')->options([
+            ['value' => 0, 'label' => '请选择分类'],
+            ['value' => 1, 'label' => '顶板'],
+            ['value' => 2, 'label' => '侧板'],
+            ['value' => 3, 'label' => '拉筋'],
+            ['value' => 4, 'label' => '底板'],
+            ['value' => 5, 'label' => '立柱'],
+            ['value' => 6, 'label' => '辅拉'],
+        ])->filterable(true);
+        $f[] = Form::select('th_id', '选择厚度', '')->options(
+            array_merge([['value' => 0, 'label' => '请选择分类']], \app\admin\model\water\WaterThickness::order('id DESC')->field('id as value,name as label')->select()->toArray())
+        )->filterable(true);
+        $f[] = Form::input('weight', '重量(kg)');
+        $f[] = Form::input('unit_price', '单价');
+        $f[] = Form::input('company', '单位');
+        $form = Form::make_post_form('添加', $f, Url::buildUrl('save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+
+
     }
 
     public function save()
@@ -130,8 +164,6 @@ class WaterMaterialScience extends AuthController
             'weight' => 'require',
             'unit_price' => 'require',
             'company' => 'require',
-            'long' => 'require',
-            'wide' => 'require',
         ]);
         $validate->message([
             'name.require' => '名称不能为空',
@@ -140,8 +172,6 @@ class WaterMaterialScience extends AuthController
             'weight.require' => '请填写重量',
             'unit_price.require' => '请填写单价',
             'company.require' => '请填写单位',
-            'long.require' => '请填写长度',
-            'wide.require' => '请填写宽度',
         ]);
         if (!$validate->check($data)) {
             return Json::fail($validate->getError());
@@ -185,6 +215,37 @@ class WaterMaterialScience extends AuthController
         return $this->fetch('public/form-builder');
     }
 
+    /**
+     * 显示创建资源表单页.
+     *
+     * @return \think\Response
+     */
+    public function edits($id = 0)
+    {
+        $data = model::find($id);
+        $f = [];
+        $f[] = Form::input('name', '名称', $data['name'])->col(12);
+        $f[] = Form::select('type', '选择分类', (string)$data['type'])->options([
+            ['value' => 0, 'label' => '请选择分类'],
+            ['value' => 1, 'label' => '顶板'],
+            ['value' => 2, 'label' => '侧板'],
+            ['value' => 3, 'label' => '拉筋'],
+            ['value' => 4, 'label' => '底板'],
+            ['value' => 5, 'label' => '立柱'],
+            ['value' => 6, 'label' => '辅拉'],
+        ])->filterable(true);
+        $f[] = Form::select('th_id', '选择厚度', (string)$data['th_id'])->options(
+            array_merge([['value' => 0, 'label' => '请选择分类']], \app\admin\model\water\WaterThickness::order('id DESC')->field('id as value,name as label')->select()->toArray())
+        )->filterable(true);
+        $f[] = Form::input('weight', '重量(kg)', $data['weight']);
+        $f[] = Form::input('unit_price', '单价', $data['unit_price']);
+        $f[] = Form::input('company', '单位', $data['company']);
+        $f[] = Form::hidden('id', $id);
+        $form = Form::make_post_form('修改', $f, Url::buildUrl('update'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
 
     /**
      * 修改
@@ -214,8 +275,6 @@ class WaterMaterialScience extends AuthController
             'weight' => 'require',
             'unit_price' => 'require',
             'company' => 'require',
-            'long' => 'require',
-            'wide' => 'require',
         ]);
         $validate->message([
             'name.require' => '名称不能为空',
@@ -224,12 +283,14 @@ class WaterMaterialScience extends AuthController
             'weight.require' => '请填写重量',
             'unit_price.require' => '请填写单价',
             'company.require' => '请填写单位',
-            'long.require' => '请填写长度',
-            'wide.require' => '请填写宽度',
         ]);
         $details = $model->find($data['id']);
         $details['name'] = $data['name'];
-        $details['thickness'] = $data['thickness'];
+        $details['type'] = $data['type'];
+        $details['th_id'] = $data['th_id'];
+        $details['weight'] = $data['weight'];
+        $details['unit_price'] = $data['unit_price'];
+        $details['company'] = $data['company'];
         $res = $details->save();
         if ($res) return Json::successful('修改成功');
         return Json::fail('修改失败');

+ 6 - 4
app/admin/view/water/water_material_science/column.php

@@ -68,7 +68,7 @@
                 <div class="layui-card-body">
 
                     <div class="layui-btn-container" id="container-action">
-                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:900,w:700})">添加材料</a>
+                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('creates')}',{h:900,w:700})">添加材料</a>
 <!--                        <button class="layui-btn layui-btn-sm" data-type="del_auction">批量删除</button>-->
                     </div>
                     <table class="layui-hide" id="List" lay-filter="List"></table>
@@ -84,11 +84,15 @@
                         拉筋
                         {{#  } else if(d.type == 4) { }}
                         底板
+                        {{#  } else if(d.type == 5) { }}
+                        立柱
+                        {{#  } else if(d.type == 6) { }}
+                        辅拉
                         {{#  } }}
                     </script>
 
                     <script type="text/html" id="act">
-                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('edit')}?id={{d.id}}',{h:900,w:700})">
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('edits')}?id={{d.id}}',{h:900,w:700})">
                             编辑
                         </button>
                         <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">
@@ -117,8 +121,6 @@
             {field: 'weight', title: '重量', align: 'center'},
             {field: 'unit_price', title: '单价', align: 'center'},
             {field: 'company', title: '单位', align: 'center'},
-            {field: 'long', title: '长度', align: 'center'},
-            {field: 'wide', title: '宽度', align: 'center'},
             {field: 'right', title: '操作', align: 'center', toolbar: '#act',width: '15%'},
         ];
     });

+ 2 - 4
app/admin/view/water/water_material_science/fula.php

@@ -68,7 +68,7 @@
                 <div class="layui-card-body">
 
                     <div class="layui-btn-container" id="container-action">
-                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:900,w:700})">添加材料</a>
+                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('creates')}',{h:900,w:700})">添加材料</a>
 <!--                        <button class="layui-btn layui-btn-sm" data-type="del_auction">批量删除</button>-->
                     </div>
                     <table class="layui-hide" id="List" lay-filter="List"></table>
@@ -88,7 +88,7 @@
                     </script>
 
                     <script type="text/html" id="act">
-                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('edit')}?id={{d.id}}',{h:900,w:700})">
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('edits')}?id={{d.id}}',{h:900,w:700})">
                             编辑
                         </button>
                         <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">
@@ -117,8 +117,6 @@
             {field: 'weight', title: '重量', align: 'center'},
             {field: 'unit_price', title: '单价', align: 'center'},
             {field: 'company', title: '单位', align: 'center'},
-            {field: 'long', title: '长度', align: 'center'},
-            {field: 'wide', title: '宽度', align: 'center'},
             {field: 'right', title: '操作', align: 'center', toolbar: '#act',width: '15%'},
         ];
     });

+ 2 - 4
app/admin/view/water/water_material_science/lacing.php

@@ -68,7 +68,7 @@
                 <div class="layui-card-body">
 
                     <div class="layui-btn-container" id="container-action">
-                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:900,w:700})">添加材料</a>
+                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('creates')}',{h:900,w:700})">添加材料</a>
 <!--                        <button class="layui-btn layui-btn-sm" data-type="del_auction">批量删除</button>-->
                     </div>
                     <table class="layui-hide" id="List" lay-filter="List"></table>
@@ -88,7 +88,7 @@
                     </script>
 
                     <script type="text/html" id="act">
-                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('edit')}?id={{d.id}}',{h:900,w:700})">
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('编辑','{:Url('edits')}?id={{d.id}}',{h:900,w:700})">
                             编辑
                         </button>
                         <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">
@@ -117,8 +117,6 @@
             {field: 'weight', title: '重量', align: 'center'},
             {field: 'unit_price', title: '单价', align: 'center'},
             {field: 'company', title: '单位', align: 'center'},
-            {field: 'long', title: '长度', align: 'center'},
-            {field: 'wide', title: '宽度', align: 'center'},
             {field: 'right', title: '操作', align: 'center', toolbar: '#act',width: '15%'},
         ];
     });