Commit 0f374662 authored by cx49085's avatar cx49085
Browse files

fix bug

parent a4be0e3c
...@@ -45,7 +45,7 @@ export function parseTime(time, cFormat) { ...@@ -45,7 +45,7 @@ export function parseTime(time, cFormat) {
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
const value = formatObj[key] const value = formatObj[key]
// Note: getDay() returns 0 on Sunday // Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['', '', '', '', '', '', ''][value ] } if (key === 'a') { return ['', '', '', '', '', '', ''][value] }
return value.toString().padStart(2, '0') return value.toString().padStart(2, '0')
}) })
return time_str return time_str
...@@ -254,7 +254,7 @@ export function getTime(type) { ...@@ -254,7 +254,7 @@ export function getTime(type) {
export function debounce(func, wait, immediate) { export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result let timeout, args, context, timestamp, result
const later = function() { const later = function () {
// 据上一次触发时间间隔 // 据上一次触发时间间隔
const last = +new Date() - timestamp const last = +new Date() - timestamp
...@@ -271,7 +271,7 @@ export function debounce(func, wait, immediate) { ...@@ -271,7 +271,7 @@ export function debounce(func, wait, immediate) {
} }
} }
return function(...args) { return function (...args) {
context = this context = this
timestamp = +new Date() timestamp = +new Date()
const callNow = immediate && !timeout const callNow = immediate && !timeout
...@@ -355,3 +355,8 @@ export function removeClass(ele, cls) { ...@@ -355,3 +355,8 @@ export function removeClass(ele, cls) {
ele.className = ele.className.replace(reg, ' ') ele.className = ele.className.replace(reg, ' ')
} }
} }
export function backPage() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.back();
}
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
<el-switch v-model="scope.row.state" @change=" <el-switch v-model="scope.row.state" @change="
updateState({ updateState({
...scope.row, ...scope.row,
index: scope.$index,
oldState: !scope.row.state,
state: Math.abs(scope.row.state - 1), state: Math.abs(scope.row.state - 1),
}) })
" active-color="#13ce66" inactive-color="#ff4949"> " active-color="#13ce66" inactive-color="#ff4949">
...@@ -174,6 +176,7 @@ export default { ...@@ -174,6 +176,7 @@ export default {
// this.dialogFormVisible && (this.dialogFormVisible = false) // this.dialogFormVisible && (this.dialogFormVisible = false)
this.getContractTypeList(); this.getContractTypeList();
} else { } else {
this.contractTypeList[data.index].state = data.oldState
this.$message.error(res.msg); this.$message.error(res.msg);
} }
}); });
......
...@@ -62,6 +62,7 @@ import { insertPettyMoneyRecord, selctByPettyId, updatePettyMoneyRecord } from ' ...@@ -62,6 +62,7 @@ import { insertPettyMoneyRecord, selctByPettyId, updatePettyMoneyRecord } from '
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { previewPDF } from '@/utils/download' import { previewPDF } from '@/utils/download'
import { addRecordRules as rules, staticParams } from './pettyMoneyStaticData' import { addRecordRules as rules, staticParams } from './pettyMoneyStaticData'
import { backPage } from '@/utils'
export default { export default {
// props: ['drawerVisible'], // props: ['drawerVisible'],
computed: { computed: {
...@@ -101,7 +102,7 @@ export default { ...@@ -101,7 +102,7 @@ export default {
if (this.$route.path.indexOf('/editPetty') >= 0 && pettyId) { if (this.$route.path.indexOf('/editPetty') >= 0 && pettyId) {
this.isEdit = true; this.isEdit = true;
this.getPettytDetail(pettyId) this.getPettytDetail(pettyId)
this.getPettyFiles(pettyId) //获取合同文件 // this.getPettyFiles(pettyId) //获取合同文件
// 添加 // 添加
} else if (this.$route.path.indexOf('/addPettyMoneyRecord') >= 0) { } else if (this.$route.path.indexOf('/addPettyMoneyRecord') >= 0) {
this.isEdit = false; this.isEdit = false;
...@@ -111,11 +112,11 @@ export default { ...@@ -111,11 +112,11 @@ export default {
// console.log(1) // console.log(1)
}, },
methods: { methods: {
back(){ // back(){
this.$store.dispatch("tagsView/delView", this.$route); // this.$store.dispatch("tagsView/delView", this.$route);
this.$router.back(); // this.$router.back();
}, // },
addPettyMoneyRecord() { addPettyMoneyRecord() {
this.$refs.form.validate(valida => { this.$refs.form.validate(valida => {
...@@ -133,7 +134,7 @@ export default { ...@@ -133,7 +134,7 @@ export default {
//this.addPettyFile(params.pettyId) //this.addPettyFile(params.pettyId)
this.$message.success("修改成功") this.$message.success("修改成功")
setTimeout(() => { setTimeout(() => {
this.$router.push('/pettyMoneyRecord') backPage.call(this)
}, 500); }, 500);
} else { } else {
this.$message.error(res.msg) this.$message.error(res.msg)
...@@ -146,7 +147,7 @@ export default { ...@@ -146,7 +147,7 @@ export default {
this.addPettyFile(res.data) this.addPettyFile(res.data)
this.$message.success("申请成功") this.$message.success("申请成功")
setTimeout(() => { setTimeout(() => {
this.$router.push('/pettyMoneyRecord') backPage.call(this)
}, 500); }, 500);
} else { } else {
this.$message.error(res.msg) this.$message.error(res.msg)
......
...@@ -234,7 +234,7 @@ export default { ...@@ -234,7 +234,7 @@ export default {
repayMoney(params).then(res => { repayMoney(params).then(res => {
if (res.success) { if (res.success) {
this.$message.success("还款成功") this.$message.success("还款成功")
this.getPettyMoneyList() this.getPettyMoneyList(false)
this.controlDialogDrawerVisible('') this.controlDialogDrawerVisible('')
} else { } else {
this.$message.error(res.msg) this.$message.error(res.msg)
...@@ -248,7 +248,7 @@ export default { ...@@ -248,7 +248,7 @@ export default {
revokePetty(params).then(res => { revokePetty(params).then(res => {
if (res.success) { if (res.success) {
this.$message.success("撤销成功") this.$message.success("撤销成功")
this.getPettyMoneyList() this.getPettyMoneyList(false)
} else { } else {
this.$message.error("撤销失败") this.$message.error("撤销失败")
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment