|
@@ -2,10 +2,9 @@
|
|
|
* @Author : yuanrunwei
|
|
|
* @Date : 2021-12-04 14:23:58
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
- * @LastEditTime: 2022-01-23 19:41:44
|
|
|
+ * @LastEditTime: 2022-02-10 18:12:52
|
|
|
* @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">
|
|
@@ -63,7 +62,10 @@
|
|
|
@cancel="handleVisible"
|
|
|
>
|
|
|
<el-form ref="form" :model="form" label-width="80px">
|
|
|
- <el-radio-group v-model="form.permission_type">
|
|
|
+ <el-radio-group
|
|
|
+ v-model="form.permission_type"
|
|
|
+ :disabled="type !== 'edit'"
|
|
|
+ >
|
|
|
<el-form-item>
|
|
|
<el-radio :label="0"><span>无特殊权限</span></el-radio>
|
|
|
<div>
|
|
@@ -72,6 +74,7 @@
|
|
|
v-model="form.person"
|
|
|
multiple
|
|
|
placeholder="请选择负责人"
|
|
|
+ :disabled="type !== 'edit'"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="({ label, value }, index) in charge_list"
|
|
@@ -101,6 +104,7 @@
|
|
|
placeholder="请选择负责人"
|
|
|
v-model="item.person"
|
|
|
filterable
|
|
|
+ :disabled="type !== 'edit'"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="({ label, value }, index) in charge_list"
|
|
@@ -111,23 +115,42 @@
|
|
|
</el-select>
|
|
|
<div class="form-select">
|
|
|
<span class="form-content">可编辑行:从</span>
|
|
|
- <el-input v-model="item.row_start" />
|
|
|
+ <el-input
|
|
|
+ v-model="item.row_start"
|
|
|
+ :disabled="type !== 'edit'"
|
|
|
+ />
|
|
|
<span class="form-content">到</span>
|
|
|
- <el-input v-model="item.row_end" />
|
|
|
+ <el-input
|
|
|
+ v-model="item.row_end"
|
|
|
+ :disabled="type !== 'edit'"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="form-select">
|
|
|
<span class="form-content">可编辑列:从</span>
|
|
|
- <el-input v-model="item.col_start" />
|
|
|
+ <el-input
|
|
|
+ :disabled="type !== 'edit'"
|
|
|
+ v-model="item.col_start"
|
|
|
+ @input="(params) => handleInput(index, 'col_start', params)"
|
|
|
+ />
|
|
|
<span class="form-content">到</span>
|
|
|
- <el-input v-model="item.col_end" />
|
|
|
+ <el-input
|
|
|
+ :disabled="type !== 'edit'"
|
|
|
+ v-model="item.col_end"
|
|
|
+ @input="(params) => handleInput(index, 'col_end', params)"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<div>
|
|
|
- <el-button @click.prevent="handleCharge('add')">添加</el-button>
|
|
|
+ <el-button
|
|
|
+ @click.prevent="handleCharge('add')"
|
|
|
+ :disabled="type !== 'edit'"
|
|
|
+ >添加</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
v-if="form.charge.length - 1"
|
|
|
@click.prevent="handleCharge('delete')"
|
|
|
+ :disabled="type !== 'edit'"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
</div>
|
|
@@ -140,7 +163,7 @@
|
|
|
title="提交"
|
|
|
:visible="manager_approve"
|
|
|
:modal="false"
|
|
|
- @cancel="handleApprove"
|
|
|
+ @cancel="handleApprove(0)"
|
|
|
>
|
|
|
<el-form :model="approveForm" label-width="120px">
|
|
|
<el-form-item
|
|
@@ -227,7 +250,6 @@ export default {
|
|
|
],
|
|
|
array: [],
|
|
|
type: null,
|
|
|
-
|
|
|
permission_type: null,
|
|
|
col_start: "",
|
|
|
col_end: "",
|
|
@@ -254,6 +276,7 @@ export default {
|
|
|
},
|
|
|
// 可提交标志
|
|
|
addFlag: "0",
|
|
|
+ rowList: [],
|
|
|
isDisable: true,
|
|
|
issued_id: null,
|
|
|
template_id: null,
|
|
@@ -287,11 +310,12 @@ export default {
|
|
|
// console.log(e,'e');
|
|
|
// },
|
|
|
handleAllow({ row, column }) {
|
|
|
- return (
|
|
|
- (!this.form.permission_type && this.type === "edit") ||
|
|
|
- (this.row_list.includes(row) && this.column_list.includes(column)) ||
|
|
|
- (this.status === "2" && this.type === "edit")
|
|
|
- );
|
|
|
+ let public_permisson = !this.form.permission_type && this.type === "edit";
|
|
|
+ let editable =
|
|
|
+ this.row_list.includes(row) && this.column_list.includes(column);
|
|
|
+ let isId = !this.id;
|
|
|
+ let totalBoolean = (public_permisson || editable) && !isId;
|
|
|
+ return totalBoolean;
|
|
|
},
|
|
|
async handleQuery() {
|
|
|
let url = "";
|
|
@@ -337,7 +361,7 @@ export default {
|
|
|
this.template_id = templateId;
|
|
|
this.issued_id = issuedId;
|
|
|
this.addFlag = addFlag;
|
|
|
- console.log(addFlag, "addFlag");
|
|
|
+ console.log(JSON.parse(templateContent), "123123");
|
|
|
if (list && list.length) {
|
|
|
const { type } = list[0];
|
|
|
if (type === "1") {
|
|
@@ -441,6 +465,9 @@ export default {
|
|
|
that.$message.error("您没有编辑权限");
|
|
|
}
|
|
|
},
|
|
|
+ cellUpdated: function (row, column) {
|
|
|
+ that.rowList.push(row);
|
|
|
+ },
|
|
|
cellUpdateBefore: function (row, column) {
|
|
|
if (!that.handleAllow({ row, column })) {
|
|
|
return false;
|
|
@@ -448,6 +475,7 @@ export default {
|
|
|
},
|
|
|
cellRenderAfter: function (cell, position) {
|
|
|
const { r: row, c: column } = position;
|
|
|
+ console.log();
|
|
|
if (cell) {
|
|
|
if (!that.handleAllow({ row, column })) {
|
|
|
cell.bg = "#d5d5d5";
|
|
@@ -587,10 +615,58 @@ export default {
|
|
|
} else {
|
|
|
// 职位
|
|
|
let duty = JSON.parse(sessionStorage.userInfo).duty;
|
|
|
+ // let { permission_type, charge } = this.form;
|
|
|
+ let reqdata = {
|
|
|
+ rowIndex: [...new Set(this.rowList)]
|
|
|
+ .sort(function (a, b) {
|
|
|
+ return a - b;
|
|
|
+ })
|
|
|
+ .join(","),
|
|
|
+ rowContent: [...new Set(this.rowList)]
|
|
|
+ .sort(function (a, b) {
|
|
|
+ return a - b;
|
|
|
+ })
|
|
|
+ .map((el) => {
|
|
|
+ return data.data[el];
|
|
|
+ }),
|
|
|
+ };
|
|
|
+ console.log(reqdata, "reqdata");
|
|
|
+ // if (permission_type) {
|
|
|
+ // // 特殊权限
|
|
|
+ // reqdata = {
|
|
|
+ // ...reqdata,
|
|
|
+ // rowIndex: this.paramsArr(
|
|
|
+ // charge[0].row_start - 1,
|
|
|
+ // charge[0].row_end - 1
|
|
|
+ // ),
|
|
|
+ // rowContent: this.paramsArr(
|
|
|
+ // charge[0].row_start - 1,
|
|
|
+ // charge[0].row_end - 1
|
|
|
+ // )
|
|
|
+ // .split(",")
|
|
|
+ // .map((el) => {
|
|
|
+ // return data.data[el];
|
|
|
+ // }),
|
|
|
+ // };
|
|
|
+ // } else {
|
|
|
+ // // 公共权限
|
|
|
+ // const RowList = [];
|
|
|
+ // const RowContent = [];
|
|
|
+ // data.data.forEach((item, rowIndex) => {
|
|
|
+ // if (this.confirmArrayData(item)) {
|
|
|
+ // RowList.push(rowIndex);
|
|
|
+ // RowContent.push(item);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // reqdata = {
|
|
|
+ // ...reqdata,
|
|
|
+ // rowIndex: RowList.join(","),
|
|
|
+ // rowContent: RowContent,
|
|
|
+ // };
|
|
|
+ // }
|
|
|
if (duty === "7") {
|
|
|
this.manager_approve = true;
|
|
|
} else {
|
|
|
- // 员工提交
|
|
|
if (type === "2") {
|
|
|
// 暂存
|
|
|
await this.$http({
|
|
@@ -609,8 +685,9 @@ export default {
|
|
|
this.$emit("save");
|
|
|
return;
|
|
|
}
|
|
|
+ // 员工提交
|
|
|
await this.$http({
|
|
|
- url: edit_url, // 新增
|
|
|
+ url: edit_url, //提交
|
|
|
method: "post",
|
|
|
headers: {
|
|
|
"Content-Type": "application/json",
|
|
@@ -620,12 +697,35 @@ export default {
|
|
|
templateContent: JSON.stringify(data),
|
|
|
templateName: workbook_name,
|
|
|
issuedId: this.issued_id,
|
|
|
+ rowJson: JSON.stringify(reqdata),
|
|
|
},
|
|
|
});
|
|
|
this.$emit("save");
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ // 判断数组是否有值
|
|
|
+ confirmArrayData(data) {
|
|
|
+ if (data instanceof Array) {
|
|
|
+ let flag = 0;
|
|
|
+ if (data.length) {
|
|
|
+ data.forEach((el) => {
|
|
|
+ if (el instanceof Object) {
|
|
|
+ flag = flag + 1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (flag) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
handleAuth() {
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
@@ -672,22 +772,78 @@ export default {
|
|
|
console.log(this.form, "aada");
|
|
|
this.visible = !this.visible;
|
|
|
},
|
|
|
+ handleInput(index, name, value) {
|
|
|
+ let reg = /^[0-9]*$/;
|
|
|
+ if (!reg.test(value)) {
|
|
|
+ this.form.charge[index][name]=this.form.charge[index][name].substr(0,this.form.charge[index][name].length-1)
|
|
|
+ this.$message.error("请输入纯数字");
|
|
|
+ }
|
|
|
+ },
|
|
|
async handleApprove(type) {
|
|
|
- if (this.approveForm.type) {
|
|
|
- if (this.approveForm.type === "3" && !this.approveForm.comments) {
|
|
|
- this.$message.error("请输入其他审批意见");
|
|
|
+ if (type) {
|
|
|
+ if (this.approveForm.type) {
|
|
|
+ if (this.approveForm.type === "3" && !this.approveForm.comments) {
|
|
|
+ this.$message.error("请输入其他审批意见");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error("请选择审批意见");
|
|
|
return;
|
|
|
}
|
|
|
- } else {
|
|
|
- this.$message.error("请选择审批意见");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (type) {
|
|
|
const sheet_name = window.luckysheet.getSheet().name;
|
|
|
const data = window.luckysheet.getSheet(sheet_name);
|
|
|
const workbook_name = window.luckysheet.getWorkbookName();
|
|
|
+ // let { permission_type, charge } = this.form;
|
|
|
+ let reqdata = {
|
|
|
+ rowIndex: [...new Set(this.rowList)]
|
|
|
+ .sort(function (a, b) {
|
|
|
+ return a - b;
|
|
|
+ })
|
|
|
+ .join(","),
|
|
|
+ rowContent: [...new Set(this.rowList)]
|
|
|
+ .sort(function (a, b) {
|
|
|
+ return a - b;
|
|
|
+ })
|
|
|
+ .map((el) => {
|
|
|
+ return data.data[el];
|
|
|
+ }),
|
|
|
+ };
|
|
|
+ console.log(reqdata, "ada");
|
|
|
+ // if (permission_type) {
|
|
|
+ // // 特殊权限
|
|
|
+ // reqdata = {
|
|
|
+ // ...reqdata,
|
|
|
+ // rowIndex: this.paramsArr(
|
|
|
+ // charge[0].row_start - 1,
|
|
|
+ // charge[0].row_end - 1
|
|
|
+ // ),
|
|
|
+ // rowContent: this.paramsArr(
|
|
|
+ // charge[0].row_start - 1,
|
|
|
+ // charge[0].row_end - 1
|
|
|
+ // )
|
|
|
+ // .split(",")
|
|
|
+ // .map((el) => {
|
|
|
+ // return data.data[el];
|
|
|
+ // }),
|
|
|
+ // };
|
|
|
+ // } else {
|
|
|
+ // // 公共权限
|
|
|
+ // const RowList = [];
|
|
|
+ // const RowContent = [];
|
|
|
+ // data.data.forEach((item, rowIndex) => {
|
|
|
+ // if (this.confirmArrayData(item)) {
|
|
|
+ // RowList.push(rowIndex);
|
|
|
+ // RowContent.push(item);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // reqdata = {
|
|
|
+ // ...reqdata,
|
|
|
+ // rowIndex: RowList.join(","),
|
|
|
+ // rowContent: RowContent,
|
|
|
+ // };
|
|
|
+ // }
|
|
|
await this.$http({
|
|
|
- url: "/market/CMKIssued/CMKIssuedSubmit", // 新增
|
|
|
+ url: "/market/CMKIssued/CMKIssuedSubmit", // 提交
|
|
|
method: "post",
|
|
|
headers: {
|
|
|
"Content-Type": "application/json",
|
|
@@ -697,6 +853,7 @@ export default {
|
|
|
templateContent: JSON.stringify(data),
|
|
|
templateName: workbook_name,
|
|
|
issuedId: this.issued_id,
|
|
|
+ rowJson: JSON.stringify(reqdata),
|
|
|
},
|
|
|
});
|
|
|
let params = {
|
|
@@ -730,7 +887,7 @@ export default {
|
|
|
break;
|
|
|
}
|
|
|
await this.$http({
|
|
|
- url: "/market/CMKIssued/CMKIssuedCheck", // 新增
|
|
|
+ url: "/market/CMKIssued/CMKIssuedCheck", // 审批
|
|
|
method: "post",
|
|
|
headers: {
|
|
|
"Content-Type": "application/json",
|