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 data
}) })
} }
//员工离岗说明
export function notWork(id, data) {
return request({
url: `/hrm/employee/${id}/not_work_remark/`,
method: 'POST',
data
})
}
export function getEmployee(data) { export function getEmployee(data) {
return request({ return request({
url: '/hrm/employee/', url: '/hrm/employee/',

View File

@ -105,3 +105,19 @@ export function createConvert(data) {
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> <el-tag type="danger" v-else>离岗</el-tag>
</template> </template>
</el-table-column> </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="部门"> <el-table-column align="header-center" label="部门">
<template v-if="scope.row.dept_" slot-scope="scope">{{ <template v-if="scope.row.dept_" slot-scope="scope">{{
scope.row.dept_.name scope.row.dept_.name
}}</template> }}</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-column>
</el-table> </el-table>
<pagination <pagination
v-show="userList.count > 0" v-show="userList.count > 0"
:total="userList.count" :total="userList.count"
:page.sync="listQuery.page" :page.sync="listQuery.page"
:limit.sync="listQuery.page_size" :limit.sync="listQuery.page_size"
@pagination="getList" @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="到岗统计"> <el-tab-pane label="到岗统计">
<div class="container"> <div class="container">
@ -55,7 +99,8 @@
</el-date-picker> </el-date-picker>
<el-button type="primary" @click="submit">查询</el-button> <el-button type="primary" @click="submit">查询</el-button>
</div> </div>
<el-row>
<el-col :span="12">
<el-table <el-table
:data="atworkList" :data="atworkList"
@ -87,7 +132,20 @@
</el-table> </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-tab-pane>
</el-tabs> </el-tabs>
@ -123,6 +181,7 @@
<script> <script>
import { getEmployeeList } from "@/api/employee"; import { getEmployeeList } from "@/api/employee";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { notWork } from "@/api/hrm";
import {getatwork } from "@/api/srm"; import {getatwork } from "@/api/srm";
import { upUrl, upHeaders } from "@/api/file"; import { upUrl, upHeaders } from "@/api/file";
@ -136,14 +195,21 @@ export default {
return { return {
userList: { count: 0 }, userList: { count: 0 },
atworkList: [], atworkList: [],
stopwork:{not_work_remark:""},
value3:null, value3:null,
value2:null, value2:null,
listLoading: true, listLoading: true,
dialogVisible:false,
stopworkID:null,
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, 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}, atworkDate:{year:null,month:null},
}; };
}, },
@ -157,7 +223,7 @@ value2:null,
checkPermission, checkPermission,
//今日到岗 //今日到岗
getList() { 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) => { getEmployeeList(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.userList = 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() 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> </script>

View File

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

View File

@ -16,14 +16,14 @@
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@click="handleFilter" @click="handleFilter"
>搜索 >搜索
</el-button> </el-button>
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
icon="el-icon-refresh-left" icon="el-icon-refresh-left"
@click="resetFilter" @click="resetFilter"
>重置 >重置
</el-button> </el-button>
<el-table <el-table
:data="productionplanList.results" :data="productionplanList.results"
@ -33,7 +33,7 @@
style="width: 100%" style="width: 100%"
height="300" height="300"
> >
<el-table-column type="index" width="50"/> <el-table-column type="index" width="50" />
<el-table-column label="任务编号" width="110"> <el-table-column label="任务编号" width="110">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
@ -41,13 +41,17 @@
<template slot-scope="scope">{{ scope.row.order_.number }}</template> <template slot-scope="scope">{{ scope.row.order_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="合同编号" width="110"> <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>
<el-table-column label="产品名称" width="150" show-overflow-tooltip> <el-table-column label="产品名称" width="150" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.name }}</template> <template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号" width="110"> <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>
<el-table-column label="产品单位" width="110"> <el-table-column label="产品单位" width="110">
<template slot-scope="scope">{{ scope.row.product_.unit }}</template> <template slot-scope="scope">{{ scope.row.product_.unit }}</template>
@ -65,13 +69,15 @@
<template slot-scope="scope">{{ scope.row.end_date }}</template> <template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="交货日期" width="110"> <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>
<el-table-column label="是否生成子计划" width="120"> <el-table-column label="是否生成子计划" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.is_planed==false"></el-tag> <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 == true"></el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" width="160"> <el-table-column label="创建时间" width="160">
@ -81,18 +87,34 @@
align="center" align="center"
label="操作" label="操作"
fixed="right" fixed="right"
width="100px" width="150px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link type="primary" <el-link type="warning"
v-if="scope.row.is_planed" v-if="scope.row.state != 70"
@click="handleselectplan(scope)" @click="handlestatesuspended(scope)"
>查看子计划 >暂停
</el-link> </el-link>
<el-link type="primary" <el-link
v-else type="primary"
@click="handleWork(scope)" 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> </el-link>
</template> </template>
</el-table-column> </el-table-column>
@ -105,7 +127,12 @@
@pagination="getplanList" @pagination="getplanList"
/> />
</el-card> </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-tab-pane label="订单排产" name="订单排产">
<el-table <el-table
:data="orderList.results" :data="orderList.results"
@ -132,7 +159,9 @@
<template slot-scope="scope">{{ scope.row.product_.name }}</template> <template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号" width="110"> <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>
<el-table-column label="产品数量"> <el-table-column label="产品数量">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
@ -180,17 +209,17 @@
label-position="right" label-position="right"
:rules="rule1" :rules="rule1"
> >
<el-form-item label="排产数量" prop="count"> <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>
<el-form-item label="计划排产时间" prop="value1"> <el-form-item label="计划排产时间" prop="value1">
<el-date-picker <el-date-picker
v-model="value1" v-model="value1"
type="daterange" type="daterange"
start-placeholder="计划开始日期" start-placeholder="计划开始日期"
end-placeholder="计划结束日期" end-placeholder="计划结束日期"
format="yyyy 年 MM 月 dd 日" format="yyyy 年 MM 月 dd 日"
@ -198,223 +227,280 @@
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <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> <el-button type="primary" @click="confirm('Form')">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="甘特图" name="甘特图"> <el-tab-pane label="甘特图" name="甘特图">
<gantt <gantt v-if="ganttShow" :proList="proList"></gantt>
v-if="ganttShow"
:proList="proList"
></gantt>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</template> </template>
<script> <script>
import gantt from "@/components/Gantt/index"; import gantt from "@/components/Gantt/index";
import {getordertoplan} from "@/api/sam"; import { getordertoplan } from "@/api/sam";
import {createProductionplan, getProductionplanList, createsubplan} from "@/api/pm"; import {
import {getMaterialList} from "@/api/mtm"; createProductionplan,
import checkPermission from "@/utils/permission"; getProductionplanList,
createsubplan,
plantoggle,
planstop
} from "@/api/pm";
import { getMaterialList } from "@/api/mtm";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import {genTree} from "@/utils"; import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination const defaulteorderplan = {};
const defaulteorderplan = {}; export default {
export default { components: { Pagination, gantt },
components: {Pagination, gantt}, data() {
data() { return {
return { orderplan: defaulteorderplan,
orderplan: defaulteorderplan, orderList: {
orderList: { count: 0,
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;
});
}, },
//生产计划列表 state_: {
//列表 10: "制定中",
getplanList() { 20: "已下达",
let that = this; 30: "已接受",
this.listLoading = true; 40: "生产中",
getProductionplanList(this.listQuery1).then((response) => { 50: "已完成",
if (response.data) { 60: "军检完成",
this.productionplanList = response.data; 70: "暂停",
let list = response.data.results; 80: "终止",
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;
});
}, },
//搜索生产计划 listQuery: {
handleFilter() { page: 1,
this.listQuery1.page = 1; page_size: 20,
this.getplanList();
}, },
resetFilter() { productionplanList: {
this.listQuery1 = { count: 0,
page: 1, },
page_size: 20, 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(); this.listLoading = false;
}, });
handleclick(scope) { },
this.orderID = scope.row.id; //生产计划列表
this.countsx = scope.row.count; //列表
this.planed_count = scope.row.planed_count; getplanList() {
this.delivery_date = scope.row.delivery_date; let that = this;
this.dialogVisible = true; this.listLoading = true;
this.$nextTick(() => { getProductionplanList(this.listQuery1).then((response) => {
this.$refs["Form"].resetFields(); if (response.data) {
this.value1=""; this.productionplanList = response.data;
}); let list = response.data.results;
let arr = [];
}, list.forEach((item) => {
async confirm(form) { if (!item.children || item.children.length < 1) {
let startTime = new Date(item.start_date).getTime();
this.orderplan.start_date = this.value1[0]; let endTime = new Date(item.end_date).getTime();
let obj = new Object();
if (this.delivery_date >= this.value1[1]) { obj.name = item.number;
this.orderplan.end_date = this.value1[1]; obj.id = item.id;
} else { obj.top = 20;
this.$message.error("计划完成时间超过订单交付日期,请从新选择日期!"); 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;
this.orderplan.order = this.orderID });
if (this.orderplan.count <= (this.countsx - this.planed_count)) { },
createProductionplan(this.orderplan).then((res) => { //修改任务状态设置暂停
handlestatesuspended(scope) {
this.$confirm("确认暂停任务?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await plantoggle(scope.row.id).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getorderList(); this.$message.success("任务暂停成功!");
this.getplanList(); this.getplanList();
this.dialogVisible = false;
this.$message.success("成功");
} }
}); });
} else {
this.$message.error("排产数超过所需数,请合理排产!");
}
},
handleWork(scope) {
this.$confirm("确认生成子计划?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
}) })
.then(async () => { .catch((err) => {
await createsubplan(scope.row.id).then((res) => { console.error(err);
if (res.code >= 200) { });
this.$message.success("生成子计划成功!"); },
this.$router.push({name: "work", params: {id: scope.row.id},}) //修改任务状态设置启动
this.getplanList() handlestate(scope) {
} this.$confirm("确认启动任务?", "提醒", {
}); confirmButtonText: "确认",
}) cancelButtonText: "取消",
.catch((err) => { type: "error",
console.error(err); })
.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];
}, if (this.delivery_date >= this.value1[1]) {
activeNameClick(tab, event) { this.orderplan.end_date = this.value1[1];
debugger; } else {
console.log(tab, event); this.$message.error("计划完成时间超过订单交付日期,请从新选择日期!");
if (tab.label === '甘特图') {
this.ganttShow = true;
} else {
this.ganttShow = false;
}
},
//查看子计划
handleselectplan(scope) {
this.$router.push({name: "work", params: {id: scope.row.id},})
} }
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> </script>
<style> <style>
.el-table .warning-row { .el-table .warning-row {
background: oldlace; background: oldlace;
} }
.el-table .success-row { .el-table .success-row {
background: #f0f9eb; background: #f0f9eb;
} }
</style> </style>

View File

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