| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <template>
- <el-dialog title="新建" :visible.sync="dialogVisible" :before-close="handleClose">
- <el-row :gutter="30">
- <el-form ref="formInfo" :model="param.content" :rules="rules" label-width="102px" label-position="left">
- <el-col :span="12">
- <el-form-item label="姓名:" prop="name">
- <el-input v-model="param.content.name" placeholder="请输入" size="small"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="职位:" prop="position">
- <el-input v-model="param.content.position" placeholder="请输入" size="small"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="手机号:" prop="phonenumber">
- <el-input v-model="param.content.phonenumber" placeholder="请输入" size="small"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="角色配置:" label-width="102px" prop="roleids">
- <el-select v-model="param.content.roleids" multiple placeholder="请选择" size="small">
- <el-option
- v-for="item in checkList"
- :key="item.rolename"
- :label="item.rolename"
- :value="item.roleid">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-form>
- <el-col :span="24">
- <div class="footer" style="margin-left:50%;transform: translateX(-40%);">
- <el-button @click="dialogVisible=false" size="small">取消</el-button>
- <el-button type="primary" @click="submitTeam()" size="small">提交</el-button>
- </div>
- </el-col>
- </el-row>
- </el-dialog>
- </template>
- <script>
- export default {
- name: 'AddUser',
- data () {
- return {
- param: {
- "classname": "sale.team.team",
- "method": "insertormodify_team",
- "content": {
- "sa_agent_hrid": 0,
- "name": "",
- "phonenumber": "",
- "position": "",
- "remarks": "备注",
- "roleids":[]
- }
- },
- dialogVisible: false,
- rules: {
- name: [
- { required: true, message: '请输入名称', trigger: 'blur' },
- ],
- phonenumber: [
- { min: 11, max: 11, message: '请输入正确的电话号', trigger: 'blur' }
- ],
- },
- checkList: []
- };
- },
- props:['editTarget'],
- components: {
- },
- computed: {
- },
- watch: {
- editTarget: {
- handler(val) {
- this.param.content.name = val.name
- this.param.content.position = val.position
- this.param.content.phonenumber = val.phonenumber
- this.param.content.roleids = val.roleids ? val.roleids.map((item) => item) : []
- this.param.content.sa_agent_hrid = val.sa_agent_hrid
- }
- }
- },
- created() {
- this.getRoleList()
- },
- methods: {
- handleClose () {
- this.dialogVisible = false
- },
- getRoleList() {
- this.$api.requested({
- "accesstoken": "86cf5a6b5314094f4b412da2b0445ac1",
- "classname": "sale.team.team",
- "method": "queryRole",
- "content": {
- "sa_agent_hrid": 0
- }
- }).then( res => {
- console.log(res);
-
- this.checkList = res.data
- console.log(this.checkList);
- })
- },
- //提交
- submitTeam() {
- this.$refs.formInfo.validate((val) => {
- if(val) {
- console.log(this.param);
- this.$api.requested(this.param).then( res => {
- console.log(res);
- if(res.code == 1) {
- this.$notify({
- title:'提示',
- message:'创建成功',
- type:'success'
- })
- this.$refs.formInfo.resetFields()
- this.dialogVisible = false
- this.$parent.getTeamData()
- }
- })
- }
- })
- }
- },
- };
- </script>
- <style scoped>
- * {
- box-sizing: border-box;
- }
- /deep/ .el-dialog__title {
- font-size: 16px;
- font-weight: bold;
- color: #333333;
- }
- /deep/.el-dialog__body {
- padding: 30px 50px 50px 30px;
- }
- /* .el-form {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- } */
- /* .el-form-item {
- margin-bottom: 30px;
- } */
- /deep/.el-dialog {
- width: 864px;
- background: #ffffff;
- }
- .el-input {
- width: 240px;
- }
- .footer {
- }
- .footer .el-button {
- width: 120px;
- }
- .el-select {
- width: 100%;
- }
- </style>
|