daogangjilu
This commit is contained in:
parent
36321f144d
commit
5d125d0875
|
@ -400,4 +400,30 @@ export default {
|
|||
},
|
||||
|
||||
},
|
||||
teammember:{
|
||||
list: {
|
||||
name: "班组列表",
|
||||
req: async function(data){
|
||||
return await http.get(
|
||||
`${config.API_URL}/mtm/teammember/`,
|
||||
data
|
||||
);
|
||||
}
|
||||
},
|
||||
create: {
|
||||
name: "创建",
|
||||
req: async function(data){
|
||||
return await http.post(
|
||||
`${config.API_URL}/mtm/teammember/`,
|
||||
data);
|
||||
}
|
||||
},
|
||||
delete: {
|
||||
name: "删除",
|
||||
req: async function(id){
|
||||
return await http.delete(
|
||||
`${config.API_URL}/mtm/teammember/${id}/`);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
|
@ -1961,17 +1961,17 @@ const routes = [
|
|||
},
|
||||
"component": "bigScreen/index_photon"
|
||||
},
|
||||
{
|
||||
"path": "/bigScreenP2",
|
||||
"name": "bigScreenP2",
|
||||
"meta": {
|
||||
"title": "数据看板2",
|
||||
"icon": "el-icon-platform",
|
||||
"perms": ["bigScreenP"],
|
||||
"fullpage": true,
|
||||
},
|
||||
"component": "bigScreen/textIndex"
|
||||
},
|
||||
// {
|
||||
// "path": "/bigScreenP2",
|
||||
// "name": "bigScreenP2",
|
||||
// "meta": {
|
||||
// "title": "数据看板2",
|
||||
// "icon": "el-icon-platform",
|
||||
// "perms": ["bigScreenP"],
|
||||
// "fullpage": true,
|
||||
// },
|
||||
// "component": "bigScreen/textIndex"
|
||||
// },
|
||||
//车间看板
|
||||
{
|
||||
"path": "/bigScreenP_10",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -104,7 +104,7 @@
|
|||
<div class="border_corner border_right_top"></div>
|
||||
<div class="border_corner border_left_bottom"></div>
|
||||
<div class="border_corner border_right_bottom"></div>
|
||||
<p class="title">10车间</p>
|
||||
<p class="title">{{dialogData.deptName}}</p>
|
||||
<div class="infoCantier">
|
||||
<div class="leftBlock">
|
||||
<el-progress width="50" type="circle" color="rgba(54, 217, 187, 1)" :percentage="25"
|
||||
|
@ -113,22 +113,22 @@
|
|||
</div>
|
||||
<div class="rightBlock">
|
||||
<div>
|
||||
<p>总量</p>
|
||||
<p>昨日产量</p>
|
||||
<p> <span class="numberFont">390</span><span class="numberUnit">件</span></p>
|
||||
</div>
|
||||
<div class="countWrap">
|
||||
<div>
|
||||
<p>总量</p>
|
||||
<p> <span class="numberFont">120</span><span class="numberUnit">件</span></p>
|
||||
<p>预制管</p>
|
||||
<p> <span class="numberFont">390</span><span class="numberUnit">件</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<p>总量</p>
|
||||
<p> <span class="numberFont">130</span><span class="numberUnit">件</span></p>
|
||||
<p>预制棒</p>
|
||||
<p> <span class="numberFont">390</span><span class="numberUnit">件</span></p>
|
||||
</div>
|
||||
<div>
|
||||
<!-- <div>
|
||||
<p>总量</p>
|
||||
<p> <span class="numberFont">140</span><span class="numberUnit">件</span></p>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -174,7 +174,7 @@ export default {
|
|||
},
|
||||
initialAlpha: -Math.PI / 4.5,
|
||||
initialBeta: Math.PI / 2,
|
||||
initialRadius: 3,
|
||||
initialRadius: 2.5,
|
||||
initialTarget: null,
|
||||
scene: null,
|
||||
myui: null,
|
||||
|
@ -185,11 +185,11 @@ export default {
|
|||
infoVisibel: false,
|
||||
updateTime: '2023-08-17 16:00:00',
|
||||
nodesLists: {
|
||||
'单身宿舍.005_primitive3': { total: '0', elec: '0', name: '办公楼' },
|
||||
'立方体.015_primitive1': { total: '0', elec: '0', name: '加工车间' },
|
||||
'立方体.004_primitive1': { total: '0', elec: '0', name: '配料车间' },
|
||||
'立方体.003_primitive1': { total: '0', elec: '0', name: '成型车间' },
|
||||
'立立方体.002_primitive1': { total: '0', elec: '0', name: '成型车间' },
|
||||
'单身宿舍.004_primitive3': { total: '0', elec: '0', name: '办公楼' },
|
||||
'立方体.024_primitive1': { total: '0', elec: '0', name: '成型10车间' },
|
||||
'立方体.034_primitive1': { total: '0', elec: '0', name: '配料8车间' },
|
||||
'立方体.026_primitive1': { total: '0', elec: '0', name: '成型7车间' },
|
||||
'立方体.025_primitive1': { total: '0', elec: '0', name: '加工6车间' },
|
||||
},
|
||||
currentTime:'',
|
||||
currentWeek:'',
|
||||
|
@ -197,6 +197,9 @@ export default {
|
|||
timerTime:null,
|
||||
start_date:'',
|
||||
end_date:'',
|
||||
dialogData:{
|
||||
deptName:'办公楼'
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -307,7 +310,7 @@ export default {
|
|||
camera.upperRadiusLimit = 6;
|
||||
// 灯光
|
||||
const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0));
|
||||
light.intensity = 0.3;
|
||||
light.intensity = 0.8;
|
||||
// 全屏GUI
|
||||
const advancedTexture = BABYLON_GUI.AdvancedDynamicTexture.CreateFullscreenUI("myUI");
|
||||
that.myui = advancedTexture;
|
||||
|
@ -443,7 +446,6 @@ export default {
|
|||
highlightLayer.removeAllMeshes();
|
||||
}
|
||||
if (pickResult.hit) {
|
||||
// console.log('pickResult',pickResult);
|
||||
const mesh = pickResult.pickedMesh;
|
||||
// if (camera.target != mesh.position) {
|
||||
// // console.log('fly to')
|
||||
|
@ -463,17 +465,9 @@ export default {
|
|||
// BABYLON.Animation.CreateAndStartAnimation('at51', camera, 'target', 45, 200, camera.target, position, 0, ease);
|
||||
// }
|
||||
highlightLayer.removeAllMeshes();
|
||||
// if(/.*[\u4e00-\u9fa5]+.*$/.test(mesh.name)&&mesh.name!=='地面1'&&mesh.name!=='绿地'&&mesh.name!=='停车场') {
|
||||
// // 在选中的 mesh 上添加高亮效果
|
||||
// highlightLayer.addMesh(mesh, new BABYLON.Color3(1, 1, 0.5));
|
||||
// that.currentLightMesh = mesh;
|
||||
// mesh_rect.linkWithMesh(mesh);
|
||||
// let name = mesh.name.split('_')[0];
|
||||
// mesh_name.text = name;
|
||||
// mesh_rect.isVisible = true;
|
||||
// that.infoVisibel = true;
|
||||
// }
|
||||
if (mesh.name == '单身宿舍.004_primitive3') {
|
||||
let key = mesh.name;
|
||||
if (that.nodesLists[key]) {
|
||||
that.getDeptDetail(that.nodesLists[key].name)
|
||||
//单身宿舍.003_primitive3
|
||||
// 在选中的 mesh 上添加高亮效果
|
||||
highlightLayer.addMesh(mesh, new BABYLON.Color3(0.1, 0.9, 0.9));
|
||||
|
@ -501,62 +495,30 @@ export default {
|
|||
that.infoVisibel = false;
|
||||
}
|
||||
});
|
||||
canvas.addEventListener('mousedown', (event) => {
|
||||
canvas.addEventListener('click', (event) => {
|
||||
// 使用 scene.pick 检测鼠标拾取
|
||||
const pickResult = scene.pick(scene.pointerX, scene.pointerY);
|
||||
if (pickResult.hit) {
|
||||
console.log('000000000000');
|
||||
console.log('pickResult', pickResult);
|
||||
const mesh = pickResult.pickedMesh;
|
||||
if (camera.target != mesh.position) {
|
||||
// console.log('fly to')
|
||||
console.log('fly to')
|
||||
// 计算新的相机位置
|
||||
let position = mesh._parentNode._position
|
||||
if (mesh._parentNode.id == '__root__') {
|
||||
position = mesh.position
|
||||
}
|
||||
const cameraPosition = new BABYLON.Vector3(
|
||||
mesh.position.x + 9 * Math.sin(camera.beta) * Math.cos(Math.PI),
|
||||
mesh.position.y + 9 * Math.cos(camera.beta),
|
||||
mesh.position.z + 9 * Math.sin(camera.beta) * Math.sin(Math.PI)
|
||||
mesh.position.x + 2.5 * Math.sin(camera.beta) * Math.cos(1.8*Math.PI),
|
||||
mesh.position.y + 2.5 * Math.cos(camera.beta),
|
||||
mesh.position.z + 2.5 * Math.sin(camera.beta) * Math.sin(1.8*Math.PI)
|
||||
);
|
||||
var ease = new BABYLON.CubicEase();
|
||||
ease.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEINOUT);
|
||||
BABYLON.Animation.CreateAndStartAnimation('at5', camera, 'position', 45, 200, camera.position, cameraPosition, 0, ease);
|
||||
BABYLON.Animation.CreateAndStartAnimation('meshclick', camera, 'position', 45, 200, camera.position, cameraPosition, 0,ease);
|
||||
BABYLON.Animation.CreateAndStartAnimation('at51', camera, 'target', 45, 200, camera.target, position, 0, ease);
|
||||
}
|
||||
}
|
||||
});
|
||||
// checkbox.isChecked = true; //默认开启自动旋转
|
||||
// scene.onPointerObservable.add((pointerInfo) => {
|
||||
// switch (pointerInfo.type) {
|
||||
// case BABYLON.PointerEventTypes.POINTERDOWN:
|
||||
// console.log(scene.pointerX, scene.pointerY);
|
||||
// const pickResult = scene.pick(scene.pointerX, scene.pointerY);
|
||||
// if (pickResult.hit) {
|
||||
// console.log('000000000000');
|
||||
// console.log('pickResult', pickResult);
|
||||
// const mesh = pickResult.pickedMesh;
|
||||
// if (camera.target != mesh.position) {
|
||||
// // console.log('fly to')
|
||||
// // 计算新的相机位置
|
||||
// let position = mesh._parentNode._position
|
||||
// if (mesh._parentNode.id == '__root__') {
|
||||
// position = mesh.position
|
||||
// }
|
||||
// const cameraPosition = new BABYLON.Vector3(
|
||||
// mesh.position.x + 9 * Math.sin(camera.beta) * Math.cos(Math.PI),
|
||||
// mesh.position.y + 9 * Math.cos(camera.beta),
|
||||
// mesh.position.z + 9 * Math.sin(camera.beta) * Math.sin(Math.PI)
|
||||
// );
|
||||
// var ease = new BABYLON.CubicEase();
|
||||
// ease.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEINOUT);
|
||||
// BABYLON.Animation.CreateAndStartAnimation('at5', camera, 'position', 45, 200, camera.position, cameraPosition, 0, ease);
|
||||
// BABYLON.Animation.CreateAndStartAnimation('at51', camera, 'target', 45, 200, camera.target, position, 0, ease);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
return scene;
|
||||
};
|
||||
const scene = createScene(); //Call the createScene function
|
||||
|
@ -571,6 +533,9 @@ export default {
|
|||
engine.resize();
|
||||
});
|
||||
},
|
||||
getDeptDetail(name){
|
||||
this.dialogData.deptName = name;
|
||||
},
|
||||
initChart() {
|
||||
//左1
|
||||
let chartDom = document.getElementById('line1');
|
||||
|
@ -1501,7 +1466,7 @@ export default {
|
|||
display: flex;
|
||||
|
||||
.leftBlock {
|
||||
width: 80px;
|
||||
width: 100px;
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,11 +48,16 @@
|
|||
row-key="id"
|
||||
stripe
|
||||
>
|
||||
<el-table-column label="姓名" prop="employee_name">
|
||||
<el-table-column label="#" fixed="left" type="index" width="40"></el-table-column>
|
||||
<el-table-column label="姓名" prop="user_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="班组" prop="shift_name">
|
||||
<el-table-column label="部门" prop="belong_dept_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="所属部门" prop="belong_dept_name">
|
||||
<el-table-column label="班次" prop="shift_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="班组" prop="team_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="岗位" prop="post_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="工作日期" prop="work_date">
|
||||
</el-table-column>
|
||||
|
@ -61,15 +66,16 @@
|
|||
<el-tag :type="states[scope.row.state].type">{{states[scope.row.state].label}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="left" width="170">
|
||||
<el-table-column label="操作" fixed="right" align="left" width="110">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="table_edit(scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="table_edit(scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
|
@ -90,7 +96,7 @@
|
|||
>
|
||||
</save-dialog>
|
||||
<el-dialog
|
||||
title="到岗状态修改"
|
||||
title="修改到岗状态"
|
||||
v-model="visible"
|
||||
:size="1000"
|
||||
destroy-on-close
|
||||
|
@ -102,13 +108,33 @@
|
|||
label-width="100px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="姓名">
|
||||
<span>{{ form.employee_name }}</span>
|
||||
<el-col :md="8" :sm="12">
|
||||
<el-form-item label="姓名:">
|
||||
<span>{{ form.user_name }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="工作日期">
|
||||
<el-col :md="8" :sm="12">
|
||||
<el-form-item label="部门:">
|
||||
<span>{{ form.belong_dept_name }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="8" :sm="12">
|
||||
<el-form-item label="班次:">
|
||||
<span>{{ form.shift_name }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="8" :sm="12">
|
||||
<el-form-item label="岗位:">
|
||||
<span>{{ form.post_name }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="8" :sm="12">
|
||||
<el-form-item label="班组:">
|
||||
<span>{{ form.team_name }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="8" :sm="12">
|
||||
<el-form-item label="工作日期:">
|
||||
<span>{{ form.work_date }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
@ -136,7 +162,7 @@
|
|||
</el-row>
|
||||
</el-form>
|
||||
<el-footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">提交</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-dialog>
|
||||
|
@ -193,9 +219,16 @@
|
|||
this.ElLoading =null;
|
||||
},
|
||||
methods: {
|
||||
async getDept() {
|
||||
let res = await this.$API.system.dept.list.req({ page: 0, type__in: 'dept' });
|
||||
this.deptData = res;
|
||||
getDept() {
|
||||
this.$API.system.dept.list.req({ page: 0,type:'dept'}).then(res=>{
|
||||
let data = [];
|
||||
res.forEach(item => {
|
||||
if(item.parent=='3423856735881117696'){
|
||||
data.push(item)
|
||||
}
|
||||
});
|
||||
this.deptData = data;
|
||||
});
|
||||
},
|
||||
handleQuery(){
|
||||
if(this.monthV){
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
v-model="belongDept"
|
||||
clearable
|
||||
style="width:100%"
|
||||
@change="getEmployee"
|
||||
@change="getTeam"
|
||||
>
|
||||
<el-option v-for="item in deptOptions"
|
||||
:key="item.id"
|
||||
|
@ -49,6 +49,24 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="班组">
|
||||
<el-select
|
||||
v-model="form.team"
|
||||
placeholder="班组"
|
||||
clearable
|
||||
style="width:100%"
|
||||
@change="getuser"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in teamOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="工作日期">
|
||||
<el-date-picker
|
||||
|
@ -69,71 +87,57 @@
|
|||
</el-row>
|
||||
</el-form>
|
||||
<sc-form-table
|
||||
v-model="userList"
|
||||
:addTemplate="addTemplate"
|
||||
placeholder="暂无数据"
|
||||
>
|
||||
<el-table-column prop="name" label="排序" >
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="belong_dept_name" label="部门" >
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.belong_dept_name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="到岗状态">
|
||||
<template #default="scope">
|
||||
<el-select
|
||||
v-model="scope.row.state"
|
||||
filterable
|
||||
placeholder="到岗状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stateOptions"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="note" label="备注">
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.note"
|
||||
placeholder="请输入内容"
|
||||
></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="open" label="操作" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="createUserPost(scope.row)"
|
||||
>保存</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</sc-form-table>
|
||||
v-model="userList"
|
||||
:addTemplate="addTemplate"
|
||||
placeholder="暂无数据"
|
||||
>
|
||||
<el-table-column prop="user_name" label="姓名"></el-table-column>
|
||||
<el-table-column prop="mgroup_name" label="工段"></el-table-column>
|
||||
<el-table-column prop="post_name" label="岗位"></el-table-column>
|
||||
<el-table-column prop="type" label="到岗状态">
|
||||
<template #default="scope">
|
||||
<el-select
|
||||
v-model="scope.row.state"
|
||||
filterable
|
||||
placeholder="到岗状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stateOptions"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="note" label="备注">
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.note"
|
||||
placeholder="请输入内容"
|
||||
></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="open" label="操作" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="createUserPost(scope.row)"
|
||||
>保存</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</sc-form-table>
|
||||
</el-main>
|
||||
<el-footer v-if="mode!=='show'">
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="isSaveing"
|
||||
@click="submit"
|
||||
>
|
||||
保存
|
||||
</el-button>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const defaultForm = {
|
||||
list:[],
|
||||
|
@ -163,6 +167,7 @@
|
|||
isSaveing: false,
|
||||
form: defaultForm,
|
||||
userList:[],
|
||||
teamOptions:[],
|
||||
deptOptions: ['6车间','7车间','8车间','10车间'],
|
||||
shiftOptions:[],
|
||||
selectionFilters: [],
|
||||
|
@ -174,21 +179,32 @@
|
|||
},
|
||||
methods: {
|
||||
getShiftOptions() {
|
||||
this.$API.system.dept.list.req({ page: 0, type__in: 'dept' }).then((res) => {
|
||||
this.deptOptions = res;
|
||||
deptOptions
|
||||
this.$API.system.dept.list.req({ page: 0,type:'dept'}).then(res=>{
|
||||
let data = [];
|
||||
res.forEach(item => {
|
||||
if(item.parent=='3423856735881117696'){
|
||||
data.push(item)
|
||||
}
|
||||
});
|
||||
this.deptOptions = data;
|
||||
});
|
||||
this.$API.mtm.shift.req({page:0}).then(res=>{
|
||||
this.shiftOptions = res;
|
||||
})
|
||||
},
|
||||
getEmployee(){
|
||||
this.$API.hrm.employee.list.req({belong_dept:this.belongDept,page:0}).then(res=>{
|
||||
getTeam(){
|
||||
//获取team
|
||||
this.$API.mtm.team.list.req({page:0,belong_dept:this.belongDept}).then(res=>{
|
||||
this.teamOptions = res;
|
||||
})
|
||||
|
||||
},
|
||||
getuser(){
|
||||
this.$API.mtm.teammember.list.req({team:this.form.team,page:0}).then(res=>{
|
||||
this.userList = [];
|
||||
res.forEach(item=>{
|
||||
let obj ={};
|
||||
obj.name = item.name;
|
||||
obj.employee = item.id;
|
||||
obj.belong_dept_name = item.belong_dept_name;
|
||||
let obj =item;
|
||||
obj.state = 'normal';
|
||||
obj.note = '';
|
||||
this.userList.push(obj)
|
||||
|
@ -213,11 +229,13 @@
|
|||
let arr = [];
|
||||
this.userList.forEach(item=>{
|
||||
let obj = {};
|
||||
obj.employee = item.employee;
|
||||
obj.team = this.form.team;
|
||||
obj.shift = this.form.shift;
|
||||
obj.state = item.state;
|
||||
obj.work_date = this.form.work_date;
|
||||
obj.user = item.user;
|
||||
obj.state = item.state;
|
||||
obj.note = item.note;
|
||||
obj.post = item.post;
|
||||
arr.push(obj)
|
||||
})
|
||||
if (this.mode === 'add') {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<el-drawer
|
||||
:title="titleMap[mode]"
|
||||
title="班组人员"
|
||||
v-model="visible"
|
||||
:size="1000"
|
||||
destroy-on-close
|
||||
|
@ -20,48 +20,71 @@
|
|||
:addTemplate="addTemplate"
|
||||
placeholder="暂无数据"
|
||||
>
|
||||
<el-table-column prop="belong_dept_name" label="部门" >
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.belong_dept_name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="人员">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.id">{{ scope.row.user_name }}</span>
|
||||
<el-select
|
||||
v-model="scope.row.employee"
|
||||
v-else
|
||||
v-model="scope.row.user"
|
||||
filterable
|
||||
placeholder="人员"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stateOptions"
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所在工段">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.id">{{ scope.row.mgroup_name }}</span>
|
||||
<el-select
|
||||
v-else
|
||||
v-model="scope.row.mgroup"
|
||||
filterable
|
||||
placeholder="所在工段"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in mgroupOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="post_name" label="岗位" >
|
||||
<template #default="scope" >
|
||||
<span v-if="scope.row.id">{{ scope.row.post_name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="open" label="操作" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="createUserPost(scope.row)"
|
||||
>保存</el-button
|
||||
>
|
||||
|
||||
<el-button
|
||||
v-if="scope.row.id"
|
||||
text
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="userMemberDel(scope.row.id)"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button
|
||||
v-else
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="userMemberCreate(scope.row)"
|
||||
>添加</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</sc-form-table>
|
||||
</el-main>
|
||||
<el-footer v-if="mode!=='show'">
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="isSaveing"
|
||||
@click="submit"
|
||||
>
|
||||
保存
|
||||
</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
|
@ -69,66 +92,61 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
const defaultForm = {
|
||||
list:[],
|
||||
};
|
||||
export default {
|
||||
emits: ["success", "closed"],
|
||||
props:{
|
||||
team: { type: String, default: "" },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
belongDept:'',
|
||||
loading: false,
|
||||
mode: "add",
|
||||
titleMap: {
|
||||
add: '新增',
|
||||
edit: '编辑',
|
||||
show: '查看'
|
||||
},
|
||||
addTemplate:{
|
||||
|
||||
user:'',
|
||||
mgroup:'',
|
||||
post_name:'',
|
||||
},
|
||||
stateOptions:[
|
||||
{label: "待定", id: "pending"},
|
||||
{label: "正常", id: "normal"},
|
||||
{label: "迟到", id: "late"},
|
||||
{label: "早退", id: "early_leave"},
|
||||
{label: "未到岗", id: "absent"},
|
||||
{label: "请假", id: "leave"},
|
||||
],
|
||||
itemObj:{},
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
userList:[{name:'',belong_dept_name:''}],
|
||||
userList:[{name:'',mgroup:'',post_name:''}],
|
||||
deptOptions: ['6车间','7车间','8车间','10车间'],
|
||||
shiftOptions:[],
|
||||
userOptions:[],
|
||||
mgroupOptions:[],
|
||||
selectionFilters: [],
|
||||
setFiltersVisible: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getShiftOptions();
|
||||
this.getUserList();
|
||||
},
|
||||
methods: {
|
||||
getShiftOptions() {
|
||||
this.$API.system.dept.list.req({ page: 0, type__in: 'dept' }).then((res) => {
|
||||
this.deptOptions = res;
|
||||
getUserList(){
|
||||
this.$API.mtm.teammember.list.req({team:this.team,page:0}).then((res) => {
|
||||
this.userList = [];
|
||||
if(res.length>0){
|
||||
res.forEach(item => {
|
||||
let obj = {};
|
||||
obj.id = item.id;
|
||||
obj.user = item.user;
|
||||
obj.user_name = item.user_name;
|
||||
obj.mgroup = item.mgroup;
|
||||
obj.mgroup_name = item.mgroup_name;
|
||||
obj.post_name = item.post_name;
|
||||
this.userList.push(obj)
|
||||
});
|
||||
}
|
||||
});
|
||||
this.$API.mtm.shift.req({page:0}).then(res=>{
|
||||
this.shiftOptions = res;
|
||||
},
|
||||
getShiftOptions() {
|
||||
this.$API.mtm.mgroup.list.req({belong_dept:this.itemObj.belong_dept,page:0}).then(res=>{
|
||||
this.mgroupOptions = res;
|
||||
})
|
||||
},
|
||||
getEmployee(){
|
||||
this.$API.hrm.employee.list.req({belong_dept:this.belongDept,page:0}).then(res=>{
|
||||
this.userList = [];
|
||||
res.forEach(item=>{
|
||||
let obj ={};
|
||||
obj.name = item.name;
|
||||
obj.employee = item.id;
|
||||
obj.belong_dept_name = item.belong_dept_name;
|
||||
obj.state = 'normal';
|
||||
obj.note = '';
|
||||
this.userList.push(obj)
|
||||
})
|
||||
getDeptUser(){
|
||||
this.$API.system.user.list.req({belong_dept__name:this.itemObj.belong_dept_name,page:0}).then(res=>{
|
||||
this.userOptions = res;
|
||||
})
|
||||
},
|
||||
//显示
|
||||
|
@ -141,54 +159,38 @@
|
|||
this.visible = false;
|
||||
this.$emit('closed');
|
||||
},
|
||||
//表单提交方法
|
||||
submit() {
|
||||
this.$refs.dialogForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.isSaveing = true;
|
||||
let arr = [];
|
||||
this.userList.forEach(item=>{
|
||||
let obj = {};
|
||||
obj.employee = item.employee;
|
||||
obj.shift = this.form.shift;
|
||||
obj.state = item.state;
|
||||
obj.work_date = this.form.work_date;
|
||||
obj.note = item.note;
|
||||
arr.push(obj)
|
||||
})
|
||||
if (this.mode === 'add') {
|
||||
this.$API.hrm.attendance.create.req(arr)
|
||||
.then(res => {
|
||||
this.isSaveing = false;
|
||||
this.visible = false;
|
||||
this.$emit("success");
|
||||
this.$message.success("操作成功");
|
||||
return res
|
||||
}).catch(err => {
|
||||
this.isSaveing = false;
|
||||
return err
|
||||
})
|
||||
} else {
|
||||
this.$API.hrm.attendance.update.req(this.form.id, this.form)
|
||||
.then(res => {
|
||||
this.isSaveing = false;
|
||||
this.visible = false;
|
||||
this.$emit("success", this.form, this.mode);
|
||||
this.$message.success("操作成功");
|
||||
return res
|
||||
}).catch(err => {
|
||||
this.isSaveing = false;
|
||||
return err
|
||||
})
|
||||
}
|
||||
}
|
||||
//新增
|
||||
userMemberCreate(row) {
|
||||
let that = this;
|
||||
this.isSaveing = true;
|
||||
row.team = this.itemObj.id;
|
||||
this.$API.mtm.teammember.create.req(row).then((res) => {
|
||||
that.$message.success("操作成功");
|
||||
that.getUserList();
|
||||
});
|
||||
},
|
||||
//删除
|
||||
userMemberDel(id) {
|
||||
let that = this;
|
||||
this.$confirm(`确定删除吗?`, "提示", {
|
||||
type: "warning",
|
||||
confirmButtonText: "删除",
|
||||
confirmButtonClass: "el-button--danger",
|
||||
}).then(() => {
|
||||
this.$API.mtm.teammember.delete.req(id).then((res) => {
|
||||
that.getUserList();
|
||||
that.$message.success("操作成功");
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
//表单注入数据
|
||||
setData(data) {
|
||||
debugger;
|
||||
console.log(data);
|
||||
Object.assign(this.itemObj, data);
|
||||
this.$nextTick(()=>{
|
||||
this.getDeptUser();
|
||||
this.getShiftOptions();
|
||||
})
|
||||
},
|
||||
//设置过滤项
|
||||
setFilters(filters) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<el-table-column label="班长" prop="leader_name" min-width="100"></el-table-column>
|
||||
<el-table-column label="所属部门" prop="belong_dept_name" min-width="150"></el-table-column>
|
||||
<el-table-column label="创建时间" prop="create_time" min-width="150"></el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="140">
|
||||
<el-table-column label="操作" fixed="right" align="center" width="180">
|
||||
<template #default="scope">
|
||||
<el-button link size="small" @click="handleMember(scope.row)" v-auth="'team.update'" type="primary">班组人员</el-button>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
|
@ -76,6 +76,7 @@
|
|||
</el-dialog>
|
||||
<member-dialog
|
||||
v-if="dialogVisible"
|
||||
:team="team"
|
||||
ref="memberDialog"
|
||||
@success="handleSuccess"
|
||||
@closed="dialogVisible = false"
|
||||
|
@ -200,6 +201,7 @@ import memberDialog from "./team_form.vue";
|
|||
this.$refs.table.refresh()
|
||||
},
|
||||
handleMember(row){
|
||||
this.team = row.id;
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.memberDialog.open('add').setData(row)
|
||||
|
|
Loading…
Reference in New Issue