From 091618590e16bc7e3f989944494b49ab6e98b626 Mon Sep 17 00:00:00 2001 From: “dzb” <2632970487@qq.com> Date: 星期三, 21 九月 2022 09:50:49 +0800 Subject: [PATCH] 注册、查看、修改组件顶部背景色改为白色 --- src/views/systemSetting/baseSetting/user/createUser/index.vue | 441 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 328 insertions(+), 113 deletions(-) diff --git a/src/views/systemSetting/baseSetting/user/createUser/index.vue b/src/views/systemSetting/baseSetting/user/createUser/index.vue index c67f1ca..3c36297 100644 --- a/src/views/systemSetting/baseSetting/user/createUser/index.vue +++ b/src/views/systemSetting/baseSetting/user/createUser/index.vue @@ -1,105 +1,106 @@ <template> <div class="createUser"> - <header> + <!-- <header> <div class="headerTitle">鏂板璐︽埛</div> <div class="headerTip"> <span>*</span> <label>涓哄繀濉」</label> </div> - </header> + </header> --> <main> - <div class="mainTitle">鍩虹淇℃伅</div> + <!-- <div class="mainTitle">鍩虹淇℃伅</div> --> <div class="mainContent"> - <el-form ref="form" :model="user"> + <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" + label-position="right"> <!-- 鐢ㄦ埛鍚嶇О --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>鐢ㄦ埛鍚嶇О:</label></div> - <div><el-input v-model="user.nick_name"></el-input></div> + <el-form-item class="optionItem" label="鐢ㄦ埛鍚嶇О:" prop="nickName"> + <el-input v-model="user.nickName" placeholder="濉啓鐢ㄦ埛鍚嶇О"></el-input> </el-form-item> <!-- 鐢ㄦ埛瀵嗙爜 --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>鐢ㄦ埛瀵嗙爜:</label></div> - <div><el-input v-model="user.nick_name"></el-input></div> + <el-form-item class="optionItems" label="鐢ㄦ埛瀵嗙爜:" prop="password"> + <el-input v-model="user.password" type="password" placeholder="璇疯緭鍏ョ敤鎴峰瘑鐮�"></el-input> </el-form-item> <!-- 鎵�灞炵敤鎴峰鍚� --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>鎵�灞炵敤鎴峰鍚�:</label></div> - <div><el-input v-model="user.nick_name"></el-input></div> + <el-form-item class="optionItem" label="鎵�灞炵敤鎴峰鍚�:" prop="username"> + <el-input v-model="user.username" placeholder="璇峰~鍐欑敤鎴峰鍚�"></el-input> </el-form-item> <!-- 鎬у埆 --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>鎬у埆:</label></div> + <!-- <el-form-item class="optionItem" label="鎬у埆:" prop="gender"> <el-radio-group v-model="user.gender"> <el-radio :label="1">鐢�</el-radio> <el-radio :label="2">濂�</el-radio> </el-radio-group> - </el-form-item> + </el-form-item> --> <!-- 鏄惁鍏氬憳 --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>鏄惁鍏氬憳:</label></div> - <el-radio-group v-model="user.member"> + <el-form-item class="optionItem" label="鏄惁鍏氬憳:" prop="isDy"> + <el-radio-group v-model="user.isDy"> <el-radio :label="1">鏄�</el-radio> <el-radio :label="0">鍚�</el-radio> </el-radio-group> </el-form-item> <!-- 鎵�灞炴墜鏈哄彿鐮� --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>鎵�灞炴墜鏈哄彿鐮�:</label></div> - <el-input v-model="user.phone"></el-input> + <el-form-item class="optionItem" label="鎵�灞炴墜鏈哄彿鐮�:" prop="mobile"> + <el-input v-model="user.mobile" placeholder="璇峰~鍐欐墜鏈哄彿鐮�"></el-input> </el-form-item> <!-- 閭鍦板潃 --> - <el-form-item class="optionItem"> - <div><label>閭鍦板潃:</label></div> - <el-input v-model="user.mail"></el-input> + <el-form-item class="optionItem" label="閭鍦板潃:" prop="email"> + <el-input v-model="user.email" placeholder="璇峰~鍐欓偖绠卞湴鍧�"></el-input> </el-form-item> <!-- 閫夋嫨瑙掕壊 --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>閫夋嫨瑙掕壊:</label></div> - <el-select v-model="user.role"> + <!-- <el-form-item class="optionItem" label="閫夋嫨瑙掕壊:" prop="role"> + <el-select v-model="user.role" placeholder="璇烽�夋嫨鎵�灞炶鑹�"> <el-option v-for="item in roleList" :key="item.name" :label="item.name" :value="item.value" :disabled="item.disabled"> </el-option> </el-select> - </el-form-item> + </el-form-item> --> <!-- 鐢ㄦ埛绫诲瀷 --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>鐢ㄦ埛绫诲瀷:</label></div> - <el-select v-model="user.type"> + <el-form-item class="optionItem" label="鐢ㄦ埛绫诲瀷:" prop="userType"> + <el-select v-model="user.userType" placeholder="璇烽�夋嫨鐢ㄦ埛绫诲瀷"> <el-option v-for="item in typeList" :key="item.name" :label="item.name" :value="item.value" :disabled="item.disabled"> </el-option> </el-select> </el-form-item> <!-- 搴ф満/鍒嗘満 --> - <el-form-item class="optionItem"> - <div><label>搴ф満/鍒嗘満:</label></div> - <el-input v-model="user.nick_name"></el-input> + <el-form-item class="optionItem" label="搴ф満/鍒嗘満:" prop="zj"> + <div class="optionHandleSp"> + <el-input class="areaNumber" v-model="user.zj.areaNumber" placeholder="鐢佃瘽鍖哄彿"> + </el-input> + <el-input class="telNumber" v-model="user.zj.phoneNumber" placeholder="鐢佃瘽鍙风爜"> + </el-input> + <el-input class="moreNumber" v-model="user.zj.moreNumber" placeholder="鍒嗘満鍙风爜"> + </el-input> + </div> </el-form-item> <!-- 鎵�灞為儴闂� --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>鎵�灞為儴闂�:</label></div> - <el-input v-model="user.nick_name"></el-input> + <el-form-item class="optionItem" label="鎵�灞為儴闂�:" prop="departmentId"> + <el-select v-model="user.departmentId" placeholder="璇烽�夋嫨鎵�灞為儴闂�"> + <el-option v-for="item in typeList" :key="item.name" :label="item.departName" + :value="item.id"> + </el-option> + </el-select> </el-form-item> <!-- 褰撳墠鑱屽姟 --> - <el-form-item class="optionItem"> - <div><span style="color: #ff3b6c;">*</span><label>褰撳墠鑱屽姟:</label></div> - <!-- <el-select v-model="value" placeholder="璇烽�夋嫨"> - <el-option v-for="item in options" :key="item.value" :label="item.label" - :value="item.value"> - </el-option> - </el-select> --> + <el-form-item class="optionItem" label="褰撳墠鑱屽姟:" prop="jobTitle"> + <el-input v-model="user.work" placeholder="璇疯緭鍏ュ綋鍓嶈亴鍔�" ></el-input> </el-form-item> <!-- 濉啓鎵�灞瀖ac鍦板潃 --> - <el-form-item class="optionItem"> - <div><label>濉啓鎵�灞瀖ac鍦板潃:</label></div> - <el-input v-model="user.nick_name"></el-input> - </el-form-item> + <!-- <el-form-item class="optionItem" label="濉啓鎵�灞瀖ac鍦板潃:" prop="mac"> + <el-input v-model="user.mac" placeholder="璇峰~鍐欐墍灞瀖ac鍦板潃"></el-input> + </el-form-item> --> <!-- 濉啓鎵�灞瀒p鍦板潃 --> - <el-form-item class="optionItem"> - <div><label>濉啓鎵�灞瀒p鍦板潃:</label></div> - <el-input v-model="user.nick_name"></el-input> + <!-- <el-form-item class="optionItem" label="濉啓鎵�灞瀒p鍦板潃:" prop="ip"> + <el-input v-model="user.ip" placeholder="璇峰~鍐欐墍灞瀒p鍦板潃"></el-input> + </el-form-item> --> + <el-form-item> + <div class="optionBtn"> + <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">鎻愪氦</el-button> + <el-button class="btn reset">閲嶇疆</el-button> + </div> </el-form-item> </el-form> + </div> </main> </div> @@ -107,69 +108,283 @@ <script> export default { data() { - return { - user: { - nick_name: '', - password: '', - true_name: '', - gender: 1, - member: 0, - phone: '', - mail: '', - role: 0, - type: 0, - }, - roleList: [ - { name: '璇烽�夋嫨鎵�灞炶鑹�', value: 0, disabled: true }, { name: '瑙掕壊1', value: 1 }, { name: '瑙掕壊2', value: 2 } - ], - typeList: [ - { name: '璇烽�夋嫨鐢ㄦ埛绫诲瀷', value: 0, disabled: true }, { name: '绫诲瀷1', value: 1 }, { name: '绫诲瀷2', value: 2 } - ] - } - }, -} -</script> -<style lang="scss" scpoed> -.createUser { - border-radius: 1px; - header { - background-color: #fff; - display: flex; - justify-content: space-between; - height: 60px; - line-height: 60px; - padding: 0 20px; - .headerTitle { - font-weight: 600; - color: #666; - } - .headerTip span { - color: #ff3b6c; - } - .headerTip label { - color: #999999; - } - } - main { - background-color: #fff; - margin-top: 1px; - text-align: left; - .mainTitle { - margin-left: 60px; - color: #666; - font-weight: 600; - font-size: 14px; - } - .mainContent { - padding: 0px 100px; - .el-form-item__content { - display: flex; - justify-content: center; - div{ - width: 160px; - text-align: right; + const validateNickname = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欑敤鎴峰悕绉�")); + } + }; + const validatePass = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�")); + } else { + const rep = /^\w+$/; + if (!rep.test(value)) { + callback(new Error("瀵嗙爜鍙兘鏄互鏁板瓧銆�26涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆")); } } + }; + const validateTruename = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欑敤鎴峰鍚�")); + } else { + const rep = /^[\u4E00-\u9FA5]{2,4}$/; + if (!rep.test(value)) { + callback("璇疯緭鍏ユ纭殑鐢ㄦ埛濮撳悕"); + } + } + }; + const validatePhone = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欐墜鏈哄彿鐮�")); + } else { + const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ + if (!rep.test(value)) { + callback("璇疯緭鍏ユ纭殑鎵嬫満鍙风爜"); + } + } + }; + const validateMail = (rule, value, callback) => { + if (value) { + const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; + if (!rep.test(value)) { + callback(new Error("璇疯緭鍏ユ纭殑閭")) + } + } + }; + const validateRole = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�")); + } else { + callback(); + } + }; + const validateType = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�")); + } else { + callback(); + } + }; + const validateDepartment = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�")); + } else { + callback(); + } + }; + const validateWork = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�")); + } else { + callback(); + } + }; + const validateMac = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�")); + } else { + callback(); + } + }; + const validateIp = (rule, value, callback) => { + if (!value) { + callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�")); + } else { + callback(); + } + }; + return { + user: { + nickName: '', + password: '', + username: '', + // gender: 1, + isDy: 0, + mobile: '', + email: '', + // role: null, + userType: null, + zj: { + areaNumber: '', + phoneNumber: "", + moreNumber: "", + }, + departmentId: null, + jobTitle: null, + // mac: '', + // ip: '', + }, + createUserRules: { + nickName: [ + { required: true, trigger: "blur", validator: validateNickname }, + ], + password: [ + { required: true, trigger: "blur", validator: validatePass }, + ], + username: [ + { required: true, trigger: "blur", validator: validateTruename }, + ], + // gender: [ + // { required: true, trigger: "blur" }, + // ], + isDy: [ + { required: true, trigger: "blur" }, + ], + mobile: [ + { required: true, trigger: "blur", validator: validatePhone }, + ], + email: [ + { required: false, trigger: "blur", validator: validateMail }, + ], + // role: [ + // { required: true, trigger: "blur", validator: validateRole }, + // ], + userType: [ + { required: true, trigger: "blur", validator: validateType }, + ], + zj: [ + { required: false, trigger: "blur" }, + ], + departmentId: [ + { required: true, trigger: "blur", validator: validateDepartment }, + ], + jobTitle: [ + { required: true, trigger: "blur", validator: validateWork }, + ], + // mac: [ + // { required: false, trigger: "blur", validator: validateMac }, + // ], + // ip: [ + // { required: false, trigger: "blur", validator: validateIp }, + // ], + }, + roleList: [ + { name: '瑙掕壊1', value: 1 }, { name: '瑙掕壊2', value: 2 } + ], + typeList: [] + } + }, + created() { + const that = this; + // 鑾峰彇瑙掕壊鍒楄〃 + // this.$axios.get('') + // 鑾峰彇鐢ㄦ埛绫诲瀷鍒楄〃 + // this.$axios.get('sccg/admin/list',{userType:0}).then(res=>{ + // console.log(res); + // }) + // 鑾峰彇鍏ㄩ儴閮ㄩ棬鍒楄〃 + this.$axios.get('sccg/depart/page').then(res => { + that.typeList = res.data.records; + }) + }, + methods: { + handleUser() { + const { user } = this; + console.log(user); + this.$axios.post('sccg/admin/register', { + departmentId: user.departmentId, + email: user.email, + jsDy: user.isDy, + jobTitle: user.jobTitle, + mobile: user.mobile, + nickName: user.nickName, + password: user.password, + userType: user.userType, + username: user.username, + }).then(res => { + if (res.code === 200) { + this.refresh(); + } + }) + } + }, + props: ['refresh'] +} +</script> +<style lang="scss" scoped> +.createUser { + border-radius: 1px; + background-color: #09152f; + + // header { + // display: flex; + // justify-content: space-between; + // height: 60px; + // line-height: 60px; + // padding: 0 20px; + // border: 1px solid #fff; + + // .headerTitle { + // color: #4b9bb7; + // font-weight: 600; + // } + + // .headerTip span { + // color: #ff3b6c; + // } + + // .headerTip label { + // color: #4b9bb7; + // } + // } + + main { + // border: 1px solid #fff; + text-align: left; + padding: 0 55px; + background-color: #09152f; + padding-bottom: 50px; + padding-top: 20px; + // .mainTitle { + // color: #4b9bb7; + // font-weight: 600; + // line-height: 100px; + // font-size: 14px; + // } + + .mainContent { + display: flex; + justify-content: center; + margin-top: 50px; + &::v-deep .el-form-item__label { + color: #4b9bb7; + } + + &::v-deep .el-input__inner { + background-color: #09152f; + border: 1px solid #17324c; + } + + .el-form-item__content { + width: 400px; + + .el-select { + width: 100%; + } + } + + .optionHandleSp { + display: flex; + + .areaNumber, + .moreNumber { + flex: 1; + } + + .telNumber { + flex: 2; + } + } + + .optionBtn { + display: flex; + margin-top: 20px; + + .btn { + padding: 12px 50px; + } + } + } } } -- Gitblit v1.8.0