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,21 +28,65 @@
<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>
<pagination
v-show="userList.count > 0"
:total="userList.count"
: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,7 +264,20 @@ 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
}
},
};
</script>

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

@ -16,14 +16,14 @@
type="primary"
icon="el-icon-search"
@click="handleFilter"
>搜索
>搜索
</el-button>
<el-button
class="filter-item"
type="primary"
icon="el-icon-refresh-left"
@click="resetFilter"
>重置
>重置
</el-button>
<el-table
:data="productionplanList.results"
@ -33,7 +33,7 @@
style="width: 100%"
height="300"
>
<el-table-column type="index" width="50"/>
<el-table-column type="index" width="50" />
<el-table-column label="任务编号" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
@ -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,13 +69,15 @@
<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">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_planed==false"></el-tag>
<el-tag v-if="scope.row.is_planed==true"></el-tag>
<el-tag v-if="scope.row.is_planed == false"></el-tag>
<el-tag v-if="scope.row.is_planed == true"></el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间" width="160">
@ -81,18 +87,34 @@
align="center"
label="操作"
fixed="right"
width="100px"
width="150px"
>
<template slot-scope="scope">
<el-link type="primary"
v-if="scope.row.is_planed"
@click="handleselectplan(scope)"
>查看子计划
<el-link type="warning"
v-if="scope.row.state != 70"
@click="handlestatesuspended(scope)"
>暂停
</el-link>
<el-link type="primary"
v-else
@click="handleWork(scope)"
>生成子计划
<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>
</template>
</el-table-column>
@ -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,223 +227,280 @@
>
</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>
</template>
<script>
import gantt from "@/components/Gantt/index";
import {getordertoplan} from "@/api/sam";
import {createProductionplan, getProductionplanList, createsubplan} from "@/api/pm";
import {getMaterialList} from "@/api/mtm";
import checkPermission from "@/utils/permission";
import gantt from "@/components/Gantt/index";
import { getordertoplan } from "@/api/sam";
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 = {};
export default {
components: {Pagination, gantt},
data() {
return {
orderplan: defaulteorderplan,
orderList: {
count: 0,
},
state_: {
10: '制定中',
20: '已下达',
30: '已接受',
40: '生产中',
50: '已完成',
60: '军检完成'
},
listQuery: {
page: 1,
page_size: 20,
},
productionplanList: {
count: 0,
},
listQuery1: {
page: 1,
page_size: 20,
},
value1: '',
listLoading: true,
ganttShow: false,
dialogVisible: false,
dialogType: "new",
activeName: "订单排产",
rule1: {
number: [{required: true, message: "请输入", trigger: "blur"}],
},
proList: [],
};
},
computed: {},
watch: {},
created() {
this.getorderList();
this.getplanList();
},
methods: {
checkPermission,
//订单列表
getorderList() {
this.listLoading = true;
getordertoplan(this.listQuery).then((response) => {
if (response.data) {
this.orderList = response.data;
}
this.listLoading = false;
});
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteorderplan = {};
export default {
components: { Pagination, gantt },
data() {
return {
orderplan: defaulteorderplan,
orderList: {
count: 0,
},
//生产计划列表
//列表
getplanList() {
let that = this;
this.listLoading = true;
getProductionplanList(this.listQuery1).then((response) => {
if (response.data) {
this.productionplanList = response.data;
let list = response.data.results;
let arr = [];
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();
let obj = new Object();
obj.name = item.number;
obj.id = item.id;
obj.top = 20;
obj.startTime = startTime;
obj.endTime = endTime;
obj.planTime = [startTime, endTime];
obj.per = item.count;
obj.type = 1;
obj.productName = item.product_.name;
obj.productNum = item.product_.specification;
obj.isShow = true;
arr.push(obj);
}
that.proList = arr;
});
}
this.listLoading = false;
});
state_: {
10: "制定中",
20: "已下达",
30: "已接受",
40: "生产中",
50: "已完成",
60: "军检完成",
70: "暂停",
80: "终止",
},
//搜索生产计划
handleFilter() {
this.listQuery1.page = 1;
this.getplanList();
listQuery: {
page: 1,
page_size: 20,
},
resetFilter() {
this.listQuery1 = {
page: 1,
page_size: 20,
productionplanList: {
count: 0,
},
listQuery1: {
page: 1,
page_size: 20,
},
value1: "",
listLoading: true,
dialogVisiblestate: false,
ganttShow: false,
dialogVisible: false,
dialogType: "new",
activeName: "订单排产",
rule1: {
number: [{ required: true, message: "请输入", trigger: "blur" }],
},
proList: [],
};
},
computed: {},
watch: {},
created() {
this.getorderList();
this.getplanList();
},
methods: {
checkPermission,
//订单列表
getorderList() {
this.listLoading = true;
getordertoplan(this.listQuery).then((response) => {
if (response.data) {
this.orderList = response.data;
}
this.getplanList();
},
handleclick(scope) {
this.orderID = scope.row.id;
this.countsx = scope.row.count;
this.planed_count = scope.row.planed_count;
this.delivery_date = scope.row.delivery_date;
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].resetFields();
this.value1="";
});
},
async confirm(form) {
this.orderplan.start_date = this.value1[0];
if (this.delivery_date >= this.value1[1]) {
this.orderplan.end_date = this.value1[1];
} else {
this.$message.error("计划完成时间超过订单交付日期,请从新选择日期!");
this.listLoading = false;
});
},
//生产计划列表
//列表
getplanList() {
let that = this;
this.listLoading = true;
getProductionplanList(this.listQuery1).then((response) => {
if (response.data) {
this.productionplanList = response.data;
let list = response.data.results;
let arr = [];
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();
let obj = new Object();
obj.name = item.number;
obj.id = item.id;
obj.top = 20;
obj.startTime = startTime;
obj.endTime = endTime;
obj.planTime = [startTime, endTime];
obj.per = item.count;
obj.type = 1;
obj.productName = item.product_.name;
obj.productNum = item.product_.specification;
obj.isShow = true;
arr.push(obj);
}
that.proList = arr;
});
}
this.orderplan.order = this.orderID
if (this.orderplan.count <= (this.countsx - this.planed_count)) {
createProductionplan(this.orderplan).then((res) => {
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.getorderList();
this.$message.success("任务暂停成功!");
this.getplanList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
this.$message.error("排产数超过所需数,请合理排产!");
}
},
handleWork(scope) {
this.$confirm("确认生成子计划?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
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()
}
});
})
.catch((err) => {
console.error(err);
.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;
this.getplanList();
},
resetFilter() {
this.listQuery1 = {
page: 1,
page_size: 20,
};
this.getplanList();
},
handleclick(scope) {
this.orderID = scope.row.id;
this.countsx = scope.row.count;
this.planed_count = scope.row.planed_count;
this.delivery_date = scope.row.delivery_date;
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].resetFields();
this.value1 = "";
});
},
async confirm(form) {
this.orderplan.start_date = this.value1[0];
},
activeNameClick(tab, event) {
debugger;
console.log(tab, event);
if (tab.label === '甘特图') {
this.ganttShow = true;
} else {
this.ganttShow = false;
}
},
//查看子计划
handleselectplan(scope) {
this.$router.push({name: "work", params: {id: scope.row.id},})
if (this.delivery_date >= this.value1[1]) {
this.orderplan.end_date = this.value1[1];
} else {
this.$message.error("计划完成时间超过订单交付日期,请从新选择日期!");
}
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();
this.getplanList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
this.$message.error("排产数超过所需数,请合理排产!");
}
},
};
handleWork(scope) {
this.$confirm("确认生成子计划?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
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();
}
});
})
.catch((err) => {
console.error(err);
});
},
activeNameClick(tab, event) {
debugger;
console.log(tab, event);
if (tab.label === "甘特图") {
this.ganttShow = true;
} else {
this.ganttShow = false;
}
},
//查看子计划
handleselectplan(scope) {
this.$router.push({ name: "work", params: { id: scope.row.id } });
},
},
};
</script>
<style>
.el-table .warning-row {
background: oldlace;
}
.el-table .warning-row {
background: oldlace;
}
.el-table .success-row {
background: #f0f9eb;
}
.el-table .success-row {
background: #f0f9eb;
}
</style>

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: "待复检",