Commit d2ce01dc authored by “yiyousong”'s avatar “yiyousong”

pref:修改样表上传

parent 9719dba9
......@@ -35,7 +35,7 @@ export default {
<style lang="less" scoped>
.app {
width: 1920px;
width: 100%;
min-height: 100%;
background-color: #f0f2f5;
display: flex;
......
......@@ -38,51 +38,18 @@
>
</el-switch>
</el-form-item>
<!--
<el-form-item label="上传附件" prop="fileUrl">
<el-upload
class="upload-demo"
:action="api + 'sampleform/file/commonupload'"
:on-remove="handleRemoveFileUrl"
:limit="1"
:file-list="fileUrlFileList"
:on-success="OnsuccessfileUrl"
:headers="headers"
:before-upload="beforeUpload"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
>
<el-button size="small" type="primary">上传Word文件</el-button>
</el-upload>
</el-form-item>
<el-form-item label="上传模板" prop="templatePath">
<el-upload
class="upload-demo"
:action="api + 'sampleform/file/commonupload'"
:on-remove="handleRemoveTemplatePath"
:limit="1"
:file-list="templatePathFileList"
:on-success="OnsuccesstemplatePath"
:headers="headers"
:before-upload="beforeUpload"
accept="application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
>
<el-button size="small" type="primary">上传Word文件</el-button>
</el-upload>
</el-form-item>-->
<el-form-item label="上传样表" prop="samplePath">
<el-upload
class="upload-demo"
:action="api + 'sampleform/file/commonupload'"
:on-remove="handleRemoveSamplePath"
:limit="1"
:file-list="samplePathFileList"
:on-success="OnsuccessSamplePath"
:headers="headers"
:before-upload="beforeUpload"
accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
>
<el-button size="small" type="primary">上传Word文件</el-button>
<span class="tips">提示:请上传.docx格式</span>
<!-- accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document" -->
<el-button size="small" type="primary">上传文件</el-button>
<!-- <span class="tips">提示:请上传.docx格式</span> -->
</el-upload>
</el-form-item>
</el-form>
......@@ -128,19 +95,17 @@ export default {
? local.getLocal("sampleSiteId")
: "",
matterNo: "", // 事项编号
fileName: "", // 附件名称
fileUrl: "", // 附件地址
// fileName: "", // 附件名称
// fileUrl: "", // 附件地址
samplePath: "", // 样表地址
sampleName: "", // 样表名称
templatePath: "", // 模板地址
templateName: "", // 模板名称
// templatePath: "", // 模板地址
// templateName: "", // 模板名称
matterName: "", // 事项名称
deptName: "", // 部门名称
deptId: "", // 部门id
deptCode: "", // 部门编码
},
fileUrlFileList: [],
templatePathFileList: [],
samplePathFileList: [],
loading: false,
rules: {
......@@ -183,13 +148,11 @@ export default {
this.loading = true;
let res = await saveMaterials(this.form);
let { code, msg } = res.data;
this.loading = false;
if (code === 1) {
this.$message.success(msg);
this.$emit("addSuccess");
this.loading = false;
this.handleClose();
} else {
this.loading = false;
}
}
});
......@@ -204,23 +167,10 @@ export default {
this.form.deptName = row.deptName;
this.form.deptId = row.deptId;
this.form.deptCode = row.deptCode;
console.log(row);
},
// 编辑
onEdit(row) {
this.form = { ...row };
this.fileUrlFileList = [
{
name: this.form.fileName,
url: this.form.fileUrl,
},
];
this.templatePathFileList = [
{
name: this.form.templateName,
url: this.form.templatePath,
},
];
this.samplePathFileList = [
{
name: this.form.sampleName,
......@@ -231,7 +181,7 @@ export default {
// 重置
handleRest() {
this.$refs.form.resetFields();
this.fileList = [];
this.samplePathFileList = [];
},
// 关闭
handleClose() {
......@@ -241,35 +191,12 @@ export default {
this.samplePathFileList = [];
this.Visible = false;
},
// 上传之前
beforeUpload(file) {
console.log(file);
},
// 上传附件
OnsuccessfileUrl(response) {
this.form.fileUrl = response.url;
this.form.fileName = response.fileName;
},
// 上传模板
OnsuccesstemplatePath(response) {
this.form.templatePath = response.url;
this.form.templateName = response.fileName;
},
// 上传样表
OnsuccessSamplePath(response) {
OnsuccessSamplePath(response, file, fileList) {
this.samplePathFileList = fileList.slice(-1);
this.form.samplePath = response.url;
this.form.sampleName = response.fileName;
},
// 删除附件
handleRemoveFileUrl() {
this.form.fileUrl = "";
this.form.fileName = "";
},
// 删除模板
handleRemoveTemplatePath() {
this.form.templatePath = "";
this.form.templateName = "";
},
// 删除样表
handleRemoveSamplePath() {
this.form.samplePath = "";
......
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