|
@@ -2,21 +2,24 @@
|
|
|
* @Author : yuanrunwei
|
|
|
* @Date : 2021-12-04 14:23:58
|
|
|
* @LastEditors : yuanrunwei
|
|
|
- * @LastEditTime : 2021-12-26 17:31:03
|
|
|
+ * @LastEditTime : 2021-12-26 18:36:26
|
|
|
* @FilePath : \spfm-market-front\src\pages\main\performance\components\sheet.vue
|
|
|
-->
|
|
|
|
|
|
<template>
|
|
|
<div class="sheet-container">
|
|
|
<div class="flex-justify-align-end margin-bottom-20">
|
|
|
- <el-button type="primary" @click="handleVisible" v-if="['template'].includes(attribute)"
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="handleVisible"
|
|
|
+ v-if="['template'].includes(attribute)"
|
|
|
>权限设置</el-button
|
|
|
>
|
|
|
<el-button type="primary" @click="handleDownload">导出</el-button>
|
|
|
<el-button type="primary" @click="handleFullscreen()"
|
|
|
>全屏显示</el-button
|
|
|
>
|
|
|
- <template v-if="type === 'edit'">
|
|
|
+ <template v-if="['edit'].includes(type)">
|
|
|
<el-upload
|
|
|
class="margin-right-10 margin-left-10"
|
|
|
action
|
|
@@ -29,7 +32,7 @@
|
|
|
type="primary"
|
|
|
@click="handleSave"
|
|
|
:disabled="handleForbid()"
|
|
|
- >{{ id ? "保存" : "新增"
|
|
|
+ >{{ id ? "提交" : "新增"
|
|
|
}}{{ handleForbid() ? `(请先设置权限)` : "" }}</el-button
|
|
|
>
|
|
|
</template>
|
|
@@ -199,20 +202,32 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
async handleQuery() {
|
|
|
+ let url = "";
|
|
|
+ let key = "";
|
|
|
+ switch (this.attribute) {
|
|
|
+ case "template":
|
|
|
+ url = "/market/CMKFileTemplate/QueryCMKFileTemplateById";
|
|
|
+ key = "templateId";
|
|
|
+ break;
|
|
|
+ case "order":
|
|
|
+ url = "/market/CMKIssued/CMKQueryIssuedById";
|
|
|
+ key = "id";
|
|
|
+ break;
|
|
|
+ case "file":
|
|
|
+ url = "/market/CMKIssued/CMKIssuedProcessByUser";
|
|
|
+ key = "id";
|
|
|
+ break;
|
|
|
+ }
|
|
|
const {
|
|
|
data: { templateContent, templateName, list },
|
|
|
} = await this.$http({
|
|
|
- url:
|
|
|
- this.attribute === "template"
|
|
|
- ? "/market/CMKFileTemplate/QueryCMKFileTemplateById"
|
|
|
- : "/market/CMKIssued/CMKQueryIssuedById",
|
|
|
+ url,
|
|
|
method: "post",
|
|
|
headers: {
|
|
|
"Content-Type": "application/json",
|
|
|
},
|
|
|
data: {
|
|
|
- [this.attribute === "template" ? "templateId" : "id"]:
|
|
|
- this.id,
|
|
|
+ [key]: this.id,
|
|
|
},
|
|
|
});
|
|
|
if (list && list.length) {
|
|
@@ -346,6 +361,18 @@ export default {
|
|
|
this.$message.success("操作成功");
|
|
|
},
|
|
|
async handleSave() {
|
|
|
+ let edit_url = "";
|
|
|
+ switch (this.attribute) {
|
|
|
+ case "template":
|
|
|
+ edit_url = ""
|
|
|
+ break;
|
|
|
+ case "order":
|
|
|
+ edit_url = "/market/CMKIssued/CMKIssuedSubmit";
|
|
|
+ break;
|
|
|
+ case "file":
|
|
|
+ edit_url = "";
|
|
|
+ break;
|
|
|
+ }
|
|
|
const sheet_name = window.luckysheet.getSheet().name;
|
|
|
const data = window.luckysheet.getSheet(sheet_name);
|
|
|
const workbook_name = window.luckysheet.getWorkbookName();
|
|
@@ -353,8 +380,8 @@ export default {
|
|
|
data: { body },
|
|
|
} = await this.$http({
|
|
|
url: this.id
|
|
|
- ? "/market/CMKIssued/CMKIssuedSubmit"
|
|
|
- : "/market/CMKFileTemplate/CMKFileTemplateAdd",
|
|
|
+ ? edit_url // 编辑
|
|
|
+ : "/market/CMKFileTemplate/CMKFileTemplateAdd", // 新增
|
|
|
method: "post",
|
|
|
headers: {
|
|
|
"Content-Type": "application/json",
|
|
@@ -365,6 +392,7 @@ export default {
|
|
|
templateName: workbook_name,
|
|
|
},
|
|
|
});
|
|
|
+ // 新增时添加权限
|
|
|
if (!this.id) {
|
|
|
this.handleAddAuth({ id: body });
|
|
|
}
|