|
|
@ -11,13 +11,22 @@
|
|
|
|
:rules="rules"
|
|
|
|
:rules="rules"
|
|
|
|
:disabled="templateImportDisabled"
|
|
|
|
:disabled="templateImportDisabled"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<el-button size="medium" type="text" @click="moreSetting = !moreSetting" :disabled="false">
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
size="medium"
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
@click="moreSetting = !moreSetting"
|
|
|
|
|
|
|
|
:disabled="false"
|
|
|
|
|
|
|
|
>
|
|
|
|
模板设置
|
|
|
|
模板设置
|
|
|
|
<span v-if="moreSetting">🤟</span>
|
|
|
|
<span v-if="moreSetting">🤟</span>
|
|
|
|
<span v-else>👇</span>
|
|
|
|
<span v-else>👇</span>
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
<el-collapse-transition>
|
|
|
|
<el-collapse-transition>
|
|
|
|
<el-form-item prop="templateSheetNum" label="模板所在sheet页:" v-if="moreSetting">
|
|
|
|
<el-form-item
|
|
|
|
|
|
|
|
prop="templateSheetNum"
|
|
|
|
|
|
|
|
label="模板所在sheet页:"
|
|
|
|
|
|
|
|
v-if="moreSetting"
|
|
|
|
|
|
|
|
>
|
|
|
|
<el-input-number
|
|
|
|
<el-input-number
|
|
|
|
v-model="formData.templateSheetNum"
|
|
|
|
v-model="formData.templateSheetNum"
|
|
|
|
style="width: 200px"
|
|
|
|
style="width: 200px"
|
|
|
@ -30,7 +39,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item prop="uploadTemplate" label="模板上传:">
|
|
|
|
<el-form-item prop="uploadTemplate" label="模板上传:">
|
|
|
|
<el-upload
|
|
|
|
<el-upload
|
|
|
|
:action="'/api/excel/template?templateSheetNum=' + formData.templateSheetNum"
|
|
|
|
:action="
|
|
|
|
|
|
|
|
'/api/excel/template?templateSheetNum=' + formData.templateSheetNum
|
|
|
|
|
|
|
|
"
|
|
|
|
:multiple="false"
|
|
|
|
:multiple="false"
|
|
|
|
:on-success="uploadSuccess"
|
|
|
|
:on-success="uploadSuccess"
|
|
|
|
:on-error="uploadError"
|
|
|
|
:on-error="uploadError"
|
|
|
@ -47,6 +58,7 @@
|
|
|
|
v-model="formData.cellNum"
|
|
|
|
v-model="formData.cellNum"
|
|
|
|
style="width=200px"
|
|
|
|
style="width=200px"
|
|
|
|
:disabled="cellSearchDisable"
|
|
|
|
:disabled="cellSearchDisable"
|
|
|
|
|
|
|
|
@keyup.enter.native="cellNumSearch"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
slot="append"
|
|
|
|
slot="append"
|
|
|
@ -74,6 +86,44 @@
|
|
|
|
></el-button>
|
|
|
|
></el-button>
|
|
|
|
</el-tooltip>
|
|
|
|
</el-tooltip>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item prop="expr" label="可用表达式(点一下就可以复制):">
|
|
|
|
|
|
|
|
<span
|
|
|
|
|
|
|
|
class="right-10"
|
|
|
|
|
|
|
|
v-for="item in $store.state.dataSourcePreview"
|
|
|
|
|
|
|
|
:key="item.sheetName"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-popover placement="bottom" width="400" trigger="hover">
|
|
|
|
|
|
|
|
<div style="height: 300px">
|
|
|
|
|
|
|
|
<span
|
|
|
|
|
|
|
|
>表达式
|
|
|
|
|
|
|
|
{{ `@{${item.sheetName}.name}` }} 就代表以下的这些名字</span
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-table :data="item.nameList" height="290">
|
|
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
|
|
type="index"
|
|
|
|
|
|
|
|
label="序号"
|
|
|
|
|
|
|
|
min-width="20%"
|
|
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
|
|
></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
|
|
|
prop="name"
|
|
|
|
|
|
|
|
label="姓名"
|
|
|
|
|
|
|
|
min-width="50%"
|
|
|
|
|
|
|
|
align="center"
|
|
|
|
|
|
|
|
></el-table-column>
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
|
|
slot="reference"
|
|
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
|
|
@click="copyExpr(item.sheetName)"
|
|
|
|
|
|
|
|
>{{ item.sheetName }}</el-button
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="newCellData">
|
|
|
|
<el-form-item prop="newCellData">
|
|
|
|
<span slot="label">💨替换后的数据:</span>
|
|
|
|
<span slot="label">💨替换后的数据:</span>
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
@ -85,7 +135,10 @@
|
|
|
|
></el-input>
|
|
|
|
></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="resultExcelName" label="🤩处理后Excel的文件名字:">
|
|
|
|
<el-form-item prop="resultExcelName" label="🤩处理后Excel的文件名字:">
|
|
|
|
<el-input placeholder="处理好以后的Excel文件名,不写就是默认名字" v-model="formData.resultExcelName"></el-input>
|
|
|
|
<el-input
|
|
|
|
|
|
|
|
placeholder="处理好以后的Excel文件名,不写就是默认名字"
|
|
|
|
|
|
|
|
v-model="formData.resultExcelName"
|
|
|
|
|
|
|
|
></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-row :gutter="20">
|
|
|
|
<el-col
|
|
|
|
<el-col
|
|
|
@ -95,10 +148,21 @@
|
|
|
|
:lg="{ span: 4, offset: 16 }"
|
|
|
|
:lg="{ span: 4, offset: 16 }"
|
|
|
|
:xl="{ span: 2, offset: 20 }"
|
|
|
|
:xl="{ span: 2, offset: 20 }"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<el-button type="primary" class="f-right right-10" @click="executeTemplate">生成Excel</el-button>
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
class="f-right right-10"
|
|
|
|
|
|
|
|
@click="executeTemplate"
|
|
|
|
|
|
|
|
>①生成Excel</el-button
|
|
|
|
|
|
|
|
>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
<el-col :xs="8" :sm="6" :md="5" :lg="4" :xl="2">
|
|
|
|
<el-col :xs="8" :sm="6" :md="5" :lg="4" :xl="2">
|
|
|
|
<el-button type="success" class="f-right" @click="gotoDownload">去下载文件</el-button>
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
type="success"
|
|
|
|
|
|
|
|
class="f-right"
|
|
|
|
|
|
|
|
@click="gotoDownload"
|
|
|
|
|
|
|
|
:disabled="!allowDownload"
|
|
|
|
|
|
|
|
>②去下载文件</el-button
|
|
|
|
|
|
|
|
>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
@ -114,8 +178,8 @@ export default {
|
|
|
|
templateImportDisabled: {
|
|
|
|
templateImportDisabled: {
|
|
|
|
type: Boolean,
|
|
|
|
type: Boolean,
|
|
|
|
require: true,
|
|
|
|
require: true,
|
|
|
|
default: false
|
|
|
|
default: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {},
|
|
|
|
components: {},
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
@ -125,17 +189,18 @@ export default {
|
|
|
|
templateSheetNum: 1,
|
|
|
|
templateSheetNum: 1,
|
|
|
|
cellNum: "",
|
|
|
|
cellNum: "",
|
|
|
|
cellData: "",
|
|
|
|
cellData: "",
|
|
|
|
newCellData: ""
|
|
|
|
newCellData: "",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
|
cellNum: [
|
|
|
|
cellNum: [
|
|
|
|
{ required: true, message: "请输入单元格编号", trigger: "blur" }
|
|
|
|
{ required: true, message: "请输入单元格编号", trigger: "blur" },
|
|
|
|
]
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
templateFileList: [],
|
|
|
|
templateFileList: [],
|
|
|
|
cellSearchDisable: false,
|
|
|
|
cellSearchDisable: false,
|
|
|
|
resultExcelName: "",
|
|
|
|
resultExcelName: "",
|
|
|
|
moreSetting: false
|
|
|
|
moreSetting: false,
|
|
|
|
|
|
|
|
allowDownload: false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {},
|
|
|
|
computed: {},
|
|
|
@ -160,13 +225,16 @@ export default {
|
|
|
|
this.$message.error(err);
|
|
|
|
this.$message.error(err);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
cellNumSearch() {
|
|
|
|
cellNumSearch() {
|
|
|
|
|
|
|
|
if (this.templateFileList.length == 0) {
|
|
|
|
|
|
|
|
return this.$message.error("宝子,您还没有上传模板文件呢");
|
|
|
|
|
|
|
|
}
|
|
|
|
this.$axios
|
|
|
|
this.$axios
|
|
|
|
.get("/api/excel/cellNumSearch", {
|
|
|
|
.get("/api/excel/cellNumSearch", {
|
|
|
|
params: {
|
|
|
|
params: {
|
|
|
|
cellRowStr: this.formData.cellNum
|
|
|
|
cellRowStr: this.formData.cellNum,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
.then((res) => {
|
|
|
|
const { data } = res;
|
|
|
|
const { data } = res;
|
|
|
|
if (data.success) {
|
|
|
|
if (data.success) {
|
|
|
|
this.$message.success("单元格数据获取成功");
|
|
|
|
this.$message.success("单元格数据获取成功");
|
|
|
@ -176,7 +244,7 @@ export default {
|
|
|
|
this.formData.cellData = "";
|
|
|
|
this.formData.cellData = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
.catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
console.log(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -197,24 +265,25 @@ export default {
|
|
|
|
if (this.templateFileList.length == 0) {
|
|
|
|
if (this.templateFileList.length == 0) {
|
|
|
|
return this.$message.error("宝子,您还没有上传模板文件呢");
|
|
|
|
return this.$message.error("宝子,您还没有上传模板文件呢");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.$refs["$form"].validate(valid => {
|
|
|
|
this.$refs["$form"].validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
this.$axios
|
|
|
|
this.$axios
|
|
|
|
.post("/api/excel/executeTemplate", {
|
|
|
|
.post("/api/excel/executeTemplate", {
|
|
|
|
newCellData: this.formData.newCellData,
|
|
|
|
newCellData: this.formData.newCellData,
|
|
|
|
cellRowStr: this.formData.cellNum,
|
|
|
|
cellRowStr: this.formData.cellNum,
|
|
|
|
resultExcelName: this.formData.resultExcelName
|
|
|
|
resultExcelName: this.formData.resultExcelName,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then(res => {
|
|
|
|
.then((res) => {
|
|
|
|
const { data } = res;
|
|
|
|
const { data } = res;
|
|
|
|
if (data.success) {
|
|
|
|
if (data.success) {
|
|
|
|
this.$emit("setStep", 2);
|
|
|
|
this.$emit("setStep", 2);
|
|
|
|
this.$message.success("Excel处理完成");
|
|
|
|
this.$message.success("Excel处理完成");
|
|
|
|
|
|
|
|
this.allowDownload = true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.$message.error(data.msg);
|
|
|
|
this.$message.error(data.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
.catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
console.log(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -226,7 +295,7 @@ export default {
|
|
|
|
gotoDownload() {
|
|
|
|
gotoDownload() {
|
|
|
|
this.$axios
|
|
|
|
this.$axios
|
|
|
|
.get("/api/excel/gotoDownload")
|
|
|
|
.get("/api/excel/gotoDownload")
|
|
|
|
.then(res => {
|
|
|
|
.then((res) => {
|
|
|
|
const { data } = res;
|
|
|
|
const { data } = res;
|
|
|
|
if (data.success) {
|
|
|
|
if (data.success) {
|
|
|
|
this.$emit("setStep", 3);
|
|
|
|
this.$emit("setStep", 3);
|
|
|
@ -234,13 +303,31 @@ export default {
|
|
|
|
this.$message.error(data.msg);
|
|
|
|
this.$message.error(data.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
.catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
console.log(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
copyExpr(sheetName) {
|
|
|
|
|
|
|
|
const expr = `@{${sheetName}.name}`;
|
|
|
|
|
|
|
|
this.$copyText(expr)
|
|
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
|
|
console.log("SUCCESS: copy arguments e:", res);
|
|
|
|
|
|
|
|
this.$message.success("复制成功!表达式:" + expr);
|
|
|
|
|
|
|
|
this.$notify({
|
|
|
|
|
|
|
|
title: "复制成功" + expr,
|
|
|
|
|
|
|
|
message: "您现在可以把表达式放在名字的位置,用于替换姓名",
|
|
|
|
|
|
|
|
type: "success",
|
|
|
|
|
|
|
|
position: "bottom-right",
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
|
|
console.log("ERR: copy arguments e:", err);
|
|
|
|
|
|
|
|
this.$message.error("复制失败,请重试");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {},
|
|
|
|
created() {},
|
|
|
|
mounted() {}
|
|
|
|
mounted() {},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|