From bd21c609d3e0f325f10f20bb1f59ae24a4b35dc2 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 03 三月 2025 10:29:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
UI-Project/src/views/User/userlist.vue | 153 +++++++++++++++++++++++---------------------------
1 files changed, 71 insertions(+), 82 deletions(-)
diff --git a/UI-Project/src/views/User/userlist.vue b/UI-Project/src/views/User/userlist.vue
index 2198c37..ba6b53d 100644
--- a/UI-Project/src/views/User/userlist.vue
+++ b/UI-Project/src/views/User/userlist.vue
@@ -7,30 +7,39 @@
const adda = ref(false)
import request from "@/utils/request"
import { ref, onMounted } from "vue";
-// import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
- import { useI18n } from 'vue-i18n'
- const { t } = useI18n()
- let language = ref(localStorage.getItem('lang') || 'zh')
-// import LanguageMixin from './lang/LanguageMixin'
-const selectedProjectNoa = ref(null); // 褰撳墠閫変腑鐨勮鑹�
-// const options = ref<any[]>([]); // 涓嬫媺閫夐」鍒楄〃
- const userName = ref('');
- const password = ref('');
-
+import { useI18n } from 'vue-i18n'
+const { t } = useI18n()
+let language = ref(localStorage.getItem('lang') || 'zh')
+const selectedProjectNoa = ref(null);
+const userName = ref('');
+const password = ref('');
const tableData = ref([])
const slot = ref('')
-request.post("/loadGlass/sys/user/listByUserName",{
- key: ''
-}).then((res) => {
- if (res.code == 200) {
- console.log(res.data);
- tableData.value = res.data
- } else {
- ElMessage.warning(res.msg)
-
- }
- });
+// request.post("/loadGlass/sys/user/listByUserName",{
+// key: ''
+// }).then((res) => {
+// if (res.code == 200) {
+// console.log(res.data);
+// tableData.value = res.data
+// } else {
+// ElMessage.warning(res.msg)
+// }
+// });
+ const listByUserName = async () => {
+ try {
+ const response = await request.post('/loadGlass/sys/user/listByUserName',{
+ key: ''
+ });
+ if (response.code === 200) {
+ tableData.value = response.data
+ } else {
+ ElMessage.warning(response.data);
+ }
+ } catch (error) {
+ console.error('Error fetching options:', error);
+ }
+};
// 閲嶇疆瀵嗙爜
const open = async(row) => {
try {
@@ -43,8 +52,7 @@
type: 'warning',
}
);
- if (confirmResult === 'confirm') {
- // 鐢ㄦ埛鐐瑰嚮浜嗏�滄槸鈥濓紝鐜板湪璋冪敤鍒犻櫎鎺ュ彛
+ if (confirmResult === 'confirm') {
var url="/loadGlass/sys/user/resetPassword?userId="+row.id;
console.log(url);
const response = await request.post(url, {
@@ -52,43 +60,29 @@
})
if (response.code === 200) {
ElMessage.success(response.message);
- } else {
- // 鍒犻櫎澶辫触锛屾偍鍙互澶勭悊閿欒鎴栨樉绀洪敊璇俊鎭粰鐢ㄦ埛
+ } else {
ElMessage.error(response.msg);
- // alert('鍒犻櫎澶辫触锛�' + deleteResponse.message);
}
}
- } catch (error) {
- // 澶勭悊鍙兘鍑虹幇鐨勯敊璇紝姣斿 ElMessageBox 鎶涘嚭鐨勫紓甯哥瓑
+ } catch (error) {
console.error('鍙戠敓閿欒:', error);
}
};
const titleSelectJsona = ref({
processType: [],
-
})
-// const handleInputChangea = async (value: string) => {
-// if (value) {
-// await fetchOptionsa(value);
-// } else {
-// options.value = []; // 娓呯┖閫夐」鍒楄〃
-// }
-// };
-onMounted(() => {
- // 鍦ㄧ粍浠舵寕杞藉悗璋冪敤 fetchOptions('') 鏉ュ姞杞藉垵濮嬫暟鎹紙濡傛灉闇�瑕侊級
- fetchOptionsa('');
+onMounted(() => {
+ fetchOptionsa('');
+ listByUserName('');
});
// 瑙掕壊涓嬫媺閫�
const fetchOptionsa = async () => {
- try {
- // 鍙戦�佽姹傚埌鍚庣鎺ュ彛
+ try {
const response = await request.post('/loadGlass/sys/role/queryRole',{
- key: ''
-});
+ key: ''
+ });
if (response.code === 200) {
titleSelectJsona.value.processTypea = response.data;
- console.log(response.data);
-
} else {
ElMessage.warning(response.data);
}
@@ -103,10 +97,22 @@
const firstRole = row.roleList[0];
selectedProjectNoa.value = firstRole.id; // 璁剧疆涓篒D锛岃�屼笉鏄痭ame
}
- adda.value = true; // 鏄剧ず瀵硅瘽妗�
+ adda.value = true;
window.localStorage.setItem('id', row.id)
-
}
+function closeDialog(row) {
+ add.value = false;
+ userName.value = '';
+ nickName.value = '';
+ password.value = '';
+ selectedProjectNoa.value = '';
+}
+function closeDialoga(row) {
+ adda.value = false;
+ userName.value = '';
+ nickName.value = '';
+ password.value = '';
+}
// 娣诲姞
const getTableRow = async () => {
try {
@@ -117,24 +123,17 @@
roleList: [
{
id: selectedProjectNoa.value,
- // name: selectedProjectNoa.value.name,
}]
- // roleList: selectedProjectNoa.value.map(item => ({
- // id: item.id,
- // name: item.name
- // }))
});
if (response.code === 200) {
- // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
ElMessage.success(response.message);
add.value = false;
- tableData.value = response.data;
+ listByUserName('');
+ // tableData.value = response.data;
} else {
- // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
- ElMessage.error(response.msg);
+ ElMessage.error(response.message);
}
} catch (error) {
- // 澶勭悊閿欒
console.error(error);
}
};
@@ -148,21 +147,18 @@
roleList: [
{
id: selectedProjectNoa.value,
- // roleKey: selectedProjectNoa.value.id,
}]
}
);
if (response.code === 200) {
- // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫
ElMessage.success(response.message);
adda.value = false;
- tableData.value = response.data;
+ listByUserName('');
+ tableData.value = response.data;
} else {
- // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭�
ElMessage.error(response.message);
}
} catch (error) {
- // 澶勭悊閿欒
console.error(error);
}
};
@@ -178,31 +174,26 @@
type: 'warning',
}
);
- if (confirmResult === 'confirm') {
- // 鐢ㄦ埛鐐瑰嚮浜嗏�滄槸鈥濓紝鐜板湪璋冪敤鍒犻櫎鎺ュ彛
+ if (confirmResult === 'confirm') {
const response = await request.post("/loadGlass/sys/user/deleteUser", [row.id])
if (response.code === 200) {
ElMessage.success(response.message);
- } else {
- // 鍒犻櫎澶辫触锛屾偍鍙互澶勭悊閿欒鎴栨樉绀洪敊璇俊鎭粰鐢ㄦ埛
+ listByUserName('');
+ } else {
ElMessage.error(response.msg);
- // alert('鍒犻櫎澶辫触锛�' + deleteResponse.message);
}
}
- } catch (error) {
- // 澶勭悊鍙兘鍑虹幇鐨勯敊璇紝姣斿 ElMessageBox 鎶涘嚭鐨勫紓甯哥瓑
+ } catch (error) {
console.error('鍙戠敓閿欒:', error);
}
};
-
</script>
-
<template>
<div>
<el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">{{ $t('productStock.addusers') }}</el-button>
<el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading">
<div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
- <el-table height="240" ref="table"
+ <el-table height="750" ref="table"
@selection-change="handleSelectionChange"
:data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
<el-table-column prop="userName" align="center" :label="$t('productStock.username')" min-width="180" />
@@ -233,7 +224,7 @@
<div id="dt" style="font-size: 15px;">
<div>
<el-form-item :label="$t('productStock.usernamea')" :required="true" style="width: 25vw">
- <el-input v-model="userName" autocomplete="off" :placeholder="$t('productStock.inusername')" />
+ <el-input v-model="userName" autocomplete="off" style="width: 350px;" :placeholder="$t('productStock.inusername')" />
</el-form-item></div></div>
</el-col>
</el-row>
@@ -247,10 +238,10 @@
filterable
clearable
:placeholder="$t('productStock.inrole')"
- style="width: 330px"
+ style="width: 350px;"
>
<el-option
- v-for="item in titleSelectJsona['processTypea']"
+ v-for="item in titleSelectJsona['processTypea']"
:key="item.id"
:label="item.name"
:value="item.id"
@@ -264,7 +255,7 @@
<div id="dt" style="font-size: 15px;">
<div>
<el-form-item :label="$t('productStock.password')" :required="true" style="width: 25vw;">
- <el-input style="width: 340px;"
+ <el-input style="width: 350px;"
v-model="password"
:placeholder="$t('productStock.inpassword')"
autocomplete="off"
@@ -281,7 +272,7 @@
<el-button type="primary" @click="getTableRow">
{{ $t('productStock.sure') }}
</el-button>
- <el-button @click="add = false">{{ $t('productStock.cancel') }}</el-button>
+ <el-button @click="closeDialog">{{ $t('productStock.cancel') }}</el-button>
</div>
</template>
</el-dialog>
@@ -294,7 +285,7 @@
<div id="dt" style="font-size: 15px;">
<div>
<el-form-item :label="$t('productStock.usernamea')" :required="true" style="width: 25vw">
- <el-input :placeholder="$t('productStock.inusername')" v-model="userName" autocomplete="off" />
+ <el-input :placeholder="$t('productStock.inusername')" v-model="userName" autocomplete="off" style="width: 350px;"/>
</el-form-item></div></div>
</el-col>
</el-row>
@@ -308,7 +299,7 @@
filterable
clearable
:placeholder="$t('productStock.inrole')"
- style="width: 330px"
+ style="width: 350px;"
>
<el-option
v-for="item in titleSelectJsona['processTypea']"
@@ -328,14 +319,12 @@
<el-button type="primary" @click="getTableRowa">
{{ $t('productStock.sure') }}
</el-button>
- <el-button @click="adda = false">{{ $t('productStock.cancel') }}</el-button>
+ <el-button @click="closeDialoga">{{ $t('productStock.cancel') }}</el-button>
</div>
</template>
</el-dialog>
</template>
-
<style scoped>
-
#dt { display:block; float:left;line-height: 20px;margin-left: 100px;}
#dta { display:block; float:left;line-height: 20px;margin-left: 80%;}
#dialog-footer{
--
Gitblit v1.8.0