123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <div class="page">
- <div class="title">
- <el-tag type="danger" class="alert">
- <strong>注意:</strong> 您添加的用户必须是已注册的用户,如果还还没有注册请先
- <a
- href="http://testuc.pacsonline.cn/#/reg"
- target="_black"
- >注册</a>
- </el-tag>
- </div>
- <div class="dataform" v-bind:class="{hidden:step!=1}">
- <el-tag class="alert">第一步:输入手机号/用户名查询用户</el-tag>
- <el-input v-model="search" placeholder="请输入手机号/用户名" size="small"></el-input>
- <div class="next">
- <el-button type="primary" @click="goBack" size="mini">取消</el-button>
- <el-button type="primary" @click="searchUser" size="mini">下一步</el-button>
- </div>
- </div>
- <div class="dataform" v-bind:class="{hidden:step!=2}">
- <el-tag class="alert">第二步:选择用户</el-tag>
- <el-table :data="items">
- <el-table-column label="选择">
- <template slot-scope="scope">
- <el-radio v-model="userid" :label="scope.row.userid"> </el-radio>
- </template>
- </el-table-column>
- <el-table-column label="用户名称" prop="name"></el-table-column>
- <el-table-column label="用户手机号" prop="phone"></el-table-column>
- <el-table-column label="身份证" prop="idcard"></el-table-column>
- </el-table>
- <div class="next">
- <el-button type="primary" @click="up" size="mini">上一步</el-button>
- <el-button type="primary" @click="save" size="mini">完成</el-button>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- step: 1,
- search: "",
- items: [],
- userid: false
- };
- },
- methods: {
- searchUser: function() {
- if (this.search.length == 0) {
- return;
- }
- this.$http.sarchUsers({ search: this.search }, this).then(res => {
- if (res.code === 0) {
- this.items = res.obj;
- this.step = this.step + 1;
- }
- });
- },
- goBack() {
- this.$router.back();
- },
- up: function() {
- this.step = this.step - 1;
- },
- save: function() {
- let that = this;
- if (this.userid) {
- this.items.forEach(it => {
- if (it.userid === this.userid) {
- var params = {
- uid: it.userid,
- uname: it.name,
- uphone: it.phone
- };
- this.$http.addMUser(params, this).then(res => {
- if (res.code === 0) {
- this.$message({
- message: "操作成功",
- type: "success",
- duration: 1000,
- onClose: function() {
- that.goBack();
- }
- });
- }
- });
- }
- });
- }
- }
- }
- };
- </script>
- <style scoped>
- .title {
- margin-bottom: 20px;
- }
- .alert {
- /* width: 500px; */
- }
- .hidden {
- display: none;
- }
- .next {
- text-align: center;
- margin-top: 20px;
- margin-bottom: 20px;
- }
- .page {
- height: 100%;
- width: 100%;
- display: flex;
- flex-direction: column;
- }
- .dataform {
- width: 100%;
- display: flex;
- flex-direction: column;
- }
- .dataform .alert {
- margin-bottom: 20px;
- width: 205px;
- }
- .dataform .el-input {
- width: 205px;
- }
- .dataform .next {
- width: 140px;
- }
- </style>
|