From ecb306c5612f474a5911af20a567f3f4d4db33d1 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 24 九月 2025 15:02:23 +0800
Subject: [PATCH] 原材料订单拆分功能v1
---
src/views/system/user/index.vue | 119 +++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 74 insertions(+), 45 deletions(-)
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 95dc281..9dd89c3 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -8,8 +8,8 @@
<div class="head-container addButton">
<el-input v-model="deptName" placeholder="閮ㄩ棬鍚嶇О" clearable size="small" prefix-icon="el-icon-search"
style="margin-bottom: 20px" />
- <el-button style="margin-left: 4px" type="primary" plain icon="el-icon-plus" size="mini" circle
- @click="addSchema"></el-button>
+ <!-- <el-button style="margin-left: 4px" type="primary" plain icon="el-icon-plus" size="mini" circle
+ @click="addSchema"></el-button> -->
</div>
<div class="head-container">
<el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
@@ -28,14 +28,14 @@
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="鐘舵��" prop="status">
- <el-select v-model="queryParams.status" placeholder="鐢ㄦ埛鐘舵��" clearable>
+ <el-select v-model="queryParams.status" placeholder="鐢ㄦ埛鐘舵��" clearable @change="handleQuery">
<el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鏌� 璇�</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲� 缃�</el-button>
+ <el-button type="primary" size="mini" @click="handleQuery">鏌ヨ</el-button>
+ <el-button size="mini" @click="resetQuery">閲嶇疆</el-button>
</el-form-item>
</el-form>
</div>
@@ -47,10 +47,11 @@
</div>
</div>
<el-col>
- <el-table v-loading="loading" :data="userList">
+ <el-table v-loading="loading" :data="userList" :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border>
<el-table-column label="搴忓彿" align="center" type="index" />
<el-table-column label="濮撳悕" align="center" key="nickName" prop="nickName" :show-overflow-tooltip="true" />
<el-table-column label="璐﹀彿" align="center" key="userName" prop="userName" :show-overflow-tooltip="true" />
+ <el-table-column label="瑙掕壊" align="center" key="roleName" prop="roleName" :show-overflow-tooltip="true" />
<el-table-column label="鐘舵��" align="center" key="status">
<template slot-scope="scope">
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1"
@@ -62,7 +63,7 @@
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:user:edit']">淇敼</el-button>
- <!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']">鍒犻櫎</el-button>-->
+ <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']">鍒犻櫎</el-button>
<!-- <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">-->
<!-- <el-button size="mini" type="text" icon="el-icon-d-arrow-right">鏇村</el-button>-->
<!-- <el-dropdown-menu slot="dropdown">-->
@@ -149,7 +150,8 @@
</el-col>
<el-col :span="12">
<el-form-item label="褰掑睘閮ㄩ棬" prop="deptId">
- <treeselect v-model="form.deptId" :options="enabledDeptOptions" :show-count="true" placeholder="璇烽�夋嫨褰掑睘閮ㄩ棬" />
+ <treeselect v-model="form.deptId" :options="enabledDeptOptions" :show-count="true"
+ placeholder="璇烽�夋嫨褰掑睘閮ㄩ棬" />
</el-form-item>
</el-col>
</el-row>
@@ -211,7 +213,7 @@
<el-col :span="8" style="height: 70vh;overflow: hidden;" v-if="companiesList.length != 1">
<el-input v-model="search2" placeholder="杈撳叆鍏抽敭瀛楁悳绱�" clearable size="small" @clear="searchFilter2"
@keyup.enter.native="searchFilter2" prefix-icon="el-icon-search" style="margin-bottom: 20px;width: 90%" />
- <el-tree :data="datathirdParty" node-key="companyId" :props="defaultProps" @node-click="nodeClick2"
+ <el-tree :data="datathirdParty" node-key="companyId" :props="defaultProps1" @node-click="nodeClick2"
style="height: calc(100% - 42px);" @node-expand="nodeOpen0" :filter-node-method="filterNode2" ref="tree2"
highlight-current>
</el-tree>
@@ -223,12 +225,13 @@
style="width: 50%" @keyup.enter.native="searchPerson()"></el-input>
</div>
<el-table height="67vh" stripe :data="personList" v-loading="personLoad" ref="personTable"
+ :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="50">
</el-table-column>
<el-table-column prop="employeeID" label="鍛樺伐鍙�">
</el-table-column>
- <el-table-column prop="nickName" label="鍛樺伐濮撳悕">
+ <el-table-column prop="name" label="鍛樺伐濮撳悕">
</el-table-column>
<el-table-column prop="department" label="閮ㄩ棬" min-width="200">
</el-table-column>
@@ -291,6 +294,7 @@
return {
// 閬僵灞�
loading: true,
+ multipleSelection: [],
// 閫変腑鏁扮粍
ids: [],
// 闈炲崟涓鐢�
@@ -326,6 +330,10 @@
defaultProps: {
children: "children",
label: "label"
+ },
+ defaultProps1: {
+ children: "children",
+ label: "companyName"
},
// 鐢ㄦ埛瀵煎叆鍙傛暟
upload: {
@@ -379,9 +387,35 @@
roleIds: [
{ required: true, message: "璇烽�夋嫨瑙掕壊", trigger: "change" }
],
- // password: [
- // { required: true, message: "瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" },
- // ],
+ password: [
+ { required: false, message: "瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" },
+ { min: 8, max: 20, message: "瀵嗙爜闀垮害蹇呴』鍦�8-20涓瓧绗︿箣闂�", trigger: "blur" },
+ {
+ validator: (rule, value, callback) => {
+ if (!value) {
+ callback();
+ return;
+ }
+ // 妫�鏌ユ槸鍚﹀寘鍚ぇ鍐欏瓧姣�
+ const hasUpperCase = /[A-Z]/.test(value);
+ // 妫�鏌ユ槸鍚﹀寘鍚皬鍐欏瓧姣�
+ const hasLowerCase = /[a-z]/.test(value);
+ // 妫�鏌ユ槸鍚﹀寘鍚壒娈婄鍙�
+ const hasSpecialChar = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(value);
+
+ if (!hasUpperCase) {
+ callback(new Error('瀵嗙爜蹇呴』鍖呭惈鑷冲皯涓�涓ぇ鍐欏瓧姣�'));
+ } else if (!hasLowerCase) {
+ callback(new Error('瀵嗙爜蹇呴』鍖呭惈鑷冲皯涓�涓皬鍐欏瓧姣�'));
+ } else if (!hasSpecialChar) {
+ callback(new Error('瀵嗙爜蹇呴』鍖呭惈鑷冲皯涓�涓壒娈婄鍙�'));
+ } else {
+ callback();
+ }
+ },
+ trigger: "blur"
+ }
+ ],
phonenumber: [
{
required: true,
@@ -447,10 +481,6 @@
}
this.addLoad = true
addDepartment(this.addOb).then(res => {
- if (res.code === 201) {
- this.addLoad = false
- return
- }
this.$message.success('娣诲姞鎴愬姛')
this.addDia = false
this.getList()
@@ -543,6 +573,7 @@
},
// 澶氶�夋閫変腑鏁版嵁
handleSelectionChange(selection) {
+ this.multipleSelection = selection;
this.ids = selection.map(item => item.userId);
this.single = selection.length != 1;
this.multiple = !selection.length;
@@ -561,30 +592,31 @@
}
},
// 鑾峰彇涓夋柟浜哄憳
- openthirdParty() {
- this.addthirdParty = true;
- this.thirdPartyLoading = true;
- selectCompaniesList().then(res => {
- this.companiesList = this.HaveJson(res.data);
- if (this.companiesList.length == 1) {
- selectSimpleList({ companyId: this.companiesList[0].companyId }).then(res => {
- this.thirdPartyLoading = false;
- this.personListCopy = JSON.parse(JSON.stringify(res.data))
- this.personList = res.data
- this.$refs.personTable.doLayout()
- })
- } else {
- this.thirdPartyLoading = false;
+ async openthirdParty() {
+ try {
+ this.addthirdParty = true;
+ this.thirdPartyLoading = true;
+
+ const companiesResponse = await selectCompaniesList();
+ this.companiesList = this.HaveJson(companiesResponse.data);
+
+ if (this.companiesList.length === 1) {
+ const personResponse = await selectSimpleList({ companyId: this.companiesList[0].companyId });
+ this.personListCopy = JSON.parse(JSON.stringify(personResponse.data));
+ this.personList = personResponse.data;
+ this.$refs.personTable.doLayout();
}
- this.datathirdParty = this.tranListToTreeData(res.data, "ROOT");
- }).catch(() => {
+
+ this.datathirdParty = this.tranListToTreeData(this.companiesList, "ROOT");
+ console.log(' this.datathirdParty---', this.datathirdParty)
+ } catch (error) {
+ console.error("Error fetching third party data:", error);
+ } finally {
this.thirdPartyLoading = false;
- })
- if (this.componentData.entity.roleId > 10000) this.$message.warning('鐢变簬鏈�変腑鍏蜂綋瑙掕壊锛屾柊澧炵敤鎴峰皢鎴愪负榛樿瑙掕壊')
+ }
},
tranListToTreeData(list, rootValue) {
- const arr = [];
- list.forEach((item) => {
+ return list.reduce((arr, item) => {
if (item.parentCompanyId === rootValue) {
const children = this.tranListToTreeData(list, item.companyId);
if (children.length) {
@@ -592,8 +624,8 @@
}
arr.push(item);
}
- });
- return arr;
+ return arr;
+ }, []);
},
searchPerson() {
let arr = JSON.parse(JSON.stringify(this.personListCopy))
@@ -625,7 +657,7 @@
}
},
nodeOpen0(data, node, el) {
- this.currentCompaniesList[node.level - nodeOpen01] = data.id
+ // this.currentCompaniesList[node.level - nodeOpen01] = data.id
},
filterNode2(value, data) {
if (!value) return true;
@@ -653,16 +685,13 @@
addPersonUser({
company: arr,
person: this.multipleSelection,
- roleId: this.componentData.entity.roleId
+ // roleId: this.componentData.entity.roleId
}).then(res => {
- if (res.code === 201) {
- this.addLoad = false
- return
- }
this.$message.success('鎿嶄綔鎴愬姛')
this.multipleSelection = []
this.$refs.personTable.clearSelection()
this.addLoad = false
+ this.addthirdParty = false
this.userSearch2 = ''
this.getList()
}).catch(e => {
--
Gitblit v1.9.3