|
@@ -2,10 +2,51 @@
|
|
<!-- 添加人员信息 -->
|
|
<!-- 添加人员信息 -->
|
|
<div class="addWagonLoad">
|
|
<div class="addWagonLoad">
|
|
<PageTitle>返回</PageTitle>
|
|
<PageTitle>返回</PageTitle>
|
|
- <el-divider content-position="left">人员信息</el-divider>
|
|
|
|
<div class="form-box" style="margin-right: 10rem">
|
|
<div class="form-box" style="margin-right: 10rem">
|
|
<dil-form :formId="325" v-model="form1" ref="from1"></dil-form>
|
|
<dil-form :formId="325" v-model="form1" ref="from1"></dil-form>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <div class="department">
|
|
|
|
+ <div class="department2">
|
|
|
|
+ <span>二级部门:</span>
|
|
|
|
+ <el-select v-model="value1" placeholder="请选择" @change="onchange1">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item,i) in options1"
|
|
|
|
+ :key="i"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="department3">
|
|
|
|
+ <span>三级部门:</span>
|
|
|
|
+ <el-select v-model="value2" placeholder="请选择" @change="onchange2">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item,i) in options2"
|
|
|
|
+ :key="i"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <div class="role">
|
|
|
|
+ <span>赋权角色:</span>
|
|
|
|
+ <el-select v-model="value3" placeholder="请选择" @change="onchange3">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item,i) in options3"
|
|
|
|
+ :key="i"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<div class="button-box">
|
|
<div class="button-box">
|
|
<el-button @click="cancel">取消</el-button>
|
|
<el-button @click="cancel">取消</el-button>
|
|
<el-button type="primary" @click="makeSure">确定</el-button>
|
|
<el-button type="primary" @click="makeSure">确定</el-button>
|
|
@@ -15,57 +56,167 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import PageTitle from "@/components/Page/Title";
|
|
import PageTitle from "@/components/Page/Title";
|
|
-
|
|
|
|
|
|
+import { getCookie } from "@/utils/util.js";
|
|
export default {
|
|
export default {
|
|
components: { PageTitle },
|
|
components: { PageTitle },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
form1: {},
|
|
form1: {},
|
|
value: undefined,
|
|
value: undefined,
|
|
|
|
+ //token
|
|
|
|
+ token: null,
|
|
|
|
+ //二级部门
|
|
|
|
+ options1:[],
|
|
|
|
+ //选中的二级部门名称
|
|
|
|
+ value1:'',
|
|
|
|
+ //选中的二级部门机构ID和机构编码
|
|
|
|
+ map1:[],
|
|
|
|
+ // 三级部门
|
|
|
|
+ options2:[],
|
|
|
|
+ // 选中的三级部门名称
|
|
|
|
+ value2:'',
|
|
|
|
+ //选中的三级部门机构ID和机构编码
|
|
|
|
+ map2:[],
|
|
|
|
+ // 角色
|
|
|
|
+ options3:[],
|
|
|
|
+ // 选中的角色名称
|
|
|
|
+ value3:'',
|
|
|
|
+ // 选中的角色ID
|
|
|
|
+ roleId:''
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- mounted() {},
|
|
|
|
|
|
+ created(){
|
|
|
|
+ this.token = getCookie("accessToken");
|
|
|
|
+ console.log('this.token',this.token)
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ //初始化二级机构和角色
|
|
|
|
+ this.initialization();
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
|
|
+ initialization(){
|
|
|
|
+ //初始化选择二级机构
|
|
|
|
+ this.axios.get('/api/v1/rms/getSecondShipper').then((res)=>{
|
|
|
|
+ this.options1 = res.data.data;
|
|
|
|
+ console.log("this.options1",this.options1)
|
|
|
|
+ })
|
|
|
|
+ //初始化角色
|
|
|
|
+ this.axios({
|
|
|
|
+ Headers:{
|
|
|
|
+ // 'Content-Type':'application/x-www-form-urlencoded',
|
|
|
|
+ 'authorization' : 'Bearer' + this.token
|
|
|
|
+ },
|
|
|
|
+ method:'get',
|
|
|
|
+ url:'https://wl.dasteel.cn:32322/icore.icp.web/pass/v1/sysroles/getRolesUser?companyId=713710108567277568&appId=821034072422879232',
|
|
|
|
+ })
|
|
|
|
+ .then((res)=>{
|
|
|
|
+ console.log('res',res)
|
|
|
|
+ this.options3 = res.data.data;
|
|
|
|
+ console.log("this.options3",this.options3)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ onchange1(val){
|
|
|
|
+ console.log("val",val);
|
|
|
|
+ // 查询选中的二级机构下的三级机构
|
|
|
|
+ this.value2 = '';
|
|
|
|
+ this.axios.get('/api/v1/rms/getThirdShipper?shipperId='+val).then((res)=>{
|
|
|
|
+ this.options2 = res.data.data;
|
|
|
|
+ console.log("this.options2",this.options2)
|
|
|
|
+ })
|
|
|
|
+ //获取二级部门的机构ID和机构编码
|
|
|
|
+ this.axios.post('/api/v1/rms/getShipperMap?shipperId='+val).then((res)=>{
|
|
|
|
+ this.map1 = res.data.data;
|
|
|
|
+ console.log("this.map1",this.map1)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ onchange2(val){
|
|
|
|
+ console.log("val",val);
|
|
|
|
+ //获取三级部门的机构ID和机构编码
|
|
|
|
+ this.axios.post('/api/v1/rms/getShipperMap?shipperId='+val).then((res)=>{
|
|
|
|
+ this.map2 = res.data.data;
|
|
|
|
+ console.log("this.map2",this.map2)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //确定人员新增
|
|
makeSure() {
|
|
makeSure() {
|
|
- console.log(this.form1)
|
|
|
|
- let RmsPersonnel={
|
|
|
|
- personnelId:this.form1.personnelId,
|
|
|
|
- personnelJobNumber: this.form1.personnelJobNumber,
|
|
|
|
- personnelName: this.form1.personnelName,
|
|
|
|
- personnelPost: this.form1.personnelPost,
|
|
|
|
- personnelWorkshopid: this.form1.personnelWorkshopid,
|
|
|
|
- personnelShifts: this.form1.personnelShifts,
|
|
|
|
- personnelTeam:this.form1.personnelTeam,
|
|
|
|
- departmentId: this.form1.shipperId
|
|
|
|
- };
|
|
|
|
- if(
|
|
|
|
- RmsPersonnel.personnelJobNumber ==null ||
|
|
|
|
- RmsPersonnel.personnelName ==null ||
|
|
|
|
- RmsPersonnel.personnelPost ==null ||
|
|
|
|
- RmsPersonnel.personnelWorkshopid==null ||
|
|
|
|
- RmsPersonnel.personnelShifts==null ||
|
|
|
|
- RmsPersonnel.departmentId==null ||
|
|
|
|
- RmsPersonnel.personnelTeam==null
|
|
|
|
- )this.$message.error("存在空值!");
|
|
|
|
- else
|
|
|
|
- this.axios
|
|
|
|
- .post(
|
|
|
|
- "/api/v1/rms/insertPersonnel",
|
|
|
|
- RmsPersonnel
|
|
|
|
- )
|
|
|
|
- .then((res) => {
|
|
|
|
- if (res.data.code == 200) {
|
|
|
|
- this.$message({
|
|
|
|
- type: "success",
|
|
|
|
- message: "新增成功!",
|
|
|
|
- });
|
|
|
|
- // this.$refs.table.refreshData();
|
|
|
|
- this.$router.go(-1);
|
|
|
|
- } else {
|
|
|
|
- this.$message.error("新增失败,可能存在重复!");
|
|
|
|
- }
|
|
|
|
- this.$refs['table'].resetField();
|
|
|
|
- });
|
|
|
|
|
|
+ if(this.options2.length==0){
|
|
|
|
+ let userInfo = {
|
|
|
|
+ userName : this.form1.personnelName,
|
|
|
|
+ userCode : this.form1.personnelJobNumber,
|
|
|
|
+ orgCode : this.map1.shipperOrgCode,
|
|
|
|
+ orgName : this.value1,
|
|
|
|
+ orgId : this.map1.shipperSsoId,
|
|
|
|
+ mobile : '13500000011',
|
|
|
|
+ email : '123456789@qq.com',
|
|
|
|
+ groupId : '506514577756917769',
|
|
|
|
+ companyId : '713710108567277568'
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ let userInfo = {
|
|
|
|
+ userName : this.form1.personnelName,
|
|
|
|
+ userCode : this.form1.personnelJobNumber,
|
|
|
|
+ orgCode : this.map2.shipperOrgCode,
|
|
|
|
+ orgName : this.value1,
|
|
|
|
+ orgId : this.map2.shipperSsoId,
|
|
|
|
+ mobile : '13500000011',
|
|
|
|
+ email : '123456789@qq.com',
|
|
|
|
+ groupId : '506514577756917769',
|
|
|
|
+ companyId : '713710108567277568'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //先新增SSO中的用户
|
|
|
|
+
|
|
|
|
+ const formData = new FormData();
|
|
|
|
+ Object.keys(userInfo).forEach((key) => {
|
|
|
|
+ formData.append(key, userInfo[key]);
|
|
|
|
+ });
|
|
|
|
+ console.log('formData',formData)
|
|
|
|
+ // this.axios.post('https://wl.dasteel.cn:32322/icore.icp.web/pass/v1/sysusers/',)
|
|
|
|
+ // .then((res)=>{
|
|
|
|
+ // console.log("res",res)
|
|
|
|
+ // })
|
|
|
|
+
|
|
|
|
+ // let RmsPersonnel={
|
|
|
|
+ // personnelId:this.form1.personnelId,
|
|
|
|
+ // personnelJobNumber: this.form1.personnelJobNumber,
|
|
|
|
+ // personnelName: this.form1.personnelName,
|
|
|
|
+ // personnelPost: this.form1.personnelPost,
|
|
|
|
+ // personnelWorkshopid: this.form1.personnelWorkshopid,
|
|
|
|
+ // personnelShifts: this.form1.personnelShifts,
|
|
|
|
+ // personnelTeam:this.form1.personnelTeam,
|
|
|
|
+ // departmentId: this.form1.shipperId
|
|
|
|
+ // };
|
|
|
|
+ // if(
|
|
|
|
+ // RmsPersonnel.personnelJobNumber ==null ||
|
|
|
|
+ // RmsPersonnel.personnelName ==null ||
|
|
|
|
+ // RmsPersonnel.personnelPost ==null ||
|
|
|
|
+ // RmsPersonnel.personnelWorkshopid==null ||
|
|
|
|
+ // RmsPersonnel.personnelShifts==null ||
|
|
|
|
+ // RmsPersonnel.departmentId==null ||
|
|
|
|
+ // RmsPersonnel.personnelTeam==null
|
|
|
|
+ // )this.$message.error("存在空值!");
|
|
|
|
+ // else
|
|
|
|
+ // this.axios
|
|
|
|
+ // .post(
|
|
|
|
+ // "/api/v1/rms/insertPersonnel",
|
|
|
|
+ // RmsPersonnel
|
|
|
|
+ // )
|
|
|
|
+ // .then((res) => {
|
|
|
|
+ // if (res.data.code == 200) {
|
|
|
|
+ // this.$message({
|
|
|
|
+ // type: "success",
|
|
|
|
+ // message: "新增成功!",
|
|
|
|
+ // });
|
|
|
|
+ // // this.$refs.table.refreshData();
|
|
|
|
+ // this.$router.go(-1);
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$message.error("新增失败,可能存在重复!");
|
|
|
|
+ // }
|
|
|
|
+ // this.$refs['table'].resetField();
|
|
|
|
+ // });
|
|
},
|
|
},
|
|
// 取消
|
|
// 取消
|
|
cancel() {
|
|
cancel() {
|
|
@@ -102,4 +253,16 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+.department{
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ .department3{
|
|
|
|
+ margin-left: 2rem;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+.role{
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ margin-top: 2rem;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|