qymljy před 2 roky
rodič
revize
b269af614b

+ 4 - 1
src/system/moduleNormal/systemSet/codeRuleMag/index.vue

@@ -3,7 +3,7 @@
     <listTemp ref="list" :param="param" :tableName="'coderuleTable'" :searchType="searchType">
       <template #tb_cell="{data}">
         <template v-if="data.column.dataIndex === 'operation'">
-          <edit :data="data.record"></edit>
+          <edit :data="data.record" @onSuccess="listData"></edit>
         </template>
       </template>
     </listTemp>
@@ -29,6 +29,9 @@
     },
     "id": 20221109110204,
   })
+  const listData = ()=>{
+    list.value.tableData()
+  }
 </script>
 
 <style>

+ 26 - 4
src/system/moduleNormal/systemSet/codeRuleMag/modules/edit.vue

@@ -35,7 +35,7 @@
           </a-col>
           <a-col :span="24">
             <a-form-item label="是否包含时间信息">
-              <a-checkbox :true-label="1" :false-label="0" v-model:value="form.numincludetime"></a-checkbox>
+              <a-checkbox  v-model:checked="checked"></a-checkbox>
             </a-form-item>
           </a-col>
           <a-col :span="24">
@@ -47,7 +47,7 @@
       </a-form>
       <template #extra>
         <a-space>
-          <a-button  @click="dialogFormVisible = false" class="normal-btn-width">取 消</a-button>
+          <a-button  @click="onClose" class="normal-btn-width">取 消</a-button>
           <a-button  type="primary" @click="submit" class="normal-btn-width">确 定</a-button>
         </a-space>
       </template>
@@ -56,14 +56,36 @@
 </template>
 
 <script setup>
-  import {ref,defineProps} from "vue";
+  import {ref, defineProps, defineEmits} from "vue";
+  import Api from '@/api/api'
+  import utils from '@/utils/utils'
+  const emit = defineEmits(['onSuccess'])
   const props = defineProps(['data'])
   const form = ref({})
   const dialogFormVisible = ref(false)
+  const checked = ref(false)
   const onShow = ()=>{
     dialogFormVisible.value = true
     form.value = Object.assign({},form.value,props.data)
-    console.log(form.value,'传参')
+    form.value.numincludetime == 1 ? checked.value = true : checked.value = false
+  }
+  const submit = async ()=>{
+    try {
+      form.value.numincludetime ? checked.value = 1 : checked.value = 0
+      const res = await Api.requested({
+        "content":form.value,
+        "id":20230608101202
+      })
+      utils.message(res,'编辑成功',()=>{
+        onClose()
+        emit('onSuccess')
+      })
+    } catch (errorInfo) {
+      console.log('Failed:', errorInfo);
+    }
+  }
+  const onClose = ()=>{
+    dialogFormVisible.value = false
   }
 </script>