ddd
This commit is contained in:
commit
497b47b227
|
|
@ -13,6 +13,7 @@ export function clockRecord(data) {
|
|||
data
|
||||
})
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
//员工离岗说明
|
||||
export function notWork(id, data) {
|
||||
return request({
|
||||
|
|
@ -22,3 +23,12 @@ export function notWork(id, data) {
|
|||
})
|
||||
}
|
||||
|
||||
=======
|
||||
export function getEmployee(data) {
|
||||
return request({
|
||||
url: '/hrm/employee/',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
>>>>>>> 802cd214bef263b51b08f9299e5a7bd9ec93b8ef
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@
|
|||
import center from './center'
|
||||
import bottomLeft from './bottomLeft'
|
||||
import bottomRight from './bottomRight'
|
||||
import { getPlanGantt } from "@/api/srm";
|
||||
|
||||
export default {
|
||||
mixins: [ drawMixin ],
|
||||
|
|
@ -108,6 +109,7 @@
|
|||
dateDay: null,
|
||||
dateYear: null,
|
||||
dateWeek: null,
|
||||
planGanttList:[],
|
||||
weekday: ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
|
||||
}
|
||||
},
|
||||
|
|
@ -122,6 +124,7 @@
|
|||
mounted() {
|
||||
this.timeFn();
|
||||
this.cancelLoading();
|
||||
this.getPageData();
|
||||
let bigHeight = document.getElementsByClassName('host-body')[0].clientHeight;
|
||||
let firstHeight = document.getElementById('firstLine').clientHeight;
|
||||
let secondHeight = document.getElementsByClassName('jc-between')[0].clientHeight;
|
||||
|
|
@ -139,6 +142,16 @@
|
|||
this.dateWeek = this.weekday[new Date().getDay()]
|
||||
}, 1000)
|
||||
},
|
||||
getPageData(){
|
||||
let that = this;
|
||||
getPlanGantt({Authorization:'big_screen'}).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.planGanttList = res.data.results;
|
||||
} else {
|
||||
that.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
},
|
||||
cancelLoading() {
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
|
|
|
|||
|
|
@ -240,7 +240,8 @@
|
|||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="部门" prop="dept_name">
|
||||
<el-table-column label="部门" prop="dept_">
|
||||
<template slot-scope="scope">{{scope.row.dept_.name}}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
|
@ -338,7 +339,8 @@
|
|||
<script>
|
||||
import echarts from 'echarts'
|
||||
import {mapGetters} from 'vuex';
|
||||
import {getUserList} from "@/api/user";
|
||||
// import {getUserList} from "@/api/user";
|
||||
import {getEmployee} from "@/api/hrm";
|
||||
import {getMaterialList} from "@/api/mtm";
|
||||
import {getProductionplanList} from "@/api/pm";
|
||||
import {getmaterialbatchList} from "@/api/inm";
|
||||
|
|
@ -586,7 +588,7 @@
|
|||
let that = this;
|
||||
that.listLoadingUser = true;
|
||||
that.userPage =1;
|
||||
getUserList({page: that.userPage, page_size: that.userPageSize, fields: 'id,name,dept_name,is_atwork'}).then((response) => {
|
||||
getEmployee({page: that.userPage, page_size: that.userPageSize}).then((response) => {
|
||||
if (response.data) {
|
||||
that.userList = response.data.results;
|
||||
that.userTotal = response.data.count;
|
||||
|
|
@ -600,7 +602,7 @@
|
|||
let that = this;
|
||||
that.listLoadingUser = true;
|
||||
that.userPage = val;
|
||||
getUserList({page: val, page_size: that.userPageSize, fields: 'id,name,dept_name,is_atwork'}).then((response) => {
|
||||
getEmployee({page: val, page_size: that.userPageSize, fields: 'id,name,dept_name,is_atwork'}).then((response) => {
|
||||
if (response.data) {
|
||||
that.userList = response.data.results;
|
||||
that.userTotal = response.data.count;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="app-container">
|
||||
<el-card>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleorder"
|
||||
>选择订单
|
||||
>选择订单
|
||||
</el-button>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
|
|
@ -15,8 +15,8 @@
|
|||
height="100"
|
||||
v-el-height-adaptive-table="{bottomOffset: 42}"
|
||||
>
|
||||
<el-table-column type="selection" width="55"> </el-table-column>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column type="index" width="50"/>
|
||||
<el-table-column label="成品编号">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
|
|
@ -24,25 +24,18 @@
|
|||
<el-table-column label="成品批次">
|
||||
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成品名称">
|
||||
<el-table-column label="成品名称" min-width="100" show-overflow-tooltip>
|
||||
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="所在仓库">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.warehouse_.name
|
||||
}}</template>
|
||||
<template slot-scope="scope">{{scope.row.warehouse_.name}}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="订单">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.to_order_">{{
|
||||
scope.row.to_order_.number
|
||||
}}</span>
|
||||
<span v-if="scope.row.to_order_">{{scope.row.to_order_.number}}</span>
|
||||
<el-tag
|
||||
v-else-if="
|
||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
||||
"
|
||||
v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true"
|
||||
>
|
||||
需要确定订单
|
||||
</el-tag>
|
||||
|
|
@ -51,13 +44,9 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="合同">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.to_order_">{{
|
||||
scope.row.to_order_.contract_.name
|
||||
}}</span>
|
||||
<span v-if="scope.row.to_order_">{{scope.row.to_order_.contract_.name}}</span>
|
||||
<span
|
||||
v-else-if="
|
||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
||||
"
|
||||
v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true"
|
||||
>
|
||||
</span>
|
||||
<span v-else></span>
|
||||
|
|
@ -65,38 +54,33 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="客户">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.to_order_">{{
|
||||
scope.row.to_order_.customer_.name
|
||||
}}</span>
|
||||
<span v-if="scope.row.to_order_">{{scope.row.to_order_.customer_.name}}</span>
|
||||
<span
|
||||
v-else-if="
|
||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
||||
"
|
||||
v-else-if="scope.row.to_order_ == null && scope.row.need_to_order == true"
|
||||
>
|
||||
</span>
|
||||
<span v-else></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="军检">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag>
|
||||
<el-tag v-else-if="scope.row.is_mtestok == true">合格</el-tag>
|
||||
<span v-else></span
|
||||
></template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" label="操作" width="220px">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="
|
||||
checkPermission(['warehouse_update']) &&
|
||||
scope.row.act_state == 30
|
||||
"
|
||||
@click="handleMtest(scope)"
|
||||
>军检
|
||||
</el-link>
|
||||
<span v-else></span>
|
||||
</template>
|
||||
</el-table-column>!-->
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" label="操作" width="220px">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="
|
||||
checkPermission(['warehouse_update']) &&
|
||||
scope.row.act_state == 30
|
||||
"
|
||||
@click="handleMtest(scope)"
|
||||
>军检
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>!-->
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="iproductData.count > 0"
|
||||
|
|
@ -112,8 +96,8 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="军检备注" prop="name">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="mtestform.remark_mtest"
|
||||
type="textarea"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
|
@ -127,12 +111,11 @@
|
|||
:close-on-click-modal="false"
|
||||
:visible.sync="dialogFormVisibleorder"
|
||||
>
|
||||
<el-descriptions :column="5" border style="margin-bottom: 20px">
|
||||
<el-descriptions-item label="原订单">{{ this.ordershow }}</el-descriptions-item>
|
||||
<el-descriptions-item label="原客户">{{ this.customershow }}</el-descriptions-item>
|
||||
<el-descriptions-item label="原合同" >{{ this.contractshow }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-descriptions :column="5" border style="margin-bottom: 20px">
|
||||
<el-descriptions-item label="原订单">{{ this.ordershow }}</el-descriptions-item>
|
||||
<el-descriptions-item label="原客户">{{ this.customershow }}</el-descriptions-item>
|
||||
<el-descriptions-item label="原合同">{{ this.contractshow }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="orderList"
|
||||
|
|
@ -143,32 +126,28 @@
|
|||
height="100"
|
||||
v-el-height-adaptive-table="{ bottomOffset: 42 }"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
|
||||
<el-table-column type="index" width="50"/>
|
||||
<el-table-column label="订单编号" width="160" show-overflow-tooltip>
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户" width="200" show-overflow-tooltip>
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.customer_.name
|
||||
}}</template>
|
||||
<template slot-scope="scope">{{scope.row.customer_.name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所属合同" width="200" show-overflow-tooltip>
|
||||
<template slot-scope="scope" v-if="scope.row.contract">{{
|
||||
scope.row.contract_.name
|
||||
}}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.contract">{{scope.row.contract_.name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="checkPermission(['warehouse_update'])"
|
||||
@click="toorders(scope)"
|
||||
>确认
|
||||
>确认
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisibleorder = false">取 消</el-button>
|
||||
</div>
|
||||
|
|
@ -177,111 +156,111 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getiproductList } from "@/api/inm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import { getOrderList } from "@/api/sam";
|
||||
import { mtest, toorder } from "@/api/wpm";
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
import {getiproductList} from "@/api/inm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import {getOrderList} from "@/api/sam";
|
||||
import {mtest, toorder} from "@/api/wpm";
|
||||
import {genTree} from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
|
||||
export default {
|
||||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
iproductData: {
|
||||
count: 0,
|
||||
},
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
mtest: {},
|
||||
salesdetail: "",
|
||||
saleproduct: "",
|
||||
dialogVisible: false,
|
||||
mtestform: {
|
||||
is_mtestok: false,
|
||||
},
|
||||
form1: {},
|
||||
dialogFormVisibleorder: false,
|
||||
orderList: [],
|
||||
mutipID1: [],
|
||||
mutipID: [],
|
||||
mtmId: [],
|
||||
ordershow: "",
|
||||
customershow:"",
|
||||
contractshow:"",
|
||||
materialshow: [],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//半成品列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
this.listQuery.material__type = 1;
|
||||
this.listQuery.is_saled = false;
|
||||
getiproductList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.iproductData = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
export default {
|
||||
components: {Pagination},
|
||||
data() {
|
||||
return {
|
||||
iproductData: {
|
||||
count: 0,
|
||||
},
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
mtest: {},
|
||||
salesdetail: "",
|
||||
saleproduct: "",
|
||||
dialogVisible: false,
|
||||
mtestform: {
|
||||
is_mtestok: false,
|
||||
},
|
||||
form1: {},
|
||||
dialogFormVisibleorder: false,
|
||||
orderList: [],
|
||||
mutipID1: [],
|
||||
mutipID: [],
|
||||
mtmId: [],
|
||||
ordershow: "",
|
||||
customershow: "",
|
||||
contractshow: "",
|
||||
materialshow: [],
|
||||
};
|
||||
},
|
||||
handleMtest(scope) {
|
||||
this.saleproduct = scope.row.id;
|
||||
this.dialogVisible = true;
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
submtest() {
|
||||
mtest(this.saleproduct, this.mtestform).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.$message.success("提交成功!");
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
//批量选择成品发给谋订单
|
||||
handleorder() {
|
||||
this.dialogFormVisibleorder = true;
|
||||
let _this = this;
|
||||
_this.mutipID1 = [];
|
||||
_this.mtmId = [];
|
||||
_this.materialshow = [];
|
||||
this.$refs.multipleTable.selection.forEach((item) => {
|
||||
_this.mutipID1.push(item.wproduct);
|
||||
_this.mtmId.push(item.material_.id);
|
||||
_this.materialshow.push(item);
|
||||
});
|
||||
this.ordershow = _this.materialshow[0].order_.number;
|
||||
this.customershow=_this.materialshow[0].order_.customer_.name;
|
||||
this.contractshow=_this.materialshow[0].order_.contract_.name;
|
||||
getOrderList({ page: 0, material: _this.mtmId[0], tag:'not_done' }).then(
|
||||
(response) => {
|
||||
methods: {
|
||||
checkPermission,
|
||||
//半成品列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
this.listQuery.material__type = 1;
|
||||
this.listQuery.is_saled = false;
|
||||
getiproductList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.orderList = response.data;
|
||||
this.iproductData = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
handleMtest(scope) {
|
||||
this.saleproduct = scope.row.id;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
submtest() {
|
||||
mtest(this.saleproduct, this.mtestform).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.$message.success("提交成功!");
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
//批量选择成品发给谋订单
|
||||
handleorder() {
|
||||
this.dialogFormVisibleorder = true;
|
||||
let _this = this;
|
||||
_this.mutipID1 = [];
|
||||
_this.mtmId = [];
|
||||
_this.materialshow = [];
|
||||
this.$refs.multipleTable.selection.forEach((item) => {
|
||||
_this.mutipID1.push(item.wproduct);
|
||||
_this.mtmId.push(item.material_.id);
|
||||
_this.materialshow.push(item);
|
||||
});
|
||||
this.ordershow = _this.materialshow[0].order_.number;
|
||||
this.customershow = _this.materialshow[0].order_.customer_.name;
|
||||
this.contractshow = _this.materialshow[0].order_.contract_.name;
|
||||
getOrderList({page: 0, material: _this.mtmId[0], tag: 'not_done'}).then(
|
||||
(response) => {
|
||||
if (response.data) {
|
||||
this.orderList = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
//提交批量产品选择的订单
|
||||
toorders(scope) {
|
||||
toorder({
|
||||
order: scope.row.id,
|
||||
wproducts: this.mutipID1,
|
||||
}).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.$message.success("成功!");
|
||||
this.dialogFormVisibleorder = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
//提交批量产品选择的订单
|
||||
toorders(scope) {
|
||||
toorder({
|
||||
order: scope.row.id,
|
||||
wproducts: this.mutipID1,
|
||||
}).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.$message.success("成功!");
|
||||
this.dialogFormVisibleorder = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -79,26 +79,13 @@
|
|||
<el-form-item label="表格名称" prop="name">
|
||||
<el-input v-model="recordform.name" placeholder="表格名称"/>
|
||||
</el-form-item>
|
||||
<!--<el-form-item label="引用表单" prop="field_type">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="recordform.number"
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in fieldtypeoptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>-->
|
||||
<el-form-item label="表格类型" prop="formUsed">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="recordform.type"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="请选择"
|
||||
@change="formTypeChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in typeOptions"
|
||||
|
|
@ -109,6 +96,22 @@
|
|||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="引用表单" prop="field_type">
|
||||
<el-select
|
||||
v-model="recordform.form"
|
||||
style="width: 100%"
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in formList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="name">
|
||||
<el-switch v-model="recordform.enabled"></el-switch>
|
||||
</el-form-item>
|
||||
|
|
@ -576,6 +579,7 @@
|
|||
recordformList: {
|
||||
count: 0,
|
||||
},
|
||||
formList:[],
|
||||
fieldList: {
|
||||
count: 0,
|
||||
},
|
||||
|
|
@ -696,6 +700,13 @@
|
|||
this.material = this.$route.params.id;
|
||||
this.recordformLists();
|
||||
},
|
||||
mounted(){
|
||||
getrecordformList({page:0}).then((response) => {
|
||||
if (response.data) {
|
||||
this.formList = response.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
formFunc(value) {
|
||||
this.dialogVisibleForm = value;
|
||||
|
|
@ -882,6 +893,13 @@
|
|||
// this.$refs["Forms"].resetFields();
|
||||
// });
|
||||
},
|
||||
formTypeChange(){
|
||||
getrecordformList({type:this.recordform.type,page:0}).then((response) => {
|
||||
if (response.data) {
|
||||
this.formList = response.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
//新增字段
|
||||
handlefieldCreate() {
|
||||
this.field_choice = [""];
|
||||
|
|
@ -903,6 +921,8 @@
|
|||
});
|
||||
},
|
||||
handleEdit(scope) {
|
||||
debugger;
|
||||
console.log( scope.row);
|
||||
this.recordform = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
|
|
@ -959,6 +979,7 @@
|
|||
obj.type=this.recordform.type;
|
||||
obj.enabled=this.recordform.enabled;
|
||||
if (isEdit) {
|
||||
obj.form=this.recordform.form?this.recordform.form:null;
|
||||
updaterecordform(this.recordform.id, obj).then(
|
||||
(res) => {
|
||||
if (res.code >= 200) {
|
||||
|
|
@ -970,6 +991,7 @@
|
|||
);
|
||||
} else {
|
||||
obj.material=parseInt(this.material);
|
||||
obj.form=this.recordform.form!==''?this.recordform.form:null;
|
||||
createrecordform(obj).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.recordformLists();
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
|
||||
<div style="margin-top: 2px">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||
>新增工序</el-button
|
||||
>
|
||||
</div>
|
||||
<div style="margin-top: 2px">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate">
|
||||
新增工序
|
||||
</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 2px">
|
||||
<el-table
|
||||
|
|
@ -15,29 +14,29 @@
|
|||
border
|
||||
fit
|
||||
stripe
|
||||
max-height="620"
|
||||
height="100"
|
||||
max-height="620"
|
||||
height="100"
|
||||
v-el-height-adaptive-table="{bottomOffset: 10}"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="工序编号">
|
||||
<el-table-column type="index" width="50"/>
|
||||
<el-table-column label="工序编号">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工序名称">
|
||||
<el-table-column label="工序名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工序类别">
|
||||
<el-table-column label="工序类别">
|
||||
<template slot-scope="scope">{{ type_[scope.row.type] }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="生产车间" >
|
||||
<template slot-scope="scope" v-if="scope.row.workshop_">{{ scope.row.workshop_.name }}</template>
|
||||
<el-table-column label="生产车间">
|
||||
<template slot-scope="scope" v-if="scope.row.workshop_">{{ scope.row.workshop_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="指导书">
|
||||
<el-table-column align="center" label="指导书" show-overflow-tooltip min-width="110">
|
||||
<template slot-scope="scope" v-if="scope.row.instruction_">
|
||||
<el-link :href="scope.row.instruction_.path" >{{scope.row.instruction_.name}}</el-link>
|
||||
<el-link :href="scope.row.instruction_.path">{{scope.row.instruction_.name}}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
|
@ -46,25 +45,26 @@
|
|||
width="220px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
|
||||
|
||||
<el-link
|
||||
<el-link
|
||||
type="primary"
|
||||
@click="handleAdd(scope)"
|
||||
>添加子工序</el-link
|
||||
>
|
||||
添加子工序
|
||||
</el-link>
|
||||
<el-link
|
||||
v-if="checkPermission(['process_update'])"
|
||||
type="primary"
|
||||
@click="handleEdit(scope)"
|
||||
>编辑</el-link
|
||||
>
|
||||
编辑
|
||||
</el-link>
|
||||
<el-link
|
||||
v-if="checkPermission(['process_delete'])"
|
||||
type="danger"
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-link
|
||||
>
|
||||
删除
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
/>
|
||||
</el-card>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="dialogVisible"
|
||||
:title="dialogType === 'edit' ? '编辑工序' : '新增工序'"
|
||||
>
|
||||
|
|
@ -89,43 +89,42 @@
|
|||
:rules="rule1"
|
||||
>
|
||||
<el-form-item label="工序名称" prop="name">
|
||||
<el-input v-model="process.name" placeholder="工序名称" />
|
||||
<el-input v-model="process.name" placeholder="工序名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工序编号" prop="number">
|
||||
<el-input v-model="process.number" placeholder="工序编号" />
|
||||
<el-input v-model="process.number" placeholder="工序编号"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工序编号" prop="type">
|
||||
<el-select style="width: 100%" v-model="process.type" placeholder="请选择" >
|
||||
<el-option
|
||||
v-for="item in option"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
<el-form-item label="工序编号" prop="type">
|
||||
<el-select style="width: 100%" v-model="process.type" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in option"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="生产车间" prop="workshop">
|
||||
<treeselect v-model="process.workshop" :options="workoptions" placeholder="所属部门"/>
|
||||
<treeselect v-model="process.workshop" :options="workoptions" placeholder="所属部门"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="指导书内容" prop="instruction_content">
|
||||
<el-input type="textarea" :rows="3" v-model="process.instruction_content" placeholder="指导书内容" />
|
||||
<el-form-item label="指导书内容" prop="instruction_content">
|
||||
<el-input type="textarea" :rows="3" v-model="process.instruction_content" placeholder="指导书内容"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="指导书" prop="template" v-if="dialogVisible">
|
||||
<el-form-item label="指导书" prop="template" v-if="dialogVisible">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:action="upUrl"
|
||||
:on-preview="handlePreview"
|
||||
:on-success="handleUpSuccess"
|
||||
:on-remove="handleRemove"
|
||||
:headers="upHeaders"
|
||||
:file-list="fileList"
|
||||
:limit="1"
|
||||
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx"
|
||||
>
|
||||
<el-button size="small" type="primary">上传文件</el-button>
|
||||
</el-upload>
|
||||
ref="upload"
|
||||
:action="upUrl"
|
||||
:on-preview="handlePreview"
|
||||
:on-success="handleUpSuccess"
|
||||
:on-remove="handleRemove"
|
||||
:headers="upHeaders"
|
||||
:file-list="fileList"
|
||||
:limit="1"
|
||||
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx"
|
||||
>
|
||||
<el-button size="small" type="primary">上传文件</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div style="text-align: right">
|
||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||
|
|
@ -135,42 +134,42 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getProcessList, createProcess,updateProcess,deleteProcess } from "@/api/mtm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import { getOrgAll } from "@/api/org"
|
||||
import { upUrl, upHeaders } from "@/api/file";
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import {getProcessList, createProcess, updateProcess, deleteProcess} from "@/api/mtm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import {getOrgAll} from "@/api/org"
|
||||
import {upUrl, upHeaders} from "@/api/file";
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaultprocess = {
|
||||
name: "",
|
||||
number: "",
|
||||
};
|
||||
export default {
|
||||
components: { Pagination,Treeselect },
|
||||
data() {
|
||||
return {
|
||||
process: defaultprocess,
|
||||
processList: {
|
||||
count: 0,
|
||||
},
|
||||
upHeaders: upHeaders(),
|
||||
upUrl: upUrl(),
|
||||
fileList:[],
|
||||
workoptions:[],
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
type_:{
|
||||
10:'特殊',
|
||||
20:'关键',
|
||||
30:'普通',
|
||||
|
||||
},
|
||||
option: [{
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import {genTree} from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaultprocess = {
|
||||
name: "",
|
||||
number: "",
|
||||
};
|
||||
export default {
|
||||
components: {Pagination, Treeselect},
|
||||
data() {
|
||||
return {
|
||||
process: defaultprocess,
|
||||
processList: {
|
||||
count: 0,
|
||||
},
|
||||
upHeaders: upHeaders(),
|
||||
upUrl: upUrl(),
|
||||
fileList: [],
|
||||
workoptions: [],
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
type_: {
|
||||
10: '特殊',
|
||||
20: '关键',
|
||||
30: '普通',
|
||||
|
||||
},
|
||||
option: [{
|
||||
value: 10,
|
||||
label: '特殊'
|
||||
}, {
|
||||
|
|
@ -180,144 +179,140 @@ export default {
|
|||
value: 30,
|
||||
label: '普通'
|
||||
}],
|
||||
listLoading: true,
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
rule1: {
|
||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
number: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getOrgAll();
|
||||
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//工序列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getProcessList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.processList = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
//生产车间
|
||||
getOrgAll() {
|
||||
this.treeLoding = true;
|
||||
getOrgAll().then(response => {
|
||||
this.workoptions = genTree(response.data);
|
||||
this.treeLoding = false;
|
||||
});
|
||||
},
|
||||
handlePreview(file) {
|
||||
if ("url" in file) {
|
||||
window.open(file.url);
|
||||
} else {
|
||||
window.open(file.response.data.path);
|
||||
}
|
||||
},
|
||||
handleUpSuccess(res, file, filelist) {
|
||||
this.process.instruction = res.data.id;
|
||||
},
|
||||
handleRemove(file, filelist){
|
||||
this.process.instruction = null;
|
||||
},
|
||||
//添加子工序
|
||||
handleAdd(scope)
|
||||
{
|
||||
this.$router.push({name: "Step", params: { id: scope.row.id }, })
|
||||
},
|
||||
|
||||
listLoading: true,
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
rule1: {
|
||||
name: [{required: true, message: "请输入", trigger: "blur"}],
|
||||
number: [{required: true, message: "请输入", trigger: "blur"}],
|
||||
|
||||
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getOrgAll();
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
handleCreate() {
|
||||
this.process = Object.assign({}, defaultprocess);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
this.fileList=[];
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
|
||||
handleEdit(scope) {
|
||||
this.process = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
if (this.process.instruction) {
|
||||
this.fileList = [
|
||||
{
|
||||
name:this.process.instruction_.name,
|
||||
url: this.process.instruction_.path,
|
||||
},
|
||||
];
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteProcess(scope.row.id);
|
||||
this.getList();
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
|
||||
if (isEdit) {
|
||||
updateProcess(this.process.id, this.process).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createProcess(this.process).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
methods: {
|
||||
checkPermission,
|
||||
//工序列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getProcessList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.processList = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
//生产车间
|
||||
getOrgAll() {
|
||||
this.treeLoding = true;
|
||||
getOrgAll().then(response => {
|
||||
this.workoptions = genTree(response.data);
|
||||
this.treeLoding = false;
|
||||
});
|
||||
},
|
||||
handlePreview(file) {
|
||||
if ("url" in file) {
|
||||
window.open(file.url);
|
||||
} else {
|
||||
return false;
|
||||
window.open(file.response.data.path);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleUpSuccess(res, file, filelist) {
|
||||
this.process.instruction = res.data.id;
|
||||
},
|
||||
handleRemove(file, filelist) {
|
||||
this.process.instruction = null;
|
||||
},
|
||||
//添加子工序
|
||||
handleAdd(scope) {
|
||||
this.$router.push({name: "Step", params: {id: scope.row.id},})
|
||||
},
|
||||
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
handleCreate() {
|
||||
this.process = Object.assign({}, defaultprocess);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
this.fileList = [];
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
|
||||
handleEdit(scope) {
|
||||
this.process = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
if (this.process.instruction) {
|
||||
this.fileList = [
|
||||
{
|
||||
name: this.process.instruction_.name,
|
||||
url: this.process.instruction_.path,
|
||||
},
|
||||
];
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteProcess(scope.row.id);
|
||||
this.getList();
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
|
||||
if (isEdit) {
|
||||
updateProcess(this.process.id, this.process).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createProcess(this.process).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -142,65 +142,50 @@
|
|||
style="width: 100%"
|
||||
height="250"
|
||||
>
|
||||
<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>
|
||||
<el-table-column label="客户名称" width="110">
|
||||
<template slot-scope="scope" show-overflow-tooltip>{{
|
||||
scope.row.customer_.name
|
||||
}}</template>
|
||||
<el-table-column label="客户名称" show-overflow-tooltip min-width="110">
|
||||
<template slot-scope="scope" show-overflow-tooltip>{{ scope.row.customer_.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="合同编号" width="110">
|
||||
<template slot-scope="scope" v-if="scope.row.contract">{{
|
||||
scope.row.contract_.number
|
||||
}}</template>
|
||||
<el-table-column label="合同编号" show-overflow-tooltip min-width="110">
|
||||
<template slot-scope="scope" v-if="scope.row.contract">{{ scope.row.contract_.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同名称" show-overflow-tooltip width="110">
|
||||
<template slot-scope="scope" v-if="scope.row.contract">{{
|
||||
scope.row.contract_.name
|
||||
}}</template>
|
||||
<el-table-column label="合同名称" show-overflow-tooltip min-width="110">
|
||||
<template slot-scope="scope" v-if="scope.row.contract">{{ scope.row.contract_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所需产品" show-overflow-tooltip width="150">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.product_.name
|
||||
}}</template>
|
||||
<el-table-column label="所需产品" show-overflow-tooltip min-width="150">
|
||||
<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>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品数量" width="110">
|
||||
<el-table-column label="产品数量">
|
||||
<template slot-scope="scope">{{ scope.row.count }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已派数量" width="110">
|
||||
<el-table-column label="已派数量">
|
||||
<template slot-scope="scope">{{ scope.row.planed_count }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="交货日期" width="110">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.delivery_date
|
||||
}}</template>
|
||||
<el-table-column label="交货日期" width="100">
|
||||
<template slot-scope="scope">{{ scope.row.delivery_date }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建时间">
|
||||
<el-table-column label="创建时间" show-overflow-tooltip min-width="110">
|
||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="操作"
|
||||
fixed="right"
|
||||
width="150px"
|
||||
width="80px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
type="primary"
|
||||
v-if="checkPermission(['warehouse_update'])"
|
||||
@click="handleclick(scope)"
|
||||
>排产
|
||||
<el-link type="primary"
|
||||
v-if="checkPermission(['warehouse_update'])"
|
||||
@click="handleclick(scope)"
|
||||
>排产
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
|
|||
|
|
@ -2,33 +2,33 @@
|
|||
<div class="app-container">
|
||||
<el-card>
|
||||
<div>
|
||||
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||
>新增供应商</el-button >
|
||||
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="供应商名称"
|
||||
style="width: 300px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
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
|
||||
>
|
||||
</div>
|
||||
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate">
|
||||
新增供应商
|
||||
</el-button>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="供应商名称"
|
||||
style="width: 300px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
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>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card style="margin-top: 2px">
|
||||
<el-table
|
||||
|
|
@ -39,31 +39,30 @@
|
|||
stripe
|
||||
highlight-current-row
|
||||
max-height="700"
|
||||
height="100"
|
||||
height="100"
|
||||
v-el-height-adaptive-table="{bottomOffset: 50}"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column type="index" width="50"/>
|
||||
<el-table-column label="供应商名">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="联系人">
|
||||
<template slot-scope="scope">{{ scope.row.contact }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="联系电话">
|
||||
<template slot-scope="scope">{{ scope.row.contact_phone }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="地址">
|
||||
<el-table-column label="地址" min-width="120" show-overflow-tooltip>
|
||||
<template slot-scope="scope">{{ scope.row.address }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="供应物料">
|
||||
<el-table-column label="供应物料">
|
||||
<template slot-scope="scope">{{ scope.row.material }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="备注">
|
||||
<template slot-scope="scope">{{ scope.row.description }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<el-table-column label="创建时间" width="160">
|
||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
|
@ -72,19 +71,20 @@
|
|||
width="220px"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
|
||||
<el-link
|
||||
v-if="checkPermission(['vendor_update'])"
|
||||
type="primary"
|
||||
type="primary"
|
||||
@click="handleEdit(scope)"
|
||||
>编辑</el-link
|
||||
>
|
||||
编辑
|
||||
</el-link>
|
||||
<el-link
|
||||
v-if="checkPermission(['vendor_delete'])"
|
||||
type="danger"
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-link
|
||||
>
|
||||
删除
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -108,22 +108,20 @@
|
|||
:rules="rule1"
|
||||
>
|
||||
<el-form-item label="供应商名称" prop="name">
|
||||
<el-input v-model="vendor.name" placeholder="供应商名称" />
|
||||
<el-input v-model="vendor.name" placeholder="供应商名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人" prop="contact">
|
||||
<el-input v-model="vendor.contact" placeholder="联系人" />
|
||||
<el-input v-model="vendor.contact" placeholder="联系人"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="contact_phone">
|
||||
<el-input v-model="vendor.contact_phone" placeholder="联系电话" />
|
||||
<el-form-item label="联系电话" prop="contact_phone">
|
||||
<el-input v-model="vendor.contact_phone" placeholder="联系电话"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="vendor.address" placeholder="地址" />
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="vendor.address" placeholder="地址"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应物料" prop="material">
|
||||
<el-input v-model="vendor.material" placeholder="供应物料" />
|
||||
<el-form-item label="供应物料" prop="material">
|
||||
<el-input v-model="vendor.material" placeholder="供应物料"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="description">
|
||||
<el-input
|
||||
type="textarea"
|
||||
|
|
@ -141,25 +139,25 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getpVendorList, createVendor,updateVendor,deleteVendor } from "@/api/vendor";
|
||||
import { getUserList } from "@/api/user";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import {getpVendorList, createVendor, updateVendor, deleteVendor} from "@/api/vendor";
|
||||
import {getUserList} from "@/api/user";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaultvendor = {
|
||||
name: "",
|
||||
number: "",
|
||||
};
|
||||
export default {
|
||||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
vendor: defaultvendor,
|
||||
vendorList: {
|
||||
count: 0,
|
||||
},
|
||||
options: [{
|
||||
import {genTree} from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaultvendor = {
|
||||
name: "",
|
||||
number: "",
|
||||
};
|
||||
export default {
|
||||
components: {Pagination},
|
||||
data() {
|
||||
return {
|
||||
vendor: defaultvendor,
|
||||
vendorList: {
|
||||
count: 0,
|
||||
},
|
||||
options: [{
|
||||
value: '0',
|
||||
label: '运转正常'
|
||||
}, {
|
||||
|
|
@ -169,110 +167,110 @@ export default {
|
|||
value: '2',
|
||||
label: '报废'
|
||||
}],
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
keeperOptions:[],
|
||||
listLoading: true,
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
rule1: {
|
||||
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
number: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
model: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
state: [{ required: true, message: "请选择", trigger: "blur" }],
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//供应商列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getpVendorList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.vendorList = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
keeperOptions: [],
|
||||
listLoading: true,
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
rule1: {
|
||||
name: [{required: true, message: "请输入", trigger: "blur"}],
|
||||
number: [{required: true, message: "请输入", trigger: "blur"}],
|
||||
model: [{required: true, message: "请输入", trigger: "blur"}],
|
||||
state: [{required: true, message: "请选择", trigger: "blur"}],
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
handleCreate() {
|
||||
this.vendor = Object.assign({}, defaultvendor);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
|
||||
handleEdit(scope) {
|
||||
this.vendor = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteVendor(scope.row.id);
|
||||
this.getList();
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
if (isEdit) {
|
||||
updateVendor(this.vendor.id, this.vendor).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createVendor(this.vendor).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
methods: {
|
||||
checkPermission,
|
||||
//供应商列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getpVendorList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.vendorList = response.data;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
}
|
||||
});
|
||||
this.getList();
|
||||
},
|
||||
handleCreate() {
|
||||
this.vendor = Object.assign({}, defaultvendor);
|
||||
this.dialogType = "new";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
|
||||
handleEdit(scope) {
|
||||
this.vendor = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteVendor(scope.row.id);
|
||||
this.getList();
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
async confirm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
if (isEdit) {
|
||||
updateVendor(this.vendor.id, this.vendor).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
createVendor(this.vendor).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -15,56 +15,56 @@
|
|||
<el-table-column label="任务编号" align="center">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称" align="center">
|
||||
<el-table-column label="产品名称" align="center" min-width="120" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.product_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号" align="center">
|
||||
<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="合格率" align="center">
|
||||
<el-table-column label="冷加工" align="center">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['01']"
|
||||
>{{ scope.row.process_json["01"].rate }}%</template
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['01']">
|
||||
{{ scope.row.process_json["01"].rate }}%
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="热弯" align="center">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['02']"
|
||||
>{{ scope.row.process_json["02"].rate }}%</template
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['02']">
|
||||
{{ scope.row.process_json["02"].rate }}%
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="化学钢化" align="center">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['03']"
|
||||
>{{ scope.row.process_json["03"].rate }}%</template
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['03']">
|
||||
{{ scope.row.process_json["03"].rate }}%
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="镀膜" align="center">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['05']"
|
||||
>{{ scope.row.process_json["05"].rate }}%</template
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['05']">
|
||||
{{ scope.row.process_json["05"].rate }}%
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="夹层" align="center">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['06']"
|
||||
>{{ scope.row.process_json["06"].rate }}%</template
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['06']">
|
||||
{{ scope.row.process_json["06"].rate }}%
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="包边" align="center">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['07']"
|
||||
>{{ scope.row.process_json["07"].rate }}%</template
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['07']">
|
||||
{{ scope.row.process_json["07"].rate }}%
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="装框" align="center">
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['08']"
|
||||
>{{ scope.row.process_json["08"].rate }}%</template
|
||||
>
|
||||
<template slot-scope="scope" v-if="scope.row.process_json['08']">
|
||||
{{ scope.row.process_json["08"].rate }}%
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.create_time
|
||||
}}</template>
|
||||
<el-table-column label="创建时间" align="center" min-width="150" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.create_time }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
|
|
@ -72,8 +72,9 @@
|
|||
v-if="checkPermission(['material_update'])"
|
||||
type="primary"
|
||||
@click="handledetail(scope)"
|
||||
>详情</el-link
|
||||
>
|
||||
详情
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -100,34 +101,34 @@
|
|||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单编号">
|
||||
<template slot-scope="scope" v-if="scope.row.order_">{{
|
||||
scope.row.order_.number
|
||||
}}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.order_">
|
||||
{{scope.row.order_.number}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称">
|
||||
<template slot-scope="scope" v-if="scope.row.product_">{{
|
||||
scope.row.product_.name
|
||||
}}</template>
|
||||
<el-table-column label="产品名称" min-width="110" show-overflow-tooltip>
|
||||
<template slot-scope="scope" v-if="scope.row.product_">
|
||||
{{scope.row.product_.name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号">
|
||||
<template slot-scope="scope" v-if="scope.row.product_">{{
|
||||
scope.row.product_.specification
|
||||
}}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.product_">
|
||||
{{scope.row.product_.specification}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="责任工序">
|
||||
<template slot-scope="scope" v-if="scope.row.resp_process_">{{
|
||||
scope.row.resp_process_.name
|
||||
}}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.resp_process_">
|
||||
{{scope.row.resp_process_.name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理结果">
|
||||
<template slot-scope="scope">{{
|
||||
decision_[scope.row.decision]
|
||||
}}</template>
|
||||
<template slot-scope="scope">
|
||||
{{decision_[scope.row.decision]}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.create_time
|
||||
}}</template>
|
||||
<el-table-column label="创建时间" min-width="150" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.create_time}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
|
|
@ -135,8 +136,9 @@
|
|||
v-if="checkPermission(['material_update'])"
|
||||
type="primary"
|
||||
@click="handledetailbhg(scope)"
|
||||
>查看</el-link
|
||||
>
|
||||
查看
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -147,7 +149,6 @@
|
|||
:limit.sync="listQuery2.page_size"
|
||||
@pagination="getList2"
|
||||
/>
|
||||
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<template slot-scope="scope" v-if="scope.row.subproduction_plan_">{{ scope.row.subproduction_plan_.number }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称">
|
||||
<el-table-column label="产品名称" min-width="120" show-overflow-tooltip>
|
||||
<template slot-scope="scope" v-if="scope.row.material_">{{ scope.row.material_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号规格">
|
||||
|
|
|
|||
|
|
@ -3,65 +3,65 @@
|
|||
<el-card style="margin-top: 2px">
|
||||
<el-tabs v-model="activeName" type="card">
|
||||
<el-tab-pane label="成品不合格" name="1">
|
||||
<el-table
|
||||
:data="wproductList.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="50"/>
|
||||
<el-table-column label="产品编号">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="任务编号">
|
||||
<template slot-scope="scope" v-if="scope.row.subproduction_plan_">{{ scope.row.subproduction_plan_.number }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称">
|
||||
<template slot-scope="scope" v-if="scope.row.material_">{{ scope.row.material_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号规格">
|
||||
<template slot-scope="scope" v-if="scope.row.material_">{{ scope.row.material_.specification }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="军检结论">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.is_mtestok==false">不合格</el-tag>
|
||||
<el-tag v-if="scope.row.is_mtestok==true">合格</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库">
|
||||
<template slot-scope="scope" v-if="scope.row.warehouse_">{{ scope.row.warehouse_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检查表">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检查状态">
|
||||
<template slot-scope="scope">{{ actstate_[scope.row.act_state]}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="220px">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="checkPermission(['warehouse_update'])&&scope.row.act_state==30&&scope.row.is_mtested==false"
|
||||
@click="handleMtest(scope)"
|
||||
>军检
|
||||
</el-link>
|
||||
<el-link
|
||||
@click="checkRecord(scope)"
|
||||
>检验记录
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="wproductList.count > 0"
|
||||
:total="wproductList.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<el-table
|
||||
:data="wproductList.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="50"/>
|
||||
<el-table-column label="产品编号">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="任务编号">
|
||||
<template slot-scope="scope" v-if="scope.row.subproduction_plan_">
|
||||
{{ scope.row.subproduction_plan_.number}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称" min-width="100" show-overflow-tooltip>
|
||||
<template slot-scope="scope" v-if="scope.row.material_">{{ scope.row.material_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号规格">
|
||||
<template slot-scope="scope" v-if="scope.row.material_">{{ scope.row.material_.specification }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="军检结论">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.is_mtestok==false">不合格</el-tag>
|
||||
<el-tag v-if="scope.row.is_mtestok==true">合格</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库">
|
||||
<template slot-scope="scope" v-if="scope.row.warehouse_">{{ scope.row.warehouse_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检查表">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="检查状态">
|
||||
<template slot-scope="scope">{{ actstate_[scope.row.act_state]}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="220px">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="checkPermission(['warehouse_update'])&&scope.row.act_state==30&&scope.row.is_mtested==false"
|
||||
@click="handleMtest(scope)"
|
||||
>军检
|
||||
</el-link>
|
||||
<el-link
|
||||
@click="checkRecord(scope)"
|
||||
>检验记录
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="wproductList.count > 0"
|
||||
:total="wproductList.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="过程不合格品" name="2">
|
||||
<el-table
|
||||
|
|
@ -73,39 +73,39 @@
|
|||
height="620"
|
||||
v-el-height-adaptive-table="{ bottomOffset: 40 }"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column type="index" width="50"/>
|
||||
<el-table-column label="玻璃编号">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单编号">
|
||||
<template slot-scope="scope" v-if="scope.row.order_">{{
|
||||
scope.row.order_.number
|
||||
}}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.order_">
|
||||
{{scope.row.order_.number}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称">
|
||||
<template slot-scope="scope" v-if="scope.row.product_">{{
|
||||
scope.row.product_.name
|
||||
}}</template>
|
||||
<el-table-column label="产品名称" min-width="120" show-overflow-tooltip>
|
||||
<template slot-scope="scope" v-if="scope.row.product_">
|
||||
{{scope.row.product_.name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号">
|
||||
<template slot-scope="scope" v-if="scope.row.product_">{{
|
||||
scope.row.product_.specification
|
||||
}}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.product_">
|
||||
{{scope.row.product_.specification}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="责任工序">
|
||||
<template slot-scope="scope" v-if="scope.row.resp_process_">{{
|
||||
scope.row.resp_process_.name
|
||||
}}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.resp_process_">
|
||||
{{scope.row.resp_process_.name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理结果">
|
||||
<template slot-scope="scope">{{
|
||||
decision_[scope.row.decision]
|
||||
}}</template>
|
||||
<template slot-scope="scope">
|
||||
{{decision_[scope.row.decision]}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.create_time
|
||||
}}</template>
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.create_time}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
|
|
@ -113,8 +113,9 @@
|
|||
v-if="checkPermission(['material_update'])"
|
||||
type="primary"
|
||||
@click="handledetailbhg(scope)"
|
||||
>查看</el-link
|
||||
>
|
||||
查看
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -125,68 +126,68 @@
|
|||
:limit.sync="listQuery2.page_size"
|
||||
@pagination="getList2"
|
||||
/>
|
||||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="入厂不合格" name="4">
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="fifodetailList4.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
height="620"
|
||||
v-el-height-adaptive-table="{bottomOffset: 40}"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="物料批次">
|
||||
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料名称">
|
||||
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.material_.specification
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料单位">
|
||||
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="fifodetailList4.count > 0"
|
||||
:total="fifodetailList4.count"
|
||||
:page.sync="listQuery4.page"
|
||||
:limit.sync="listQuery4.page_size"
|
||||
@pagination="getList4"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="入厂不合格" name="4">
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="fifodetailList4.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
height="620"
|
||||
v-el-height-adaptive-table="{bottomOffset: 40}"
|
||||
>
|
||||
<el-table-column type="index" width="50"/>
|
||||
<el-table-column label="物料批次">
|
||||
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料名称">
|
||||
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.material_.specification
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料单位">
|
||||
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="创建时间">
|
||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="fifodetailList4.count > 0"
|
||||
:total="fifodetailList4.count"
|
||||
:page.sync="listQuery4.page"
|
||||
:limit.sync="listQuery4.page_size"
|
||||
@pagination="getList4"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getProductionplanList } from "@/api/pm";
|
||||
import { getwproductticketList,getwproductList } from "@/api/wpm";
|
||||
import { ticketread } from "@/api/workflow";
|
||||
import { getfifodetailList} from "@/api/inm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
import {getProductionplanList} from "@/api/pm";
|
||||
import {getwproductticketList, getwproductList} from "@/api/wpm";
|
||||
import {ticketread} from "@/api/workflow";
|
||||
import {getfifodetailList} from "@/api/inm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
|
||||
export default {
|
||||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
wproductList: {
|
||||
count: 0,
|
||||
},
|
||||
actstate_: {
|
||||
export default {
|
||||
components: {Pagination},
|
||||
data() {
|
||||
return {
|
||||
wproductList: {
|
||||
count: 0,
|
||||
},
|
||||
actstate_: {
|
||||
6: "待复检",
|
||||
10: "操作进行中",
|
||||
20: "待检验",
|
||||
|
|
@ -198,93 +199,92 @@ export default {
|
|||
26: "待夹层检验",
|
||||
70: "报废",
|
||||
},
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
wproductticket: {
|
||||
count: 0,
|
||||
},
|
||||
|
||||
listQuery2: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
customfieldList: [],
|
||||
activeName: "1",
|
||||
count: 0,
|
||||
},
|
||||
|
||||
listQuery2: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
customfieldList: [],
|
||||
activeName: "1",
|
||||
decision_: {
|
||||
10: "返工",
|
||||
20: "返修",
|
||||
30: "报废",
|
||||
40: "让步接受",
|
||||
50: "偏离许可",
|
||||
60: "降级使用",
|
||||
70: "退回供方",
|
||||
80: "召回",
|
||||
},
|
||||
listQuery4: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
fifodetailList4:{
|
||||
count: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList(); //成品不合格
|
||||
this.getList2(); //过程
|
||||
this.getList4();//入场不合格
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//不合格成品
|
||||
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
|
||||
|
||||
10: "返工",
|
||||
20: "返修",
|
||||
30: "报废",
|
||||
40: "让步接受",
|
||||
50: "偏离许可",
|
||||
60: "降级使用",
|
||||
70: "退回供方",
|
||||
80: "召回",
|
||||
},
|
||||
listQuery4: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
fifodetailList4: {
|
||||
count: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList(); //成品不合格
|
||||
this.getList2(); //过程
|
||||
this.getList4();//入场不合格
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//不合格成品
|
||||
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
|
||||
|
||||
this.listQuery.material__type = 1;
|
||||
this.listQuery.tag='notok';
|
||||
this.listQuery.tag = 'notok';
|
||||
getwproductList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.wproductList = response.data;
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
//不合格玻璃审批工单列表
|
||||
getList2() {
|
||||
getwproductticketList(this.listQuery2).then((response) => {
|
||||
if (response.data) {
|
||||
this.wproductticket = response.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
//不合格玻璃审理单查看
|
||||
handledetailbhg(scope)
|
||||
{
|
||||
|
||||
this.$router.push({name:"ticketDetail",params:{ticketId:scope.row.ticket}})
|
||||
},
|
||||
//入场检验不合格
|
||||
//不合格物料
|
||||
},
|
||||
|
||||
//不合格玻璃审批工单列表
|
||||
getList2() {
|
||||
getwproductticketList(this.listQuery2).then((response) => {
|
||||
if (response.data) {
|
||||
this.wproductticket = response.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
//不合格玻璃审理单查看
|
||||
handledetailbhg(scope) {
|
||||
|
||||
this.$router.push({name: "ticketDetail", params: {ticketId: scope.row.ticket}})
|
||||
},
|
||||
//入场检验不合格
|
||||
//不合格物料
|
||||
getList4() {
|
||||
this.listLoading = true;
|
||||
this.listQuery4.fifo__type = 3;
|
||||
this.listQuery4.is_testok = false;
|
||||
this.listQuery4.is_tested = true;
|
||||
getfifodetailList(this.listQuery4).then((response) => {
|
||||
if (response.data) {
|
||||
this.fifodetailList4 = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
this.listLoading = true;
|
||||
this.listQuery4.fifo__type = 3;
|
||||
this.listQuery4.is_testok = false;
|
||||
this.listQuery4.is_tested = true;
|
||||
getfifodetailList(this.listQuery4).then((response) => {
|
||||
if (response.data) {
|
||||
this.fifodetailList4 = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@
|
|||
<Echart
|
||||
:options="pieOptions"
|
||||
id="pieChart"
|
||||
height="400px"
|
||||
height="45vh"
|
||||
></Echart>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<el-card>
|
||||
<div class="chartsTitle">废料原因统计</div>
|
||||
<div id="barChart" style="width:100%;height: 400px;"></div>
|
||||
<div id="barChart" style="width:100%;height: 45vh"></div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
:id="chartId1"
|
||||
:options="barOptions"
|
||||
:className="chartsName"
|
||||
height="400px"
|
||||
height="45vh"
|
||||
width="600px"
|
||||
>
|
||||
</charts>
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
:id="chartId2"
|
||||
:options="barOptions"
|
||||
:className="chartsName"
|
||||
height="400px"
|
||||
height="45vh"
|
||||
width="600px"
|
||||
>
|
||||
</charts>
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
:id="chartId3"
|
||||
:options="barOptions"
|
||||
:className="chartsName"
|
||||
height="400px"
|
||||
height="45vh"
|
||||
>
|
||||
</charts>
|
||||
</el-card>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<Echart
|
||||
:options="pieOptions"
|
||||
id="pieChart"
|
||||
height="400px"
|
||||
height="45vh"
|
||||
></Echart>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
:id="chartId1"
|
||||
:options="barOptions"
|
||||
:className="chartsName"
|
||||
height="400px"
|
||||
height="45vh"
|
||||
width="100%"
|
||||
>
|
||||
</charts>
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
:id="chartId2"
|
||||
:options="barOptions1"
|
||||
:className="chartsName"
|
||||
height="400px"
|
||||
height="45vh"
|
||||
width="100%"
|
||||
>
|
||||
</charts>
|
||||
|
|
@ -55,10 +55,10 @@
|
|||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
|
||||
<el-table-column label="订单编号" width="160" show-overflow-tooltip>
|
||||
<el-table-column label="订单编号" width="120" show-overflow-tooltip>
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称" width="200" show-overflow-tooltip>
|
||||
<el-table-column label="产品名称" width="160" show-overflow-tooltip>
|
||||
<template slot-scope="scope">{{ scope.row.product_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品数量">
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.2.9 on 2022-02-17 13:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hrm', '0005_auto_20220126_1351'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='employee',
|
||||
name='is_atwork',
|
||||
field=models.BooleanField(default=False, verbose_name='当前在岗'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='employee',
|
||||
name='last_check_time',
|
||||
field=models.DateTimeField(blank=True, null=True, verbose_name='打卡时间'),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
# Generated by Django 3.2.9 on 2022-02-18 00:43
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('hrm', '0006_auto_20220217_2155'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='employee',
|
||||
name='not_work_remark',
|
||||
field=models.CharField(blank=True, max_length=200, null=True, verbose_name='当前未打卡说明'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='NotWorkRemark',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
|
||||
('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
|
||||
('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
|
||||
('year', models.PositiveSmallIntegerField(default=2022, verbose_name='年')),
|
||||
('month', models.PositiveSmallIntegerField(default=2, verbose_name='月')),
|
||||
('day', models.PositiveSmallIntegerField(default=1, verbose_name='日')),
|
||||
('remark', models.CharField(blank=True, max_length=200, null=True, verbose_name='未打卡说明')),
|
||||
('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='notworkremark_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
|
||||
('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='notworkremark_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='用户')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
@ -30,6 +30,9 @@ class Employee(CommonAModel):
|
|||
qualification = models.CharField('学历', max_length=50, null=True, blank=True)
|
||||
job_state = models.IntegerField('在职状态', choices=jobstate_choices, default=1)
|
||||
face_data = models.JSONField('人脸识别数据', null=True, blank=True)
|
||||
is_atwork = models.BooleanField('当前在岗', default=False)
|
||||
last_check_time = models.DateTimeField('打卡时间', null=True, blank=True)
|
||||
not_work_remark = models.CharField('当前未打卡说明', null=True, blank=True, max_length=200)
|
||||
class Meta:
|
||||
verbose_name = '员工补充信息'
|
||||
verbose_name_plural = verbose_name
|
||||
|
|
@ -37,6 +40,16 @@ class Employee(CommonAModel):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class NotWorkRemark(CommonAModel):
|
||||
"""
|
||||
离岗说明
|
||||
"""
|
||||
year = models.PositiveSmallIntegerField('年', default=2022)
|
||||
month = models.PositiveSmallIntegerField('月', default=2)
|
||||
day = models.PositiveSmallIntegerField('日', default=1)
|
||||
user = models.ForeignKey(User, verbose_name='用户', on_delete=models.CASCADE)
|
||||
remark = models.CharField('未打卡说明', null=True, blank=True, max_length=200)
|
||||
|
||||
class ClockRecord(CommonADModel):
|
||||
"""
|
||||
打卡记录
|
||||
|
|
|
|||
|
|
@ -10,12 +10,14 @@ from django.db.models.query import Prefetch
|
|||
class EmployeeSerializer(DynamicFieldsSerializerMixin, ModelSerializer):
|
||||
name = serializers.CharField(source='user.name', read_only=True)
|
||||
dept_ = OrganizationSimpleSerializer(source='user.dept', read_only=True)
|
||||
is_atwork = serializers.BooleanField(source='user.is_atwork', read_only=True)
|
||||
last_check_time = serializers.DateTimeField(source='user.last_check_time', read_only=True)
|
||||
class Meta:
|
||||
model = Employee
|
||||
exclude = ['face_data']
|
||||
|
||||
class EmployeeNotWorkRemarkSerializer(ModelSerializer):
|
||||
class Meta:
|
||||
model = Employee
|
||||
fields = ['not_work_remark']
|
||||
class FaceLoginSerializer(serializers.Serializer):
|
||||
base64 = serializers.CharField()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,15 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
from celery import shared_task
|
||||
from apps.hrm.models import Employee
|
||||
from apps.system.models import User
|
||||
from django.core.cache import cache
|
||||
|
||||
|
||||
@shared_task
|
||||
def update_all_user_not_atwork():
|
||||
def update_all_employee_not_atwork():
|
||||
"""
|
||||
将所有员工设为非在岗状态
|
||||
"""
|
||||
User.objects.all().update(is_atwork=False, last_check_time = None)
|
||||
Employee.objects.all().update(is_atwork=False, last_check_time = None)
|
||||
|
||||
@shared_task
|
||||
def update_all_user_facedata_cache():
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from functools import update_wrapper
|
||||
from venv import create
|
||||
from django.shortcuts import render
|
||||
from django.utils import timezone
|
||||
from rest_framework.response import Response
|
||||
|
|
@ -8,8 +9,8 @@ from apps.hrm.filters import ClockRecordFilterSet, EmployeeFilterSet
|
|||
from apps.hrm.services import HRMService
|
||||
from apps.hrm.tasks import update_all_user_facedata_cache
|
||||
from apps.system.mixins import CreateUpdateModelAMixin, OptimizationMixin
|
||||
from apps.hrm.models import ClockRecord, Employee
|
||||
from apps.hrm.serializers import ClockRecordListSerializer, EmployeeSerializer, FaceClockCreateSerializer, FaceLoginSerializer
|
||||
from apps.hrm.models import ClockRecord, Employee, NotWorkRemark
|
||||
from apps.hrm.serializers import ClockRecordListSerializer, EmployeeNotWorkRemarkSerializer, EmployeeSerializer, FaceClockCreateSerializer, FaceLoginSerializer
|
||||
|
||||
|
||||
|
||||
|
|
@ -53,6 +54,41 @@ class EmployeeViewSet(CreateUpdateModelAMixin, OptimizationMixin, UpdateModelMix
|
|||
serializer.save(update_by=request.user)
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=True, perms_map={'post': 'employee_notworkremark'}
|
||||
, serializer_class=EmployeeNotWorkRemarkSerializer)
|
||||
def not_work_remark(self, request, pk=None):
|
||||
"""
|
||||
填写离岗说明
|
||||
"""
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
obj = self.get_object()
|
||||
if not obj.is_atwork:
|
||||
remark = request.data.get('not_work_remark', '')
|
||||
obj.not_work_remark = remark
|
||||
obj.save()
|
||||
now_local = timezone.localtime()
|
||||
instance, created = NotWorkRemark.objects.get_or_create(
|
||||
year = now_local.year,
|
||||
month = now_local.month,
|
||||
day = now_local.day,
|
||||
user = obj.user,
|
||||
defaults={
|
||||
"year":now_local.year,
|
||||
"month":now_local.month,
|
||||
"day":now_local.day,
|
||||
"user":obj.user,
|
||||
"remark":remark,
|
||||
"create_by":request.user,
|
||||
}
|
||||
)
|
||||
if not created:
|
||||
instance.remark = remark
|
||||
instance.update_by = request.user
|
||||
instance.save()
|
||||
return Response()
|
||||
return Response('无需填写离岗说明', status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
class ClockRecordViewSet(CreateModelMixin, ListModelMixin, GenericViewSet):
|
||||
"""
|
||||
|
|
@ -92,9 +128,7 @@ class ClockRecordViewSet(CreateModelMixin, ListModelMixin, GenericViewSet):
|
|||
ins.update_time = now
|
||||
ins.save()
|
||||
# 设为在岗
|
||||
user.is_atwork = True
|
||||
user.last_check_time = now
|
||||
user.save()
|
||||
Employee.objects.filter(user=user).update(is_atwork=True, last_check_time=now)
|
||||
return Response(UserSimpleSerializer(instance=user).data)
|
||||
return Response(msg, status=status.HTTP_400_BAD_REQUEST)
|
||||
return Response('非打卡时间范围', status=status.HTTP_400_BAD_REQUEST)
|
||||
|
|
@ -140,9 +174,7 @@ class FaceLogin(CreateAPIView):
|
|||
})
|
||||
# 设为在岗
|
||||
if created:
|
||||
user.is_atwork = True
|
||||
user.last_check_time = now
|
||||
user.save()
|
||||
Employee.objects.filter(user=user).update(is_atwork=True, last_check_time=now)
|
||||
|
||||
return Response({
|
||||
'refresh': str(refresh),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
# Generated by Django 3.2.9 on 2022-02-18 07:20
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('mtm', '0046_alter_recordform_type'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='PackItem',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
|
||||
('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
|
||||
('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
|
||||
('name', models.CharField(max_length=100, verbose_name='名称')),
|
||||
('specification', models.CharField(blank=True, max_length=100, null=True, verbose_name='型号')),
|
||||
('unit', models.CharField(max_length=10, verbose_name='单位')),
|
||||
('count', models.PositiveIntegerField(default=1, verbose_name='数量')),
|
||||
('sort', models.PositiveIntegerField(default=1, verbose_name='序号')),
|
||||
('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='packitem_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
|
||||
('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.material', verbose_name='关联成品')),
|
||||
('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='packitem_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
from cv2 import meanStdDev
|
||||
from django.db import models
|
||||
from django.db.models.base import Model
|
||||
import django.utils.timezone as timezone
|
||||
|
|
@ -49,6 +50,18 @@ class Material(CommonAModel):
|
|||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class PackItem(CommonAModel):
|
||||
"""
|
||||
装箱项目
|
||||
"""
|
||||
material = models.ForeignKey(Material, verbose_name='关联成品',
|
||||
on_delete=models.CASCADE)
|
||||
name = models.CharField('名称', max_length=100)
|
||||
specification = models.CharField('型号', max_length=100, null=True, blank=True)
|
||||
unit = models.CharField('单位', max_length=10)
|
||||
count = models.PositiveIntegerField('数量', default=1)
|
||||
sort = models.PositiveIntegerField('序号', default=1)
|
||||
|
||||
class Process(CommonAModel):
|
||||
"""
|
||||
工序
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from rest_framework import serializers
|
|||
from rest_framework.exceptions import ParseError, ValidationError
|
||||
|
||||
from utils.mixins import DynamicFieldsSerializerMixin
|
||||
from .models import Material, Process, RecordForm, RecordFormField, Step, SubprodctionMaterial, TechDoc, UsedStep, SubProduction
|
||||
from .models import Material, PackItem, Process, RecordForm, RecordFormField, Step, SubprodctionMaterial, TechDoc, UsedStep, SubProduction
|
||||
from apps.system.serializers import FileSimpleSerializer, OrganizationSimpleSerializer
|
||||
|
||||
|
||||
|
|
@ -24,6 +24,20 @@ class MaterialDetailSerializer(serializers.ModelSerializer):
|
|||
objs = Process.objects.filter(subproduction_process__product=obj, subproduction_process__is_deleted=False, is_deleted=False).distinct().order_by('number')
|
||||
return ProcessSimpleSerializer(instance=objs, many=True).data
|
||||
|
||||
class PackItemSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = PackItem
|
||||
fields = '__all__'
|
||||
|
||||
class PackItemCreateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = PackItem
|
||||
fields = ['material', 'name', 'specification', 'unit', 'count', 'sort']
|
||||
|
||||
class PackItemUpdateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = PackItem
|
||||
fields = ['count', 'sort']
|
||||
|
||||
class MaterialSimpleSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
@ -186,15 +200,31 @@ class RecordFormSerializer(serializers.ModelSerializer):
|
|||
return queryset
|
||||
|
||||
class RecordFormCreateSerializer(serializers.ModelSerializer):
|
||||
form = serializers.PrimaryKeyRelatedField(
|
||||
queryset=RecordForm.objects.all(), label="复制表ID", required=False)
|
||||
class Meta:
|
||||
model = RecordForm
|
||||
fields = ['name', 'type', 'step', 'material', 'number', 'enabled']
|
||||
fields = ['name', 'type', 'step', 'material', 'number', 'enabled', 'form']
|
||||
|
||||
|
||||
# def validate(self, attrs):
|
||||
# if attrs['enabled']:
|
||||
# if RecordForm.objects.filter(type=attrs['type'],
|
||||
# enabled=True).exists():
|
||||
# raise ValidationError('已存在启用的同类检查表')
|
||||
# return super().validate(attrs)
|
||||
|
||||
class RecordFormUpdateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = RecordForm
|
||||
fields = ['name', 'type', 'number', 'enabled']
|
||||
|
||||
# def validate(self, attrs):
|
||||
# if attrs['enabled']:
|
||||
# if RecordForm.objects.filter(type=attrs['type'],
|
||||
# enabled=True).exists():
|
||||
# raise ValidationError('已存在启用的同类检查表')
|
||||
# return super().validate(attrs)
|
||||
|
||||
class RecordFormFieldSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
from django.db.models import base
|
||||
from rest_framework import urlpatterns
|
||||
from apps.mtm.views import InputMaterialViewSet, MaterialViewSet, OtherMaterialViewSet, OutputMaterialViewSet, ProcessViewSet, RecordFormFieldViewSet, RecordFormViewSet, StepViewSet, SubProductionViewSet, TechDocViewSet, UsedStepViewSet
|
||||
from apps.mtm.views import InputMaterialViewSet, MaterialViewSet, OtherMaterialViewSet, OutputMaterialViewSet, PackItemViewSet, ProcessViewSet, RecordFormFieldViewSet, RecordFormViewSet, StepViewSet, SubProductionViewSet, TechDocViewSet, UsedStepViewSet
|
||||
from django.urls import path, include
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register('material', MaterialViewSet, basename='material')
|
||||
router.register('packitem', PackItemViewSet, basename='packitem')
|
||||
router.register('process', ProcessViewSet, basename='process')
|
||||
router.register('step', StepViewSet, basename='step')
|
||||
router.register('subproducation', SubProductionViewSet, basename='subproducation')
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ from rest_framework.viewsets import ModelViewSet, GenericViewSet
|
|||
from rest_framework.mixins import CreateModelMixin, ListModelMixin, UpdateModelMixin, RetrieveModelMixin, DestroyModelMixin
|
||||
from apps.mtm.filters import MaterialFilterSet, TechDocFilterset
|
||||
|
||||
from apps.mtm.models import Material, Process, RecordForm, RecordFormField, Step, SubprodctionMaterial, TechDoc, UsedStep, SubProduction
|
||||
from apps.mtm.serializers import InputMaterialSerializer, InputMaterialUpdateSerializer, MaterialDetailSerializer, MaterialSerializer, MaterialSimpleSerializer, OtherMaterialSerializer, OutputMaterialSerializer, OutputMaterialUpdateSerializer, ProcessSerializer, RecordFormCreateSerializer, RecordFormDetailSerializer, RecordFormFieldCreateSerializer, RecordFormFieldSerializer, RecordFormFieldUpdateSerializer, RecordFormSerializer, RecordFormUpdateSerializer, StepDetailSerializer, StepSerializer, SubProductionCreateUpdateSerializer, SubProductionSerializer, SubprodctionMaterialListSerializer, TechDocCreateSerializer, TechDocListSerializer, TechDocUpdateSerializer, UsedStepCreateSerializer, UsedStepListSerializer, UsedStepUpdateSerializer
|
||||
from apps.mtm.models import Material, PackItem, Process, RecordForm, RecordFormField, Step, SubprodctionMaterial, TechDoc, UsedStep, SubProduction
|
||||
from apps.mtm.serializers import InputMaterialSerializer, InputMaterialUpdateSerializer, MaterialDetailSerializer, MaterialSerializer, MaterialSimpleSerializer, OtherMaterialSerializer, OutputMaterialSerializer, OutputMaterialUpdateSerializer, PackItemCreateSerializer, PackItemUpdateSerializer, ProcessSerializer, RecordFormCreateSerializer, RecordFormDetailSerializer, RecordFormFieldCreateSerializer, RecordFormFieldSerializer, RecordFormFieldUpdateSerializer, RecordFormSerializer, RecordFormUpdateSerializer, StepDetailSerializer, StepSerializer, SubProductionCreateUpdateSerializer, SubProductionSerializer, SubprodctionMaterialListSerializer, TechDocCreateSerializer, TechDocListSerializer, TechDocUpdateSerializer, UsedStepCreateSerializer, UsedStepListSerializer, UsedStepUpdateSerializer
|
||||
from apps.system.mixins import CreateUpdateModelAMixin, OptimizationMixin
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.response import Response
|
||||
from utils.pagination import PageOrNot
|
||||
from rest_framework.exceptions import APIException
|
||||
|
||||
from django.db import transaction
|
||||
|
||||
# Create your views here.
|
||||
class MaterialViewSet(PageOrNot, CreateUpdateModelAMixin, ModelViewSet):
|
||||
|
|
@ -31,6 +31,25 @@ class MaterialViewSet(PageOrNot, CreateUpdateModelAMixin, ModelViewSet):
|
|||
return MaterialDetailSerializer
|
||||
return MaterialSerializer
|
||||
|
||||
class PackItemViewSet(CreateUpdateModelAMixin, ModelViewSet):
|
||||
"""
|
||||
装箱项目-增删改查
|
||||
"""
|
||||
perms_map = {'get': '*', 'post': 'packitem_create',
|
||||
'put': 'packitem_update', 'delete': 'packitem_delete'}
|
||||
queryset = PackItem.objects.all()
|
||||
serializer_class = MaterialSerializer
|
||||
search_fields = ['name', 'number']
|
||||
filterset_fields = ['material']
|
||||
ordering = ['sort']
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.action == 'create':
|
||||
return PackItemCreateSerializer
|
||||
elif self.action == 'update':
|
||||
return PackItemUpdateSerializer
|
||||
return super().get_serializer_class()
|
||||
|
||||
|
||||
class ProcessViewSet(PageOrNot, CreateUpdateModelAMixin, ModelViewSet):
|
||||
"""
|
||||
|
|
@ -185,6 +204,23 @@ class RecordFormViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelViewSet
|
|||
instance = self.get_object()
|
||||
serializer = self.serializer_class(instance=RecordFormField.objects.filter(form=instance, is_deleted=False), many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
@transaction.atomic
|
||||
def create(self, request, *args, **kwargs):
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
vdata = serializer.validated_data
|
||||
form = vdata.pop('form', None)
|
||||
instance = RecordForm(**vdata)
|
||||
instance.create_by = request.user
|
||||
instance.save()
|
||||
if form:
|
||||
for i in RecordFormField.objects.filter(form=form, is_deleted=False):
|
||||
i.pk = None
|
||||
i.form = instance
|
||||
i.parent = None
|
||||
i.save()
|
||||
return Response()
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.2.9 on 2022-02-17 07:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pm', '0023_alter_productionplan_order'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='productionplan',
|
||||
name='old_state',
|
||||
field=models.PositiveIntegerField(blank=True, choices=[(10, '制定中'), (20, '已下达'), (30, '已接收'), (40, '生产中'), (50, '生产完成'), (60, '军检完成'), (70, '暂停'), (80, '终止')], null=True, verbose_name='原状态'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='productionplan',
|
||||
name='state',
|
||||
field=models.PositiveIntegerField(choices=[(10, '制定中'), (20, '已下达'), (30, '已接收'), (40, '生产中'), (50, '生产完成'), (60, '军检完成'), (70, '暂停'), (80, '终止')], default=10, verbose_name='状态'),
|
||||
),
|
||||
]
|
||||
|
|
@ -20,13 +20,17 @@ class ProductionPlan(CommonAModel):
|
|||
PLAN_STATE_WORKING = 40
|
||||
PLAN_STATE_DONE = 50
|
||||
PLAN_MTEST_DONE = 60
|
||||
PLAN_STATE_PAUSE = 70
|
||||
PLAN_STATE_STOP = 80
|
||||
state_choices=(
|
||||
(PLAN_STATE_PLANING, '制定中'),
|
||||
(PLAN_STATE_ASSGINED, '已下达'),
|
||||
(PLAN_STATE_ACCEPTED, '已接收'),
|
||||
(PLAN_STATE_WORKING, '生产中'),
|
||||
(PLAN_STATE_DONE, '生产完成'),
|
||||
(PLAN_MTEST_DONE, '军检完成')
|
||||
(PLAN_MTEST_DONE, '军检完成'),
|
||||
(PLAN_STATE_PAUSE, '暂停'),
|
||||
(PLAN_STATE_STOP, '终止')
|
||||
)
|
||||
number = models.CharField('编号', max_length=50, unique=True)
|
||||
order = models.ForeignKey(Order, verbose_name='关联订单', null=True, blank=True, on_delete=models.SET_NULL, related_name='plan_order')
|
||||
|
|
@ -41,6 +45,7 @@ class ProductionPlan(CommonAModel):
|
|||
end_date = models.DateField('计划完工日期')
|
||||
process_json = models.JSONField('按工序的统计数', default=dict, null=True, blank=True)
|
||||
is_planed = models.BooleanField('是否已排产', default=False)
|
||||
old_state = models.PositiveIntegerField('原状态', choices=state_choices, null=True, blank=True)
|
||||
class Meta:
|
||||
verbose_name = '生产计划'
|
||||
verbose_name_plural = verbose_name
|
||||
|
|
@ -62,7 +67,7 @@ class SubProductionPlan(CommonAModel):
|
|||
(SUBPLAN_STATE_ASSGINED, '已下达'),
|
||||
(SUBPLAN_STATE_ACCEPTED, '已接收'),
|
||||
(SUBPLAN_STATE_WORKING, '生产中'),
|
||||
(SUBPLAN_STATE_DONE, '已完成')
|
||||
(SUBPLAN_STATE_DONE, '已完成'),
|
||||
)
|
||||
number = models.CharField('子计划编号', max_length=50, unique=True, null=True, blank=True)
|
||||
production_plan = models.ForeignKey(ProductionPlan, verbose_name='关联主生产计划', on_delete=models.CASCADE, related_name='subplan_plan')
|
||||
|
|
@ -91,15 +96,15 @@ class SubProductionPlan(CommonAModel):
|
|||
verbose_name = '子生产计划'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
class FirstItem(BaseModel):
|
||||
"""
|
||||
首件确认表记录条目
|
||||
"""
|
||||
form_field = models.ForeignKey(RecordFormField, verbose_name='关联自定义表格字段', on_delete=models.CASCADE)
|
||||
field_value = models.JSONField('录入值', null=True, blank=True)
|
||||
is_hidden = models.BooleanField('是否隐藏', default=False)
|
||||
is_testok = models.BooleanField('是否合格', null=True, blank=True)
|
||||
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联的子计划', on_delete=models.CASCADE, related_name='item_test_record')
|
||||
# class FirstItem(BaseModel):
|
||||
# """
|
||||
# 首件确认表记录条目
|
||||
# """
|
||||
# form_field = models.ForeignKey(RecordFormField, verbose_name='关联自定义表格字段', on_delete=models.CASCADE)
|
||||
# field_value = models.JSONField('录入值', null=True, blank=True)
|
||||
# is_hidden = models.BooleanField('是否隐藏', default=False)
|
||||
# is_testok = models.BooleanField('是否合格', null=True, blank=True)
|
||||
# subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联的子计划', on_delete=models.CASCADE, related_name='item_test_record')
|
||||
|
||||
class SubProductionProgress(BaseModel):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ from apps.pm.models import ProductionPlan, SubProductionProgress, SubProductionP
|
|||
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
||||
from django.shortcuts import render
|
||||
from apps.sam.models import Order
|
||||
from rest_framework.exceptions import APIException
|
||||
from rest_framework.exceptions import APIException, ParseError
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.decorators import action
|
||||
from django.db.models import F
|
||||
|
|
@ -86,6 +86,8 @@ class ProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, CreateModel
|
|||
production_plan=self.get_object()
|
||||
if production_plan.is_planed:
|
||||
raise APIException('已生成子计划')
|
||||
if production_plan.state != ProductionPlan.PLAN_STATE_PLANING:
|
||||
raise APIException('不可操作')
|
||||
subps = SubProduction.objects.filter(product=production_plan.product).order_by('process__number')
|
||||
for index, i in enumerate(subps):
|
||||
steps = Step.objects.filter(usedstep__subproduction=i, usedstep__subproduction__is_deleted=False,
|
||||
|
|
@ -101,9 +103,42 @@ class ProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, CreateModel
|
|||
is_main=m.is_main,
|
||||
count=m.count*production_plan.count, subproduction_plan=instance)
|
||||
production_plan.is_planed=True
|
||||
production_plan.state = ProductionPlan.PLAN_STATE_PLANING
|
||||
production_plan.save()
|
||||
return Response()
|
||||
|
||||
@action(methods=['put'], detail=True, perms_map={'post':'plan_toggle'}, serializer_class=serializers.Serializer)
|
||||
@transaction.atomic
|
||||
def toggle(self, request, pk=None):
|
||||
"""
|
||||
计划暂停或启动
|
||||
"""
|
||||
plan = self.get_object()
|
||||
if plan.state == ProductionPlan.PLAN_STATE_PAUSE:
|
||||
plan.state = plan.old_state
|
||||
plan.old_state = None
|
||||
plan.save()
|
||||
return Response()
|
||||
elif plan.state <= ProductionPlan.PLAN_STATE_WORKING:
|
||||
plan.old_state = plan.state
|
||||
plan.state = ProductionPlan.PLAN_STATE_PAUSE
|
||||
plan.save()
|
||||
return Response()
|
||||
raise APIException('不可操作')
|
||||
|
||||
@action(methods=['put'], detail=True, perms_map={'post':'plan_stop'}, serializer_class=serializers.Serializer)
|
||||
@transaction.atomic
|
||||
def stop(self, request, pk=None):
|
||||
"""
|
||||
计划终止
|
||||
"""
|
||||
plan = self.get_object()
|
||||
if plan.state == ProductionPlan.PLAN_STATE_PAUSE:
|
||||
plan.state = ProductionPlan.PLAN_STATE_STOP
|
||||
plan.save()
|
||||
return Response()
|
||||
raise APIException('不可操作')
|
||||
|
||||
|
||||
|
||||
class SubProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, UpdateModelMixin, GenericViewSet):
|
||||
"""
|
||||
|
|
@ -166,6 +201,7 @@ class SubProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, UpdateMo
|
|||
plan.save()
|
||||
return Response()
|
||||
raise APIException('计划状态有误')
|
||||
|
||||
|
||||
@action(methods=['get'], detail=True, perms_map={'get':'*'}, serializer_class=serializers.Serializer)
|
||||
def pick_need_(self, request, pk=None):
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ class UserFilter(DynamicFieldsFilterMixin, filters.FilterSet):
|
|||
name = filters.CharFilter(field_name='name', lookup_expr='contains')
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ['name', 'is_active', 'is_atwork']
|
||||
fields = ['name', 'is_active']
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 3.2.9 on 2022-01-21 05:41
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0003_auto_20210812_0909'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='is_atwork',
|
||||
field=models.BooleanField(default=False, verbose_name='当前在岗'),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 3.2.9 on 2022-01-25 08:51
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0004_user_is_atwork'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='user',
|
||||
name='last_check_time',
|
||||
field=models.DateTimeField(blank=True, null=True, verbose_name='打卡时间'),
|
||||
),
|
||||
]
|
||||
|
|
@ -116,8 +116,6 @@ class User(AbstractUser):
|
|||
superior = models.ForeignKey(
|
||||
'self', null=True, blank=True, on_delete=models.SET_NULL, verbose_name='上级主管')
|
||||
roles = models.ManyToManyField(Role, blank=True, verbose_name='角色')
|
||||
is_atwork = models.BooleanField('当前在岗', default=False)
|
||||
last_check_time = models.DateTimeField('打卡时间', null=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = '用户信息'
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class UserListSerializer(DynamicFieldsSerializerMixin, serializers.ModelSerializ
|
|||
fields = ['id', 'name', 'phone', 'email', 'position',
|
||||
'username', 'is_active', 'date_joined',
|
||||
'dept_', 'dept', 'roles', 'avatar',
|
||||
'roles_', 'is_atwork', 'last_check_time']
|
||||
'roles_']
|
||||
|
||||
@staticmethod
|
||||
def setup_eager_loading(queryset):
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from apps.inm.models import FIFO, FIFOItem, FIFOItemProduct
|
|||
from apps.inm.services import InmService
|
||||
from apps.mtm.models import Material, RecordForm, RecordFormField, Step, SubprodctionMaterial, TechDoc
|
||||
from apps.mtm.serializers import RecordFormDetailSerializer, SubprodctionMaterialListSerializer, TechDocListSerializer
|
||||
from apps.pm.models import SubProductionPlan, SubProductionProgress
|
||||
from apps.pm.models import ProductionPlan, SubProductionPlan, SubProductionProgress
|
||||
from apps.pm.serializers import SubProductionPlanListSerializer, SubProductionProgressSerializer
|
||||
from apps.qm.models import TestRecord, TestRecordItem
|
||||
from apps.qm.serializers import TestRecordDetailSerializer
|
||||
|
|
@ -35,7 +35,7 @@ from rest_framework import exceptions, serializers
|
|||
from apps.wpm.services import WpmService
|
||||
from django.utils import timezone
|
||||
from rest_framework import status
|
||||
from django.db.models import Count
|
||||
from django.db.models import Count, Q
|
||||
|
||||
from utils.tools import ranstr
|
||||
|
||||
|
|
@ -49,7 +49,11 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
|||
"""
|
||||
perms_map = {'get': '*'}
|
||||
queryset = SubProductionPlan.objects.select_related(
|
||||
'process', 'workshop', 'subproduction', 'product').exclude(state=0)
|
||||
'process', 'workshop', 'subproduction', 'product').filter(
|
||||
production_plan__state__in =[
|
||||
ProductionPlan.PLAN_STATE_WORKING, ProductionPlan.PLAN_STATE_ASSGINED
|
||||
]
|
||||
)
|
||||
search_fields = []
|
||||
serializer_class = SubProductionPlanListSerializer
|
||||
filterset_fields = ['production_plan',
|
||||
|
|
@ -57,6 +61,7 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
|||
ordering_fields = []
|
||||
ordering = ['-update_time']
|
||||
|
||||
|
||||
@action(methods=['post', 'get'], detail=True, perms_map={'post': 'pick_half', 'get': '*'}, serializer_class=PickHalfsSerializer)
|
||||
@transaction.atomic
|
||||
def pick_half(self, request, pk=None):
|
||||
|
|
@ -116,6 +121,10 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
|||
pw.save()
|
||||
sp.is_picked = True
|
||||
sp.save()
|
||||
if sp.production_plan.state in \
|
||||
[ProductionPlan.PLAN_STATE_ASSGINED, ProductionPlan.PLAN_STATE_ACCEPTED]:
|
||||
sp.production_plan.state = ProductionPlan.PLAN_STATE_WORKING
|
||||
sp.production_plan.save()
|
||||
|
||||
return Response()
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,9 @@ class FitJSONRenderer(JSONRenderer):
|
|||
if isinstance(data, dict):
|
||||
prefix = list(data.keys())[0]
|
||||
data = data[prefix]
|
||||
elif isinstance(data, list):
|
||||
if isinstance(data, list):
|
||||
data = data[0]
|
||||
|
||||
response_body.msg = prefix + ":" + str(data) # 取一部分放入msg,方便前端alert
|
||||
else:
|
||||
response_body.data = data
|
||||
|
|
|
|||
Loading…
Reference in New Issue