下拉加参数
This commit is contained in:
parent
943318d697
commit
97b709112a
|
|
@ -1,49 +1,52 @@
|
|||
<template>
|
||||
<div class="app-container" style="width:800px;margin:0 auto">
|
||||
<el-form size="mini" label-width="160px" :rules="rules" ref="ruleForm" :model="formInline">
|
||||
<el-form
|
||||
ref="ruleForm"
|
||||
:rules="rules"
|
||||
:model="formInline"
|
||||
size="mini"
|
||||
label-width="160px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
|
||||
|
||||
<el-form-item label="项目编号" prop="xyProjectId">
|
||||
<el-select
|
||||
style="width: 100%;"
|
||||
v-model="formInline.xyProjectId"
|
||||
style="width: 100%;"
|
||||
clearable
|
||||
@change="getxoProjectname"
|
||||
placeholder="项目编号"
|
||||
class="filter-item"
|
||||
@change="getxoProjectname"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in xwProjectIdOption"
|
||||
:key="item.xpId"
|
||||
:label="item.xpId + '-' + item.xpProName"
|
||||
:value="item.xpId"
|
||||
></el-option>
|
||||
/>
|
||||
</el-select>
|
||||
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
|
||||
<el-form-item label="项目名称">
|
||||
<el-input disabled
|
||||
<el-input
|
||||
v-model="formInline.xoProjectname"
|
||||
disabled
|
||||
placeholder="项目名称"
|
||||
maxlength="100"
|
||||
></el-input>
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="月份:" prop="date">
|
||||
<el-date-picker style="width: 100%;"
|
||||
<el-date-picker
|
||||
v-model="formInline.date"
|
||||
style="width: 100%;"
|
||||
type="month"
|
||||
value-format="yyyy-MM"
|
||||
v-model="formInline.date"
|
||||
placeholder="月份"
|
||||
></el-date-picker>
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
|
|
@ -51,18 +54,14 @@
|
|||
<div style="display: flex;height: 30px;">
|
||||
<el-upload
|
||||
:auto-upload="false"
|
||||
action="www.baidu.com"
|
||||
|
||||
|
||||
:on-change="handleSuccess"
|
||||
action="www.baidu.com"
|
||||
>
|
||||
<el-button type="primary">上传</el-button>
|
||||
</el-upload>
|
||||
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<div style="float: right;">
|
||||
<el-button @click="cancelBtn('ruleForm')">取 消</el-button>
|
||||
|
|
@ -73,17 +72,15 @@
|
|||
</template>
|
||||
<script>
|
||||
import {
|
||||
|
||||
xyProjectinfoSelectXm, // 姓名下拉框
|
||||
xyProjectinfoList,
|
||||
xyCostEntry
|
||||
} from '@/api/article'
|
||||
} from "@/api/article";
|
||||
export default {
|
||||
data() {
|
||||
var validateInput = (rule, value, callback) => {
|
||||
|
||||
if (value === '' ) {
|
||||
callback(new Error('没有数据'));
|
||||
if (value === "") {
|
||||
callback(new Error("没有数据"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
|
|
@ -92,109 +89,95 @@ export default {
|
|||
xwProjectIdOption: [],
|
||||
uploadUrl: "www.baidu.com",
|
||||
headerObj: {
|
||||
Authorization:"",
|
||||
Authorization: ""
|
||||
},
|
||||
|
||||
formInline: {
|
||||
|
||||
file: "",
|
||||
date: "",
|
||||
xyProjectId:'',
|
||||
|
||||
xyProjectId: ""
|
||||
},
|
||||
rules: {
|
||||
xyProjectId: [{ validator: validateInput, trigger: 'change' }],
|
||||
date: [ { validator: validateInput, trigger: 'blur' }],
|
||||
|
||||
file: [{ validator: validateInput, trigger: 'change' } ],
|
||||
xyProjectId: [{ validator: validateInput, trigger: "change" }],
|
||||
date: [{ validator: validateInput, trigger: "blur" }],
|
||||
|
||||
file: [{ validator: validateInput, trigger: "change" }]
|
||||
},
|
||||
editState: 0, // 0:新增,1:编辑
|
||||
editId :'',//编辑id-xpId
|
||||
nameOption : [],//姓名下拉框
|
||||
|
||||
editId: "", // 编辑id-xpId
|
||||
nameOption: [] // 姓名下拉框
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getxwProjectIdOption()
|
||||
this.getxwProjectIdOption();
|
||||
this.getNameSelect(); // 姓名下拉框
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
getxoProjectname(val) {
|
||||
if (val) {
|
||||
let obj = this.xwProjectIdOption.find((item)=>{
|
||||
return item.xpId == val
|
||||
})
|
||||
this.formInline.xoProjectname = obj.xpProName
|
||||
|
||||
const obj = this.xwProjectIdOption.find(item => {
|
||||
return item.xpId == val;
|
||||
});
|
||||
this.formInline.xoProjectname = obj.xpProName;
|
||||
} else {
|
||||
this.formInline.xoProjectname = "";
|
||||
}
|
||||
else{
|
||||
this.formInline.xoProjectname = ''
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
getxwProjectIdOption() {
|
||||
xyProjectinfoList().then(res=>{
|
||||
xyProjectinfoList({ page: 0, size: 500 }).then(res => {
|
||||
// console.log(res);
|
||||
this.xwProjectIdOption = res.content;
|
||||
})
|
||||
});
|
||||
},
|
||||
// 姓名下拉框
|
||||
getNameSelect() {
|
||||
xyProjectinfoSelectXm().then(res=>{
|
||||
xyProjectinfoSelectXm()
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
this.nameOption = res
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
this.nameOption = res;
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
// 姓名下拉:选中值发生变化时触发
|
||||
nameChange(val) {
|
||||
console.log(val);
|
||||
if (val != "") {
|
||||
this.formInline.empName = val.split('-')[0]
|
||||
this.formInline.jobNum = val.split('-')[1]
|
||||
this.formInline.empName = val.split("-")[0];
|
||||
this.formInline.jobNum = val.split("-")[1];
|
||||
} else {
|
||||
this.formInline.empName = '' ;
|
||||
this.formInline.jobNum = '' ;
|
||||
this.formInline.empName = "";
|
||||
this.formInline.jobNum = "";
|
||||
}
|
||||
},
|
||||
// 保存
|
||||
onSubmit(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
let formdata=new FormData();
|
||||
debugger
|
||||
console.log(this.formInline.file)
|
||||
const formdata = new FormData();
|
||||
debugger;
|
||||
console.log(this.formInline.file);
|
||||
formdata.append("file", this.formInline.file);
|
||||
formdata.append("date", this.formInline.date);
|
||||
formdata.append("xyProjectId", this.formInline.xyProjectId);
|
||||
xyCostEntry(formdata)
|
||||
.then(res => {
|
||||
this.$router.push('/reimbursement/listc')
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
this.$router.push("/reimbursement/listc");
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
console.log("error submit!!");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
handleSuccess(file) {
|
||||
|
||||
|
||||
|
||||
this.formInline.file= file.raw
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
this.formInline.file = file.raw;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user