|
|
|
<template>
|
|
|
|
<j-modal
|
|
|
|
:title="title"
|
|
|
|
:width="800"
|
|
|
|
:visible="visible"
|
|
|
|
:confirmLoading="confirmLoading"
|
|
|
|
switchFullscreen
|
|
|
|
@ok="handleOk"
|
|
|
|
@cancel="handleCancel"
|
|
|
|
cancelText="关闭">
|
|
|
|
|
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
|
<a-form-model ref="form" :model="model" :rules="validatorRules">
|
|
|
|
|
|
|
|
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="departId" label="部门">
|
|
|
|
<!-- <a-input placeholder="请输入部门编号" v-model="model.departId"/>-->
|
|
|
|
<!-- <j-select-depart placeholder="请选择部门" v-model="model.departId"/>-->
|
|
|
|
<j-dict-select-tag type="list" v-model="model.departId" dictCode="sys_depart,depart_name,id,org_type='1'" placeholder="请选择部门" />
|
|
|
|
|
|
|
|
</a-form-model-item>
|
|
|
|
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="groupName" label="班组名称">
|
|
|
|
<a-input placeholder="请输入班组名称" v-model="model.groupName"/>
|
|
|
|
</a-form-model-item>
|
|
|
|
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="enterprisesManager" label="负责人">
|
|
|
|
<!-- <a-input placeholder="请输入负责人" v-model="model.enterprisesManager"/>-->
|
|
|
|
<j-select-multi-user placeholder="请选择负责人" v-model="model.enterprisesManager" @change="getQuestionBankList()"/>
|
|
|
|
</a-form-model-item>
|
|
|
|
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="mobile" label="手机号">
|
|
|
|
<a-input placeholder="请输入手机号" v-model="model.mobile"/>
|
|
|
|
<!-- <j-dict-select-tag type="list" v-model="model.mobile" :dictCode="mobileVal"></j-dict-select-tag>-->
|
|
|
|
</a-form-model-item>
|
|
|
|
|
|
|
|
</a-form-model>
|
|
|
|
</a-spin>
|
|
|
|
</j-modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {httpAction, getAction} from '@/api/manage'
|
|
|
|
import JDictSelectTag from '@/components/dict/JDictSelectTag'
|
|
|
|
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "GroupxModal",
|
|
|
|
components: {
|
|
|
|
JDictSelectTag,
|
|
|
|
JSelectDepart,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
title: "操作",
|
|
|
|
visible: false,
|
|
|
|
// mobileVal: "",
|
|
|
|
model: {},
|
|
|
|
labelCol: {
|
|
|
|
xs: {span: 24},
|
|
|
|
sm: {span: 5},
|
|
|
|
},
|
|
|
|
wrapperCol: {
|
|
|
|
xs: {span: 24},
|
|
|
|
sm: {span: 16},
|
|
|
|
},
|
|
|
|
|
|
|
|
confirmLoading: false,
|
|
|
|
validatorRules: {
|
|
|
|
departId: [
|
|
|
|
{required: true, message: "部门不能为空"},
|
|
|
|
],
|
|
|
|
groupName: [
|
|
|
|
{required: true, message: '班组名称不能为空!'},
|
|
|
|
{pattern: /(^[\u4e00-\u9fa5_a-zA-Z0-9_]{1,10}$)/, message: '班组名称不能为空且长度不能超过10!'}
|
|
|
|
],
|
|
|
|
enterprisesManager: [
|
|
|
|
{required: true, message: "负责人不能为空"},
|
|
|
|
],
|
|
|
|
// mobile: [
|
|
|
|
// {required: false},
|
|
|
|
// {pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'},
|
|
|
|
// ],
|
|
|
|
|
|
|
|
},
|
|
|
|
url: {
|
|
|
|
add: "/groupx/add",
|
|
|
|
edit: "/groupx/edit",
|
|
|
|
sysUserList: "/sys/user/list",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async getQuestionBankList() {
|
|
|
|
let param = {
|
|
|
|
"username": this.model.enterprisesManager,
|
|
|
|
}
|
|
|
|
let that = this;
|
|
|
|
const {data: res} = await this.$axios.get('/jeecg-boot/sys/user/list', {params: param})
|
|
|
|
// this.questionBankList = res.result
|
|
|
|
console.log("userlist:"+JSON.stringify(res))
|
|
|
|
console.log("the phone:"+JSON.stringify(res.result.records[0].phone))
|
|
|
|
let phone = JSON.stringify(res.result.records[0].phone);
|
|
|
|
that.model.mobile = phone;
|
|
|
|
},
|
|
|
|
|
|
|
|
// getMobile() {
|
|
|
|
// alert(this.model.enterprisesManager);
|
|
|
|
// this.mobileVal = "sys_user,phone,username,username='" + this.model.enterprisesManager + "'";
|
|
|
|
// // this.model.mobile = "123456789";
|
|
|
|
//
|
|
|
|
// let param = {
|
|
|
|
// "username": this.model.enterprisesManager,
|
|
|
|
// }
|
|
|
|
// let that = this;
|
|
|
|
// getAction(this.url.sysUserList, param).then((res) => {
|
|
|
|
// if (res.success) {
|
|
|
|
// console.log("res:" + JSON.stringify(res.result.records[0]))
|
|
|
|
// console.log("res22222222:" + JSON.stringify(res.result.records[0].phone));
|
|
|
|
// // this.model.mobile = res.result.records[0].phone;
|
|
|
|
// // this.model.mobile = JSON.stringify(res.result.records[0].phone)
|
|
|
|
// if (JSON.stringify(res.result.records[0].phone) !== "") {
|
|
|
|
// that.model.mobile = "15112345678";
|
|
|
|
// } else {
|
|
|
|
// that.model.mobile = JSON.stringify(res.result.records[0].phone)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
add() {
|
|
|
|
//初始化默认值
|
|
|
|
this.edit({});
|
|
|
|
},
|
|
|
|
edit(record) {
|
|
|
|
this.model = Object.assign({}, record);
|
|
|
|
this.visible = true;
|
|
|
|
},
|
|
|
|
close() {
|
|
|
|
this.$emit('close');
|
|
|
|
this.visible = false;
|
|
|
|
this.$refs.form.clearValidate();
|
|
|
|
},
|
|
|
|
handleOk() {
|
|
|
|
const that = this;
|
|
|
|
// 触发表单验证
|
|
|
|
this.$refs.form.validate(valid => {
|
|
|
|
if (valid) {
|
|
|
|
that.confirmLoading = true;
|
|
|
|
let httpurl = '';
|
|
|
|
let method = '';
|
|
|
|
if (!this.model.id) {
|
|
|
|
httpurl += this.url.add;
|
|
|
|
method = 'post';
|
|
|
|
} else {
|
|
|
|
httpurl += this.url.edit;
|
|
|
|
method = 'put';
|
|
|
|
}
|
|
|
|
httpAction(httpurl, this.model, method).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
that.$message.success(res.message);
|
|
|
|
that.$emit('ok');
|
|
|
|
} else {
|
|
|
|
that.$message.warning(res.message);
|
|
|
|
}
|
|
|
|
}).finally(() => {
|
|
|
|
that.confirmLoading = false;
|
|
|
|
that.close();
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleCancel() {
|
|
|
|
this.close()
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
|
|
|
</style>
|