|  | @@ -1,10 +1,256 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +  <div>
 | 
	
		
			
				|  |  | +    <el-button size="small" :type="data.status !== '新建'?'':'primary'"   @click="onShow(dialogVisible = true)" :disabled="data.status !== '新建'">编 辑</el-button>
 | 
	
		
			
				|  |  | +    <el-drawer
 | 
	
		
			
				|  |  | +        title="编辑支出凭证"
 | 
	
		
			
				|  |  | +        :visible.sync="dialogVisible"
 | 
	
		
			
				|  |  | +        size="600px"
 | 
	
		
			
				|  |  | +        direction="rtl"
 | 
	
		
			
				|  |  | +        append-to-body
 | 
	
		
			
				|  |  | +        @close="onClose">
 | 
	
		
			
				|  |  | +      <div class="drawer__panel">
 | 
	
		
			
				|  |  | +        <el-row :gutter="20">
 | 
	
		
			
				|  |  | +          <el-form :model="form" :rules="rules" ref="formRef" label-width="90px" label-position="right" size="mini">
 | 
	
		
			
				|  |  | +            <el-col :span="24">
 | 
	
		
			
				|  |  | +              <el-form-item label="业务员:" prop="hrid">
 | 
	
		
			
				|  |  | +                <el-popover
 | 
	
		
			
				|  |  | +                    placement="bottom"
 | 
	
		
			
				|  |  | +                    v-model="isShow"
 | 
	
		
			
				|  |  | +                    width="600"
 | 
	
		
			
				|  |  | +                    trigger="click">
 | 
	
		
			
				|  |  | +                  <tableNewLayout :layout="tablecols" :data="list" :opwidth="200" height="400px" :width="true" :custom="true" @rowClick="rowClick">
 | 
	
		
			
				|  |  | +                    <template v-slot:customcol="scope">
 | 
	
		
			
				|  |  | +                      <div>
 | 
	
		
			
				|  |  | +                        {{scope.column.data[[scope.column.columnname]] || scope.column.columnname === 'operation'?scope.column.data[[scope.column.columnname]]:'--'}}
 | 
	
		
			
				|  |  | +                      </div>
 | 
	
		
			
				|  |  | +                    </template>
 | 
	
		
			
				|  |  | +                  </tableNewLayout>
 | 
	
		
			
				|  |  | +                  <div  class="container normal-panel" style="text-align:right">
 | 
	
		
			
				|  |  | +                    <el-pagination
 | 
	
		
			
				|  |  | +                        background
 | 
	
		
			
				|  |  | +                        @size-change="handleSizeChange"
 | 
	
		
			
				|  |  | +                        @current-change="handleCurrentChange"
 | 
	
		
			
				|  |  | +                        :current-page="currentPage"
 | 
	
		
			
				|  |  | +                        :page-sizes="[20, 50, 100, 200]"
 | 
	
		
			
				|  |  | +                        :page-size="20"
 | 
	
		
			
				|  |  | +                        layout="total,sizes, prev, pager, next, jumper"
 | 
	
		
			
				|  |  | +                        :total="total">
 | 
	
		
			
				|  |  | +                    </el-pagination>
 | 
	
		
			
				|  |  | +                  </div>
 | 
	
		
			
				|  |  | +                  <el-input slot="reference" v-model="form.name" placeholder="请选择业务员" readonly @focus="listData" disabled></el-input>
 | 
	
		
			
				|  |  | +                </el-popover>
 | 
	
		
			
				|  |  | +              </el-form-item>
 | 
	
		
			
				|  |  | +            </el-col>
 | 
	
		
			
				|  |  | +            <el-col :span="24">
 | 
	
		
			
				|  |  | +              <el-form-item label="账户类型:" prop="sa_hraccountclassid">
 | 
	
		
			
				|  |  | +                <el-select v-model="form.sa_hraccountclassid" placeholder="请选择账户类型" style="width: 100%" @change="incomeData" disabled>
 | 
	
		
			
				|  |  | +                  <el-option
 | 
	
		
			
				|  |  | +                      v-for="item in accountData"
 | 
	
		
			
				|  |  | +                      :key="item.sa_hraccountclassid"
 | 
	
		
			
				|  |  | +                      :label="item.hraccountname"
 | 
	
		
			
				|  |  | +                      :value="item.sa_hraccountclassid">
 | 
	
		
			
				|  |  | +                  </el-option>
 | 
	
		
			
				|  |  | +                </el-select>
 | 
	
		
			
				|  |  | +              </el-form-item>
 | 
	
		
			
				|  |  | +            </el-col>
 | 
	
		
			
				|  |  | +            <el-col :span="24">
 | 
	
		
			
				|  |  | +              <el-form-item label="金额:" prop="amount">
 | 
	
		
			
				|  |  | +                <el-input v-model="form.amount" placeholder="请填写金额"></el-input>
 | 
	
		
			
				|  |  | +              </el-form-item>
 | 
	
		
			
				|  |  | +            </el-col>
 | 
	
		
			
				|  |  | +            <el-col :span="24">
 | 
	
		
			
				|  |  | +              <el-form-item label="收入凭证:" prop="source_hrcashbill">
 | 
	
		
			
				|  |  | +                <tableNewLayout ref="tableRef" :checkbox="false" :layout="income.tablecols" :data="income.list" :opwidth="200" height="400px" :width="true" :custom="true" @selectionChange="selectionChange">
 | 
	
		
			
				|  |  | +                  <template v-slot:customcol="scope">
 | 
	
		
			
				|  |  | +                    <div v-if="scope.column.columnname === 'amount'">
 | 
	
		
			
				|  |  | +                      {{tool.formatAmount(scope.column.data[[scope.column.columnname]],2)}}
 | 
	
		
			
				|  |  | +                    </div>
 | 
	
		
			
				|  |  | +                    <div v-else>
 | 
	
		
			
				|  |  | +                      {{scope.column.data[[scope.column.columnname]] || scope.column.columnname === 'operation'?scope.column.data[[scope.column.columnname]]:'--'}}
 | 
	
		
			
				|  |  | +                    </div>
 | 
	
		
			
				|  |  | +                  </template>
 | 
	
		
			
				|  |  | +                </tableNewLayout>
 | 
	
		
			
				|  |  | +              </el-form-item>
 | 
	
		
			
				|  |  | +            </el-col>
 | 
	
		
			
				|  |  | +            <el-col :span="24">
 | 
	
		
			
				|  |  | +              <el-form-item label="备注:" prop="remarks">
 | 
	
		
			
				|  |  | +                <el-input v-model="form.remarks" type="textarea" rows="5" placeholder="请输入备注信息"></el-input>
 | 
	
		
			
				|  |  | +              </el-form-item>
 | 
	
		
			
				|  |  | +            </el-col>
 | 
	
		
			
				|  |  | +          </el-form>
 | 
	
		
			
				|  |  | +        </el-row>
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +      <div class="fixed__btn__panel">
 | 
	
		
			
				|  |  | +        <el-button size="small" @click="onClose" 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>
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  | -  name: "edit"
 | 
	
		
			
				|  |  | +  name: "edit",
 | 
	
		
			
				|  |  | +  props:['data'],
 | 
	
		
			
				|  |  | +  data(){
 | 
	
		
			
				|  |  | +    return {
 | 
	
		
			
				|  |  | +      dialogVisible:false,
 | 
	
		
			
				|  |  | +      isShow:false,
 | 
	
		
			
				|  |  | +      tablecols:[],
 | 
	
		
			
				|  |  | +      list:[],
 | 
	
		
			
				|  |  | +      currentPage:0,
 | 
	
		
			
				|  |  | +      total:0,
 | 
	
		
			
				|  |  | +      form:{
 | 
	
		
			
				|  |  | +        "sa_hrcashbillid": "0",
 | 
	
		
			
				|  |  | +        "hrid": '',
 | 
	
		
			
				|  |  | +        "name":'',
 | 
	
		
			
				|  |  | +        "sa_hraccountclassid": "",
 | 
	
		
			
				|  |  | +        "type": "0", //1收 0支
 | 
	
		
			
				|  |  | +        "billdate": new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate(),
 | 
	
		
			
				|  |  | +        "class": "",
 | 
	
		
			
				|  |  | +        "subclass": "",
 | 
	
		
			
				|  |  | +        "remarks": "",
 | 
	
		
			
				|  |  | +        "amount": "",
 | 
	
		
			
				|  |  | +        "source_hrcashbill": [ ] //用于建支出凭证时传选择的收入凭证信息
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      rules:{
 | 
	
		
			
				|  |  | +        hrid:[
 | 
	
		
			
				|  |  | +          { required: true, message: '未选择业务员', trigger: 'change'},
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  | +        sa_hraccountclassid:[
 | 
	
		
			
				|  |  | +          { required: true, message: '未选择账户类型', trigger: 'change'},
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  | +        source_hrcashbill:[
 | 
	
		
			
				|  |  | +          { required: true, message: '未选择收入凭证', trigger: 'blur'},
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  | +        amount:[
 | 
	
		
			
				|  |  | +          { required: true, message: '金额不可为空', trigger: 'change'},
 | 
	
		
			
				|  |  | +          { pattern:/^[0-9]+\.{0,1}[0-9]{0,6}$/,message: '输入不合法,请输入数值',trigger: 'change'},
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      param:{
 | 
	
		
			
				|  |  | +        "id": 20240111143104,
 | 
	
		
			
				|  |  | +        "content": {
 | 
	
		
			
				|  |  | +          "pageNumber": 1,
 | 
	
		
			
				|  |  | +          "pageSize": 20,
 | 
	
		
			
				|  |  | +          "where": {
 | 
	
		
			
				|  |  | +            "condition": ""
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      accountType:{
 | 
	
		
			
				|  |  | +        "id": 20240111085104,
 | 
	
		
			
				|  |  | +        "content": {
 | 
	
		
			
				|  |  | +          "pageSize": 9999,
 | 
	
		
			
				|  |  | +          "pageNumber": 1,
 | 
	
		
			
				|  |  | +          "where": {}
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      accountData:[],
 | 
	
		
			
				|  |  | +      income:{
 | 
	
		
			
				|  |  | +        tablecols:[],
 | 
	
		
			
				|  |  | +        list:[],
 | 
	
		
			
				|  |  | +        param:{
 | 
	
		
			
				|  |  | +          "id": 20240111143204,
 | 
	
		
			
				|  |  | +          "content": {
 | 
	
		
			
				|  |  | +            "pageNumber": 1,
 | 
	
		
			
				|  |  | +            "pageSize": 999,
 | 
	
		
			
				|  |  | +            "sa_hraccountclassid":"",
 | 
	
		
			
				|  |  | +            "hrid":"",
 | 
	
		
			
				|  |  | +            "where": {
 | 
	
		
			
				|  |  | +              "condition": ""
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  methods:{
 | 
	
		
			
				|  |  | +    onShow(){
 | 
	
		
			
				|  |  | +      this.form = Object.assign({},this.form,this.data)
 | 
	
		
			
				|  |  | +      this.income.list = this.data.source_hrcashbill
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    /*可选业务员*/
 | 
	
		
			
				|  |  | +    async listData(){
 | 
	
		
			
				|  |  | +      const res = await this.$api.requested(this.param)
 | 
	
		
			
				|  |  | +      this.list = res.data
 | 
	
		
			
				|  |  | +      this.currentPage = res.pageNumber
 | 
	
		
			
				|  |  | +      this.total = res.total
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    /*可选收入凭证*/
 | 
	
		
			
				|  |  | +    async incomeData(){
 | 
	
		
			
				|  |  | +      this.income.param.content.hrid = this.form.hrid
 | 
	
		
			
				|  |  | +      this.income.param.content.sa_hraccountclassid = this.form.sa_hraccountclassid
 | 
	
		
			
				|  |  | +      const res = await this.$api.requested(this.income.param)
 | 
	
		
			
				|  |  | +      this.income.list = res.data
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onClose(){
 | 
	
		
			
				|  |  | +      this.dialogVisible = false
 | 
	
		
			
				|  |  | +      this.income.list = []
 | 
	
		
			
				|  |  | +      this.form.name = ''
 | 
	
		
			
				|  |  | +      this.form.hrid = ''
 | 
	
		
			
				|  |  | +      this.$refs.tableRef.$refs.table.clearSelection()
 | 
	
		
			
				|  |  | +      this.$refs.formRef.resetFields()
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    handleSizeChange(val) {
 | 
	
		
			
				|  |  | +      // console.log(`每页 ${val} 条`);
 | 
	
		
			
				|  |  | +      this.param.content.pageSize = val
 | 
	
		
			
				|  |  | +      this.listData()
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    handleCurrentChange(val) {
 | 
	
		
			
				|  |  | +      // console.log(`当前页: ${val}`);
 | 
	
		
			
				|  |  | +      this.param.content.pageNumber = val
 | 
	
		
			
				|  |  | +      this.listData()
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    rowClick(row){
 | 
	
		
			
				|  |  | +      this.isShow = false
 | 
	
		
			
				|  |  | +      this.form.name = row.name
 | 
	
		
			
				|  |  | +      this.form.hrid = row.hrid
 | 
	
		
			
				|  |  | +      if (this.form.sa_hraccountclassid !== ''){
 | 
	
		
			
				|  |  | +        this.incomeData()
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onSubmit(){
 | 
	
		
			
				|  |  | +      console.log(this.form)
 | 
	
		
			
				|  |  | +      this.$refs.formRef.validate(async (valid)=>{
 | 
	
		
			
				|  |  | +        if (!valid) return false
 | 
	
		
			
				|  |  | +        const res = await this.$api.requested({
 | 
	
		
			
				|  |  | +          "id": 20240111085604,
 | 
	
		
			
				|  |  | +          "content": this.form
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        this.tool.showMessage(res,()=>{
 | 
	
		
			
				|  |  | +          this.dialogVisible = false
 | 
	
		
			
				|  |  | +          this.income.list = []
 | 
	
		
			
				|  |  | +          this.$refs.tableRef.$refs.table.clearSelection()
 | 
	
		
			
				|  |  | +          this.$refs.formRef.resetFields()
 | 
	
		
			
				|  |  | +          this.form.name = ''
 | 
	
		
			
				|  |  | +          this.form.hrid = ''
 | 
	
		
			
				|  |  | +          this.$emit('onSuccess')
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    /*获取账户类型*/
 | 
	
		
			
				|  |  | +    async queryAccountType(){
 | 
	
		
			
				|  |  | +      const res = await this.$api.requested(this.accountType)
 | 
	
		
			
				|  |  | +      this.accountData = res.data
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    /*已选业务员*/
 | 
	
		
			
				|  |  | +    selectionChange(row){
 | 
	
		
			
				|  |  | +      this.form.source_hrcashbill =  row.map(item =>{
 | 
	
		
			
				|  |  | +        return {
 | 
	
		
			
				|  |  | +          "ownerid":item.sa_hrcashbillid,
 | 
	
		
			
				|  |  | +          "amount":item.amount
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  mounted() {
 | 
	
		
			
				|  |  | +    this.queryAccountType()
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  created() {
 | 
	
		
			
				|  |  | +    this.tablecols = this.tool.tabelCol(this.$route.name).salerSelectTable.tablecols
 | 
	
		
			
				|  |  | +    this.income.tablecols = this.tool.tabelCol(this.$route.name).incomeSelectTable.tablecols
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  </script>
 | 
	
		
			
				|  |  |  
 |