Browse Source

记账记录

afa 5 months ago
parent
commit
115bca0cf3

+ 3 - 3
app/admin/controller/user/MoneyLog.php

@@ -58,8 +58,8 @@ class MoneyLog extends Backend
      public function edit()
     {
         if(!$this->request->isPost()){
-            $catelist= site_config('addonsd.money_in_type');;
-            $this->assign('parentList',$catelist);
+            $catelist= site_config('addonsd.money_in_type');
+            $this->assign('parentList', $catelist);
         }
         return $this->_edit();
     }
@@ -70,7 +70,7 @@ class MoneyLog extends Backend
     #[Route("GET,POST","del")]
     public function del()
     {
-         $ids = $this->request->param("ids");
+        $ids = $this->request->param("ids");
         if (empty($ids)) {
             $this->error(__('参数%s不能为空', ['s'=>'ids']));
         }

+ 9 - 6
app/admin/view/user/money_log/add.html

@@ -12,11 +12,10 @@
                 {:token_field()}
             </template>
             <template v-slot:type_name="{rows}">
-                <el-form-item label="{:__('父级')}:" prop="type_name">
-                    <el-select placeholder="{:__('请选择父级')}" v-model="rows.type_name" :clearable="true" style="width: 100%">
-                        <el-option key="all" label="无" value="0"></el-option>
+                <el-form-item label="{:__('账变名称')}:" prop="type_name">
+                    <el-select placeholder="{:('请选择父级')}" v-model="rows.type_name" :clearable="true" style="width: 100%">
                         {foreach name="parentList" item="vo"}
-                        <el-option v-if="rows.type_name=='{$vo}'" key="{$key}"  value="{$vo}"></el-option>
+                       <el-option v-for="(item,index) in parentList" :key="index"  :value="item.value"></el-option>
                         {/foreach}
                     </el-select>
                 </el-form-item>
@@ -49,7 +48,7 @@ export default{
     methods: {
         changeType:function(data,row){
             
-             row.type_name='0'
+            row.type_name='0'
         },
         onSubmit:function(rows){
             //表单提交前执行,返回false可以阻止表单提交
@@ -69,7 +68,11 @@ export default{
         },
         onFail:function(err){
             //表单提交失败后执行
-        }
+        },
+        //页面加载完成时执行
+        onShow:function(query){
+            console.log(query, "====");
+        },
     }
 }
 </script>

+ 3 - 2
app/api/controller/MoneyLog.php

@@ -17,10 +17,11 @@ class MoneyLog extends Base
       //记账记录
       public function moneylog(MonuyModel $monuyModel)
       {
-
             $time = $this->request->post('time/s', date('Y-m'));
             $result['count'] = $monuyModel::getCountMonthBalance($time);
-            $result['list']  = $monuyModel->where('status', MonuyModel::STATUS_NORMAL)
+            $result['list']  = $monuyModel
+                              ->with('users')
+                              ->where('status', MonuyModel::STATUS_NORMAL)
                               ->whereMonth('create_date', $time)
                               ->order('id desc')
                               ->paginate(10);