zhangqi 1 год назад
Родитель
Сommit
fcf6e40d9b

+ 200 - 0
src/DRP/HDrpManagement/collectionVoucher/modules/add copy.vue

@@ -0,0 +1,200 @@
+<template>
+  <div>
+    <a-button type="primary" @click="showDrawer">新建</a-button>
+    <a-drawer
+      v-model:open="visible"
+      class="custom-class"
+      title="新建收入凭证"
+      placement="right"
+      width="600"
+      :closable="false"
+      @close="onClose"
+    >
+      <a-form :model="form" ref="formRef" layout="vertical">
+        <a-row :gutter="16">
+          <a-col :span="12">
+            <a-form-item label="经销商信息" name="enterprisename" :rules="[{ required: true, message: '选择经销商信息' }]">
+              <a-input v-model:value="form.enterprisename" placeholder="选择企业信息" @pressEnter="onPressEnter">
+                <template #addonAfter>
+                  <select-enterprise :autoComplete="true" ref="enterprise" :param="{id:20230427101304,content:{pageNumber:1,pageSize:20,where:{condition:form.enterprisename, status: '启用'}}}" @onSelect="onSelect"></select-enterprise>
+                </template>
+              </a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="收入账户" name="sa_accountclassid" :rules="[{ required: true, message: '请选择收入账户' }]">
+              <a-select
+                :disabled="!form.sys_enterpriseid"
+                ref="select"
+                v-model:value="form.sa_accountclassid"
+                placeholder="选择收入账户"
+                style="width: 100%"
+              >
+                <a-select-option :value="item.sa_accountclassid" v-for="item in accountOptions" :key="item.sa_accountclassid">{{item.accountname}}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="16">
+          <a-col :span="12">
+            <a-form-item label="账户余额">
+              <a-input readonly v-model:value="accountInfo.balance" placeholder="输入收入金额"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="信用额度">
+              <a-input readonly v-model:value="accountInfo.creditquota" placeholder="输入收入金额"></a-input>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="16">
+          <a-col :span="12">
+            <a-form-item label="收入类型">
+              <a-select
+                ref="select"
+                v-model:value="form.class"
+                placeholder="选择收入类型"
+                style="width: 100%"
+              >
+                <a-select-option :value="item.value" v-for="item in classOptions" :key="item.index">{{item.remarks}}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="类型明细" name="subclass" :rules="[{ required: true, message: '请选择明细' }]">
+              <a-select
+                :disabled="!form.class"
+                ref="select"
+                v-model:value="form.subclass"
+                placeholder="选择类型明细"
+                style="width: 100%"
+              >
+                <a-select-option :value="item" v-for="item in classSubvalues" :key="item.index">{{item}}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row :gutter="16">
+          <a-col :span="12">
+            <a-form-item label="收入金额" name="amount" :rules="[{ required: true, message: '请输入收入金额' }]">
+              <a-input v-model:value="form.amount" placeholder="输入收入金额"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="归属日期" name="period" :rules="[{ required: true, message: '请选择归属日期' }]">
+              <a-date-picker style="width:100%" v-model:value="form.period" value-format="YYYY-MM-DD" placeholder="请选择归属日期"/>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-row>
+          <a-col :span="24">
+            <a-form-item label="备注" name="remarks">
+              <a-textarea
+                v-model:value="form.remarks"
+                :rows="4"
+                placeholder="输入备注信息"
+              />
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </a-form>
+      <template #extra>
+        <a-space>
+          <a-button @click="onClose">关闭</a-button>
+          <a-button type="primary" @click="onSubmit">保存</a-button>
+        </a-space>
+      </template>
+    </a-drawer>
+  </div>
+</template>
+
+<script setup>
+import {ref,computed,defineEmits} from 'vue'
+import Api from '@/api/api'
+import utils from '@/utils/utils'
+import selectEnterprise from '@/template/selectEnterprise/index.vue'
+import { useRouter } from "vue-router";
+const router = useRouter()
+const emit = defineEmits(['onSuccess'])
+const visible = ref(false)
+const form = ref({
+  sa_cashbillid:0,
+  status:'新建',
+  enterprisename:'',
+  type:1,
+  period:(new Date()).toISOString().split('T')[0],
+  class:null,
+  subclass:'',
+  remarks:''
+})
+const accountInfo = computed(()=>{
+  let obj = {}
+  accountOptions.value.forEach(e=>{
+    if (e.sa_accountclassid == form.value.sa_accountclassid) {
+      obj = {
+        creditquota:e.creditquota,
+        balance:e.balance
+      }
+    }
+  })
+  return obj
+})
+const classSubvalues = computed(()=>{
+  let arr = []
+  form.value.subclass = ''
+  classOptions.value.forEach(e=>{
+    if (e.value == form.value.class) {
+      arr = e.subvalues
+    }
+  })
+  return arr
+})
+const showDrawer = ()=>{
+  visible.value = true
+  classList()
+}
+const formRef = ref()
+const onClose = () => {
+  visible.value = false;
+  formRef.value.resetFields();
+};
+const onSubmit = async ()=>{
+  try {
+    const values = await formRef.value.validateFields();
+    const res = await Api.post({
+      "id": "20221009102803",
+      "version":1,
+      "content": form.value
+    })
+    utils.message(res,'创建成功',()=>{
+      emit('onSuccess')
+      onClose()
+      router.push({path:'/cVoucherDetail',query:{id:res.data.sa_cashbillid}})
+    })
+  } catch (errorInfo) {
+    console.log('Failed:', errorInfo);
+  }
+}
+const onSelect = (val)=>{
+  form.value.enterprisename  = val.enterprisename
+  form.value.sys_enterpriseid  = val.sys_enterpriseid
+  accountData()
+}
+const accountOptions = ref([])
+const accountData = async ()=>{
+  const res = await Api.optionstype('cashbillaccountclassselect','sys_enterpriseid',form.value.sys_enterpriseid)
+  accountOptions.value = res.data
+}
+const classOptions = ref([])
+const classList = async ()=>{
+  const res = await Api.optionstype('cashbillrectype')
+  classOptions.value = res.data
+  res.data.length == 1 ?form.value.class = res.data[0].value : null
+}
+const enterprise = ref()
+const onPressEnter = ()=>{
+  enterprise.value.showModel()
+}
+</script>
+<style>
+</style>

+ 26 - 161
src/DRP/HDrpManagement/collectionVoucher/modules/add.vue

@@ -4,104 +4,17 @@
     <a-drawer
       v-model:open="visible"
       class="custom-class"
-      title="新建收入凭证"
+      title="新建"
       placement="right"
       width="600"
       :closable="false"
       @close="onClose"
     >
-      <a-form :model="form" ref="formRef" layout="vertical">
-        <a-row :gutter="16">
-          <a-col :span="12">
-            <a-form-item label="经销商信息" name="enterprisename" :rules="[{ required: true, message: '选择经销商信息' }]">
-              <a-input v-model:value="form.enterprisename" placeholder="选择企业信息" @pressEnter="onPressEnter">
-                <template #addonAfter>
-                  <select-enterprise :autoComplete="true" ref="enterprise" :param="{id:20230427101304,content:{pageNumber:1,pageSize:20,where:{condition:form.enterprisename, status: '启用'}}}" @onSelect="onSelect"></select-enterprise>
-                </template>
-              </a-input>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="收入账户" name="sa_accountclassid" :rules="[{ required: true, message: '请选择收入账户' }]">
-              <a-select
-                :disabled="!form.sys_enterpriseid"
-                ref="select"
-                v-model:value="form.sa_accountclassid"
-                placeholder="选择收入账户"
-                style="width: 100%"
-              >
-                <a-select-option :value="item.sa_accountclassid" v-for="item in accountOptions" :key="item.sa_accountclassid">{{item.accountname}}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="16">
-          <a-col :span="12">
-            <a-form-item label="账户余额">
-              <a-input readonly v-model:value="accountInfo.balance" placeholder="输入收入金额"></a-input>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="信用额度">
-              <a-input readonly v-model:value="accountInfo.creditquota" placeholder="输入收入金额"></a-input>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="16">
-          <a-col :span="12">
-            <a-form-item label="收入类型">
-              <a-select
-                ref="select"
-                v-model:value="form.class"
-                placeholder="选择收入类型"
-                style="width: 100%"
-              >
-                <a-select-option :value="item.value" v-for="item in classOptions" :key="item.index">{{item.remarks}}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="类型明细" name="subclass" :rules="[{ required: true, message: '请选择明细' }]">
-              <a-select
-                :disabled="!form.class"
-                ref="select"
-                v-model:value="form.subclass"
-                placeholder="选择类型明细"
-                style="width: 100%"
-              >
-                <a-select-option :value="item" v-for="item in classSubvalues" :key="item.index">{{item}}</a-select-option>
-              </a-select>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row :gutter="16">
-          <a-col :span="12">
-            <a-form-item label="收入金额" name="amount" :rules="[{ required: true, message: '请输入收入金额' }]">
-              <a-input v-model:value="form.amount" placeholder="输入收入金额"></a-input>
-            </a-form-item>
-          </a-col>
-          <a-col :span="12">
-            <a-form-item label="归属日期" name="period" :rules="[{ required: true, message: '请选择归属日期' }]">
-              <a-date-picker style="width:100%" v-model:value="form.period" value-format="YYYY-MM-DD" placeholder="请选择归属日期"/>
-            </a-form-item>
-          </a-col>
-        </a-row>
-        <a-row>
-          <a-col :span="24">
-            <a-form-item label="备注" name="remarks">
-              <a-textarea
-                v-model:value="form.remarks"
-                :rows="4"
-                placeholder="输入备注信息"
-              />
-            </a-form-item>
-          </a-col>
-        </a-row>
-      </a-form>
+      <customForm v-if="visible" ref="formRef" :layoutData="layoutData" @onSubmit="addQuested"></customForm>
       <template #extra>
         <a-space>
           <a-button @click="onClose">关闭</a-button>
-          <a-button type="primary" @click="onSubmit">保存</a-button>
+          <a-button type="primary" @click="submit">保存</a-button>
         </a-space>
       </template>
     </a-drawer>
@@ -109,92 +22,44 @@
 </template>
 
 <script setup>
-import {ref,computed,defineEmits} from 'vue'
+import {ref,defineProps,computed,onMounted,defineEmits} from 'vue'
 import Api from '@/api/api'
+import custf from '@/utils/customForm'
 import utils from '@/utils/utils'
-import selectEnterprise from '@/template/selectEnterprise/index.vue'
 import { useRouter } from "vue-router";
+
+import customForm from '@/demo/customForm.vue'
 const router = useRouter()
 const emit = defineEmits(['onSuccess'])
+
 const visible = ref(false)
 const form = ref({
-  sa_cashbillid:0,
-  status:'新建',
-  enterprisename:'',
-  type:1,
-  period:(new Date()).toISOString().split('T')[0],
-  class:null,
-  subclass:'',
-  remarks:''
-})
-const accountInfo = computed(()=>{
-  let obj = {}
-  accountOptions.value.forEach(e=>{
-    if (e.sa_accountclassid == form.value.sa_accountclassid) {
-      obj = {
-        creditquota:e.creditquota,
-        balance:e.balance
-      }
-    }
-  })
-  return obj
-})
-const classSubvalues = computed(()=>{
-  let arr = []
-  form.value.subclass = ''
-  classOptions.value.forEach(e=>{
-    if (e.value == form.value.class) {
-      arr = e.subvalues
-    }
-  })
-  return arr
+  type:'标准订单',
+  enterprisename:''
 })
-const showDrawer = ()=>{
+const layoutData = ref([])
+const showDrawer = async ()=>{
+  layoutData.value = await custf.customForm('addForm')
   visible.value = true
-  classList()
 }
 const formRef = ref()
 const onClose = () => {
   visible.value = false;
-  formRef.value.resetFields();
+  // 
 };
-const onSubmit = async ()=>{
-  try {
-    const values = await formRef.value.validateFields();
-    const res = await Api.post({
-      "id": "20221009102803",
-      "version":1,
-      "content": form.value
-    })
-    utils.message(res,'创建成功',()=>{
-      emit('onSuccess')
-      onClose()
-      router.push({path:'/cVoucherDetail',query:{id:res.data.sa_cashbillid}})
-    })
-  } catch (errorInfo) {
-    console.log('Failed:', errorInfo);
-  }
+const submit = async ()=>{
+  formRef.value.onSubmit();
 }
-
-const onSelect = (val)=>{
-  form.value.enterprisename  = val.enterprisename
-  form.value.sys_enterpriseid  = val.sys_enterpriseid
-  accountData()
-}
-const accountOptions = ref([])
-const accountData = async ()=>{
-  const res = await Api.optionstype('cashbillaccountclassselect','sys_enterpriseid',form.value.sys_enterpriseid)
-  accountOptions.value = res.data
-}
-const classOptions = ref([])
-const classList = async ()=>{
-  const res = await Api.optionstype('cashbillrectype')
-  classOptions.value = res.data
-  res.data.length == 1 ?form.value.class = res.data[0].value : null
-}
-const enterprise = ref()
-const onPressEnter = ()=>{
-  enterprise.value.showModel()
+const addQuested = async (form)=>{
+  const res = await Api.post({
+    id:20221009102803,
+    content:form
+  })
+  utils.message(res,'创建成功',()=>{
+    emit('onSuccess')
+    router.push({path:'/cVoucherDetail',query:{id:res.data.sa_cashbillid}})
+    onClose()
+  })
 }
 </script>
 <style>

+ 1 - 0
src/utils/customForm.js

@@ -28,6 +28,7 @@ export default {
                   e.request.content[cot] = data[cot]
                 })
               }
+              console.log(e.request)
               const res = await Api.requested(e.request)
               let arr = res.data.map(rs=>{
                 return  {