流程相关-分公司项目部新增
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({
|
return request({
|
||||||
url: '/system/dict/type/' + dictId,
|
url: '/system/subOrg/' + orgId,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
export function addType(data) {
|
export function addType(data) {
|
||||||
console.log(data)
|
let dataList = handle(data)
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/type',
|
url: '/system/subOrg',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: dataList
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改
|
// 修改
|
||||||
export function updateType(data) {
|
export function updateType(data) {
|
||||||
|
let dataList = handle(data)
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/type',
|
url: '/system/subOrg',
|
||||||
method: 'put',
|
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({
|
return request({
|
||||||
url: '/system/dict/type/' + dictId,
|
url: '/system/subOrg/' + orgId,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 刷新
|
// 审批/提交/撤回
|
||||||
export function refreshCache() {
|
export function changeStatus(orgId,reviewerStatus) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/type/refreshCache',
|
url: '/system/subOrg/changeStatus/'+orgId+"/"+reviewerStatus,
|
||||||
method: 'delete'
|
method: 'put'
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取选择框列表
|
|
||||||
export function optionselect() {
|
|
||||||
return request({
|
|
||||||
url: '/system/dict/type/optionselect',
|
|
||||||
method: 'get'
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,9 @@
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
|
|
||||||
>导出
|
>导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -55,11 +53,9 @@
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-s-custom"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
|
|
||||||
>权限分配
|
>权限分配
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -84,6 +80,7 @@
|
||||||
<span v-if="scope.row.reviewerStatus == 0">待审核</span>
|
<span v-if="scope.row.reviewerStatus == 0">待审核</span>
|
||||||
<span v-else-if="scope.row.reviewerStatus == 1">已审核</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 == 2">未通过</span>
|
||||||
|
<span v-else-if="scope.row.reviewerStatus == 3">撤回</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
|
@ -92,8 +89,8 @@
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-search"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="detailsUpdate(scope.row)"
|
||||||
>详情
|
>详情
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -101,13 +98,15 @@
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-if="scope.row.reviewerStatus == 0"
|
||||||
>修改
|
>修改
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-refresh-left"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleWithdraw(scope.row)"
|
||||||
|
v-if="scope.row.reviewerStatus == 0"
|
||||||
>撤回
|
>撤回
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -115,6 +114,7 @@
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
|
v-if="scope.row.reviewerStatus == 3 "
|
||||||
>删除
|
>删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -327,7 +327,7 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<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>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
@ -335,7 +335,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {listType, getType, delType, addType, updateType, refreshCache} from "@/api/process/branchPro";
|
import {listType, getType, delType, addType, updateType, changeStatus} from "@/api/process/branchPro";
|
||||||
import {listDept, orgPersonSelect} from "@/api/system/dept";
|
import {listDept, orgPersonSelect} from "@/api/system/dept";
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
@ -348,12 +348,6 @@ export default {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
|
||||||
ids: [],
|
|
||||||
// 非单个禁用
|
|
||||||
single: true,
|
|
||||||
// 非多个禁用
|
|
||||||
multiple: true,
|
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 总条数
|
// 总条数
|
||||||
|
|
@ -364,6 +358,7 @@ export default {
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
|
details:true,
|
||||||
// 日期范围
|
// 日期范围
|
||||||
dateRange: [],
|
dateRange: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
|
|
@ -462,11 +457,53 @@ export default {
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
dictId: undefined,
|
parentId: undefined,
|
||||||
dictName: undefined,
|
orgName: undefined,
|
||||||
dictType: undefined,
|
address: undefined,
|
||||||
status: "0",
|
attendanceUserId: undefined,
|
||||||
remark: 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");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
|
|
@ -485,6 +522,7 @@ export default {
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
|
this.details = true;
|
||||||
this.title = "分公司项目部新增";
|
this.title = "分公司项目部新增";
|
||||||
/**
|
/**
|
||||||
* 上级部门下拉选
|
* 上级部门下拉选
|
||||||
|
|
@ -527,13 +565,72 @@ export default {
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const dictId = row.dictId || this.ids
|
const ids = row.id
|
||||||
getType(dictId).then(response => {
|
getType(ids).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
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 () {
|
submitForm: function () {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
|
|
@ -543,7 +640,7 @@ export default {
|
||||||
this.$message.error("请至少选择一个项目经理");
|
this.$message.error("请至少选择一个项目经理");
|
||||||
return;
|
return;
|
||||||
} else if (manager.length > 1) {
|
} else if (manager.length > 1) {
|
||||||
this.$message.error("请选择一个项目经理");
|
this.$message.error("请选择一个项目经理!!!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.form.manager = manager.join(",");
|
this.form.manager = manager.join(",");
|
||||||
|
|
@ -635,15 +732,28 @@ export default {
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const dictIds = row.dictId || this.ids;
|
const ids = row.id;
|
||||||
this.$modal.confirm('是否确认删除编号为"' + dictIds + '"的数据项?').then(function () {
|
this.$modal.confirm('是否确认删除此数据项?').then(function () {
|
||||||
return delType(dictIds);
|
return delType(ids);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** 撤回按钮操作 */
|
||||||
|
handleWithdraw(row) {
|
||||||
|
const ids = row.id;
|
||||||
|
this.$modal.confirm('是否确认撤回此数据项?').then(function () {
|
||||||
|
return changeStatus(ids,"3");
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("撤回成功");
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.download('system/dict/type/export', {
|
this.download('system/dict/type/export', {
|
||||||
|
|
@ -682,12 +792,10 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
handleSelect1(value, instanceId) {
|
handleSelect1(value, instanceId) {
|
||||||
console.log('Selected:', value);
|
|
||||||
// 在这里处理选择事件
|
// 在这里处理选择事件
|
||||||
this.form.orgHeadUserName = value.name;
|
this.form.orgHeadUserName = value.name;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/** 查询员工树结构 */
|
/** 查询员工树结构 */
|
||||||
getStaffTreeselect(orgId, deptRoleId, departmentId, types) {
|
getStaffTreeselect(orgId, deptRoleId, departmentId, types) {
|
||||||
let data = {
|
let data = {
|
||||||
|
|
@ -696,155 +804,34 @@ export default {
|
||||||
departmentId: departmentId,
|
departmentId: departmentId,
|
||||||
}
|
}
|
||||||
staffTreeselect(data).then(response => {
|
staffTreeselect(data).then(response => {
|
||||||
this.managerOptions = response.data;
|
// 动态设置每个类型的选项
|
||||||
this.processData(types, this.managerOptions);
|
this[`${types}Options`] = response.data;
|
||||||
/** 设置默认选中的节点 */
|
// 处理数据
|
||||||
this.managerDefaultCheckedKeys = this.getCheckedKeys(types, this.managerOptions);
|
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 = '') {
|
processData(types, nodes, parentId = '') {
|
||||||
switch (types) {
|
const idKey = `${types}Id`;
|
||||||
case "manager":
|
const idMapKey = `${types}IdToIdMap`;
|
||||||
|
|
||||||
nodes.forEach(node => {
|
nodes.forEach(node => {
|
||||||
node.managerId = `${parentId ? parentId + '-' : ''}${node.id}`; // 生成唯一标识符
|
// 生成唯一标识符
|
||||||
this.managerIdToIdMap[node.managerId] = node.id; // 建立 uniqueId 到 id 的映射
|
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) {
|
if (node.children && node.children.length > 0) {
|
||||||
this.processData(node.children, node.managerId); // 递归处理子节点
|
this.processData(types, node.children, node[idKey]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
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;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 递归获取默认选中的节点 id */
|
/** 递归获取默认选中的节点 id */
|
||||||
|
|
@ -1112,47 +1099,22 @@ export default {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// 所有菜单节点数据
|
// 所有菜单节点数据
|
||||||
getAllCheckedKeys(type) {
|
getAllCheckedKeys(type) {
|
||||||
// 目前被选中的菜单节点
|
// 获取当前被选中的菜单节点
|
||||||
let checkedKeys;
|
const idMapKey = `${type}IdToIdMap`;
|
||||||
let checkedIds;
|
const ref = this.$refs[type];
|
||||||
switch (type){
|
const idMap = this[idMapKey];
|
||||||
case "manager":
|
if (!ref || !idMap) {
|
||||||
checkedKeys = this.$refs.manager.getCheckedKeys();
|
console.error(`Reference or ID map for type "${type}" not found.`);
|
||||||
checkedIds = checkedKeys.map(managerId => this.managerIdToIdMap[managerId]);
|
return [];
|
||||||
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 checkedKeys = ref.getCheckedKeys();
|
||||||
|
const checkedIds = checkedKeys.map(key => idMap[key]);
|
||||||
return checkedIds;
|
return checkedIds;
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -280,6 +280,7 @@ export default {
|
||||||
this.processData(node.children, node.uniqueId); // 递归处理子节点
|
this.processData(node.children, node.uniqueId); // 递归处理子节点
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log("this.uniqueIdToIdMap",this.uniqueIdToIdMap)
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 设置默认选中的节点 */
|
/** 设置默认选中的节点 */
|
||||||
|
|
@ -351,6 +352,7 @@ export default {
|
||||||
getStaffAllCheckedKeys() {
|
getStaffAllCheckedKeys() {
|
||||||
// 目前被选中的菜单节点
|
// 目前被选中的菜单节点
|
||||||
let checkedKeys = this.$refs.staff.getCheckedKeys();
|
let checkedKeys = this.$refs.staff.getCheckedKeys();
|
||||||
|
console.log("checkedKeys,",checkedKeys)
|
||||||
const checkedIds = checkedKeys.map(uniqueId => this.uniqueIdToIdMap[uniqueId]);
|
const checkedIds = checkedKeys.map(uniqueId => this.uniqueIdToIdMap[uniqueId]);
|
||||||
// 半选中的菜单节点
|
// 半选中的菜单节点
|
||||||
// let halfCheckedKeys = this.$refs.staff.getHalfCheckedKeys();
|
// let halfCheckedKeys = this.$refs.staff.getHalfCheckedKeys();
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ module.exports = {
|
||||||
proxy: {
|
proxy: {
|
||||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||||
[process.env.VUE_APP_BASE_API]: {
|
[process.env.VUE_APP_BASE_API]: {
|
||||||
target: `http://192.168.0.32:8100`,
|
target: `http://192.168.0.137:8100`,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue