修复采购订单编辑失败的问题

master
toesbieya 6 years ago
parent 3c1eb4bd79
commit 8432312e29
  1. 16
      vue/src/component/AbstractForm/FormAnchor.vue
  2. 3
      vue/src/mixin/docDetailMixin.js
  3. 2
      vue/src/view/purchase/inbound/detail.vue
  4. 4
      vue/src/view/purchase/order/detail.vue
  5. 2
      vue/src/view/sell/outbound/detail.vue
  6. 14
      vue/src/view/system/user/index.vue

@ -21,8 +21,8 @@ export default {
props: { props: {
reference: Function, reference: Function,
data: {type: Array, default: () => []}, data: {type: Array, default: () => []},
offsetTop: Number, offsetTop: {type: Number, default: 15},
bounds: Number, bounds: {type: Number, default: 0},
getContainer: { getContainer: {
type: Function, type: Function,
default: () => document.querySelector('#app .app-main>.el-scrollbar>.el-scrollbar__wrap') default: () => document.querySelector('#app .app-main>.el-scrollbar>.el-scrollbar__wrap')
@ -32,13 +32,13 @@ export default {
data: () => ({cur: null}), data: () => ({cur: null}),
methods: { methods: {
getCur(offsetTop = 0, bounds = 5) { getCur(offsetTop, bounds) {
const sections = [] const sections = []
const container = this.getContainer() const container = this.getContainer()
this.data.forEach(({ref}) => { this.data.forEach(({ref}) => {
const target = this.getDomFromRef(ref) const target = this.getDomFromRef(ref)
const top = getOffsetTop(target, container) const top = getOffsetTop(target, container)
if (top < offsetTop + bounds) { if (top <= offsetTop + bounds) {
sections.push({ref, top}) sections.push({ref, top})
} }
}) })
@ -58,22 +58,20 @@ export default {
click(ref) { click(ref) {
if (!ref || this.animating || !this.reference) return if (!ref || this.animating || !this.reference) return
this.cur = ref this.cur = ref
const {offsetTop, getContainer, targetOffset} = this const {offsetTop, getContainer} = this
const container = getContainer() const container = getContainer()
const scrollTop = getScroll(container, true) const scrollTop = getScroll(container, true)
const targetElement = this.getDomFromRef(ref) const targetElement = this.getDomFromRef(ref)
if (!targetElement) return if (!targetElement) return
const eleOffsetTop = getOffsetTop(targetElement, container) const eleOffsetTop = getOffsetTop(targetElement, container)
let y = scrollTop + eleOffsetTop const y = scrollTop + eleOffsetTop - offsetTop
y -= targetOffset !== undefined ? targetOffset : offsetTop || 0
this.animating = true this.animating = true
scrollTo(y, {callback: () => this.animating = false, getContainer}) scrollTo(y, {callback: () => this.animating = false, getContainer})
}, },
scroll() { scroll() {
if (this.animating || !this.reference) return if (this.animating || !this.reference) return
const {offsetTop, bounds, targetOffset} = this this.cur = this.getCur(this.offsetTop, this.bounds)
this.cur = this.getCur(targetOffset !== undefined ? targetOffset : offsetTop || 0, bounds)
} }
}, },

@ -209,11 +209,12 @@ export default {
this.api.getById(id) this.api.getById(id)
.then(data => { .then(data => {
if (!data || id !== data.id) return Promise.reject() if (!data || id !== data.id) return Promise.reject()
this.modifyDataBeforeMerge && this.modifyDataBeforeMerge(data)
return Promise.resolve(mergeObj(this.form, data)) return Promise.resolve(mergeObj(this.form, data))
}) })
.then(() => this.afterInit ? this.afterInit() : Promise.resolve()) .then(() => this.afterInit ? this.afterInit() : Promise.resolve())
.catch(e => { .catch(e => {
console.log(e) console.error(e)
return elAlert(`获取${this.docName}数据失败,请重试`, this.close) return elAlert(`获取${this.docName}数据失败,请重试`, this.close)
}) })
.finally(() => this.loading = false) .finally(() => this.loading = false)

@ -143,7 +143,7 @@ export default {
methods: { methods: {
afterInit() { afterInit() {
if (this.type !== 'edit') return if (this.type !== 'edit') return Promise.resolve()
return getParentSubById(this.form.pid).then(data => this.parentSubList = data) return getParentSubById(this.form.pid).then(data => this.parentSubList = data)
}, },
selectParent(id, sub) { selectParent(id, sub) {

@ -244,8 +244,8 @@ export default {
} }
return null return null
}, },
afterInit() { modifyDataBeforeMerge(data) {
this.form.data.forEach(item => item.__editable = false) data.data.forEach(item => item._editable = false)
} }
} }
} }

@ -165,7 +165,7 @@ export default {
methods: { methods: {
afterInit() { afterInit() {
if (this.type === 'add') return if (this.type === 'add') return Promise.resolve()
const ids = this.form.data.map(i => i.sid).join(',') const ids = this.form.data.map(i => i.sid).join(',')
return Promise.all([ return Promise.all([
getParentSubById(this.form.pid), getParentSubById(this.form.pid),

@ -86,25 +86,23 @@
</template> </template>
<script> <script>
import tableMixin from '@/mixin/tablePageMixin'
import EditDialog from './component/EditDialog'
import RoleSelector from './component/RoleSelector'
import SearchForm from "@/component/SearchForm" import SearchForm from "@/component/SearchForm"
import SearchFormItem from "@/component/SearchForm/SearchFormItem" import SearchFormItem from "@/component/SearchForm/SearchFormItem"
import RoleSelector from './component/RoleSelector' import {baseUrl, delUser, getUsers, kick, resetUserPwd} from "@/api/system/user"
import EditDialog from './component/EditDialog'
import {delUser, getUsers, kick, resetUserPwd} from "@/api/system/user"
import {isEmpty} from '@/util' import {isEmpty} from '@/util'
import {auth} from "@/util/auth"
import {autoCompleteUrl} from "@/util/file" import {autoCompleteUrl} from "@/util/file"
import {elConfirm, elError, elSuccess} from "@/util/message" import {elConfirm, elError, elSuccess} from "@/util/message"
import {auth} from "@/util/auth"
import tableMixin from '@/mixin/tablePageMixin'
const baseUrl = '/system/user'
export default { export default {
name: "userManagement", name: "userManagement",
mixins: [tableMixin], mixins: [tableMixin],
components: {SearchForm, SearchFormItem, RoleSelector, EditDialog}, components: {EditDialog, RoleSelector, SearchForm, SearchFormItem},
data() { data() {
return { return {

Loading…
Cancel
Save