解决新增项目的bug

main
wuyize 2022-07-01 23:36:25 +08:00
parent 65794e3e46
commit da6513a0c9
2 changed files with 11 additions and 6 deletions

View File

@ -196,9 +196,10 @@ export default {
return callback() return callback()
} else { } else {
if (!reg.test(value)) { if (!reg.test(value)) {
callback(new Error("只能输入字母和数字")) return callback(new Error("只能输入字母和数字"))
} }
} }
return callback()
} }
let validateAmount = (rule, value, callback) => {//0,2 let validateAmount = (rule, value, callback) => {//0,2
var reg = new RegExp("^(([0-9]|([1-9][0-9]{0,9}))((\\.[0-9]{1,2})?))$"); var reg = new RegExp("^(([0-9]|([1-9][0-9]{0,9}))((\\.[0-9]{1,2})?))$");
@ -206,9 +207,10 @@ export default {
return callback() return callback()
} else { } else {
if (!reg.test(value)) { if (!reg.test(value)) {
callback(new Error("请输入正确的合同额")) return callback(new Error("请输入正确的合同额"))
} }
} }
return callback()
} }
let validateFinancial = (rule, value, callback) => {// let validateFinancial = (rule, value, callback) => {//
var reg = new RegExp("^\\d+$|^\\d+[.]?\\d+$"); var reg = new RegExp("^\\d+$|^\\d+[.]?\\d+$");
@ -216,13 +218,13 @@ export default {
return callback() return callback()
} else { } else {
if (!reg.test(value)) { if (!reg.test(value)) {
callback(new Error("请输入正确的财务编码")) return callback(new Error("请输入正确的财务编码"))
} }
} }
return callback()
} }
return { return {
dialogFormVisible: false,
formLabelWidth: '120px', formLabelWidth: '120px',
currentProjectSubClasses: [], currentProjectSubClasses: [],
@ -355,9 +357,10 @@ export default {
// //
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
const that = this
if (valid) { if (valid) {
console.log('submit') console.log('submit')
let form = this.ruleForm let { ...form} = this.ruleForm
form.projectFinalTestTime = form.projectFinalTestTime.getTime() / 1000 form.projectFinalTestTime = form.projectFinalTestTime.getTime() / 1000
form.projectEndTime = form.projectEndTime.getTime() / 1000 form.projectEndTime = form.projectEndTime.getTime() / 1000
form.projectFirstTestTime = form.projectFirstTestTime.getTime() / 1000 form.projectFirstTestTime = form.projectFirstTestTime.getTime() / 1000
@ -371,6 +374,8 @@ export default {
console.log(response) console.log(response)
if (response.data.code === 200) { if (response.data.code === 200) {
//console.log(response.data.data.records) //console.log(response.data.data.records)
that.dialogFormVisible = false
that.$emit("created");
ElMessage({ ElMessage({
message: '新增项目成功', message: '新增项目成功',
type: 'success', type: 'success',

View File

@ -48,7 +48,7 @@
</div> </div>
</div> </div>
<CreateProjectDialog v-model:dialogFormVisible="dialogFormVisible" :projectClasses="projectClasses" <CreateProjectDialog v-model:dialogFormVisible="dialogFormVisible" :projectClasses="projectClasses"
:projectSubClasses="projectSubClasses"></CreateProjectDialog> :projectSubClasses="projectSubClasses" @created="getProjects"></CreateProjectDialog>
</template> </template>
<script setup> <script setup>