feat:temp

This commit is contained in:
fanxb 2021-06-27 22:06:11 +08:00
parent 670f0258a3
commit 25423fd464
7 changed files with 217 additions and 2 deletions

View File

@ -0,0 +1,19 @@
import config from '../config';
import * as path from 'path';
import * as fs from 'fs-extra';
import ProcessHelper from '../util/ProcesHelper';
import FileObj from '../vo/FileObj';
import RuleObj from 'vo/RuleObj';
import DeleteRule from '../vo/rules/DeleteRule';
class RenamerService {
static async readPath(fileList: Array<FileObj>, ruleList): Promise<Array<FileObj>> {
let obj = new RuleObj({});
return null;
}
}
export default RenamerService;

View File

@ -0,0 +1,27 @@
import DeleteRule from "./rules/DeleteRule";
import InsertRule from "./rules/InsertRule";
import SerializationRule from "./rules/SerializationRule";
export default class RuleObj {
type: string;
message: string;
/**
*
*/
data: any;
constructor(data: any) {
this.type = data.type;
this.message = data.message;
switch (this.type) {
case "delete":
this.data = new DeleteRule(data.data);
break;
case "insert":
this.data = new InsertRule(data.data);
break;
default:
this.data = new SerializationRule(data.data);
}
}
}

View File

@ -0,0 +1,52 @@
import RuleInterface from "./RuleInterface";
import FileObj from "../FileObj";
export default class DeleteRule implements RuleInterface {
/**
* deletePart:部分删除deleteAll:全部删除
*/
type: string;
/**
*
*/
start: DeleteRuleItem;
/**
*
*/
end: DeleteRuleItem;
/**
* true:false
*/
ignorePostfix: boolean;
constructor(data: any) {
this.type = data.type;
this.start = new DeleteRuleItem(data.start);
this.end = new DeleteRuleItem(data.end);
this.ignorePostfix = data.ignorePostfix;
}
deal(file: FileObj): string {
return null;
}
}
class DeleteRuleItem {
/**
* location:位置text:文本end:直到末尾
*/
type: string;
/**
*
*/
value: string;
constructor(data: any) {
this.type = data.type;
this.value = data.value;
}
}

View File

@ -0,0 +1,39 @@
import RuleInterface from "./RuleInterface";
import FileObj from "../FileObj";
export default class InsertRule implements RuleInterface {
/**
*
*/
insertContent: string;
/**
* frontbackendat:位置replace:替换当前文件名
*/
type: string;
/**
* type为at,,1
*/
atInput: number;
/**
* type为at,true:false:
*/
atIsRightToleft: boolean;
/**
* true:false
*/
ignorePostfix: boolean;
constructor(data: any) {
this.insertContent = data.insertContent;
this.type = data.type;
this.atInput = data.atInput;
this.atIsRightToleft = data.atIsRightToleft;
this.ignorePostfix = data.ignorePostfix;
}
deal(file: FileObj): string {
return null;
}
}

View File

@ -0,0 +1,6 @@
import FileObj from "../FileObj";
export default interface RuleInterface {
deal(file: FileObj): string;
}

View File

@ -0,0 +1,47 @@
import RuleInterface from "./RuleInterface";
import FileObj from "../FileObj";
export default class InsertRule implements RuleInterface {
/**
*
*/
start: number;
/**
*
*/
increment: number;
/**
* 0
*/
addZero: boolean;
/**
*
*/
numLength: number;
/**
* ,front:前缀backendat
*/
insertType: string;
/**
*
*/
insertValue: number;
/**
*
*/
ignorePostfix: boolean;
constructor(data: any) {
this.start = data.start;
this.increment = data.increment;
this.addZero = data.addZero;
this.numLength = data.numLength;
this.insertType = data.insertType;
this.insertValue = data.insertValue;
this.ignorePostfix = data.ignorePostfix;
}
deal(file: FileObj): string {
return null;
}
}

View File

@ -1,5 +1,5 @@
<template>
<div>
<div v-loading="loading" element-loading-text="后台处理中,请稍候">
<el-button type="primary" @click="dialogVisible = true" size="small"
>新增文件</el-button
>
@ -39,6 +39,16 @@
<!-- 文件预览列表 -->
<div class="fileList">
<div>文件列表</div>
<div class="fileBlock">
<div v-for="(item, index) in fileList" :key="index">
{{ item.name }}
</div>
</div>
<div class="fileBlock">
<div v-for="(item, index) in changedFileList" :key="index">
{{ item.name }}
</div>
</div>
</div>
</div>
<el-dialog
@ -62,6 +72,7 @@
<script>
// @ is an alias to /src
import HttpUtil from "../../utils/HttpUtil";
import FileChose from "@/components/FileChose";
import Rule from "@/components/Rule";
export default {
@ -69,9 +80,11 @@ export default {
components: { FileChose, Rule },
data() {
return {
loading: false, //
dialogVisible: false,
ruleDialogShow: true, //
ruleDialogShow: false, //
fileList: [],
changedFileList: [],
ruleList: [],
editRule: null,
};
@ -109,10 +122,16 @@ export default {
deleteRule() {
this.ruleList = this.ruleList.filter((item) => !item.checked);
},
//
editClick() {
this.editRule = this.checkedRules[0];
this.ruleDialogShow = true;
},
//
showResult() {
this.loading = true;
HttpUtil.post();
},
},
};
</script>
@ -133,4 +152,10 @@ export default {
align-items: baseline;
}
}
.fileBlock {
text-align: left;
display: inline-block;
width: 50%;
}
</style>