From c502a1e37ea372b52140e8913f636c9d57b56e23 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期一, 26 六月 2023 14:25:05 +0800
Subject: [PATCH] 删除无用页面
---
pages/customer-page/customer-my/userMange/userManageEdit/userManageEdit.vue | 460 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 253 insertions(+), 207 deletions(-)
diff --git a/pages/customer-page/customer-my/userMange/userManageEdit/userManageEdit.vue b/pages/customer-page/customer-my/userMange/userManageEdit/userManageEdit.vue
index 3d56130..4b56a60 100644
--- a/pages/customer-page/customer-my/userMange/userManageEdit/userManageEdit.vue
+++ b/pages/customer-page/customer-my/userMange/userManageEdit/userManageEdit.vue
@@ -1,237 +1,283 @@
<template>
<view class="main">
<view class="main-block">
- <u--form labelPosition="left" :model="model1" :rules="rules" ref="uForm" :errorType="errorType">
- <u-form-item label="鏈嶅姟閮ㄩ棬" labelWidth="20%" @click="treeOpen" borderBottom prop="deptIds">
- <u--input placeholder="璇烽�夋嫨鏈嶅姟閮ㄩ棬" v-model="model1.deptIds" class="input" type="text"></u--input>
- <qian-tree ref="tkitree" :range="department" confirmColor="#4e8af7" :multiple="true" :selectParent="true" title="閫夋嫨閮ㄩ棬" @confirm="treeChooseValue" />
+ <u--form labelPosition="left"
+ :model="model1"
+ :rules="rules"
+ ref="uForm"
+ :errorType="errorType">
+ <u-form-item label="鏈嶅姟閮ㄩ棬"
+ labelWidth="20%"
+ @click="treeOpen"
+ borderBottom
+ prop="deptIds">
+ <u--input placeholder="璇烽�夋嫨鏈嶅姟閮ㄩ棬"
+ v-model="model1.deptIds"
+ class="input"
+ type="text"></u--input>
+ <qian-tree ref="tkitree"
+ :range="department"
+ confirmColor="#4e8af7"
+ :multiple="true"
+ :selectParent="true"
+ title="閫夋嫨閮ㄩ棬"
+ @confirm="treeChooseValue" />
</u-form-item>
- <u-form-item label="韬唤璇�" labelWidth="20%" borderBottom prop="idCard">
- <u--input border="none" v-model="model1.idCard" placeholder="璇疯緭鍏ヨ韩浠借瘉"></u--input>
+ <u-form-item label="韬唤璇�"
+ labelWidth="20%"
+ borderBottom
+ prop="idCard">
+ <u--input border="none"
+ v-model="model1.idCard"
+ placeholder="璇疯緭鍏ヨ韩浠借瘉"></u--input>
</u-form-item>
- <u-form-item label="鐪熷疄濮撳悕" labelWidth="20%" borderBottom prop="name">
- <u--input border="none" v-model="model1.name" placeholder="璇疯緭鍏ョ湡瀹炲鍚�"></u--input>
+ <u-form-item label="鐪熷疄濮撳悕"
+ labelWidth="20%"
+ borderBottom
+ prop="name">
+ <u--input border="none"
+ v-model="model1.name"
+ placeholder="璇疯緭鍏ョ湡瀹炲鍚�"></u--input>
</u-form-item>
- <u-form-item label="鎵嬫満鍙�" labelWidth="20%" borderBottom prop="phone">
- <u--input border="none" v-model="model1.phone" placeholder="璇疯緭鍏ユ墜鏈哄彿"></u--input>
+ <u-form-item label="鎵嬫満鍙�"
+ labelWidth="20%"
+ borderBottom
+ prop="phone">
+ <u--input border="none"
+ v-model="model1.phone"
+ placeholder="璇疯緭鍏ユ墜鏈哄彿"></u--input>
</u-form-item>
- <u-form-item label="瀵嗙爜" labelWidth="20%" borderBottom prop="password">
- <u--input border="none" v-model="model1.password" placeholder="璇疯緭鍏ュ瘑鐮�"></u--input>
+ <u-form-item label="瀵嗙爜"
+ labelWidth="20%"
+ borderBottom
+ prop="password">
+ <u--input border="none"
+ v-model="model1.password"
+ placeholder="璇疯緭鍏ュ瘑鐮�"></u--input>
</u-form-item>
</u--form>
</view>
- <view class="submit-button"><u-button :text="userId ? '纭淇敼' : '纭鎻愪氦'" type="primary" @click="submitMsg"></u-button></view>
+ <view class="submit-button"><u-button :text="userId ? '纭淇敼' : '纭鎻愪氦'"
+ type="primary"
+ @click="submitMsg"></u-button></view>
</view>
</template>
<script>
-let url = 'http://192.168.31.14:9999';
-import qianTree from '@/components/qian-tree/qian-tree.vue';
-export default {
- components: {
- qianTree
- },
- data() {
- return {
- department: [],
- model1: {
- departmentName: '',
- idCard: '',
- name: '',
- phone: '',
- password: '',
- deptIds: '',
- isHostUser: 1
- },
- tempdeptIds: '',
- userId: '',
- diffdeptId: '',
- ismodifyDept: false,
- rules: {
- deptIds: {
- type: 'string',
- required: true,
- message: '璇疯嚦灏戦�夋嫨涓�涓儴闂�',
- trigger: ['blur', 'change']
- },
- idCard: {
- type: 'string',
- required: true,
- message: '璇峰~鍐欒韩浠借瘉鍙风爜',
- trigger: ['blur', 'change']
- },
- name: {
- type: 'string',
- required: true,
- message: '璇峰~鍐欏鍚�',
- trigger: ['blur', 'change']
- },
- phone: {
- type: 'string',
- required: true,
- message: '璇峰~鍐欐墜鏈哄彿',
- trigger: ['blur', 'change']
- },
- password: {
- type: 'string',
- required: true,
- message: '璇峰~鍐欏瘑鐮�',
- trigger: ['blur', 'change']
- }
- },
- errorType: 'message'
- };
- },
- onLoad(params) {
- if (params.userId) {
- this.userId = params.userId;
- }
- },
- onShow() {
- if (this.userId) {
- this.viewInfo();
- }
- this.$refs.tkitree._hide();
- },
- onReady() {
- this.$refs.uForm.setRules(this.rules);
- },
- created() {
- this.fetchTree();
- },
- methods: {
- fetchTree() {
- uni.request({
- url: `${url}/admin/dept/ownTree`,
- header: {
- Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'),
- CLIENT_TOC: 'Y'
- },
- success: res => {
- this.department = res.data.data;
- }
- });
+ let url = 'http://192.168.31.14:9999';
+ import qianTree from '@/components/qian-tree/qian-tree.vue';
+ import { BaseUrl } from '@/api/publicInterface.js'
+ export default {
+ components: {
+ qianTree
},
- viewInfo(v) {
- uni.showLoading({
- title: '鍔犺浇涓�'
- });
- this.$reqGet('getAppById', { userId: this.userId.toString() }).then(res => {
- uni.hideLoading();
- if (res.code == 0) {
- this.tempdeptIds = res.data.deptIds;
- if (res.data.deptIds == null) {
- this.diffdeptId = '鍏ㄩ儴';
- } else {
- this.diffdeptId = this.findNameById(this.department, res.data.deptIds.split(',')).join();
+ data() {
+ return {
+ department: [],
+ model1: {
+ departmentName: '',
+ idCard: '',
+ name: '',
+ phone: '',
+ password: '',
+ deptIds: '',
+ isHostUser: 1
+ },
+ tempdeptIds: '',
+ userId: '',
+ diffdeptId: '',
+ ismodifyDept: false,
+ rules: {
+ deptIds: {
+ type: 'string',
+ required: true,
+ message: '璇疯嚦灏戦�夋嫨涓�涓儴闂�',
+ trigger: ['blur', 'change']
+ },
+ idCard: {
+ type: 'string',
+ required: true,
+ message: '璇峰~鍐欒韩浠借瘉鍙风爜',
+ trigger: ['blur', 'change']
+ },
+ name: {
+ type: 'string',
+ required: true,
+ message: '璇峰~鍐欏鍚�',
+ trigger: ['blur', 'change']
+ },
+ phone: {
+ type: 'string',
+ required: true,
+ message: '璇峰~鍐欐墜鏈哄彿',
+ trigger: ['blur', 'change']
+ },
+ password: {
+ type: 'string',
+ required: true,
+ message: '璇峰~鍐欏瘑鐮�',
+ trigger: ['blur', 'change']
}
- this.model1 = {
- ...res.data,
- password: '',
- deptIds: this.diffdeptId
- };
- } else {
- this.$u.toast('鍔犺浇澶辫触');
- }
- });
+ },
+ errorType: 'message'
+ };
},
- treeOpen() {
- this.$refs.tkitree._show();
- },
- treeClose() {
- this.$refs.tkitree._hide();
- },
- treeChooseValue(v) {
- this.$refs.tkitree._hide();
- this.model1.deptIds = this.findNameById(this.department, v).join();
- this.diffdeptId = v.join();
- this.ismodifyDept = true;
- this.$refs.uForm.clearValidate('deptIds');
- },
- findNameById(tree, idArr) {
- let result = [];
-
- function traverse(node, idArr) {
- if (!node) return;
- if (idArr.includes(node.id)) {
- result.push(node.name);
- }
- if (node.children && node.children.length > 0) {
- node.children.forEach(child => {
- traverse(child, idArr);
- });
- }
+ onLoad(params) {
+ if (params.userId) {
+ this.userId = params.userId;
}
-
- tree.forEach(node => {
- traverse(node, idArr);
- });
-
- return result;
},
- submitMsg() {
- this.$refs.uForm
- .validate()
- .then(res => {
- if (this.userId) {
- this.model1.deptIds = this.ismodifyDept ? this.diffdeptId : this.tempdeptIds;
- this.$reqAllJson('appUpdateById', this.model1, { method: 'PUT', 'Content-type': 'application/json' }).then(res => {
- if (res.code == 0) {
- this.$u.toast('淇敼鎴愬姛');
- let timer = setTimeout(() => {
- uni.navigateBack({
- delta: 1
- });
- }, 500);
- } else {
- this.$u.toast('淇敼澶辫触');
- }
- });
- } else {
+ onShow() {
+ if (this.userId) {
+ this.viewInfo();
+ }
+ this.$refs.tkitree._hide();
+ },
+ onReady() {
+ this.$refs.uForm.setRules(this.rules);
+ },
+ created() {
+ this.fetchTree();
+ },
+ methods: {
+ fetchTree() {
+ uni.request({
+ url: `${BaseUrl}/admin/dept/ownTree`,
+ header: {
+ Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'),
+ CLIENT_TOC: 'Y'
+ },
+ success: res => {
+ this.department = res.data.data;
+ }
+ });
+ },
+ viewInfo(v) {
+ uni.showLoading({
+ title: '鍔犺浇涓�'
+ });
+ this.$reqGet('getAppById', { userId: this.userId.toString() }).then(res => {
+ uni.hideLoading();
+ if (res.code == 0) {
+ this.tempdeptIds = res.data.deptIds;
+ if (res.data.deptIds == null) {
+ this.diffdeptId = '鍏ㄩ儴';
+ } else {
+ this.diffdeptId = this.findNameById(this.department, res.data.deptIds.split(','))
+ .join();
+ }
this.model1 = {
- ...this.model1,
+ ...res.data,
+ password: '',
deptIds: this.diffdeptId
};
- this.$reqPost('appSave', this.model1, 'json').then(result => {
- if (result.code == 0) {
- this.$u.toast('鎻愪氦鎴愬姛');
- let timer = setTimeout(() => {
- uni.navigateBack({
- delta: 1
- });
- }, 500);
- } else {
- this.$u.toast(result.msg ? result.msg : '鎻愪氦澶辫触');
- }
+ } else {
+ this.$u.toast('鍔犺浇澶辫触');
+ }
+ });
+ },
+ treeOpen() {
+ this.$refs.tkitree._show();
+ },
+ treeClose() {
+ this.$refs.tkitree._hide();
+ },
+ treeChooseValue(v) {
+ this.$refs.tkitree._hide();
+ this.model1.deptIds = this.findNameById(this.department, v).join();
+ this.diffdeptId = v.join();
+ this.ismodifyDept = true;
+ this.$refs.uForm.clearValidate('deptIds');
+ },
+ findNameById(tree, idArr) {
+ let result = [];
+
+ function traverse(node, idArr) {
+ if (!node) return;
+ if (idArr.includes(node.id)) {
+ result.push(node.name);
+ }
+ if (node.children && node.children.length > 0) {
+ node.children.forEach(child => {
+ traverse(child, idArr);
});
}
- })
- .catch(error => {
- console.log(error);
+ }
+
+ tree.forEach(node => {
+ traverse(node, idArr);
});
+
+ return result;
+ },
+ submitMsg() {
+ this.$refs.uForm
+ .validate()
+ .then(res => {
+ if (this.userId) {
+ this.model1.deptIds = this.ismodifyDept ? this.diffdeptId : this.tempdeptIds;
+ this.$reqAllJson('appUpdateById', this
+ .model1, { method: 'PUT', 'Content-type': 'application/json' }).then(res => {
+ if (res.code == 0) {
+ this.$u.toast('淇敼鎴愬姛');
+ let timer = setTimeout(() => {
+ uni.navigateBack({
+ delta: 1
+ });
+ }, 500);
+ } else {
+ this.$u.toast('淇敼澶辫触');
+ }
+ });
+ } else {
+ this.model1 = {
+ ...this.model1,
+ deptIds: this.diffdeptId
+ };
+ this.$reqPost('appSave', this.model1, 'json').then(result => {
+ if (result.code == 0) {
+ this.$u.toast('鎻愪氦鎴愬姛');
+ let timer = setTimeout(() => {
+ uni.navigateBack({
+ delta: 1
+ });
+ }, 500);
+ } else {
+ this.$u.toast(result.msg ? result.msg : '鎻愪氦澶辫触');
+ }
+ });
+ }
+ })
+ .catch(error => {
+ console.log(error);
+ });
+ }
}
- }
-};
+ };
</script>
-<style lang="scss" scoped>
-.main {
- width: 100%;
- &-block {
- width: 94%;
- margin: vww(15);
- }
- .submit-button {
- position: relative;
- bottom: vww(-20);
- /deep/ .u-button {
- width: 631rpx;
- height: 74rpx;
- border: 2px solid #3b56eb;
- background-color: #fff;
- color: #3b56eb;
- border-radius: 37rpx 37rpx 37rpx 37rpx;
+<style lang="scss"
+ scoped>
+ .main {
+ width: 100%;
+
+ &-block {
+ width: 94%;
+ margin: vww(15);
+ }
+
+ .submit-button {
+ position: relative;
+ bottom: vww(-20);
+
+ /deep/ .u-button {
+ width: 631rpx;
+ height: 74rpx;
+ border: 2px solid #3b56eb;
+ background-color: #fff;
+ color: #3b56eb;
+ border-radius: 37rpx 37rpx 37rpx 37rpx;
+ }
}
}
-}
-</style>
+</style>
\ No newline at end of file
--
Gitblit v1.9.1