Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
caoqianming 2022-02-18 16:16:38 +08:00
commit 1282b9c7ea
6 changed files with 440 additions and 228 deletions

View File

@ -13,6 +13,15 @@ export function clockRecord(data) {
data
})
}
//员工离岗说明
export function notWork(id, data) {
return request({
url: `/hrm/employee/${id}/not_work_remark/`,
method: 'POST',
data
})
}
export function getEmployee(data) {
return request({
url: '/hrm/employee/',

View File

@ -105,3 +105,19 @@ export function createConvert(data) {
data
})
}
//任务终止
export function planstop(id) {
return request({
url: `/pm/production_plan/${id}/stop/`,
method: 'put',
})
}
//任务启动,暂停
export function plantoggle(id) {
return request({
url: `/pm/production_plan/${id}/toggle/`,
method: 'put',
})
}

View File

@ -28,11 +28,29 @@
<el-tag type="danger" v-else>离岗</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="离岗备注">
<template slot-scope="scope">{{ scope.row.not_work_remark }}</template>
</el-table-column>
<el-table-column align="header-center" label="部门">
<template v-if="scope.row.dept_" slot-scope="scope">{{
scope.row.dept_.name
}}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
fixed="right"
>
<template slot-scope="scope">
<el-link
type="primary"
v-if="scope.row.is_atwork==false"
@click="handlestopwork(scope)"
>离岗说明
</el-link>
</template>
</el-table-column>
</el-table>
@ -42,7 +60,33 @@
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/></el-tab-pane>
/>
<el-dialog
:visible.sync="dialogVisible"
:close-on-click-modal="false"
title="离岗备注"
>
<el-form
ref="Form"
:model="stopwork"
label-width="100px"
label-position="right"
>
<el-form-item label="备注" prop="remark">
<el-input type="textarea" v-model="stopwork.not_work_remark" placeholder="备注" />
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="smtconfirm()">确认</el-button>
</div>
</el-dialog>
</el-tab-pane>
<el-tab-pane label="到岗统计">
<div class="container">
@ -55,7 +99,8 @@
</el-date-picker>
<el-button type="primary" @click="submit">查询</el-button>
</div>
<el-row>
<el-col :span="12">
<el-table
:data="atworkList"
@ -87,7 +132,20 @@
</el-table>
</el-col>
<el-col :span="12">
<el-calendar >
<template
slot="dateCell"
slot-scope="{date, data}">
<p>
{{ data.day.split('-').slice(1).join('-') }}<br /> {{dealMyDate(data.day)}}
</p>
</template>
</el-calendar>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
@ -123,6 +181,7 @@
<script>
import { getEmployeeList } from "@/api/employee";
import checkPermission from "@/utils/permission";
import { notWork } from "@/api/hrm";
import {getatwork } from "@/api/srm";
import { upUrl, upHeaders } from "@/api/file";
@ -136,14 +195,21 @@ export default {
return {
userList: { count: 0 },
atworkList: [],
stopwork:{not_work_remark:""},
value3:null,
value2:null,
listLoading: true,
dialogVisible:false,
stopworkID:null,
listQuery: {
page: 1,
page_size: 20,
},
resDate: [
{"date":"2022-02-20","content":"放假"},
{"date":"2022-02-26","content":"去交电费"},
{"date":"2022-02-25","content":"去学习vue"}
],
atworkDate:{year:null,month:null},
};
},
@ -157,7 +223,7 @@ value2:null,
checkPermission,
//今日到岗
getList() {
this.listQuery.fields='number,name,is_atwork,dept_';
this.listQuery.fields='number,name,is_atwork,dept_,id,not_work_remark';
getEmployeeList(this.listQuery).then((response) => {
if (response.data) {
this.userList = response.data;
@ -165,6 +231,24 @@ value2:null,
});
},
handlestopwork(scope)
{
this.dialogVisible=true;
this.stopworkID=scope.row.id;
},
//离职备注提交
smtconfirm()
{
console.log(this.stopwork);
notWork(this.stopworkID, this.stopwork).then((res) => {
if (res.code >= 200) {
this.$message.success("离职备注提交成功!");
this.dialogVisible=false;
this.getList();
}
})
},
//到岗统计
submit()
@ -180,6 +264,19 @@ value2:null,
});
},
//考勤日历
dealMyDate(v) {
console.log(v)
let len = this.resDate.length
let res = ""
for(let i=0; i<len; i++){
if(this.resDate[i].date == v) {
res = this.resDate[i].content
break
}
}
return res
}
},
};

View File

@ -132,12 +132,14 @@ export default {
page_size: 20,
},
state_:{
10:'制定中',
20:'已下达',
30:'已接受',
40:'生产中',
50:'已完成',
60:'军检完成'},
10: "制定中",
20: "已下达",
30: "已接受",
40: "生产中",
50: "已完成",
60: "军检完成",
70: "暂停",
80: "终止"},
listLoading: true,
proList: [],

View File

@ -41,13 +41,17 @@
<template slot-scope="scope">{{ scope.row.order_.number }}</template>
</el-table-column>
<el-table-column label="合同编号" width="110">
<template slot-scope="scope" v-if="scope.row.contract">{{ scope.row.order_.contract_.number }}</template>
<template slot-scope="scope" v-if="scope.row.contract">{{
scope.row.order_.contract_.number
}}</template>
</el-table-column>
<el-table-column label="产品名称" width="150" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
<template slot-scope="scope">{{
scope.row.product_.specification
}}</template>
</el-table-column>
<el-table-column label="产品单位" width="110">
<template slot-scope="scope">{{ scope.row.product_.unit }}</template>
@ -65,7 +69,9 @@
<template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column>
<el-table-column label="交货日期" width="110">
<template slot-scope="scope">{{ scope.row.order_.delivery_date }}</template>
<template slot-scope="scope">{{
scope.row.order_.delivery_date
}}</template>
</el-table-column>
<el-table-column label="是否生成子计划" width="120">
@ -81,17 +87,33 @@
align="center"
label="操作"
fixed="right"
width="100px"
width="150px"
>
<template slot-scope="scope">
<el-link type="primary"
<el-link type="warning"
v-if="scope.row.state != 70"
@click="handlestatesuspended(scope)"
>暂停
</el-link>
<el-link
type="primary"
v-if="scope.row.state == 70"
@click="handlestate(scope)"
>启用
</el-link>
<el-link
type="danger"
v-if="scope.row.state == 70"
@click="handlestatestop(scope)"
>终止
</el-link>
<el-link
type="primary"
v-if="scope.row.is_planed"
@click="handleselectplan(scope)"
>查看子计划
</el-link>
<el-link type="primary"
v-else
@click="handleWork(scope)"
<el-link type="primary" v-else @click="handleWork(scope)"
>生成子计划
</el-link>
</template>
@ -105,7 +127,12 @@
@pagination="getplanList"
/>
</el-card>
<el-tabs class="overFlowShow" type="border-card" v-model="activeName" @tab-click="activeNameClick">
<el-tabs
class="overFlowShow"
type="border-card"
v-model="activeName"
@tab-click="activeNameClick"
>
<el-tab-pane label="订单排产" name="订单排产">
<el-table
:data="orderList.results"
@ -132,7 +159,9 @@
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号" width="110">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
<template slot-scope="scope">{{
scope.row.product_.specification
}}</template>
</el-table-column>
<el-table-column label="产品数量">
<template slot-scope="scope">{{ scope.row.count }}</template>
@ -180,17 +209,17 @@
label-position="right"
:rules="rule1"
>
<el-form-item label="排产数量" prop="count">
<el-input-number v-model="orderplan.count" :min="0"></el-input-number>
<el-input-number
v-model="orderplan.count"
:min="0"
></el-input-number>
</el-form-item>
<el-form-item label="计划排产时间" prop="value1">
<el-date-picker
v-model="value1"
type="daterange"
start-placeholder="计划开始日期"
end-placeholder="计划结束日期"
format="yyyy 年 MM 月 dd 日"
@ -198,19 +227,17 @@
>
</el-date-picker>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="danger" @click="dialogVisible = false"
>取消</el-button
>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</el-tab-pane>
<el-tab-pane label="甘特图" name="甘特图">
<gantt
v-if="ganttShow"
:proList="proList"
></gantt>
<gantt v-if="ganttShow" :proList="proList"></gantt>
</el-tab-pane>
</el-tabs>
</div>
@ -218,11 +245,16 @@
<script>
import gantt from "@/components/Gantt/index";
import { getordertoplan } from "@/api/sam";
import {createProductionplan, getProductionplanList, createsubplan} from "@/api/pm";
import {
createProductionplan,
getProductionplanList,
createsubplan,
plantoggle,
planstop
} from "@/api/pm";
import { getMaterialList } from "@/api/mtm";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteorderplan = {};
@ -235,12 +267,14 @@
count: 0,
},
state_: {
10: '制定中',
20: '已下达',
30: '已接受',
40: '生产中',
50: '已完成',
60: '军检完成'
10: "制定中",
20: "已下达",
30: "已接受",
40: "生产中",
50: "已完成",
60: "军检完成",
70: "暂停",
80: "终止",
},
listQuery: {
page: 1,
@ -253,15 +287,15 @@
page: 1,
page_size: 20,
},
value1: '',
value1: "",
listLoading: true,
dialogVisiblestate: false,
ganttShow: false,
dialogVisible: false,
dialogType: "new",
activeName: "订单排产",
rule1: {
number: [{ required: true, message: "请输入", trigger: "blur" }],
},
proList: [],
};
@ -269,7 +303,6 @@
computed: {},
watch: {},
created() {
this.getorderList();
this.getplanList();
},
@ -296,7 +329,7 @@
this.productionplanList = response.data;
let list = response.data.results;
let arr = [];
list.forEach(item => {
list.forEach((item) => {
if (!item.children || item.children.length < 1) {
let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime();
@ -320,6 +353,65 @@
this.listLoading = false;
});
},
//修改任务状态设置暂停
handlestatesuspended(scope) {
this.$confirm("确认暂停任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await plantoggle(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("任务暂停成功!");
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
//修改任务状态设置启动
handlestate(scope) {
this.$confirm("确认启动任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await plantoggle(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("任务启动成功!");
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
//修改任务状态设置终止
handlestatestop(scope) {
this.$confirm("确认终止任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await planstop(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("任务终止成功!");
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
//搜索生产计划
handleFilter() {
this.listQuery1.page = 1;
@ -329,7 +421,7 @@
this.listQuery1 = {
page: 1,
page_size: 20,
}
};
this.getplanList();
},
handleclick(scope) {
@ -342,10 +434,8 @@
this.$refs["Form"].resetFields();
this.value1 = "";
});
},
async confirm(form) {
this.orderplan.start_date = this.value1[0];
if (this.delivery_date >= this.value1[1]) {
@ -354,8 +444,8 @@
this.$message.error("计划完成时间超过订单交付日期,请从新选择日期!");
}
this.orderplan.order = this.orderID
if (this.orderplan.count <= (this.countsx - this.planed_count)) {
this.orderplan.order = this.orderID;
if (this.orderplan.count <= this.countsx - this.planed_count) {
createProductionplan(this.orderplan).then((res) => {
if (res.code >= 200) {
this.getorderList();
@ -367,7 +457,6 @@
} else {
this.$message.error("排产数超过所需数,请合理排产!");
}
},
handleWork(scope) {
this.$confirm("确认生成子计划?", "提醒", {
@ -379,20 +468,19 @@
await createsubplan(scope.row.id).then((res) => {
if (res.code >= 200) {
this.$message.success("生成子计划成功!");
this.$router.push({name: "work", params: {id: scope.row.id},})
this.getplanList()
this.$router.push({ name: "work", params: { id: scope.row.id } });
this.getplanList();
}
});
})
.catch((err) => {
console.error(err);
});
},
activeNameClick(tab, event) {
debugger;
console.log(tab, event);
if (tab.label === '甘特图') {
if (tab.label === "甘特图") {
this.ganttShow = true;
} else {
this.ganttShow = false;
@ -400,12 +488,10 @@
},
//查看子计划
handleselectplan(scope) {
this.$router.push({name: "work", params: {id: scope.row.id},})
}
this.$router.push({ name: "work", params: { id: scope.row.id } });
},
},
};
</script>

View File

@ -134,12 +134,14 @@
page_size: 20,
},
state_: {
10: '制定中',
20: '已下达',
30: '已接受',
40: '生产中',
50: '已完成',
60: '军检完成'
10: "制定中",
20: "已下达",
30: "已接受",
40: "生产中",
50: "已完成",
60: "军检完成",
70: "暂停",
80: "终止",
},
actstate_: {
6: "待复检",