Commit adc56c9e authored by 郝聪敏's avatar 郝聪敏

feature: 修改优惠券选择bug;升级业务库

parent 2081ab27
...@@ -21,6 +21,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) { ...@@ -21,6 +21,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) {
modal: boolean = false; modal: boolean = false;
selections: object[] = []; selections: object[] = [];
activeName: number = 0; activeName: number = 0;
isSelected: boolean = false;
get idsLength() { get idsLength() {
return this.getLength('value'); return this.getLength('value');
...@@ -29,7 +30,11 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) { ...@@ -29,7 +30,11 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) {
getTableData() { getTableData() {
const tableData = this.$refs?.[`qgTable${this.activeName}`]?.[0]?.tableData || []; const tableData = this.$refs?.[`qgTable${this.activeName}`]?.[0]?.tableData || [];
console.log('get tableData', tableData); console.log('get tableData', tableData);
return tableData; return this.isSelected ? tableData : [];
}
changePageNo() {
this.isSelected = false;
} }
// 获取除本页之外的默认值 // 获取除本页之外的默认值
...@@ -47,7 +52,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) { ...@@ -47,7 +52,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) {
filterIds = tableData.map(v => v.id); filterIds = tableData.map(v => v.id);
} }
const rs = defaultIds.filter(v => !filterIds.includes(v)); const rs = this.isSelected ? defaultIds.filter(v => !filterIds.includes(v)) : defaultIds;
return rs; return rs;
} }
...@@ -73,7 +78,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) { ...@@ -73,7 +78,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) {
templates = this.templates; templates = this.templates;
} }
const rs = templates.filter(v => !filterIds.includes(v)); const rs = this.isSelected ? templates.filter(v => !filterIds.includes(v)) : templates;
return rs; return rs;
} }
...@@ -142,6 +147,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) { ...@@ -142,6 +147,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) {
}); });
return this.templates; return this.templates;
} }
this.isSelected = true;
this.selections = selection.length ? selection : this.getDefaultSelections(); this.selections = selection.length ? selection : this.getDefaultSelections();
const ids = Array.from(new Set([...this.getSelectionsIds(), ...(this.getLength('templates') ? this.getTemplateIds() : this.getDefaultIds())])); const ids = Array.from(new Set([...this.getSelectionsIds(), ...(this.getLength('templates') ? this.getTemplateIds() : this.getDefaultIds())]));
...@@ -156,9 +162,13 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) { ...@@ -156,9 +162,13 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) {
} }
ok() { ok() {
const ids = [...this.getSelectionsIds(), ...(this.getLength('templates') ? this.getTemplateIds() : this.getDefaultIds())].filter(v => v !== -1); let ids = [...this.getSelectionsIds(), ...(this.getLength('templates') ? this.getTemplateIds() : this.getDefaultIds())];
// if (!ids.length) { return; } // ids为空时表示未选择
if (!ids.length) { return; }
// 当前页selections为空
ids = ids.filter(v => v !== -1);
this.selections = []; this.selections = [];
this.isSelected = false;
// console.log('commit', selections); // console.log('commit', selections);
if (this.table.length > 1) { if (this.table.length > 1) {
this.$emit('update:templates', {}); this.$emit('update:templates', {});
...@@ -175,6 +185,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) { ...@@ -175,6 +185,7 @@ export default class DynamicForm extends Mixins(DynamicFormMixin) {
@Emit('update:templates') @Emit('update:templates')
cancel() { cancel() {
this.selections = []; this.selections = [];
this.isSelected = false;
let rs = null; let rs = null;
if (this.table.length > 1) { if (this.table.length > 1) {
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
:hideAdd="true" :hideAdd="true"
:height="500" :height="500"
@on-selection-change="selectionChange" @on-selection-change="selectionChange"
@on-page-change="changePageNo"
> >
</QGTable> </QGTable>
</div> </div>
......
...@@ -88,6 +88,7 @@ export default { ...@@ -88,6 +88,7 @@ export default {
methods: { methods: {
changePageNo(page) { changePageNo(page) {
this.query(page); this.query(page);
this.$emit('on-page-change', page);
}, },
changePageSize(size) { changePageSize(size) {
this.searchForm.pageSize = size; this.searchForm.pageSize = size;
......
...@@ -1456,9 +1456,9 @@ ...@@ -1456,9 +1456,9 @@
} }
}, },
"@qg/citrus-ui": { "@qg/citrus-ui": {
"version": "0.0.49", "version": "0.0.50",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.0.49.tgz", "resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.0.50.tgz",
"integrity": "sha512-AfQrts57c7WyofgTkABy6MVCWB5a5lyHWkV0a20AuMlSUboFuB+/4uauRSUGbIJP5voDWf/4VN7eV2Y48YLuKw==", "integrity": "sha512-rws0modT35uFdnFhkJKngXyqSk64TnZe0ou9mPSJKTW5+hC+CdMeeA+yMFCTiETi9kFx/ru8KCD9sQa5gMs4zg==",
"requires": { "requires": {
"@better-scroll/core": "^2.1.1", "@better-scroll/core": "^2.1.1",
"@qg/cherry-ui": "^2.20.5", "@qg/cherry-ui": "^2.20.5",
...@@ -19936,9 +19936,9 @@ ...@@ -19936,9 +19936,9 @@
"integrity": "sha1-8z/pz7Urv9UgqhgyO8ZdsRCht2w=" "integrity": "sha1-8z/pz7Urv9UgqhgyO8ZdsRCht2w="
}, },
"rollup": { "rollup": {
"version": "2.43.1", "version": "2.44.0",
"resolved": "http://npmprivate.quantgroups.com/rollup/-/rollup-2.43.1.tgz", "resolved": "http://npmprivate.quantgroups.com/rollup/-/rollup-2.44.0.tgz",
"integrity": "sha512-kvRE6VJbiv4d8m2nGeccc3qRpzOMghAhu2KeITjyZVCjneIFLPQ3zm2Wmqnl0LcUg3FvDaV0MfKnG4NCMbiSfw==", "integrity": "sha512-rGSF4pLwvuaH/x4nAS+zP6UNn5YUDWf/TeEU5IoXSZKBbKRNTCI3qMnYXKZgrC0D2KzS2baiOZt1OlqhMu5rnQ==",
"requires": { "requires": {
"fsevents": "~2.3.1" "fsevents": "~2.3.1"
} }
......
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