123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <template>
- <div v-loading="fullscreenLoading" class="dailyedit-box">
- <div class="dailyedit-title">
- 新增日常费用付款申请款项
- </div>
- <div style="text-align: right;margin-bottom: 20px;">
- <el-button v-if="editid&&userid==21||userid==22" size="small" type="primary" @click="PostDelDailyPaymentAudit(1)">审核通过</el-button>
- <el-button v-if="editid&&userid==21||userid==22" size="small" type="primary" @click="PostDelDailyPaymentAudit(2)">审核不通过</el-button>
- <el-button size="small" type="primary" @click="submitForm('ruleForm')">保 存</el-button>
- <el-button size="small" @click="resetForm('ruleForm')">返 回</el-button>
- </div>
- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" class="demo-ruleForm">
- <div class="dailyedit-set">
- <el-form-item label="类型标识:" label-width="85px" prop="transferation">
- <el-select :disabled="thesame" @change="trans()" v-model="ruleForm.transferation" placeholder="请选择转账标识">
- <el-option v-for="(item,index) in Transferlogo" :key="index" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="转账标识:" prop="identification" label-width="85px">
- <el-select :disabled="banned" v-model="ruleForm.identification" placeholder="请选择费用类型">
- <el-option v-for="(item,index) in identificationset" :key="index" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="费用类型:" prop="type" label-width="85px">
- <el-select :disabled="thesame" @change="typechange()" v-model="ruleForm.type" placeholder="请选择费用类型">
- <el-option v-for="(item,index) in typeset" :key="index" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="费用名称:" prop="name" label-width="85px">
- <el-select :disabled="bannedtype" v-model="ruleForm.name" placeholder="请选择费用名称">
- <el-option v-for="(item,index) in nameset" :key="index" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="申请公司:" prop="company" label-width="85px">
- <el-select :disabled="thesame" v-model="ruleForm.company" placeholder="请选择申请公司">
- <el-option v-for="(item,index) in companyset" :key="index" :label="item.companyName" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- </div>
- <el-form-item label="申请说明:" label-width="85px" prop="desc">
- <el-input :disabled="thesame" type="textarea" v-model="ruleForm.desc"></el-input>
- </el-form-item>
- <div class="dailyfrom-title">
- <div>录入具体费用</div>
- <el-form-item>
- <el-button size="mini" @click="AddForm()" type="primary">新 增</el-button>
- </el-form-item>
- </div>
- <div class="items-form">
- <div v-for="(item,index) in itemsArr" :key="index" class="items-li">
- <el-form :model="item" class="demo-form-inline" label-width="85px">
- <el-form-item label="费用项目:">
- <el-input :disabled="thesame" v-model="item.priceName" placeholder="费用项目名称"></el-input>
- </el-form-item>
- <el-form-item label="数量:">
- <template>
- <el-input-number :disabled="thesame" :min="1" v-model="item.quantity"></el-input-number>
- </template>
- </el-form-item>
- <el-form-item label="单价(CNY):">
- <el-input-number :disabled="thesame" :controls="false" v-model="item.price" :precision="2"></el-input-number>
- </el-form-item>
- <el-form-item label="小计(CNY):">
- <div class="sub-box">{{item.itemTotal=(item.quantity*item.price).toFixed(2)}}</div>
- </el-form-item>
- <el-form-item label="备注:">
- <el-input :disabled="thesame" v-model="item.remark" placeholder="备注"></el-input>
- </el-form-item>
- <el-form-item>
- <el-button
- size="mini"
- type="danger"
- :disabled="itemsArr.length<=1"
- @click="deleteRow(index,itemsArr )"><i class="el-icon-delete"></i></el-button>
- </el-form-item>
- </el-form>
- </div>
- </div>
-
- </el-form>
- </div>
- </template>
- <script>
- export default {
- // beforeRouteLeave(to, from, next) {
- // if(to.name=='DailyFeePayment'){
- // to.meta.keepAlive = true;
- // }
- // next()
- // },
- data(){
- return{
- editid:'',
- userid:'',
- token:'',
- banned:true,
- bannedtype:true,
- thesame:false,//是否能编辑标识
- ruleForm: {
- transferation:'',
- identification: '',
- type: '',
- name: '',
- company: '',
- desc:''
- },
- SumPrice:0,
- itemsArr:[
- {
- priceName:"",
- quantity:'',
- price:"",
- itemTotal:'',
- remark:""
- }
- ],
- rules: {
- transferation: [
- { required: true, message: '请选择转账标识', trigger: 'change' }
- ],
- identification: [
- { required: true, message: '请选择费用标识', trigger: 'change' }
- ],
- type: [
- { required: true, message: '请选择费用类型', trigger: 'change' }
- ],
- name: [
- { required: true, message: '请选择费用名称', trigger: 'change' }
- ],
- company: [
- { required: true, message: '请选择申请公司', trigger: 'change' }
- ],
- desc: [
- { required: true, message: '请填写申请说明', trigger: 'change' }
- ],
- },
- Transferlogo:[],//类型标识
- feeMarkSubTypeData:[],//转账标识ALL
- identificationset:[],//转账标识
- typeset:[],//费用类型
- feeSubTypeData:[],//费用名称ALL
- nameset:[],//费用名称
- companyset:[],//申请公司
- fullscreenLoading:false,//loading
- }
- },
- methods:{
- submitForm(formName) {
- this.$refs[formName].validate((valid) => {
- console.log(valid)
- if (valid) {
- console.log(this.itemsArr)
- var issubmit=true;
- for(var g=0;g<this.itemsArr.length;g++){
- if(this.itemsArr[g].itemTotal!=""&&this.itemsArr[g].price!=0&&this.itemsArr[g].priceName!=""&&this.itemsArr[g].quantity!=""){
- if(!this.thesame){
- //for(var k=0;k<this.itemsArr.length;k++){
- this.SumPrice+=Number(this.itemsArr[g].itemTotal)
- //}
- }else{
- this.$message({
- showClose: true,
- message: '本申请不是您建立的或已被审核,无法修改!',
- type: 'error'
- });
- issubmit=false;
- break;
- }
- }else{
- this.$message({
- showClose: true,
- message: '请检查录入具体费用是否填写完整!',
- type: 'error'
- });
- issubmit=false;
- break;
- }
- }
- if(issubmit){
- if(this.editid!=undefined){
- this.UpdateDailyPayment()
- }else{
- this.AddDailyPayment()
- }
- }
-
- } else {
- console.log('error submit!!');
- return false;
- }
- });
- },
- resetForm(formName) {
- // this.$refs[formName].resetFields();
- this.$router.push({ path: "/home/DailyFeePayment"});
- },
- AddForm(){
- if(this.thesame){
- this.$message({
- showClose: true,
- message: '本申请不是您建立的或已被审核,无法操作!',
- type: 'error'
- });
- return false
- }
- this.itemsArr.push(
- {priceName: '', quantity: '', price:'',itemTotal:'', remark: ''}
- )
- },
- deleteRow(index, rows) {
- if(this.thesame){
- this.$message({
- showClose: true,
- message: '本申请不是您建立的或已被审核,无法操作!',
- type: 'error'
- });
- return false
- }
- rows.splice(index, 1);
- },
- getTypeData() {
- var url = "/api/Financial/PostPageSearchDailyPaymentPriceTypeData"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + that.token
- },
- data: {
- portType: 1,
- }
- }).then(function (res) {
- console.log(res)
- if (res.data.code == 200) {
- that.Transferlogo=res.data.data.feeMarkTypeData;
- that.feeMarkSubTypeData=res.data.data.feeMarkSubTypeData;
- that.typeset=res.data.data.feeTypeData;
- that.feeSubTypeData=res.data.data.feeSubTypeData;
- that.companyset=res.data.data.companyNameData;
- }
- })
- },
- trans(){
- this.identificationset=[];
- this.ruleForm.identification='';
- for(var i=0;i<this.feeMarkSubTypeData.length;i++){
- if(this.feeMarkSubTypeData[i].sTid==this.ruleForm.transferation){
- this.identificationset.push(this.feeMarkSubTypeData[i]);
- }
- }
- if(this.identificationset.length==0){
- this.banned=true;
- }else{
- this.banned=false;
- }
- },
- typechange(){
- this.nameset=[];
- this.ruleForm.name='';
- console.log(this.feeSubTypeData)
- for(var i=0;i<this.feeSubTypeData.length;i++){
- if(this.feeSubTypeData[i].sTid==this.ruleForm.type){
- this.nameset.push(this.feeSubTypeData[i]);
- }
- }
- if(this.nameset.length==0){
- this.bannedtype=true;
- }else{
- this.bannedtype=false;
- }
- },
- AddDailyPayment(){
- var url = "/api/Financial/PostAddDailyPayment"
- var that = this
- var data={
- UserId:that.userid,
- Instructions:that.ruleForm.desc,
- SumPrice:that.SumPrice,
- TransferTypeId:that.ruleForm.identification,
- PriceTypeId:that.ruleForm.name,
- CompanyId:that.ruleForm.company,
- FeeContents:that.itemsArr
- }
- console.log(data)
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + that.token
- },
- data: {
- PortType: 1,
- UserId:that.userid,
- Instructions:that.ruleForm.desc,
- SumPrice:that.SumPrice,
- TransferTypeId:that.ruleForm.identification,
- PriceTypeId:that.ruleForm.name,
- CompanyId:that.ruleForm.company,
- FeeContents:that.itemsArr
- }
- }).then(function (res) {
- console.log(res)
- if (res.data.code == 200) {
- that.$message({
- message: res.data.msg,
- type: 'success',
- offset:50
- });
- that.$router.push({ path: "/home/DailyFeePayment"});
- }
- })
- },
- UpdateDailyPayment(){
- var url = "/api/Financial/PostEditDailyPayment"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + that.token
- },
- data: {
- PortType: 1,
- Id:that.editid,
- UserId:that.userid,
- Instructions:that.ruleForm.desc,
- SumPrice:that.SumPrice,
- TransferTypeId:that.ruleForm.identification,
- PriceTypeId:that.ruleForm.name,
- CompanyId:that.ruleForm.company,
- FeeContents:that.itemsArr
- }
- }).then(function (res) {
- console.log(res)
- if (res.data.code == 200) {
- that.$message({
- message: res.data.msg,
- type: 'success',
- offset:50
- });
- that.$router.push({ path: "/home/DailyFeePayment"});
- }
- })
- },
- //审核
- PostDelDailyPaymentAudit(val){
- var url = "/api/Financial/PostDelDailyPaymentAudit"
- var that = this
- var auditType=0
- if(that.userid==21){
- auditType=2
- }
- if(that.userid==22){
- auditType=1
- }
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + that.token
- },
- data: {
- id: that.editid,
- auditType:auditType,
- auditStatus:val
- }
- }).then(function (res) {
- if (res.data.code == 200) {
- that.$message({
- message: res.data.msg,
- type: 'success',
- offset:50
- });
- that.$router.push({ path: "/home/DailyFeePayment"});
- }else{
- that.$message.error(res.data.msg);
- }
- })
- },
- getPostSearchDailyPaymentInfo(){
- if(this.editid!=undefined){
- console.log("jing")
- this.fullscreenLoading=true;
- var url = "/api/Financial/PostSearchDailyPaymentInfo"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + that.token
- },
- data: {
- PortType: 1,
- id:that.editid
- }
- }).then(function (res) {
- console.log(res)
- if (res.data.code == 200) {
- that.itemsArr=res.data.data.feeContents;
- that.ruleForm.desc=res.data.data.instructions;
- setTimeout(function (){
- for(var a=0;a<that.feeMarkSubTypeData.length;a++){
- if(that.feeMarkSubTypeData[a].id==res.data.data.transferTypeId){
- that.ruleForm.transferation=that.feeMarkSubTypeData[a].sTid;
- }
- }
- that.trans();
- that.ruleForm.identification=res.data.data.transferTypeId;
- for(var b=0;b<that.feeSubTypeData.length;b++){
- if(that.feeSubTypeData[b].id==res.data.data.priceTypeId){
- that.ruleForm.type=that.feeSubTypeData[b].sTid;
- }
- }
- that.typechange()
- that.ruleForm.name=res.data.data.priceTypeId;
- that.fullscreenLoading=false;
- if(that.userid!=res.data.data.createUserId){
- that.thesame=true;
- }else if(res.data.data.fAudit!=0||res.data.data.mAudit!=0){
- that.thesame=true;
- }
- if(that.thesame==true){
- that.banned=true;
- that.bannedtype=true;
- }
- },1000);
- that.ruleForm.company=res.data.data.companyId;
- }
- })
- }
- }
- },
- mounted(){
- this.editid=this.$route.query.id;
- this.token = JSON.parse(localStorage.getItem('userinif')).token;
- this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
- this.getTypeData();
- this.getPostSearchDailyPaymentInfo();
- }
- }
- </script>
- <style>
- .dailyedit-box{
- background-color: #fff;
- padding: 10px;
- box-shadow: 0 0 5px #0005;
- border-radius: 10px;
- min-height: 800px;
- }
- .dailyedit-title{
- font-size: 17px;
- font-weight: 600;
- color: #555;
- margin-bottom: 30px;
- }
- .dailyedit-set{
- display: flex;
- justify-content: space-between;
- }
- .items-li{
- border-bottom: 1px #DCDFE6 solid;
- margin-bottom: 12px;
- }
- .items-li .demo-form-inline{
- display: flex;
- justify-content: space-between;
- }
- .dailyfrom-title{
- font-size: 14px;
- font-weight: 600;
- color: #555;
- margin-bottom: 30px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .dailyfrom-title .el-form-item{
- margin: 0;
- }
- .items-li .el-form-item{
- margin-bottom: 10px;
- }
- .dailyedit-box .sub-box{
- -ms-user-select: none;
- font-family:"微软雅黑";
- -khtml-user-select: none;
- -webkit-user-select: none;
- -moz-user-select: none;
- user-select: none;
- background-color: #FFF;
- background-image: none;
- border-radius: 4px;
- border: 1px solid #DCDFE6;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- color: #606266;
- display: inline-block;
- height: 40px;
- line-height: 40px;
- outline: 0;
- padding: 0 15px;
- -webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);
- transition: border-color .2s cubic-bezier(.645,.045,.355,1);
- width: 100%;
- }
- </style>
|