jufubao-admin-library 1.0.0-beta1

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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/library/gulpfile.js/const.js +51 -0
  4. package/library/gulpfile.js/index.js +237 -0
  5. package/library/gulpfile.js/util.js +114 -0
  6. package/library/viewModules/config.js +75 -0
  7. package/library/viewModules/viewStat/router/supplierStat.js +33 -0
  8. package/library/viewModules/viewStat/schemas/supplier.stat.js +70 -0
  9. package/library/viewModules/viewStat/schemas.js +18 -0
  10. package/library/viewModules/viewStat/viewsStat/index/components/stat-all.vue +233 -0
  11. package/library/viewModules/viewStat/viewsStat/index/components/stat-product.vue +129 -0
  12. package/library/viewModules/viewStat/viewsStat/index/components/stat-supplier.vue +124 -0
  13. package/library/viewModules/viewStat/viewsStat/index/components/table-category.vue +309 -0
  14. package/library/viewModules/viewStat/viewsStat/index/components/table-product.vue +316 -0
  15. package/library/viewModules/viewStat/viewsStat/index/components/table-supplier.vue +276 -0
  16. package/library/viewModules/viewStat/viewsStat/index/index.vue +117 -0
  17. package/library/viewModules/viewTask/router/tasks.js +34 -0
  18. package/library/viewModules/viewTask/schemas/tasks.js +52 -0
  19. package/library/viewModules/viewTask/viewTask/list.vue +195 -0
  20. package/library/viewModules/viewsEnterpriseBuy/router/enterprise_buy.js +91 -0
  21. package/library/viewModules/viewsEnterpriseBuy/schemas/enterprise_buy.js +420 -0
  22. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/compontents/OrderInfoButton.vue +550 -0
  23. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/compontents/cardList.vue +119 -0
  24. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/compontents/expressCopy.vue +259 -0
  25. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/compontents/operateHistory.vue +164 -0
  26. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/compontents/send_list.vue +395 -0
  27. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/compontents/storeList.vue +100 -0
  28. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/compontents/workHistory.vue +163 -0
  29. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/detail.vue +503 -0
  30. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/list.vue +635 -0
  31. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/order_detail.vue +860 -0
  32. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/set_create.vue +219 -0
  33. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/set_list.vue +237 -0
  34. package/library/viewModules/viewsEnterpriseBuy/viewsEnterpriseBuy/table-card.vue +180 -0
  35. package/library/viewModules/viewsFinance/router/balance.js +75 -0
  36. package/library/viewModules/viewsFinance/router/finance.js +30 -0
  37. package/library/viewModules/viewsFinance/schemas/trade.record.js +153 -0
  38. package/library/viewModules/viewsFinance/schemas/wallet.js +116 -0
  39. package/library/viewModules/viewsFinance/viewsFinance/balance/components/listChannel.vue +220 -0
  40. package/library/viewModules/viewsFinance/viewsFinance/balance/components/listOpenapi.vue +260 -0
  41. package/library/viewModules/viewsFinance/viewsFinance/balance/components/listPartner.vue +217 -0
  42. package/library/viewModules/viewsFinance/viewsFinance/balance/components/listSupplier.vue +229 -0
  43. package/library/viewModules/viewsFinance/viewsFinance/balance/detail_channel.vue +401 -0
  44. package/library/viewModules/viewsFinance/viewsFinance/balance/detail_openapi.vue +364 -0
  45. package/library/viewModules/viewsFinance/viewsFinance/balance/detail_partner.vue +633 -0
  46. package/library/viewModules/viewsFinance/viewsFinance/balance/detail_supplier.vue +417 -0
  47. package/library/viewModules/viewsFinance/viewsFinance/balance/list.vue +75 -0
  48. package/library/viewModules/viewsFinance/viewsFinance/index.vue +191 -0
  49. package/library/viewModules/viewsLimit/router/buyLimit/buyLimit.js +31 -0
  50. package/library/viewModules/viewsLimit/schemas/buyLimit.js +22 -0
  51. package/library/viewModules/viewsLimit/viewsLimit/index.vue +211 -0
  52. package/package.json +114 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017-present PanJiaChen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # vue-admin-template
2
+
3
+ English | [简体中文](./README-zh.md)
4
+
5
+ > A minimal vue admin template with Element UI & axios & iconfont & permission control & lint
6
+
7
+ **Live demo:** http://panjiachen.github.io/vue-admin-template
8
+
9
+
10
+ **The current version is `v4.0+` build on `vue-cli`. If you want to use the old version , you can switch branch to [tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0), it does not rely on `vue-cli`**
11
+
12
+ ## Build Setup
13
+
14
+ ```bash
15
+ # clone the project
16
+ git clone https://github.com/PanJiaChen/vue-admin-template.git
17
+
18
+ # enter the project directory
19
+ cd vue-admin-template
20
+
21
+ # install dependency
22
+ npm install
23
+
24
+ # develop
25
+ npm run dev
26
+ ```
27
+
28
+ This will automatically open http://localhost:9528
29
+
30
+ ## Build
31
+
32
+ ```bash
33
+ # build for test environment
34
+ npm run build:stage
35
+
36
+ # build for production environment
37
+ npm run build:prod
38
+ ```
39
+
40
+ ## Advanced
41
+
42
+ ```bash
43
+ # preview the release environment effect
44
+ npm run preview
45
+
46
+ # preview the release environment effect + static resource analysis
47
+ npm run preview -- --report
48
+
49
+ # code format check
50
+ npm run lint
51
+
52
+ # code format check and auto fix
53
+ npm run lint -- --fix
54
+ ```
55
+
56
+ Refer to [Documentation](https://panjiachen.github.io/vue-element-admin-site/guide/essentials/deploy.html) for more information
57
+
58
+ ## Demo
59
+
60
+ ![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif)
61
+
62
+ ## Extra
63
+
64
+ If you want router permission && generate menu by user roles , you can use this branch [permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control)
65
+
66
+ For `typescript` version, you can use [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template) (Credits: [@Armour](https://github.com/Armour))
67
+
68
+ ## Related Project
69
+
70
+ - [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
71
+
72
+ - [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
73
+
74
+ - [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template)
75
+
76
+ - [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
77
+
78
+ ## Browsers support
79
+
80
+ Modern browsers and Internet Explorer 10+.
81
+
82
+ | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari |
83
+ | --------- | --------- | --------- | --------- |
84
+ | IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions
85
+
86
+ ## License
87
+
88
+ [MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license.
89
+
90
+ Copyright (c) 2017-present PanJiaChen
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ const fileHelper = require('./../build/fileHepler');
4
+ const basePath = require('./../build/path');
5
+ const clog = require('./../build/clog');
6
+ const os = require('os');
7
+
8
+
9
+ let SRC_ROOT_PATH = ''
10
+ let configPath = `${basePath.rootDir}/gulp.config.js`;
11
+ let modelData = [];
12
+ let name = []
13
+
14
+ //检查配置文件是否存在
15
+ if(!fileHelper.existFileSync(configPath)) {
16
+ modelData = []
17
+ }
18
+ else{
19
+ let config = require(configPath);
20
+
21
+ //非打包模式
22
+ if(config.src && fileHelper.existFileSync(config.src)) SRC_ROOT_PATH = config.src;
23
+ else {
24
+ SRC_ROOT_PATH = basePath.rootDir + '/node_modules/gxd-vue-library/src/'
25
+ }
26
+
27
+ //打包模式
28
+ if(process.env.type === 'build') {
29
+ SRC_ROOT_PATH = basePath.rootDir + '/node_modules/gxd-vue-library/src/'
30
+ }
31
+
32
+ modelData = config.schemas.filter(item=>{
33
+ return item.STATUS
34
+ }).map(item=>{
35
+ name.push(item.DEST_PAGE_PATH)
36
+ return {
37
+ NAME: item.NAME,
38
+ API_APP: item.API_APP, // 项目API目录 /${API_APP}/v1/supplier-stat/total-counts
39
+ SRC_ROOT_PATH: fileHelper.getPlatformSurePath(`${SRC_ROOT_PATH}/${item.PACK_MODULE_DIR}`),
40
+ DEST_PAGE_PATH: item.DEST_PAGE_PATH, // 项目页面目录
41
+ DEST_ROOT_PATH: "src", // 项目根目录
42
+ replaceOptionServer: item.replaceOptionServer, // 替换选项卡 fn: server
43
+ ROUTE_TO_CHILDREN:item.ROUTE_TO_CHILDREN || false,
44
+ }
45
+ })
46
+
47
+ }
48
+ if(modelData.length >0 ) {
49
+ clog(`已安装模块:${os.EOL}【${name.join('】【')}】${os.EOL}`, 'green')
50
+ }
51
+ module.exports = modelData;
@@ -0,0 +1,237 @@
1
+ const { series, parallel, src, dest, watch } = require('gulp');
2
+ const replace = require('gulp-replace');
3
+ const through2 = require('through2');
4
+ const requireFromString = require('require-from-string');
5
+ const exec = require('child_process').exec;
6
+ const del = require('del');
7
+ const { handleGitIgnore, replaceServerFromTxt, replacePlatformCode } = require("./util");
8
+ const clog = require('./../build/clog');
9
+ const os = require('os');
10
+ const moduleArr = require("./const");
11
+ const execSync = require('child_process').execSync;
12
+ const setting = require("./../settings");
13
+ const utils = require('./../build/lib/utils');
14
+
15
+ //无任务
16
+ if(moduleArr.length === 0) {
17
+ clog(`${os.EOL}当前次无安装模块任务${os.EOL}`,'green');
18
+ execSync('npm run coder', {stdio: 'inherit'});
19
+ process.exit(0);
20
+ }
21
+
22
+ let src_dest_map = {};
23
+ let src_root_path_view = [];
24
+ let src_root_path_schema = [];
25
+ let src_root_path_router = [];
26
+ // let replaceOptionServer = [];
27
+ let DEST_PAGE_PATH = [];
28
+ if(!Array.isArray(moduleArr)){ moduleArr = [moduleArr]}
29
+
30
+ moduleArr.forEach(item => {
31
+ let srcPageBaseURL = item.SRC_ROOT_PATH + "/" + item.DEST_PAGE_PATH;
32
+ let destPageBaseUrl = item.DEST_ROOT_PATH + "/" + item.DEST_PAGE_PATH;
33
+ src_dest_map[srcPageBaseURL] = destPageBaseUrl;
34
+ src_root_path_view.push(item.SRC_ROOT_PATH + "/" + item.DEST_PAGE_PATH + "/**/*.vue");
35
+ src_root_path_schema.push(item.SRC_ROOT_PATH + "/schemas/*.js");
36
+ src_root_path_router.push(item.SRC_ROOT_PATH + "/router/**/*.js");
37
+ // replaceOptionServer.push(item.replaceOptionServer);
38
+ DEST_PAGE_PATH.push(item.DEST_PAGE_PATH)
39
+ })
40
+ // const src_root_path_schema = SRC_ROOT_PATH + "/schemas/*.js";
41
+ // const src_root_path_view = SRC_ROOT_PATH + `/${DEST_PAGE_PATH}/**/*.vue`;
42
+ // const src_root_path_router = SRC_ROOT_PATH + "/router/*.js";
43
+
44
+ const schemasGitIgnorePath = "./schemas/.gitignore";
45
+ const gitIgnorePath = "./.gitignore";
46
+ const routerGitIgnorePath = "./src/router/modules/.gitignore";
47
+
48
+ let argv = process.argv.slice(2);
49
+ let addIgnore = argv.filter(item => item.startsWith("-ignore"))[0];
50
+
51
+ /**
52
+ * Handles the schema files.
53
+ *
54
+ * @returns {Promise<void>} A promise that resolves when the schema files are handled.
55
+ */
56
+ async function handleSchema() {
57
+ let ignoreArr = []; // Array to store the ignored file names
58
+ clog(`当前处理schema${JSON.stringify(src_root_path_schema)}`,'green');
59
+ if(src_root_path_schema.length === 0) return Promise.resolve();
60
+
61
+ return src(src_root_path_schema) // Get the schema files
62
+ .pipe(through2.obj(function (file, _, cb) {
63
+ const fileName = file.history[0].split("\\").pop().split("/").pop();
64
+ ignoreArr.push(fileName); // Add the file name to the ignore array
65
+ if(file.isBuffer()){
66
+ let code = file.contents.toString();
67
+ let tempStr = replacePlatformCode(code, setting.system);
68
+ file.contents = Buffer.from(tempStr);
69
+ }
70
+ cb(null, file);
71
+ }))
72
+ .pipe(replace(/\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g, function(match, p1, offset, string){
73
+ let file = this.file;
74
+ let curModule = moduleArr.find(item => file.base.indexOf(item.SRC_ROOT_PATH) !== -1);
75
+
76
+ //@@@.@@@@.XXX_BBB_CCC
77
+ var reg = new RegExp(`['"]?role['"]?:\\s?['"](\\S*\\.)?(\\S*\\.)([\\w]*)['"]`, "g")
78
+ if (reg.test(match)) {
79
+ match = match.replace(reg, function (match, p1, p2, p3) {
80
+ return `role: "${p1 ? setting.system.toUpperCase() + "." : ""}${curModule.API_APP.toUpperCase()}.${p3}"`
81
+ })
82
+ }
83
+ if (/isPublic:\s?true/.test(match)) {
84
+ return match
85
+ }
86
+ match = match.replace(/['"]?path['"]?:\s?['"]\/\S*\/v1\/(\S*)['"]/, `path: "/${curModule.API_APP}/v1/$1"`);
87
+ return match;
88
+ }))
89
+
90
+ //美化代码
91
+ .pipe(through2.obj(function (file, _, cb){
92
+ if(file.isBuffer()){
93
+ let code = utils.beautifyFile(file.contents.toString(),'js_beautify');
94
+ //console.log(code);
95
+ file.contents = Buffer.from(code);
96
+ }
97
+ cb(null, file);
98
+
99
+ }))
100
+ .pipe(dest("schemas")) // Write the modified files to the "schemas" directory
101
+ .on("end", async () => {
102
+ if(addIgnore){
103
+ // Handle the gitignore file with the ignored file names
104
+ await handleGitIgnore(schemasGitIgnorePath, ignoreArr);
105
+ }
106
+
107
+ //执行npm run coder
108
+ exec("npm run coder", function (err, stdout, stderr) {
109
+ if (err) {
110
+ console.log(err);
111
+ } else {
112
+ console.log(stdout);
113
+ }
114
+ })
115
+ });
116
+ }
117
+
118
+
119
+ //替换module/view目录下的vue文件
120
+ async function handlePage(){
121
+ clog(`当前处理page${JSON.stringify(src_root_path_view)}`,'green');
122
+ if(src_root_path_view.length === 0) return Promise.resolve();
123
+ return src(src_root_path_view)
124
+ .pipe(through2.obj(function(file, _, cb){
125
+ if(file.isBuffer){
126
+ let code = file.contents.toString();
127
+ let tempStr = replacePlatformCode(code, setting.system);
128
+ file.contents = Buffer.from(tempStr);
129
+ }
130
+ cb(null, file);
131
+ }))
132
+ .pipe(replace(/getOptions\(([\s\S]*?)\)/g, function(match, p1, offset, string){
133
+ let file = this.file;
134
+ let curModule = moduleArr.find(item => file.base.indexOf(item.SRC_ROOT_PATH) !== -1);
135
+ replaceOptionServer = curModule.replaceOptionServer;
136
+ let result = replaceServerFromTxt(p1, replaceOptionServer);
137
+ // console.log(result);
138
+ return `getOptions(${result})`;
139
+ }))
140
+ .pipe(dest(function(file){
141
+ return src_dest_map[file.base];
142
+ }))
143
+ .on("end", async () => {
144
+ if(addIgnore){
145
+ await handleGitIgnore(gitIgnorePath, DEST_PAGE_PATH);
146
+ }
147
+ });
148
+ }
149
+
150
+ //替换module/router目录下的js文件
151
+ async function handleRouter(){
152
+ clog(`当前处理router${JSON.stringify(src_root_path_router)}`,'green');
153
+ if(src_root_path_router.length === 0) return Promise.resolve();
154
+ let ignoreArr = [];
155
+ return src(src_root_path_router)
156
+ .pipe(through2.obj(function(file, _, cb){
157
+ const fileName = file.history[0].split("\\").pop().split("/").pop();
158
+ let index = moduleArr.findIndex(item => file.base.indexOf(item.SRC_ROOT_PATH) !== -1);
159
+ ignoreArr.push(fileName);
160
+ if(file.isBuffer()){
161
+ let code = file.contents.toString();
162
+ //子路由处理
163
+ if(moduleArr[index].ROUTE_TO_CHILDREN){
164
+ let regMixin = /(sort([\s\S]*?):)([\s\S]*?)(,)+?/;
165
+ const matchArr = code.match(regMixin)
166
+ //替换布局文件
167
+ code = code.replace('@/layout', '@/views/children');
168
+ //替换(sort: 999,)
169
+ code = code.replace(matchArr[0],'\t');
170
+ }
171
+ let tempStr = replacePlatformCode(code, setting.system, moduleArr[index].ROUTE_TO_CHILDREN || false);
172
+ file.contents = Buffer.from(tempStr);
173
+ }
174
+ cb(null, file)
175
+ }))
176
+ .pipe(dest(function(file){
177
+ let index = moduleArr.findIndex(item => file.base.indexOf(item.SRC_ROOT_PATH) !== -1);
178
+ //生成子目录
179
+ if(moduleArr[index].ROUTE_TO_CHILDREN) {
180
+ const baseName = file.basename.split('.');
181
+ const name = baseName[0].slice(0,1).toUpperCase() + baseName[0].slice(1);
182
+ return moduleArr[index].DEST_ROOT_PATH + `/router/modules/route${name}`
183
+ }
184
+ return moduleArr[index].DEST_ROOT_PATH + "/router/modules"
185
+ }))
186
+ .on("end", async () => {
187
+ if(addIgnore){
188
+ await handleGitIgnore(routerGitIgnorePath, ignoreArr);
189
+ }
190
+ });
191
+ }
192
+
193
+ function openWatch(){
194
+ console.log("当前监听文件", src_root_path_view, src_root_path_schema, src_root_path_router)
195
+ watch(src_root_path_schema, handleSchema);
196
+ watch(src_root_path_view, handlePage);
197
+ watch(src_root_path_router, handleRouter);
198
+ }
199
+
200
+ function uninstall(cb){
201
+ //获取命令行参数module的值 gulp uninstall --m=supplier
202
+ let argv = process.argv.slice(2);
203
+ let module = argv.filter(item => item.startsWith("-m="))[0].split("=")[1];
204
+ let index = moduleArr.findIndex(item => item.NAME === module);
205
+ if(index === -1) {
206
+ console.log("未找到模块", module);
207
+ cb();
208
+ return;
209
+ }
210
+ let curModule = moduleArr[index];
211
+ var fileArr = [];
212
+ src(curModule.SRC_ROOT_PATH + "/router/*.js")
213
+ .pipe(through2.obj(function(file, _, cb){
214
+ //获取fileName
215
+ const fileName = file.history[0].split("\\").pop().split("/").pop();
216
+ if(curModule.ROUTE_TO_CHILDREN) {
217
+ const baseName = file.basename.split('.');
218
+ const name = baseName[0].slice(0,1).toUpperCase() + baseName[0].slice(1);
219
+ fileArr.push(curModule.DEST_ROOT_PATH + `/router/modules/route${name}/${fileName}`);
220
+ }
221
+ else {
222
+ fileArr.push(curModule.DEST_ROOT_PATH + "/router/modules/" + fileName);
223
+ }
224
+ console.log("删除路由文件", fileArr);
225
+ del(fileArr, {force: true});
226
+ cb();
227
+ }))
228
+ cb();
229
+ }
230
+
231
+ //gulp -ignore //添加忽略文件
232
+ exports.openWatch = openWatch;
233
+ exports.handlePage = handlePage;
234
+ exports.handleRouter = handleRouter;
235
+ exports.handleSchema = handleSchema;
236
+ exports.default = parallel(handlePage, handleSchema, handleRouter);
237
+ exports.uninstall = uninstall;
@@ -0,0 +1,114 @@
1
+ const fs = require("fs");
2
+
3
+ /**
4
+ * Handles the .gitignore file by appending new entries if they don't already exist.
5
+ * @param {string} ignorePath - The path to the .gitignore file.
6
+ * @param {Array<string>} ignoreArr - An array of entries to add to the .gitignore file.
7
+ */
8
+ async function handleGitIgnore(ignorePath, ignoreArr) {
9
+ console.log("handleGitIgnore", ignorePath, ignoreArr);
10
+ if (!fs.existsSync(ignorePath)) {
11
+ // If the .gitignore file doesn't exist, create it and add all the entries from ignoreArr
12
+ fs.appendFileSync(ignorePath, `\n${ignoreArr.join("\n")}\n`);
13
+ } else {
14
+ const schemasGitIgnoreContent = fs.readFileSync(ignorePath).toString();
15
+ // Check if each entry in ignoreArr exists in the .gitignore file
16
+ ignoreArr.forEach(item => {
17
+ if (!schemasGitIgnoreContent.includes(item)) {
18
+ // If an entry doesn't exist, append it to the .gitignore file
19
+ fs.appendFileSync(ignorePath, `\n${item}`);
20
+ }
21
+ });
22
+ }
23
+ return Promise.resolve();
24
+ }
25
+
26
+ /**
27
+ * 找到fn对应的server,并替换
28
+ */
29
+ function replaceServerFromTxt(txt, replaceStr){
30
+ /**
31
+ \{ 匹配左大括号 {。
32
+ ([^{}]*(?:\{[^{}]*\}[^{}]*)*) 是一个捕获组,它包含两个部分:
33
+ [^{}]* 匹配任意个不是大括号的字符。
34
+ (?:\{[^{}]*\}[^{}]*)* 是一个非捕获组,表示可以重复匹配大括号内的内容,直到遇到下一个右大括号 }。
35
+ \} 匹配右大括号 }。
36
+ */
37
+ let regex = /\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g;
38
+ var result = txt.replace(regex, function(match, p1){
39
+ for(var key in replaceStr){
40
+ var reg = new RegExp(`fn:\\s?['"]${key}['"]`, "g");
41
+ if(reg.test(match)){
42
+ match = match.replace(/server:\s?['"][\w-]*['"]/, `server: '${replaceStr[key]}'`);
43
+ break;
44
+ }
45
+ }
46
+ return match;
47
+ });
48
+ return result;
49
+ }
50
+
51
+ /**
52
+ * 找到文本中匹配的内容,根据平台判断匹配则保留否则删除内容
53
+ * 用(// #ifdef platform 内容 // #endif)定位匹配的内容
54
+ * @param {*} txt 文件文本内容
55
+ * @param {*} platform 平台
56
+ * @returns
57
+ */
58
+ function replacePlatformCode1(txt, platform){
59
+ const regex = new RegExp(`\/\/\\s?#ifdef\\s?(.*?)\\n([\\s\\S]*?)\/\/\\s?#endif\\n`, "g");
60
+ const result = txt.replace(regex, function(match, p1, p2){
61
+ //p1是匹配的平台,p2是匹配的内容
62
+ //如果匹配的模板包含temp, 则返回匹配的内容,否则返回空
63
+ if(p1.split(" ").includes(platform)) return p2;
64
+ return "";
65
+ });
66
+ return result;
67
+ }
68
+ /**
69
+ * 找到文本中匹配的内容,根据平台判断匹配则保留否则删除内容
70
+ * 用(<!-- #ifdef platform --> 内容 <!-- #endif -->)定位匹配的内容
71
+ * @param {*} txt 文件文本内容
72
+ * @param {*} platform 平台
73
+ * @returns
74
+ */
75
+ function replacePlatformCode2(txt, platform){
76
+ const regex = new RegExp(`<!--\\s?#ifdef\\s?(.*?)-->([\\s\\S]*?)<!--\\s?#endif\\s?-->`, "g");
77
+ const result = txt.replace(regex, function(match, p1, p2){
78
+ //p1是匹配的平台,p2是匹配的内容
79
+ //如果匹配的模板包含temp, 则返回匹配的内容,否则返回空
80
+ if(p1.split(" ").includes(platform)) return p2;
81
+ return "";
82
+ })
83
+ return result;
84
+ }
85
+
86
+ function replacePlatformCode(txt, platform){
87
+ const regex = new RegExp(`\/\/\\s?#if(n?)def\\s?(.*?)\\n([\\s\\S]*?)\/\/\\s?#endif\\n|<!--\\s?#if(n?)def\\s?(.*?)-->([\\s\\S]*?)<!--\\s?#endif\\s?-->`, "g");
88
+ const result = txt.replace(regex, function(match, flag1, platform1, cont1, flag2, platform2, cont2){
89
+ let flag = flag1 || flag2;
90
+ let p = platform1 || platform2;
91
+ let cont = cont1 || cont2;
92
+ // console.log(flag);
93
+ // console.log(p);
94
+ // console.log(cont);
95
+ // console.log("-----------")
96
+ //如果匹配的模板包含platform, 则返回匹配的内容,否则返回空
97
+ //如果flag为n则取反
98
+ //p转换小写
99
+ p = p.toLowerCase();
100
+ if(flag === "n") {
101
+ if(!p.split(" ").includes(platform)) return cont;
102
+ } else {
103
+ if(p.split(" ").includes(platform)) return cont;
104
+ }
105
+ return "";
106
+ })
107
+ return result;
108
+ }
109
+
110
+ module.exports = {
111
+ handleGitIgnore,
112
+ replaceServerFromTxt,
113
+ replacePlatformCode
114
+ }
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ //开发模式设置插件库路径
5
+ src: '/Users/shiyonggao/Desktop/code/BASE/PACKAGE/PC-ADMIN/xd-vue-package/src',
6
+ schemas:[
7
+ {
8
+ NAME: "buyLimit", //模块名称:限购
9
+ STATUS: true, //是否启用
10
+ PACK_MODULE_DIR: 'viewModules/viewsLimit',//插件库中模块目录
11
+ //smsbuylimit-partner,smsbuylimit-admin(客服,超管,限购项目)
12
+ API_APP: "smsbuylimit-partner", // 项目API目录 /${API_APP}/v1/supplier-stat/total-counts
13
+ DEST_PAGE_PATH: "viewsLimit", // 项目页面目录
14
+ DEST_ROOT_PATH: "src", // 项目根目录
15
+ replaceOptionServer: { // 替换选项卡 fn: server
16
+ "supplier": "supplier-partner",
17
+ "categories": "product-partner",
18
+ "business-line":"partner", //partner,partner-admin
19
+ }
20
+ },
21
+ {
22
+ NAME: "enterprise", //模块名称: 集采模块
23
+ STATUS: true, //是否启用
24
+ PACK_MODULE_DIR: 'viewModules/viewsEnterpriseBuy',//插件库中模块目录
25
+ //wholesale-partner,wholesale-admin(设计到超管,加盟商-集采,加盟商-财务)
26
+ API_APP: "wholesale-partner", // 项目API目录 /${API_APP}/v1/supplier-stat/total-counts
27
+ DEST_PAGE_PATH: "viewsEnterpriseBuy", // 项目页面目录
28
+ DEST_ROOT_PATH: "src", // 项目根目录
29
+ replaceOptionServer: { // 替换选项卡 fn: server
30
+
31
+ }
32
+ },
33
+ {
34
+ NAME: "finance", //模块名称:财务
35
+ STATUS: true, //是否启用
36
+ PACK_MODULE_DIR: 'viewModules/viewsFinance',//插件库中模块目录
37
+ //finance-partner(加盟商-财务)
38
+ API_APP: "finance-partner", // 项目API目录 /${API_APP}/v1/supplier-stat/total-counts
39
+ DEST_PAGE_PATH: "viewsFinance", // 项目页面目录
40
+ DEST_ROOT_PATH: "src", // 项目根目录
41
+ replaceOptionServer: { // 替换选项卡 fn: server
42
+ "supplier": "supplier-partner",
43
+ "categories": "product-partner",
44
+ }
45
+ },
46
+ {
47
+ NAME: "stat", //模块名称: 统计
48
+ STATUS: true,
49
+ PACK_MODULE_DIR: 'viewModules/viewStat',//插件库中模块目录
50
+ //stat-partner(加盟商-统计)
51
+ API_APP: "stat-partner", // 项目API目录 /${API_APP}/v1/supplier-stat/total-counts
52
+ DEST_PAGE_PATH: "viewsStat", // 项目页面目录
53
+ DEST_ROOT_PATH: "src", // 项目根目录
54
+ replaceOptionServer: { // 替换选项卡 fn: server
55
+ "supplier": "supplier-admin",
56
+ "categories": "product-admin",
57
+ }
58
+ },
59
+ {
60
+ NAME: "TASK", //模块名称: 任务管理
61
+ STATUS: true,
62
+ //export-partner, export-supplier, export-admin
63
+ // (加盟商-统计,加盟商-财务 , 加盟商,商城,电影,礼包,供货商,超管(未启用))
64
+ PACK_MODULE_DIR: 'viewModules/viewTask',
65
+ API_APP: "export-partner",
66
+ DEST_PAGE_PATH: "viewTask",
67
+ DEST_ROOT_PATH: "src",
68
+ replaceOptionServer: {
69
+
70
+ }
71
+ }
72
+ ]
73
+ }
74
+
75
+
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ import Layout from '@/layout'
4
+ import roles from '@/constant/permissions' //引用权限值
5
+ const role = roles.supplierStat;
6
+
7
+ const supplierStatRouter = {
8
+ path: '/stat',
9
+ sort: 95,
10
+ component: Layout,
11
+ name: '供货商统计',
12
+ redirect: '/stat/index',
13
+ meta: {
14
+ title: '供货商统计',
15
+ icon: 'xdicon_rizhi',
16
+ iconSize: 22,
17
+ },
18
+ children: [
19
+ {
20
+ path: 'index',
21
+ name: '供货商统计',
22
+ component: () => import ('@/viewsStat/index/index'),
23
+ meta: {
24
+ title: '供货商统计',
25
+ icon: 'xdicon_rizhi',
26
+ iconSize: 22,
27
+ role: [role.totalCounts, role.productCycCounts, role.supplierCycCounts, role.supplierCycSales, role.productCycSales, role.productCategoryCycSales]
28
+ }
29
+ }
30
+ ]
31
+ }
32
+
33
+ export default supplierStatRouter