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

pref:修改样表上传

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