From 0c966cb74acac1a1cc3bcaaa579019f1177d3e36 Mon Sep 17 00:00:00 2001 From: “dzb” <2632970487@qq.com> Date: 星期二, 20 九月 2022 15:42:26 +0800 Subject: [PATCH] 解决dialog数据不销毁 --- src/views/systemSetting/baseSetting/department/createUser/index.vue | 333 ++++++++++++++++-------------------------------------- 1 files changed, 100 insertions(+), 233 deletions(-) diff --git a/src/views/systemSetting/baseSetting/department/createUser/index.vue b/src/views/systemSetting/baseSetting/department/createUser/index.vue index a56064a..82c27d4 100644 --- a/src/views/systemSetting/baseSetting/department/createUser/index.vue +++ b/src/views/systemSetting/baseSetting/department/createUser/index.vue @@ -1,109 +1,57 @@ <template> <div class="createUser"> <header> - <div class="headerTitle">鏂板璐︽埛</div> + <div class="headerTitle">鏂板閮ㄩ棬淇℃伅</div> <div class="headerTip"> - <span>*</span> - <label>涓哄繀濉」</label> + <label>x</label> </div> </header> <main> - <div class="mainTitle">鍩虹淇℃伅</div> <div class="mainContent"> - <el-form ref="user" label-width="140px" autoComplete="on" :model="user" :rules="createUserRules" + <el-form ref="user" label-width="140px" autoComplete="on" :model="depart" :rules="createDepartRules" label-position="right"> - <!-- 鐢ㄦ埛鍚嶇О --> - <el-form-item class="optionItem" label="鐢ㄦ埛鍚嶇О:" prop="nickName"> - <el-input v-model="user.nickName" placeholder="濉啓鐢ㄦ埛鍚嶇О"></el-input> + <!-- 閮ㄩ棬鍚嶇О --> + <el-form-item class="optionItem" label="閮ㄩ棬鍚嶇О:" prop="departName"> + <el-input v-model="depart.departName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�"></el-input> </el-form-item> - <!-- 鐢ㄦ埛瀵嗙爜 --> - <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" label="鎵�灞炵敤鎴峰鍚�:" prop="username"> - <el-input v-model="user.username" placeholder="璇峰~鍐欑敤鎴峰鍚�"></el-input> - </el-form-item> - <!-- 鎬у埆 --> - <!-- <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 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" label="鎵�灞炴墜鏈哄彿鐮�:" prop="mobile"> - <el-input v-model="user.mobile" placeholder="璇峰~鍐欐墜鏈哄彿鐮�"></el-input> - </el-form-item> - <!-- 閭鍦板潃 --> - <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" 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 class="optionItem" label="鐢ㄦ埛绫诲瀷:" prop="userType"> - <el-select v-model="user.userType" placeholder="璇烽�夋嫨鐢ㄦ埛绫诲瀷"> + <!-- 涓婄骇閮ㄩ棬 --> + <el-form-item class="optionItems" label="涓婄骇閮ㄩ棬:" prop="parentId"> + <el-select v-model="depart.parentId" 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" 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" 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" label="褰撳墠鑱屽姟:" prop="jobTitle"> - <el-select v-model="user.work" placeholder="璇烽�夋嫨褰撳墠鑱屽姟"> + <!-- 閮ㄩ棬绫诲瀷 --> + <el-form-item class="optionItem" label="閮ㄩ棬绫诲瀷:" prop="departType"> + <el-select v-model="depart.departType" 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> - <!-- 濉啓鎵�灞瀖ac鍦板潃 --> - <!-- <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" label="濉啓鎵�灞瀒p鍦板潃:" prop="ip"> - <el-input v-model="user.ip" placeholder="璇峰~鍐欐墍灞瀒p鍦板潃"></el-input> - </el-form-item> --> - <el-form-item class="optionBtn"> - <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">鎻愪氦</el-button> - <el-button class="btn reset">閲嶇疆</el-button> + <!--娣诲姞浜哄憳 --> + <el-form-item class="optionItem" label="娣诲姞浜哄憳:"> + <ul class="addPerson"> + <li><i class="el-icon-user-solid"></i></li> + <li><i class="el-icon-user-solid"></i></li> + <li><i class="el-icon-user-solid"></i></li> + <li><i class="el-icon-plus"></i></li> + </ul> + </el-form-item> + <!-- 閮ㄩ棬鎻忚堪 --> + <el-form-item class="optionItem" label="閮ㄩ棬鎻忚堪:" prop="departDes"> + <el-input v-model="depart.departDes" placeholder="璇疯緭鍏ラ儴闂ㄦ弿杩�"></el-input> </el-form-item> </el-form> - </div> </main> + <footer> + <div class="optionBtn"> + <el-button>鍙栨秷</el-button> + <el-button type="primary" class="btn submit" @click="handleUser">纭畾</el-button> + </div> + </footer> </div> </template> <script> @@ -119,7 +67,7 @@ callback(new Error("璇峰~鍐欑櫥褰曞瘑鐮�")); } else { const rep = /^\w+$/; - if(!rep.test(value)){ + if (!rep.test(value)) { callback(new Error("瀵嗙爜鍙兘鏄互鏁板瓧銆�26涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆")); } } @@ -129,7 +77,7 @@ callback(new Error("璇峰~鍐欑敤鎴峰鍚�")); } else { const rep = /^[\u4E00-\u9FA5]{2,4}$/; - if(!rep.test(value)){ + if (!rep.test(value)) { callback("璇疯緭鍏ユ纭殑鐢ㄦ埛濮撳悕"); } } @@ -139,125 +87,31 @@ callback(new Error("璇峰~鍐欐墜鏈哄彿鐮�")); } else { const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/ - if(!rep.test(value)){ + 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: '', + depart: { + departName: '', + parentId: '', + departType: '', + departDes: '', }, - createUserRules: { - nickName: [ + createDepartRules: { + departName: [ { required: true, trigger: "blur", validator: validateNickname }, ], - password: [ + parentId: [ { required: true, trigger: "blur", validator: validatePass }, ], - username: [ + departType: [ { required: true, trigger: "blur", validator: validateTruename }, ], - // gender: [ - // { required: true, trigger: "blur" }, - // ], - isDy: [ + departDes: [ { 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 } @@ -265,8 +119,8 @@ typeList: [] } }, - created() { - const that = this ; + created() { + const that = this; // 鑾峰彇瑙掕壊鍒楄〃 // this.$axios.get('') // 鑾峰彇鐢ㄦ埛绫诲瀷鍒楄〃 @@ -274,39 +128,30 @@ // console.log(res); // }) // 鑾峰彇鍏ㄩ儴閮ㄩ棬鍒楄〃 - this.$axios.get('sccg/depart/page').then(res=>{ - that.typeList = res.data.records; - }) + // 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){ + const { depart } = this; + console.log(depart); + this.$axios.post('/sccg/depart/create', { + departName: depart.departName, + parentId: depart.parentId, departType: depart.departType, departDes: depart.departDes + }).then(res => { + if (res.code === 200) { this.refresh(); } }) } }, - props:['refresh'] + props: ['refresh'] } </script> -<style lang="scss" scpoed> +<style lang="scss" scoped> .createUser { border-radius: 1px; - // min-width: 1024px; - // min-height: 1450px; background-color: #09152f; header { @@ -316,9 +161,10 @@ line-height: 60px; padding: 0 20px; border: 1px solid #fff; + .headerTitle { + color: #4b9bb7; font-weight: 600; - color: #666; } .headerTip span { @@ -326,27 +172,44 @@ } .headerTip label { - color: #999999; + color: #4b9bb7; } } main { - // border-top: 1px solid #f0f2f5; border: 1px solid #fff; text-align: left; padding: 0 55px; background-color: #09152f; - .mainTitle { - // margin-left: 60px; - color: #666; - font-weight: 600; - line-height: 100px; - font-size: 14px; - } + padding-bottom: 50px; .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; + } + .addPerson{ + display: flex; + list-style: none; + padding:0; + li{ + background-color: #cccccc; + width: 36px; + height: 36px; + border-radius: 50%; + color: #fff; + text-align: center; + font-size: 30px; + margin-left: 10px; + } + } .el-form-item__content { width: 400px; @@ -354,25 +217,29 @@ width: 100%; } } - .optionHandleSp{ + + .optionHandleSp { display: flex; - .areaNumber,.moreNumber{ + + .areaNumber, + .moreNumber { flex: 1; } - .telNumber{ + + .telNumber { flex: 2; - } - } - .optionBtn{ - display: flex; - justify-content: center; - margin-top: 80px; - .btn{ - padding: 12px 50px; } } } } + footer{ + border: 1px solid #fff; + height: 80px; + display: flex; + align-items: center; + justify-content: flex-end; + padding-right: 20px; + } } </style> \ No newline at end of file -- Gitblit v1.8.0