ts-glitter 21.4.4 → 21.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/lowcode/Entry.js +2 -2
  2. package/lowcode/Entry.ts +2 -2
  3. package/lowcode/backend-manager/bg-product.js +8 -6
  4. package/lowcode/backend-manager/bg-product.ts +17 -15
  5. package/lowcode/backend-manager/bg-recommend.js +16 -5
  6. package/lowcode/backend-manager/bg-recommend.ts +15 -5
  7. package/lowcode/backend-manager/bg-widget.js +160 -160
  8. package/lowcode/backend-manager/bg-widget.ts +169 -166
  9. package/lowcode/cms-plugin/POS-setting.js +75 -23
  10. package/lowcode/cms-plugin/POS-setting.ts +87 -30
  11. package/lowcode/cms-plugin/menus-setting.js +165 -37
  12. package/lowcode/cms-plugin/menus-setting.ts +144 -21
  13. package/lowcode/cms-plugin/module/order-excel.js +8 -8
  14. package/lowcode/cms-plugin/module/order-excel.ts +10 -10
  15. package/lowcode/cms-plugin/module/stock-excel.js +184 -0
  16. package/lowcode/cms-plugin/module/stock-excel.ts +205 -0
  17. package/lowcode/cms-plugin/module/vendor-excel.js +375 -0
  18. package/lowcode/cms-plugin/module/vendor-excel.ts +450 -0
  19. package/lowcode/cms-plugin/order/order-module.js +6 -4
  20. package/lowcode/cms-plugin/order/order-module.ts +16 -14
  21. package/lowcode/cms-plugin/pos-pages/models.ts +6 -2
  22. package/lowcode/cms-plugin/pos-pages/products-page.js +589 -469
  23. package/lowcode/cms-plugin/pos-pages/products-page.ts +657 -491
  24. package/lowcode/cms-plugin/shopping-product-setting.js +7 -10
  25. package/lowcode/cms-plugin/shopping-product-setting.ts +12 -10
  26. package/lowcode/cms-plugin/shopping-setting-basic.js +2 -5
  27. package/lowcode/cms-plugin/shopping-setting-basic.ts +2 -5
  28. package/lowcode/cms-plugin/stock-history.js +39 -26
  29. package/lowcode/cms-plugin/stock-history.ts +58 -49
  30. package/lowcode/cms-plugin/stock-vendors.js +18 -13
  31. package/lowcode/cms-plugin/stock-vendors.ts +31 -16
  32. package/package.json +1 -1
  33. package/src/api-public/services/schedule.js +6 -1
  34. package/src/api-public/services/schedule.js.map +1 -1
  35. package/src/api-public/services/schedule.ts +4 -1
@@ -260,18 +260,14 @@ export class ShoppingProductSetting {
260
260
  width: 40,
261
261
  class: 'rounded border me-2',
262
262
  })}
263
- <div class="d-flex flex-column">
263
+ <div class="d-flex align-items-center gap-2">
264
+ ${Tool.truncateString(dd.content.title, dd.content.shopee_id ? 16 : 20)}
264
265
  ${dd.content.shopee_id
265
- ? html `<div style="margin-bottom: -10px;">
266
- <div
267
- class="insignia"
268
- style="background: orangered;color: white;"
269
- >
270
- 蝦皮
271
- </div>
272
- </div> `
266
+ ? html `<img
267
+ src="${ShoppingProductSetting.shopeeImage}"
268
+ style="width: 20px; height: 20px;"
269
+ />`
273
270
  : ''}
274
- <div>${Tool.truncateString(dd.content.title)}</div>
275
271
  </div>
276
272
  </div>`,
277
273
  },
@@ -1740,4 +1736,5 @@ ShoppingProductSetting.getDateTime = (n = 0) => {
1740
1736
  const timeStr = `${hours}:00`;
1741
1737
  return { date: dateStr, time: timeStr };
1742
1738
  };
1739
+ ShoppingProductSetting.shopeeImage = 'https://deo.shopeemobile.com/shopee/shopee-mobilemall-live-sg/assets/icon_favicon_1_32.0Wecxv.png';
1743
1740
  window.glitter.setModule(import.meta.url, ShoppingProductSetting);
@@ -318,18 +318,17 @@ export class ShoppingProductSetting {
318
318
  width: 40,
319
319
  class: 'rounded border me-2',
320
320
  })}
321
- <div class="d-flex flex-column">
321
+ <div class="d-flex align-items-center gap-2">
322
+ ${Tool.truncateString(
323
+ dd.content.title,
324
+ dd.content.shopee_id ? 16 : 20
325
+ )}
322
326
  ${dd.content.shopee_id
323
- ? html`<div style="margin-bottom: -10px;">
324
- <div
325
- class="insignia"
326
- style="background: orangered;color: white;"
327
- >
328
- 蝦皮
329
- </div>
330
- </div> `
327
+ ? html`<img
328
+ src="${ShoppingProductSetting.shopeeImage}"
329
+ style="width: 20px; height: 20px;"
330
+ />`
331
331
  : ''}
332
- <div>${Tool.truncateString(dd.content.title)}</div>
333
332
  </div>
334
333
  </div>`,
335
334
  },
@@ -2033,6 +2032,9 @@ export class ShoppingProductSetting {
2033
2032
  return BgWidget.secondaryInsignia('草稿');
2034
2033
  }
2035
2034
  }
2035
+
2036
+ static shopeeImage =
2037
+ 'https://deo.shopeemobile.com/shopee/shopee-mobilemall-live-sg/assets/icon_favicon_1_32.0Wecxv.png';
2036
2038
  }
2037
2039
 
2038
2040
  (window as any).glitter.setModule(import.meta.url, ShoppingProductSetting);
@@ -3262,11 +3262,8 @@ ${(_b = language_data.seo.content) !== null && _b !== void 0 ? _b : ''}</textare
3262
3262
  single: false,
3263
3263
  readonly: postMD.product_category === 'weighing',
3264
3264
  })}
3265
- <div class="${postMD.shopee_id ? `d-flex` : `d-none`} align-items-center mt-1" style="gap:6px;">
3266
- <img
3267
- src="https://deo.shopeemobile.com/shopee/shopee-mobilemall-live-sg/assets/icon_favicon_1_32.0Wecxv.png"
3268
- style="width:20px;height:20px;"
3269
- />
3265
+ <div class="${postMD.shopee_id ? `d-flex` : `d-none`} align-items-center mt-1" style="gap: 6px;">
3266
+ <img src="${ShoppingProductSetting.shopeeImage}" style="width: 20px; height: 20px;" />
3270
3267
  蝦皮賣場
3271
3268
  </div>
3272
3269
  `;
@@ -3604,11 +3604,8 @@ ${language_data.seo.content ?? ''}</textarea
3604
3604
  readonly: postMD.product_category === 'weighing',
3605
3605
  }
3606
3606
  )}
3607
- <div class="${postMD.shopee_id ? `d-flex` : `d-none`} align-items-center mt-1" style="gap:6px;">
3608
- <img
3609
- src="https://deo.shopeemobile.com/shopee/shopee-mobilemall-live-sg/assets/icon_favicon_1_32.0Wecxv.png"
3610
- style="width:20px;height:20px;"
3611
- />
3607
+ <div class="${postMD.shopee_id ? `d-flex` : `d-none`} align-items-center mt-1" style="gap: 6px;">
3608
+ <img src="${ShoppingProductSetting.shopeeImage}" style="width: 20px; height: 20px;" />
3612
3609
  蝦皮賣場
3613
3610
  </div>
3614
3611
  `;
@@ -21,6 +21,7 @@ import { CheckInput } from '../modules/checkInput.js';
21
21
  import { Tool } from '../modules/tool.js';
22
22
  import { BgProduct } from '../backend-manager/bg-product.js';
23
23
  import { TableStorage } from './module/table-storage.js';
24
+ import { StockExcel } from './module/stock-excel.js';
24
25
  const html = String.raw;
25
26
  const typeConfig = {
26
27
  restocking: {
@@ -670,6 +671,21 @@ export class StockHistory {
670
671
  vm.view = 'replace';
671
672
  }))}${BgWidget.title(`${typeData.name}核對`)}
672
673
  <div class="flex-fill"></div>
674
+ <div class="d-flex" style="gap: 14px;">
675
+ ${vm.data.type === 'checking' && [2, 4, 5].includes(vm.data.status)
676
+ ? BgWidget.grayButton('匯入', gvc.event(() => {
677
+ StockExcel.importDialog(gvc, vm.data.content.product_list, (updateList) => {
678
+ vm.data.content.product_list = updateList;
679
+ gvc.notifyDataChange(vm.id);
680
+ });
681
+ }))
682
+ : ''}
683
+ ${vm.data.type === 'checking' && [2, 4, 5].includes(vm.data.status)
684
+ ? BgWidget.grayButton('匯出', gvc.event(() => {
685
+ StockExcel.exportChecking(gvc, vm.data.order_id, vm.data.content.product_list);
686
+ }))
687
+ : ''}
688
+ </div>
673
689
  </div>
674
690
  <div class="title-container">
675
691
  ${BgWidget.tab(tabs, gvc, vm.tabKey, text => {
@@ -776,7 +792,6 @@ export class StockHistory {
776
792
  hiddenPageSplit: true,
777
793
  });
778
794
  },
779
- divCreate: {},
780
795
  onCreate: () => {
781
796
  if (loading) {
782
797
  loading = false;
@@ -1811,17 +1826,19 @@ export class StockHistory {
1811
1826
  return StockHistory.vendorForm(gvc2, newVendorData);
1812
1827
  },
1813
1828
  footer_html: gvc2 => {
1814
- return `${BgWidget.cancel(gvc2.event(() => {
1815
- gvc2.closeDialog();
1816
- }))}
1817
- ${BgWidget.save(gvc2.event(() => {
1818
- StockVendors.verifyStoreForm(glitter, 'create', newVendorData, response => {
1829
+ return [
1830
+ BgWidget.cancel(gvc2.event(() => {
1819
1831
  gvc2.closeDialog();
1820
- vm.data.content.vendor = response.id;
1821
- loading = true;
1822
- gvc.notifyDataChange(id);
1823
- });
1824
- }), '完成')}`;
1832
+ })),
1833
+ BgWidget.save(gvc2.event(() => {
1834
+ StockVendors.verifyStoreForm(glitter, 'create', newVendorData, response => {
1835
+ gvc2.closeDialog();
1836
+ vm.data.content.vendor = response.id;
1837
+ loading = true;
1838
+ gvc.notifyDataChange(id);
1839
+ });
1840
+ }), '完成'),
1841
+ ].join('');
1825
1842
  },
1826
1843
  });
1827
1844
  },
@@ -1829,7 +1846,6 @@ export class StockHistory {
1829
1846
  });
1830
1847
  }
1831
1848
  },
1832
- divCreate: {},
1833
1849
  onCreate: () => {
1834
1850
  if (loading) {
1835
1851
  ApiUser.getPublicConfig('vendor_manager', 'manager').then((dd) => {
@@ -1901,17 +1917,18 @@ export class StockHistory {
1901
1917
  return StockHistory.storeForm(gvc2, newStoreData);
1902
1918
  },
1903
1919
  footer_html: gvc2 => {
1904
- return `${BgWidget.cancel(gvc2.event(() => {
1905
- gvc2.closeDialog();
1906
- }))}
1907
- ${BgWidget.save(gvc2.event(() => {
1908
- StockStores.verifyStoreForm(glitter, 'create', newStoreData, response => {
1920
+ return [
1921
+ BgWidget.cancel(gvc2.event(() => {
1909
1922
  gvc2.closeDialog();
1910
- vm.data.content.store_in = response.id;
1911
- loading = true;
1912
- gvc.notifyDataChange(id);
1913
- });
1914
- }), '完成')}`;
1923
+ }), BgWidget.save(gvc2.event(() => {
1924
+ StockStores.verifyStoreForm(glitter, 'create', newStoreData, response => {
1925
+ gvc2.closeDialog();
1926
+ vm.data.content.store_in = response.id;
1927
+ loading = true;
1928
+ gvc.notifyDataChange(id);
1929
+ });
1930
+ }), '完成')),
1931
+ ].join('');
1915
1932
  },
1916
1933
  });
1917
1934
  },
@@ -1919,7 +1936,6 @@ export class StockHistory {
1919
1936
  });
1920
1937
  }
1921
1938
  },
1922
- divCreate: {},
1923
1939
  onCreate: () => {
1924
1940
  if (loading) {
1925
1941
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd) => {
@@ -1984,7 +2000,6 @@ export class StockHistory {
1984
2000
  });
1985
2001
  }
1986
2002
  },
1987
- divCreate: {},
1988
2003
  onCreate: () => {
1989
2004
  if (loading) {
1990
2005
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd) => {
@@ -2042,7 +2057,6 @@ export class StockHistory {
2042
2057
  });
2043
2058
  }
2044
2059
  },
2045
- divCreate: {},
2046
2060
  onCreate: () => {
2047
2061
  if (loading) {
2048
2062
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd) => {
@@ -2109,7 +2123,6 @@ export class StockHistory {
2109
2123
  });
2110
2124
  }
2111
2125
  },
2112
- divCreate: {},
2113
2126
  onCreate: () => {
2114
2127
  if (loading) {
2115
2128
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd) => {
@@ -13,6 +13,7 @@ import { CheckInput } from '../modules/checkInput.js';
13
13
  import { Tool } from '../modules/tool.js';
14
14
  import { BgProduct, OptionsItem } from '../backend-manager/bg-product.js';
15
15
  import { TableStorage } from './module/table-storage.js';
16
+ import { StockExcel } from './module/stock-excel.js';
16
17
 
17
18
  const html = String.raw;
18
19
 
@@ -725,6 +726,27 @@ export class StockHistory {
725
726
  })
726
727
  )}${BgWidget.title(`${typeData.name}核對`)}
727
728
  <div class="flex-fill"></div>
729
+ <div class="d-flex" style="gap: 14px;">
730
+ ${vm.data.type === 'checking' && [2, 4, 5].includes(vm.data.status)
731
+ ? BgWidget.grayButton(
732
+ '匯入',
733
+ gvc.event(() => {
734
+ StockExcel.importDialog(gvc, vm.data.content.product_list, (updateList: ContentProduct[]) => {
735
+ vm.data.content.product_list = updateList;
736
+ gvc.notifyDataChange(vm.id);
737
+ });
738
+ })
739
+ )
740
+ : ''}
741
+ ${vm.data.type === 'checking' && [2, 4, 5].includes(vm.data.status)
742
+ ? BgWidget.grayButton(
743
+ '匯出',
744
+ gvc.event(() => {
745
+ StockExcel.exportChecking(gvc, vm.data.order_id, vm.data.content.product_list);
746
+ })
747
+ )
748
+ : ''}
749
+ </div>
728
750
  </div>
729
751
  <div class="title-container">
730
752
  ${BgWidget.tab(
@@ -852,7 +874,6 @@ export class StockHistory {
852
874
  hiddenPageSplit: true,
853
875
  });
854
876
  },
855
- divCreate: {},
856
877
  onCreate: () => {
857
878
  if (loading) {
858
879
  loading = false;
@@ -1976,27 +1997,24 @@ export class StockHistory {
1976
1997
  return StockHistory.vendorForm(gvc2, newVendorData);
1977
1998
  },
1978
1999
  footer_html: gvc2 => {
1979
- return `${BgWidget.cancel(
1980
- gvc2.event(() => {
1981
- gvc2.closeDialog();
1982
- })
1983
- )}
1984
- ${BgWidget.save(
1985
- gvc2.event(() => {
1986
- StockVendors.verifyStoreForm(
1987
- glitter,
1988
- 'create',
1989
- newVendorData,
1990
- response => {
1991
- gvc2.closeDialog();
1992
- vm.data.content.vendor = response.id;
1993
- loading = true;
1994
- gvc.notifyDataChange(id);
1995
- }
1996
- );
1997
- }),
1998
- '完成'
1999
- )}`;
2000
+ return [
2001
+ BgWidget.cancel(
2002
+ gvc2.event(() => {
2003
+ gvc2.closeDialog();
2004
+ })
2005
+ ),
2006
+ BgWidget.save(
2007
+ gvc2.event(() => {
2008
+ StockVendors.verifyStoreForm(glitter, 'create', newVendorData, response => {
2009
+ gvc2.closeDialog();
2010
+ vm.data.content.vendor = response.id;
2011
+ loading = true;
2012
+ gvc.notifyDataChange(id);
2013
+ });
2014
+ }),
2015
+ '完成'
2016
+ ),
2017
+ ].join('');
2000
2018
  },
2001
2019
  });
2002
2020
  },
@@ -2004,7 +2022,6 @@ export class StockHistory {
2004
2022
  });
2005
2023
  }
2006
2024
  },
2007
- divCreate: {},
2008
2025
  onCreate: () => {
2009
2026
  if (loading) {
2010
2027
  ApiUser.getPublicConfig('vendor_manager', 'manager').then((dd: any) => {
@@ -2079,27 +2096,24 @@ export class StockHistory {
2079
2096
  return StockHistory.storeForm(gvc2, newStoreData);
2080
2097
  },
2081
2098
  footer_html: gvc2 => {
2082
- return `${BgWidget.cancel(
2083
- gvc2.event(() => {
2084
- gvc2.closeDialog();
2085
- })
2086
- )}
2087
- ${BgWidget.save(
2088
- gvc2.event(() => {
2089
- StockStores.verifyStoreForm(
2090
- glitter,
2091
- 'create',
2092
- newStoreData,
2093
- response => {
2094
- gvc2.closeDialog();
2095
- vm.data.content.store_in = response.id;
2096
- loading = true;
2097
- gvc.notifyDataChange(id);
2098
- }
2099
- );
2100
- }),
2101
- '完成'
2102
- )}`;
2099
+ return [
2100
+ BgWidget.cancel(
2101
+ gvc2.event(() => {
2102
+ gvc2.closeDialog();
2103
+ }),
2104
+ BgWidget.save(
2105
+ gvc2.event(() => {
2106
+ StockStores.verifyStoreForm(glitter, 'create', newStoreData, response => {
2107
+ gvc2.closeDialog();
2108
+ vm.data.content.store_in = response.id;
2109
+ loading = true;
2110
+ gvc.notifyDataChange(id);
2111
+ });
2112
+ }),
2113
+ '完成'
2114
+ )
2115
+ ),
2116
+ ].join('');
2103
2117
  },
2104
2118
  });
2105
2119
  },
@@ -2107,7 +2121,6 @@ export class StockHistory {
2107
2121
  });
2108
2122
  }
2109
2123
  },
2110
- divCreate: {},
2111
2124
  onCreate: () => {
2112
2125
  if (loading) {
2113
2126
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd: any) => {
@@ -2175,7 +2188,6 @@ export class StockHistory {
2175
2188
  });
2176
2189
  }
2177
2190
  },
2178
- divCreate: {},
2179
2191
  onCreate: () => {
2180
2192
  if (loading) {
2181
2193
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd: any) => {
@@ -2236,7 +2248,6 @@ export class StockHistory {
2236
2248
  });
2237
2249
  }
2238
2250
  },
2239
- divCreate: {},
2240
2251
  onCreate: () => {
2241
2252
  if (loading) {
2242
2253
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd: any) => {
@@ -2306,7 +2317,6 @@ export class StockHistory {
2306
2317
  });
2307
2318
  }
2308
2319
  },
2309
- divCreate: {},
2310
2320
  onCreate: () => {
2311
2321
  if (loading) {
2312
2322
  ApiUser.getPublicConfig('store_manager', 'manager').then((dd: any) => {
@@ -3445,7 +3455,6 @@ export class StockHistory {
3445
3455
  let product_list = data.content.product_list;
3446
3456
  if (ids.length === 0) {
3447
3457
  callback([]);
3448
- // callback(product_list);
3449
3458
  return;
3450
3459
  }
3451
3460
 
@@ -5,8 +5,8 @@ import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
5
5
  import { FilterOptions } from './filter-options.js';
6
6
  import { ApiUser } from '../glitter-base/route/user.js';
7
7
  import { CheckInput } from '../modules/checkInput.js';
8
- import { Tool } from '../modules/tool.js';
9
8
  import { TableStorage } from './module/table-storage.js';
9
+ import { VendorExcel } from './module/vendor-excel.js';
10
10
  const html = String.raw;
11
11
  export class StockVendors {
12
12
  static main(gvc) {
@@ -62,7 +62,7 @@ export class StockVendors {
62
62
  },
63
63
  {
64
64
  key: '聯絡人姓名',
65
- value: `<span class="fs-7">${dd.manager_name}</span>`,
65
+ value: `<span class="fs-7">${dd.manager_name || '(尚未填寫)'}</span>`,
66
66
  },
67
67
  ];
68
68
  });
@@ -70,9 +70,15 @@ export class StockVendors {
70
70
  return BgWidget.container(html ` <div class="title-container">
71
71
  ${BgWidget.title('供應商管理')}
72
72
  <div class="flex-fill"></div>
73
- ${BgWidget.grayButton('新增供應商', gvc.event(() => {
74
- vm.type = 'create';
75
- }))}
73
+ <div class="d-flex align-items-center gap-2">
74
+ ${[
75
+ BgWidget.grayButton('匯入', gvc.event(() => VendorExcel.importDialog(gvc, () => gvc.notifyDataChange(vm.id)))),
76
+ BgWidget.grayButton('匯出', gvc.event(() => VendorExcel.exportDialog(gvc))),
77
+ BgWidget.grayButton('新增供應商', gvc.event(() => {
78
+ vm.type = 'create';
79
+ })),
80
+ ].join('')}
81
+ </div>
76
82
  </div>
77
83
  ${BgWidget.container(BgWidget.mainCard([
78
84
  (() => {
@@ -289,13 +295,6 @@ export class StockVendors {
289
295
  });
290
296
  });
291
297
  }
292
- static getNewID(list) {
293
- let newId;
294
- do {
295
- newId = `vendor_${Tool.randomString(6)}`;
296
- } while (list.some((item) => item.id === newId));
297
- return newId;
298
- }
299
298
  static verifyStoreForm(glitter, type, data, callback) {
300
299
  const dialog = new ShareDialog(glitter);
301
300
  if (CheckInput.isEmpty(data.name)) {
@@ -314,6 +313,12 @@ export class StockVendors {
314
313
  this.getPublicData().then((vendors) => {
315
314
  var _a;
316
315
  vendors.list = (_a = vendors.list) !== null && _a !== void 0 ? _a : [];
316
+ const find_vendor = vendors.list.find((item) => item.name === data.name);
317
+ if (find_vendor && find_vendor.id !== data.id) {
318
+ dialog.dataLoading({ visible: false });
319
+ dialog.infoMessage({ text: `供應商「${data.name}」已存在` });
320
+ return;
321
+ }
317
322
  if (type === 'replace') {
318
323
  const vendor = vendors.list.find((item) => item.id === data.id);
319
324
  if (vendor) {
@@ -321,7 +326,7 @@ export class StockVendors {
321
326
  }
322
327
  }
323
328
  else {
324
- data.id = this.getNewID(vendors.list);
329
+ data.id = VendorExcel.getNewID(vendors.list);
325
330
  vendors.list.push(data);
326
331
  }
327
332
  ApiUser.setPublicConfig({
@@ -8,6 +8,7 @@ import { ApiUser } from '../glitter-base/route/user.js';
8
8
  import { CheckInput } from '../modules/checkInput.js';
9
9
  import { Tool } from '../modules/tool.js';
10
10
  import { TableStorage } from './module/table-storage.js';
11
+ import { VendorExcel } from './module/vendor-excel.js';
11
12
 
12
13
  const html = String.raw;
13
14
 
@@ -106,7 +107,7 @@ export class StockVendors {
106
107
  },
107
108
  {
108
109
  key: '聯絡人姓名',
109
- value: `<span class="fs-7">${dd.manager_name}</span>`,
110
+ value: `<span class="fs-7">${dd.manager_name || '(尚未填寫)'}</span>`,
110
111
  },
111
112
  ];
112
113
  });
@@ -116,12 +117,24 @@ export class StockVendors {
116
117
  html` <div class="title-container">
117
118
  ${BgWidget.title('供應商管理')}
118
119
  <div class="flex-fill"></div>
119
- ${BgWidget.grayButton(
120
- '新增供應商',
121
- gvc.event(() => {
122
- vm.type = 'create';
123
- })
124
- )}
120
+ <div class="d-flex align-items-center gap-2">
121
+ ${[
122
+ BgWidget.grayButton(
123
+ '匯入',
124
+ gvc.event(() => VendorExcel.importDialog(gvc, () => gvc.notifyDataChange(vm.id)))
125
+ ),
126
+ BgWidget.grayButton(
127
+ '匯出',
128
+ gvc.event(() => VendorExcel.exportDialog(gvc))
129
+ ),
130
+ BgWidget.grayButton(
131
+ '新增供應商',
132
+ gvc.event(() => {
133
+ vm.type = 'create';
134
+ })
135
+ ),
136
+ ].join('')}
137
+ </div>
125
138
  </div>
126
139
  ${BgWidget.container(
127
140
  BgWidget.mainCard(
@@ -177,6 +190,7 @@ export class StockVendors {
177
190
  return vm.query === '' || item.name.includes(vm.query);
178
191
  });
179
192
  vm.dataList = data.list;
193
+
180
194
  vmi.pageSize = Math.ceil(data.list.length / vm.listLimit);
181
195
  vmi.originalData = vm.dataList;
182
196
  vmi.tableData = getDatalist();
@@ -363,14 +377,6 @@ export class StockVendors {
363
377
  });
364
378
  }
365
379
 
366
- static getNewID(list: VendorData[]) {
367
- let newId: string;
368
- do {
369
- newId = `vendor_${Tool.randomString(6)}`;
370
- } while (list.some((item: VendorData) => item.id === newId));
371
- return newId;
372
- }
373
-
374
380
  static verifyStoreForm(
375
381
  glitter: any,
376
382
  type: 'create' | 'replace',
@@ -378,6 +384,7 @@ export class StockVendors {
378
384
  callback: (data: any) => void
379
385
  ): void {
380
386
  const dialog = new ShareDialog(glitter);
387
+
381
388
  // 名稱未填寫驗證
382
389
  if (CheckInput.isEmpty(data.name)) {
383
390
  dialog.infoMessage({ text: '供應商名稱不得為空白' });
@@ -400,13 +407,21 @@ export class StockVendors {
400
407
  this.getPublicData().then((vendors: any) => {
401
408
  vendors.list = vendors.list ?? [];
402
409
 
410
+ // 名稱未填寫驗證
411
+ const find_vendor = vendors.list.find((item: VendorData) => item.name === data.name);
412
+ if (find_vendor && find_vendor.id !== data.id) {
413
+ dialog.dataLoading({ visible: false });
414
+ dialog.infoMessage({ text: `供應商「${data.name}」已存在` });
415
+ return;
416
+ }
417
+
403
418
  if (type === 'replace') {
404
419
  const vendor = vendors.list.find((item: VendorData) => item.id === data.id);
405
420
  if (vendor) {
406
421
  Object.assign(vendor, data);
407
422
  }
408
423
  } else {
409
- data.id = this.getNewID(vendors.list);
424
+ data.id = VendorExcel.getNewID(vendors.list);
410
425
  vendors.list.push(data);
411
426
  }
412
427
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-glitter",
3
- "version": "21.4.4",
3
+ "version": "21.4.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,6 +24,9 @@ const invoice_js_1 = require("./invoice.js");
24
24
  const process_1 = __importDefault(require("process"));
25
25
  class Schedule {
26
26
  async preload(app) {
27
+ if (app === 'shopnex') {
28
+ return true;
29
+ }
27
30
  const brand_type = await app_js_1.App.checkBrandAndMemberType(app);
28
31
  if ((brand_type.brand === 'shopnex' && brand_type.domain) || (app === 'shopnex')) {
29
32
  if (!(await this.isDatabasePass(app)))
@@ -429,7 +432,9 @@ class Schedule {
429
432
  main() {
430
433
  const scheduleList = config_1.ConfigSetting.is_local
431
434
  ?
432
- []
435
+ [
436
+ { second: 60 * 5, status: true, func: 'visitLogs', desc: '更新每天造訪人數' }
437
+ ]
433
438
  :
434
439
  [
435
440
  { second: 3600, status: true, func: 'birthRebate', desc: '生日禮發放購物金' },