流程相关-分公司项目部新增
This commit is contained in:
parent
5559e66568
commit
6cf1a8d8d6
|
|
@ -10,52 +10,99 @@ export function listType(query) {
|
|||
}
|
||||
|
||||
// 查询详细
|
||||
export function getType(dictId) {
|
||||
export function getType(orgId) {
|
||||
return request({
|
||||
url: '/system/dict/type/' + dictId,
|
||||
url: '/system/subOrg/' + orgId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增
|
||||
export function addType(data) {
|
||||
console.log(data)
|
||||
let dataList = handle(data)
|
||||
return request({
|
||||
url: '/system/dict/type',
|
||||
url: '/system/subOrg',
|
||||
method: 'post',
|
||||
data: data
|
||||
data: dataList
|
||||
})
|
||||
}
|
||||
|
||||
// 修改
|
||||
export function updateType(data) {
|
||||
let dataList = handle(data)
|
||||
return request({
|
||||
url: '/system/dict/type',
|
||||
url: '/system/subOrg',
|
||||
method: 'put',
|
||||
data: data
|
||||
data: dataList
|
||||
})
|
||||
}
|
||||
|
||||
//对数据进行处理
|
||||
function handle(data) {
|
||||
let dataList = {
|
||||
id:data.id,
|
||||
orgName: data.orgName,
|
||||
address: data.address,
|
||||
|
||||
isDepartment: "1",
|
||||
isProvince: data.isProvince,
|
||||
orgHeadUserId: data.orgHeadUserId,
|
||||
orgHeadUserName: data.orgHeadUserName,
|
||||
parentId: data.parentId,
|
||||
roleList: [
|
||||
{
|
||||
"deptRoleId": 1,
|
||||
"userId": data.manager
|
||||
},
|
||||
{
|
||||
"deptRoleId": 2,
|
||||
"userId": data.safety
|
||||
},
|
||||
{
|
||||
"deptRoleId": 3,
|
||||
"userId": data.quality
|
||||
},
|
||||
{
|
||||
"deptRoleId": 4,
|
||||
"userId": data.pro
|
||||
},
|
||||
{
|
||||
"deptRoleId": 5,
|
||||
"userId": data.mechanic
|
||||
},
|
||||
{
|
||||
"deptRoleId": 6,
|
||||
"userId": data.documenter
|
||||
},
|
||||
{
|
||||
"deptRoleId": 7,
|
||||
"userId": data.construction
|
||||
},
|
||||
{
|
||||
"deptRoleId": 8,
|
||||
"userId": data.materialman
|
||||
},
|
||||
{
|
||||
"deptRoleId": 9,
|
||||
"userId": data.other
|
||||
}
|
||||
]
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delType(dictId) {
|
||||
export function delType(orgId) {
|
||||
return request({
|
||||
url: '/system/dict/type/' + dictId,
|
||||
url: '/system/subOrg/' + orgId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 刷新
|
||||
export function refreshCache() {
|
||||
// 审批/提交/撤回
|
||||
export function changeStatus(orgId,reviewerStatus) {
|
||||
return request({
|
||||
url: '/system/dict/type/refreshCache',
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取选择框列表
|
||||
export function optionselect() {
|
||||
return request({
|
||||
url: '/system/dict/type/optionselect',
|
||||
method: 'get'
|
||||
url: '/system/subOrg/changeStatus/'+orgId+"/"+reviewerStatus,
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,9 @@
|
|||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
|
|
@ -55,11 +53,9 @@
|
|||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
icon="el-icon-s-custom"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
|
||||
>权限分配
|
||||
</el-button>
|
||||
</el-col>
|
||||
|
|
@ -84,6 +80,7 @@
|
|||
<span v-if="scope.row.reviewerStatus == 0">待审核</span>
|
||||
<span v-else-if="scope.row.reviewerStatus == 1">已审核</span>
|
||||
<span v-else-if="scope.row.reviewerStatus == 2">未通过</span>
|
||||
<span v-else-if="scope.row.reviewerStatus == 3">撤回</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
|
@ -92,8 +89,8 @@
|
|||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
icon="el-icon-search"
|
||||
@click="detailsUpdate(scope.row)"
|
||||
>详情
|
||||
</el-button>
|
||||
<el-button
|
||||
|
|
@ -101,13 +98,15 @@
|
|||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-if="scope.row.reviewerStatus == 0"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="handleWithdraw(scope.row)"
|
||||
v-if="scope.row.reviewerStatus == 0"
|
||||
>撤回
|
||||
</el-button>
|
||||
<el-button
|
||||
|
|
@ -115,6 +114,7 @@
|
|||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-if="scope.row.reviewerStatus == 3 "
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
|
|
@ -327,7 +327,7 @@
|
|||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" v-if="details">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
|
@ -335,8 +335,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {listType, getType, delType, addType, updateType, refreshCache} from "@/api/process/branchPro";
|
||||
import {listDept,orgPersonSelect} from "@/api/system/dept";
|
||||
import {listType, getType, delType, addType, updateType, changeStatus} from "@/api/process/branchPro";
|
||||
import {listDept, orgPersonSelect} from "@/api/system/dept";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import {treeselect as staffTreeselect} from "@/api/process/tree";
|
||||
|
|
@ -348,12 +348,6 @@ export default {
|
|||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
|
|
@ -364,6 +358,7 @@ export default {
|
|||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
details:true,
|
||||
// 日期范围
|
||||
dateRange: [],
|
||||
// 查询参数
|
||||
|
|
@ -462,11 +457,53 @@ export default {
|
|||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
dictId: undefined,
|
||||
dictName: undefined,
|
||||
dictType: undefined,
|
||||
status: "0",
|
||||
remark: undefined
|
||||
parentId: undefined,
|
||||
orgName: undefined,
|
||||
address: undefined,
|
||||
attendanceUserId: undefined,
|
||||
attendanceUserName: undefined,
|
||||
orgHeadUserId: undefined,
|
||||
orgHeadUserName: undefined,
|
||||
province: undefined,
|
||||
isProvince: "1",
|
||||
isDepartment: "0",
|
||||
|
||||
// 部门树选项
|
||||
deptOptions: [],
|
||||
personOptions: [],
|
||||
isProvinceList: [{id: '1', name: '省内'}, {id: '2', name: '省外'}],
|
||||
|
||||
// 人员列表
|
||||
managerOptions: [],
|
||||
safetyOptions: [],
|
||||
qualityOptions: [],
|
||||
proOptions: [],
|
||||
mechanicOptions: [],
|
||||
documenterOptions: [],
|
||||
constructionOptions: [],
|
||||
materialmanOptions: [],
|
||||
otherOptions: [],
|
||||
|
||||
// 默认选中的节点 id 数组
|
||||
managerDefaultCheckedKeys: [],
|
||||
safetyDefaultCheckedKeys: [],
|
||||
qualityDefaultCheckedKeys: [],
|
||||
proDefaultCheckedKeys: [],
|
||||
mechanicDefaultCheckedKeys: [],
|
||||
documenterDefaultCheckedKeys: [],
|
||||
constructionDefaultCheckedKeys: [],
|
||||
materialmanDefaultCheckedKeys: [],
|
||||
otherDefaultCheckedKeys: [],
|
||||
// 用于存储 uniqueId 到 id 的映射
|
||||
managerIdToIdMap: {},
|
||||
safetyIdToIdMap: {},
|
||||
qualityIdToIdMap: {},
|
||||
proIdToIdMap: {},
|
||||
mechanicIdToIdMap: {},
|
||||
documenterIdToIdMap: {},
|
||||
constructionIdToIdMap: {},
|
||||
materialmanIdToIdMap: {},
|
||||
otherIdToIdMap: {},
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
|
@ -485,6 +522,7 @@ export default {
|
|||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.details = true;
|
||||
this.title = "分公司项目部新增";
|
||||
/**
|
||||
* 上级部门下拉选
|
||||
|
|
@ -527,13 +565,72 @@ export default {
|
|||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const dictId = row.dictId || this.ids
|
||||
getType(dictId).then(response => {
|
||||
const ids = row.id
|
||||
getType(ids).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改";
|
||||
this.details = true;
|
||||
this.title = "分公司项目部修改";
|
||||
listDept().then(response => {
|
||||
this.deptOptions = this.handleTree(response.data, "id");
|
||||
});
|
||||
|
||||
/**
|
||||
* 项目部负责人
|
||||
*/
|
||||
orgPersonSelect().then(response => {
|
||||
this.personOptions = this.changeData(response.data);
|
||||
});
|
||||
|
||||
/** 人员 */
|
||||
this.getStaffTreeselect(ids, "1", "", "manager");
|
||||
this.getStaffTreeselect(ids, "2", "", "safety");
|
||||
this.getStaffTreeselect(ids, "3", "", "quality");
|
||||
this.getStaffTreeselect(ids, "4", "", "pro");
|
||||
this.getStaffTreeselect(ids, "5", "", "mechanic");
|
||||
this.getStaffTreeselect(ids, "6", "", "documenter");
|
||||
this.getStaffTreeselect(ids, "7", "", "construction");
|
||||
this.getStaffTreeselect(ids, "8", "", "materialman");
|
||||
this.getStaffTreeselect(ids, "9", "", "other");
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/** 详情按钮操作 */
|
||||
detailsUpdate(row) {
|
||||
this.reset();
|
||||
const ids = row.id
|
||||
getType(ids).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.details = false;
|
||||
this.title = "分公司项目部详情";
|
||||
listDept().then(response => {
|
||||
this.deptOptions = this.handleTree(response.data, "id");
|
||||
});
|
||||
|
||||
/**
|
||||
* 项目部负责人
|
||||
*/
|
||||
orgPersonSelect().then(response => {
|
||||
this.personOptions = this.changeData(response.data);
|
||||
});
|
||||
|
||||
/** 人员 */
|
||||
this.getStaffTreeselect("-1", "1", "", "manager");
|
||||
this.getStaffTreeselect("-1", "2", "", "safety");
|
||||
this.getStaffTreeselect("-1", "3", "", "quality");
|
||||
this.getStaffTreeselect("-1", "4", "", "pro");
|
||||
this.getStaffTreeselect("-1", "5", "", "mechanic");
|
||||
this.getStaffTreeselect("-1", "6", "", "documenter");
|
||||
this.getStaffTreeselect("-1", "7", "", "construction");
|
||||
this.getStaffTreeselect("-1", "8", "", "materialman");
|
||||
this.getStaffTreeselect("-1", "9", "", "other");
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
|
|
@ -542,8 +639,8 @@ export default {
|
|||
if (manager.length === 0) {
|
||||
this.$message.error("请至少选择一个项目经理");
|
||||
return;
|
||||
}else if(manager.length > 1){
|
||||
this.$message.error("请选择一个项目经理");
|
||||
} else if (manager.length > 1) {
|
||||
this.$message.error("请选择一个项目经理!!!");
|
||||
return;
|
||||
}
|
||||
this.form.manager = manager.join(",");
|
||||
|
|
@ -552,7 +649,7 @@ export default {
|
|||
if (safety.length === 0) {
|
||||
this.$message.error("请至少选择一个安全员");
|
||||
return;
|
||||
}else if(safety.length > 1){
|
||||
} else if (safety.length > 1) {
|
||||
this.$message.error("请选择一个安全员");
|
||||
return;
|
||||
}
|
||||
|
|
@ -562,7 +659,7 @@ export default {
|
|||
if (quality.length === 0) {
|
||||
this.$message.error("请至少选择一个质检员");
|
||||
return;
|
||||
}else if(quality.length > 1){
|
||||
} else if (quality.length > 1) {
|
||||
this.$message.error("请选择一个质检员");
|
||||
return;
|
||||
}
|
||||
|
|
@ -573,7 +670,7 @@ export default {
|
|||
if (pro.length === 0) {
|
||||
this.$message.error("请至少选择一个项目总工");
|
||||
return;
|
||||
}else if(pro.length > 1){
|
||||
} else if (pro.length > 1) {
|
||||
this.$message.error("请选择一个项目总工");
|
||||
return;
|
||||
}
|
||||
|
|
@ -635,15 +732,28 @@ export default {
|
|||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const dictIds = row.dictId || this.ids;
|
||||
this.$modal.confirm('是否确认删除编号为"' + dictIds + '"的数据项?').then(function () {
|
||||
return delType(dictIds);
|
||||
const ids = row.id;
|
||||
this.$modal.confirm('是否确认删除此数据项?').then(function () {
|
||||
return delType(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
|
||||
/** 撤回按钮操作 */
|
||||
handleWithdraw(row) {
|
||||
const ids = row.id;
|
||||
this.$modal.confirm('是否确认撤回此数据项?').then(function () {
|
||||
return changeStatus(ids,"3");
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("撤回成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/dict/type/export', {
|
||||
|
|
@ -682,12 +792,10 @@ export default {
|
|||
};
|
||||
},
|
||||
handleSelect1(value, instanceId) {
|
||||
console.log('Selected:', value);
|
||||
// 在这里处理选择事件
|
||||
this.form.orgHeadUserName = value.name;
|
||||
},
|
||||
|
||||
|
||||
/** 查询员工树结构 */
|
||||
getStaffTreeselect(orgId, deptRoleId, departmentId, types) {
|
||||
let data = {
|
||||
|
|
@ -696,155 +804,34 @@ export default {
|
|||
departmentId: departmentId,
|
||||
}
|
||||
staffTreeselect(data).then(response => {
|
||||
this.managerOptions = response.data;
|
||||
this.processData(types, this.managerOptions);
|
||||
/** 设置默认选中的节点 */
|
||||
this.managerDefaultCheckedKeys = this.getCheckedKeys(types, this.managerOptions);
|
||||
// 动态设置每个类型的选项
|
||||
this[`${types}Options`] = response.data;
|
||||
// 处理数据
|
||||
this.processData(types, this[`${types}Options`]);
|
||||
// 设置默认选中的节点
|
||||
this[`${types}DefaultCheckedKeys`] = this.getCheckedKeys(types, this[`${types}Options`]);
|
||||
});
|
||||
|
||||
staffTreeselect(data).then(response => {
|
||||
this.safetyOptions = response.data;
|
||||
this.processData(types, this.safetyOptions);
|
||||
/** 设置默认选中的节点 */
|
||||
this.safetyDefaultCheckedKeys = this.getCheckedKeys(types, this.safetyOptions);
|
||||
});
|
||||
|
||||
staffTreeselect(data).then(response => {
|
||||
this.qualityOptions = response.data;
|
||||
this.processData(types, this.qualityOptions);
|
||||
/** 设置默认选中的节点 */
|
||||
this.qualityDefaultCheckedKeys = this.getCheckedKeys(types, this.qualityOptions);
|
||||
});
|
||||
|
||||
staffTreeselect(data).then(response => {
|
||||
this.proOptions = response.data;
|
||||
this.processData(types, this.proOptions);
|
||||
/** 设置默认选中的节点 */
|
||||
this.proDefaultCheckedKeys = this.getCheckedKeys(types, this.proOptions);
|
||||
});
|
||||
|
||||
staffTreeselect(data).then(response => {
|
||||
this.mechanicOptions = response.data;
|
||||
this.processData(types, this.mechanicOptions);
|
||||
/** 设置默认选中的节点 */
|
||||
this.mechanicDefaultCheckedKeys = this.getCheckedKeys(types, this.mechanicOptions);
|
||||
});
|
||||
|
||||
staffTreeselect(data).then(response => {
|
||||
this.documenterOptions = response.data;
|
||||
this.processData(types, this.documenterOptions);
|
||||
/** 设置默认选中的节点 */
|
||||
this.documenterDefaultCheckedKeys = this.getCheckedKeys(types, this.documenterOptions);
|
||||
});
|
||||
|
||||
staffTreeselect(data).then(response => {
|
||||
this.constructionOptions = response.data;
|
||||
this.processData(types, this.constructionOptions);
|
||||
/** 设置默认选中的节点 */
|
||||
this.constructionDefaultCheckedKeys = this.getCheckedKeys(types, this.constructionOptions);
|
||||
});
|
||||
|
||||
staffTreeselect(data).then(response => {
|
||||
this.materialmanOptions = response.data;
|
||||
this.processData(types, this.materialmanOptions);
|
||||
/** 设置默认选中的节点 */
|
||||
this.materialmanDefaultCheckedKeys = this.getCheckedKeys(types, this.materialmanOptions);
|
||||
});
|
||||
|
||||
staffTreeselect(data).then(response => {
|
||||
this.otherOptions = response.data;
|
||||
this.processData(types, this.otherOptions);
|
||||
/** 设置默认选中的节点 */
|
||||
this.otherDefaultCheckedKeys = this.getCheckedKeys(types, this.otherOptions);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/** 处理数据,为每个节点生成唯一标识符并建立映射 */
|
||||
processData(types, nodes, parentId = '') {
|
||||
switch (types) {
|
||||
case "manager":
|
||||
nodes.forEach(node => {
|
||||
node.managerId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
||||
this.managerIdToIdMap[node.managerId] = node.id; // 建立 uniqueId 到 id 的映射
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(node.children, node.managerId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "safety":
|
||||
nodes.forEach(node => {
|
||||
node.safetyId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
||||
this.safetyIdToIdMap[node.safetyId] = node.id; // 建立 uniqueId 到 id 的映射
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(node.children, node.safetyId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "quality":
|
||||
nodes.forEach(node => {
|
||||
node.qualityId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
||||
this.qualityIdToIdMap[node.qualityId] = node.id; // 建立 uniqueId 到 id 的映射
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(node.children, node.qualityId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "pro":
|
||||
nodes.forEach(node => {
|
||||
node.proId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
||||
this.proIdToIdMap[node.proId] = node.id; // 建立 uniqueId 到 id 的映射
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(node.children, node.proId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "mechanic":
|
||||
nodes.forEach(node => {
|
||||
node.mechanicId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
||||
this.mechanicIdToIdMap[node.mechanicId] = node.id; // 建立 uniqueId 到 id 的映射
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(node.children, node.mechanicId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "documenter":
|
||||
nodes.forEach(node => {
|
||||
node.documenterId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
||||
this.documenterIdToIdMap[node.documenterId] = node.id; // 建立 uniqueId 到 id 的映射
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(node.children, node.documenterId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "construction":
|
||||
nodes.forEach(node => {
|
||||
node.constructionId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
||||
this.constructionIdToIdMap[node.constructionId] = node.id; // 建立 uniqueId 到 id 的映射
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(node.children, node.constructionId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "materialman":
|
||||
nodes.forEach(node => {
|
||||
node.materialmanId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
||||
this.materialmanIdToIdMap[node.materialmanId] = node.id; // 建立 uniqueId 到 id 的映射
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(node.children, node.materialmanId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "other":
|
||||
nodes.forEach(node => {
|
||||
node.otherId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
||||
this.otherIdToIdMap[node.otherId] = node.id; // 建立 uniqueId 到 id 的映射
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(node.children, node.otherId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
const idKey = `${types}Id`;
|
||||
const idMapKey = `${types}IdToIdMap`;
|
||||
|
||||
nodes.forEach(node => {
|
||||
// 生成唯一标识符
|
||||
node[idKey] = `${parentId ? parentId + '-' : ''}${node.id}`;
|
||||
// 建立 uniqueId 到 id 的映射
|
||||
if (!this[idMapKey]) {
|
||||
this[idMapKey] = {};
|
||||
}
|
||||
this[idMapKey][node[idKey]] = node.id;
|
||||
|
||||
// 递归处理子节点
|
||||
if (node.children && node.children.length > 0) {
|
||||
this.processData(types, node.children, node[idKey]);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** 递归获取默认选中的节点 id */
|
||||
|
|
@ -902,26 +889,26 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
this.uncheckAllWithSameId(idToUncheck, "manager");
|
||||
});
|
||||
}else{
|
||||
/* const indexs = this.managerCurrentCheckedNode.indexOf(data.id);
|
||||
if (indexs < 0 && this.managerCurrentCheckedNode.length === 1 && checked) {
|
||||
this.$message({
|
||||
message: '只能选择一个!',
|
||||
type: 'error',
|
||||
showClose: true
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
this.$refs.manager.setChecked(data, false,false);
|
||||
});
|
||||
}else if (this.managerCurrentCheckedNode.length === 0 && checked) {
|
||||
// 发现数组为空 并且是已选择
|
||||
// 防止数组有值,首先清空,再push
|
||||
this.managerCurrentCheckedNode = []
|
||||
this.managerCurrentCheckedNode.push(data.id)
|
||||
} else if (indexs >= 0 && this.managerCurrentCheckedNode.length === 1 && !checked) {
|
||||
// 再次直接进行赋值为空操作
|
||||
this.managerCurrentCheckedNode = []
|
||||
}*/
|
||||
} else {
|
||||
/* const indexs = this.managerCurrentCheckedNode.indexOf(data.id);
|
||||
if (indexs < 0 && this.managerCurrentCheckedNode.length === 1 && checked) {
|
||||
this.$message({
|
||||
message: '只能选择一个!',
|
||||
type: 'error',
|
||||
showClose: true
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
this.$refs.manager.setChecked(data, false,false);
|
||||
});
|
||||
}else if (this.managerCurrentCheckedNode.length === 0 && checked) {
|
||||
// 发现数组为空 并且是已选择
|
||||
// 防止数组有值,首先清空,再push
|
||||
this.managerCurrentCheckedNode = []
|
||||
this.managerCurrentCheckedNode.push(data.id)
|
||||
} else if (indexs >= 0 && this.managerCurrentCheckedNode.length === 1 && !checked) {
|
||||
// 再次直接进行赋值为空操作
|
||||
this.managerCurrentCheckedNode = []
|
||||
}*/
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -1112,47 +1099,22 @@ export default {
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
// 所有菜单节点数据
|
||||
getAllCheckedKeys(type) {
|
||||
// 目前被选中的菜单节点
|
||||
let checkedKeys;
|
||||
let checkedIds;
|
||||
switch (type){
|
||||
case "manager":
|
||||
checkedKeys = this.$refs.manager.getCheckedKeys();
|
||||
checkedIds = checkedKeys.map(managerId => this.managerIdToIdMap[managerId]);
|
||||
case "safety":
|
||||
checkedKeys = this.$refs.safety.getCheckedKeys();
|
||||
checkedIds = checkedKeys.map(safetyId => this.safetyIdToIdMap[safetyId]);
|
||||
case "quality":
|
||||
checkedKeys = this.$refs.quality.getCheckedKeys();
|
||||
checkedIds = checkedKeys.map(qualityId => this.qualityIdToIdMap[qualityId]);
|
||||
case "pro":
|
||||
checkedKeys = this.$refs.pro.getCheckedKeys();
|
||||
checkedIds = checkedKeys.map(proId => this.proIdToIdMap[proId]);
|
||||
case "mechanic":
|
||||
checkedKeys = this.$refs.mechanic.getCheckedKeys();
|
||||
checkedIds = checkedKeys.map(mechanicId => this.mechanicIdToIdMap[mechanicId]);
|
||||
case "documenter":
|
||||
checkedKeys = this.$refs.documenter.getCheckedKeys();
|
||||
checkedIds = checkedKeys.map(documenterId => this.documenterIdToIdMap[documenterId]);
|
||||
case "construction":
|
||||
checkedKeys = this.$refs.construction.getCheckedKeys();
|
||||
checkedIds = checkedKeys.map(constructionId => this.constructionIdToIdMap[constructionId]);
|
||||
case "materialman":
|
||||
checkedKeys = this.$refs.materialman.getCheckedKeys();
|
||||
checkedIds = checkedKeys.map(materialmanId => this.materialmanIdToIdMap[materialmanId]);
|
||||
case "other":
|
||||
checkedKeys = this.$refs.other.getCheckedKeys();
|
||||
checkedIds = checkedKeys.map(otherId => this.otherIdToIdMap[otherId]);
|
||||
// 获取当前被选中的菜单节点
|
||||
const idMapKey = `${type}IdToIdMap`;
|
||||
const ref = this.$refs[type];
|
||||
const idMap = this[idMapKey];
|
||||
if (!ref || !idMap) {
|
||||
console.error(`Reference or ID map for type "${type}" not found.`);
|
||||
return [];
|
||||
}
|
||||
const checkedKeys = ref.getCheckedKeys();
|
||||
const checkedIds = checkedKeys.map(key => idMap[key]);
|
||||
return checkedIds;
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ export default {
|
|||
this.processData(node.children, node.uniqueId); // 递归处理子节点
|
||||
}
|
||||
});
|
||||
console.log("this.uniqueIdToIdMap",this.uniqueIdToIdMap)
|
||||
},
|
||||
|
||||
/** 设置默认选中的节点 */
|
||||
|
|
@ -351,6 +352,7 @@ export default {
|
|||
getStaffAllCheckedKeys() {
|
||||
// 目前被选中的菜单节点
|
||||
let checkedKeys = this.$refs.staff.getCheckedKeys();
|
||||
console.log("checkedKeys,",checkedKeys)
|
||||
const checkedIds = checkedKeys.map(uniqueId => this.uniqueIdToIdMap[uniqueId]);
|
||||
// 半选中的菜单节点
|
||||
// let halfCheckedKeys = this.$refs.staff.getHalfCheckedKeys();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: `http://192.168.0.32:8100`,
|
||||
target: `http://192.168.0.137:8100`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
|
|
|||
Loading…
Reference in New Issue