|
|
@@ -1,19 +1,19 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-button size="mini" type="primary" @click="dialogFormVisible = true">新 建</el-button>
|
|
|
- <el-drawer title="新 建" append-to-body :visible.sync="dialogFormVisible" size="30%">
|
|
|
+ <el-drawer title="新 建" append-to-body :visible.sync="dialogFormVisible" size="60%">
|
|
|
<div slot="title" style="font-size: 15px">
|
|
|
新建核销单
|
|
|
</div>
|
|
|
<div class="drawer__panel">
|
|
|
<el-row>
|
|
|
<el-form :model="form" :rules="rules" ref="form" label-width="90px" label-position="right" size="mini">
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="企业:" prop="sys_enterpriseid">
|
|
|
<selectEnterprise ref="ent" @rowClick="entRowClick"></selectEnterprise>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="账户类型" prop="sa_accountclassid">
|
|
|
<el-select v-model="form.sa_accountclassid" placeholder="请选择账户类型" @change="accountChange" size="small">
|
|
|
<el-option
|
|
|
@@ -25,16 +25,38 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="凭证" prop="sa_cashbillid">
|
|
|
- <selectVoucher ref="voucher" :sys_enterpriseid="form.sys_enterpriseid" :sa_accountclassid="form.sa_accountclassid" @rowClick="voucherRowClick"></selectVoucher>
|
|
|
+ <selectVoucher ref="voucher" v-model="form.sa_cashbillid" :sys_enterpriseid="form.sys_enterpriseid" :sa_accountclassid="form.sa_accountclassid" @rowClick="voucherRowClick"></selectVoucher>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="12">
|
|
|
<el-form-item label="核销金额" prop="writeoffamount">
|
|
|
<el-input size="small" placeholder="请输入核销金额" v-model.number="form.writeoffamount"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="订单">
|
|
|
+ <selectOrder ref="table" :layout="tablecols" :data="orderList" :custom="true" height="500px">
|
|
|
+ <template v-slot:customcol="scope">
|
|
|
+ <div>{{scope.column.data[scope.column.columnname]}}</div>
|
|
|
+ </template>
|
|
|
+ </selectOrder>
|
|
|
+ <div class="container normal-panel" style="text-align:right">
|
|
|
+ <el-pagination
|
|
|
+ style="text-align:right"
|
|
|
+ background
|
|
|
+ small
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="params.content.pageNumber"
|
|
|
+ :page-sizes="[20, 50, 100, 200]"
|
|
|
+ layout="total,sizes, prev, pager, next, jumper"
|
|
|
+ :total="total">
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
@@ -49,20 +71,24 @@
|
|
|
<script>
|
|
|
import selectEnterprise from './selectEnterprise'
|
|
|
import selectVoucher from './selectVoucher'
|
|
|
+import selectOrder from '../modules/order/selectOrder'
|
|
|
export default {
|
|
|
name: "add",
|
|
|
- components:{selectEnterprise,selectVoucher},
|
|
|
+ components:{selectEnterprise,selectVoucher,selectOrder},
|
|
|
data(){
|
|
|
return {
|
|
|
dialogFormVisible:false,
|
|
|
accountType:[],
|
|
|
+ tablecols:[],
|
|
|
+ total:0,
|
|
|
+ orderList:[],
|
|
|
form:{
|
|
|
"sa_writeoffbillid":0,
|
|
|
"sys_enterpriseid": "",
|
|
|
"sa_accountclassid": "",
|
|
|
"sa_cashbillid":"",
|
|
|
"remarks":"",
|
|
|
- "writeoffamount":'' //新增时可不传
|
|
|
+ "writeoffamount":0 //新增时可不传
|
|
|
},
|
|
|
rules:{
|
|
|
sys_enterpriseid:[
|
|
|
@@ -72,16 +98,30 @@ export default {
|
|
|
{ required: true, message: '请选择账户类型', trigger: 'blur'}
|
|
|
],
|
|
|
sa_cashbillid:[
|
|
|
- { required: true, message: '请选择支出或收入凭证', trigger: 'blur'}
|
|
|
+ { required: true, message: '请选择支出或收入凭证', trigger: 'change'}
|
|
|
],
|
|
|
writeoffamount:[
|
|
|
- { message: '请填写正确金额', trigger: 'change',type:'number'}
|
|
|
+ { message: '请填写正确金额', trigger: 'blur',type:'number'}
|
|
|
],
|
|
|
+ },
|
|
|
+ params: {
|
|
|
+ "id": 20221124091104,
|
|
|
+ "content": {
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "sys_enterpriseid":'',
|
|
|
+ "sa_accountclassid":'',
|
|
|
+ "sa_writeoffbillid":'',
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
this.getAccountType()
|
|
|
+ this.tablecols = this.tool.tabelCol(this.$route.name).addOrderTable.tablecols
|
|
|
},
|
|
|
watch: {
|
|
|
dialogFormVisible (val) {
|
|
|
@@ -92,6 +132,28 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
+ handleSizeChange(val) {
|
|
|
+ // console.log(`每页 ${val} 条`);
|
|
|
+ this.params.content.pageSize = val
|
|
|
+ this.getOrderList()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ // console.log(`当前页: ${val}`);
|
|
|
+ this.params.content.pageNumber = val
|
|
|
+ this.getOrderList()
|
|
|
+ },
|
|
|
+ async getOrderList () {
|
|
|
+ if(!this.form.sa_accountclassid || !this.form.sys_enterpriseid) return
|
|
|
+
|
|
|
+ this.$refs.table.allArr = []
|
|
|
+
|
|
|
+ this.params.content.sys_enterpriseid = this.form.sys_enterpriseid
|
|
|
+ this.params.content.sa_accountclassid = this.form.sa_accountclassid
|
|
|
+ let res = await this.$api.requested(this.params)
|
|
|
+ this.orderList = res.data
|
|
|
+ this.total = res.total
|
|
|
+ console.log(res);
|
|
|
+ },
|
|
|
onSubmit(){
|
|
|
console.log(this.form)
|
|
|
this.$refs['form'].validate(async (valid) => {
|
|
|
@@ -101,7 +163,26 @@ export default {
|
|
|
"version":1,
|
|
|
"content": this.form
|
|
|
})
|
|
|
- this.tool.showMessage(res,()=>{
|
|
|
+ this.tool.showMessage(res,async ()=>{
|
|
|
+ let result = this.$refs.table.allArr.map(item => {
|
|
|
+ return {
|
|
|
+ "sa_writeoffbill_orderid": 0,
|
|
|
+ "sa_orderid":item.sa_orderid,
|
|
|
+ "sa_orderitemsid":item.sa_orderitemsid,
|
|
|
+ "writeoffamount":0,
|
|
|
+ "remarks":""
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (result.length > 0) {
|
|
|
+ const res2 = await this.$api.requested({
|
|
|
+ "id": "20221124090904",
|
|
|
+ "version":1,
|
|
|
+ "content": {
|
|
|
+ sa_writeoffbillid:res.sa_writeoffbillid,
|
|
|
+ writeoffbillOrder:result
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
this.$emit('onSuccess')
|
|
|
this.dialogFormVisible = false
|
|
|
})
|
|
|
@@ -111,6 +192,7 @@ export default {
|
|
|
this.$refs.voucher.form.billno = ''
|
|
|
this.form.sa_cashbillid = ''
|
|
|
this.form.sys_enterpriseid = data.sys_enterpriseid
|
|
|
+ this.getOrderList()
|
|
|
},
|
|
|
voucherRowClick (data) {
|
|
|
this.form.sa_cashbillid = data.sa_cashbillid
|
|
|
@@ -123,12 +205,11 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
this.accountType = res.data
|
|
|
- console.log(this.accountType);
|
|
|
-
|
|
|
},
|
|
|
accountChange (val) {
|
|
|
this.$refs.voucher.form.billno = ''
|
|
|
this.form.sa_cashbillid = ''
|
|
|
+ this.getOrderList()
|
|
|
}
|
|
|
}
|
|
|
}
|