| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <template>
- <div>
- <el-button size="mini" type="primary" :disabled="disabled" @click="editBtn">编 辑</el-button>
- <el-drawer title="新 建" append-to-body :visible.sync="dialogFormVisible" size="30%">
- <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-form-item label="经销商:" prop="sys_enterpriseid">
- <selectEnterprise ref="ent" @rowClick="entRowClick"></selectEnterprise>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="账户类型" prop="sa_accountclassid">
- <el-select v-model="form.sa_accountclassid" placeholder="请选择账户类型" @change="accountChange" size="small">
- <el-option
- v-for="item in accountType"
- :key="item.sa_accountclassid"
- :label="item.accountname"
- :value="item.sa_accountclassid">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="凭证" prop="sa_cashbillid">
- <selectVoucher ref="voucher" :sys_enterpriseid="form.sys_enterpriseid" :sa_accountclassid="form.sa_accountclassid" @rowClick="voucherRowClick"></selectVoucher>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <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="核销日期" prop="billnodate">
- <el-date-picker
- v-model="form.billnodate"
- type="date"
- value-format="yy-mm-dd"
- placeholder="选择日期">
- </el-date-picker>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="备注" prop="remarks">
- <el-input size="small" type="textarea" placeholder="请输入备注" v-model.number="form.remarks"></el-input>
- </el-form-item>
- </el-col>
- </el-form>
- </el-row>
- </div>
- <div class="fixed__btn__panel">
- <el-button size="small" @click="dialogFormVisible = false" class="normal-btn-width">取 消</el-button>
- <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
- </div>
- </el-drawer>
- </div>
- </template>
- <script>
- import selectEnterprise from './selectEnterprise'
- import selectVoucher from './selectVoucher'
- export default {
- name: "add",
- props:['data','disabled'],
- components:{selectEnterprise,selectVoucher},
- data(){
- return {
- dialogFormVisible:false,
- accountType:[],
- form:{
- "sa_writeoffbillid":0,
- "sys_enterpriseid": "",
- "sa_accountclassid": "",
- "sa_cashbillid":"",
- "remarks":"",
- "writeoffamount":'', //新增时可不传
- "billnodate":''
- },
- rules:{
- sys_enterpriseid:[
- { required: true, message: '请选择经销商', trigger: 'blur'},
- ],
- sa_accountclassid:[
- { required: true, message: '请选择账户类型', trigger: 'blur'}
- ],
- sa_cashbillid:[
- { required: true, message: '请选择支出或收入凭证', trigger: 'blur'}
- ],
- writeoffamount:[
- { message: '请填写正确金额', trigger: 'change',type:'number'}
- ],
- }
- }
- },
- created () {
- this.getAccountType()
- },
- watch: {
- dialogFormVisible (val) {
- if(!val) {
- this.$refs.ent.form.enterprisename = ''
- this.$refs.form.resetFields()
- }
- }
- },
- methods:{
- editBtn () {
- this.form = Object.assign({},this.form,this.data)
- console.log(this.form);
-
- this.$nextTick(() => {
- this.$refs.ent.form.enterprisename = this.form.enterprisename
- this.$refs.voucher.form.billno = this.form.cashbillidbillno
- console.log(this.$refs.ent.form);
-
- })
- this.dialogFormVisible = true
- },
- onSubmit(){
- console.log(this.form)
- this.$refs['form'].validate(async (valid) => {
- if (!valid) return false
- const res = await this.$api.requested({
- "id": "20221124090204",
- "version":1,
- "content": this.form
- })
- this.tool.showMessage(res,()=>{
- this.$emit('onSuccess')
- this.dialogFormVisible = false
- })
- })
- },
- entRowClick (data) {
- this.$refs.voucher.form.billno = ''
- this.form.sa_cashbillid = ''
- this.form.sys_enterpriseid = data.sys_enterpriseid
- },
- voucherRowClick (data) {
- this.form.sa_cashbillid = data.sa_cashbillid
- },
- async getAccountType () {
- let res = await this.$api.requested({
- "id":20221124090604,
- "content": {
- }
- })
- this.accountType = res.data
- console.log(this.accountType);
-
- },
- accountChange (val) {
- this.$refs.voucher.form.billno = ''
- this.form.sa_cashbillid = ''
- }
- }
- }
- </script>
- <style scoped>
- .dialog-footer {
- margin-top: 0;
- }
- .el-select {
- width: 100%;
- }
- /deep/.el-date-editor {
- width: 100% !important;
- }
- </style>
|