Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
e6ac8cb90f
|
@ -1,6 +1,12 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
|
||||
export function getEmployeeList(query) {
|
||||
return request({
|
||||
url: '/hrm/employee/',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function getEmployee(id) {
|
||||
return request({
|
||||
url: `/hrm/employee/${id}/`,
|
||||
|
|
|
@ -368,3 +368,12 @@ export function toorder(data) {
|
|||
data
|
||||
})
|
||||
}
|
||||
|
||||
//申请
|
||||
export function needtoorder(data) {
|
||||
return request({
|
||||
url: '/wpm/wproduct/need_to_order/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
|
|
@ -267,10 +267,10 @@ export const asyncRoutes = [
|
|||
meta: { title: '生产设备', icon: 'example', perms: ['em_equipment'] }
|
||||
},
|
||||
{
|
||||
path: 'detection ',
|
||||
name: 'detection ',
|
||||
component: () => import('@/views/em/detection'),
|
||||
meta: { title: '监视和测量设备', icon: 'example', perms: ['em_detection'] }
|
||||
path: 'monitoring ',
|
||||
name: 'monitoring ',
|
||||
component: () => import('@/views/em/monitoring'),
|
||||
meta: { title: '监视和测量设备', icon: 'example', perms: ['em_monitoring'] }
|
||||
},
|
||||
{
|
||||
path: 'record',
|
||||
|
@ -407,6 +407,36 @@ export const asyncRoutes = [
|
|||
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/personnel',
|
||||
component: Layout,
|
||||
redirect: '/personnel/user',
|
||||
name: 'personnel',
|
||||
meta: { title: '人员管理', icon: 'example', perms: ['personnel_set'] },
|
||||
children: [
|
||||
{
|
||||
path: 'user',
|
||||
name: 'user',
|
||||
component: () => import('@/views/personnel/user'),
|
||||
meta: { title: '人员列表', icon: 'example', perms: ['user_manage'] }
|
||||
},
|
||||
{
|
||||
path: 'personnel',
|
||||
name: 'personnel',
|
||||
component: () => import('@/views/personnel/user'),
|
||||
meta: { title: '考勤列表', icon: 'example', perms: ['user_manage'] }
|
||||
} ,{
|
||||
path: 'userupdate',
|
||||
name: 'userupdate',
|
||||
component: () => import('@/views/personnel/userupdate'),
|
||||
meta: { title: '人员信息详情', icon: 'employee', perms: ['employee_detail'] },
|
||||
hidden: true
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
,
|
||||
{
|
||||
path: '/inm',
|
||||
component: Layout,
|
||||
|
@ -548,13 +578,7 @@ export const asyncRoutes = [
|
|||
meta: { title: '用户管理', icon: 'user', perms: ['user_manage'] }
|
||||
}
|
||||
,
|
||||
{
|
||||
path: 'userupdate',
|
||||
name: 'userupdate',
|
||||
component: () => import('@/views/system/userupdate'),
|
||||
meta: { title: '人员信息详情', icon: 'employee', perms: ['employee_detail'] },
|
||||
hidden: true
|
||||
},
|
||||
|
||||
{
|
||||
path: 'organization',
|
||||
name: 'Organization',
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
>
|
||||
<el-input
|
||||
v-model="listQuery.search"
|
||||
placeholder="设备名称/设备编号/备注"
|
||||
placeholder="检测设备名称/检测设备编号/备注"
|
||||
style="width: 300px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
|
@ -40,7 +40,7 @@
|
|||
v-el-height-adaptive-table="{ bottomOffset: 42 }"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="设备编号">
|
||||
<el-table-column label="设备编号" width="100">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -63,14 +63,17 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="下次校准日期" width="130">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.next_check_date }}</template
|
||||
<el-tag v-if="scope.row.next_check_date" :type="setClass(scope.row.next_check_date)">
|
||||
{{scope.row.next_check_date}}
|
||||
</el-tag>
|
||||
<div v-else></div></template
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="设备名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号规格">
|
||||
<el-table-column label="型号规格" width="100">
|
||||
<template slot-scope="scope">{{ scope.row.model }}</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -89,7 +92,7 @@
|
|||
scope.row.keeper_.username
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="存放位置">
|
||||
<el-table-column label="存放位置" width="100">
|
||||
<template slot-scope="scope">{{ scope.row.place }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="绑定工序">
|
||||
|
@ -199,9 +202,9 @@
|
|||
>
|
||||
<el-option
|
||||
v-for="item in mgmoptions"
|
||||
:key="item.value"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
@ -226,9 +229,9 @@
|
|||
>
|
||||
<el-option
|
||||
v-for="item in keeperOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
@ -307,8 +310,7 @@
|
|||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<style>
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getpEquipmentList,
|
||||
|
@ -317,10 +319,8 @@ import {
|
|||
deleteEquipment,
|
||||
} from "@/api/equipment";
|
||||
import { getUserList } from "@/api/user";
|
||||
import { getOrgList } from "@/api/org";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaultequipment = {
|
||||
name: "",
|
||||
|
@ -411,7 +411,7 @@ export default {
|
|||
type: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
model: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||
state: [{ required: true, message: "请选择", trigger: "blur" }],
|
||||
belong_dept: [{ required: true, message: "请选择", trigger: "blur" }],
|
||||
|
||||
},
|
||||
datatime: null,
|
||||
};
|
||||
|
@ -422,7 +422,7 @@ export default {
|
|||
this.getList();
|
||||
|
||||
this.getUserList();
|
||||
this.getOrgList();
|
||||
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
|
@ -440,48 +440,28 @@ export default {
|
|||
},
|
||||
|
||||
//校准时间提醒
|
||||
tableRowClassName(row, column, rowIndex, columnIndex) {
|
||||
if(row.row.next_check_date!=null)
|
||||
{
|
||||
var adata = new Date(); //获取当前时间
|
||||
const date = {
|
||||
year: adata.getFullYear(),
|
||||
month: adata.getMonth() + 1,
|
||||
date: adata.getDate(),
|
||||
};
|
||||
const newmonth = date.month > 10 ? date.month : "0" + date.month;
|
||||
const day = date.date > 10 ? date.date : "0" + date.date;
|
||||
var updateTime = date.year + "-" + newmonth + "-" + day;
|
||||
var dateBegin = row.row.next_check_date;
|
||||
|
||||
var a =
|
||||
(new Date(dateBegin).getTime() - new Date(updateTime).getTime()) /1000/60/60/24; //计算出相差的毫秒数
|
||||
console.log(a);
|
||||
if (4>a&&a>0 && row.column.label==='下次校准日期') {
|
||||
|
||||
return "background:yellow";
|
||||
}
|
||||
else if (a<0 && row.column.label==='下次校准日期') {
|
||||
|
||||
return "background:red";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
},
|
||||
setClass:function(check_date) {
|
||||
let obj = {};
|
||||
if(check_date!=null){
|
||||
let dat = new Date();
|
||||
let time = dat.getTime();
|
||||
let check = new Date(check_date).getTime();
|
||||
let timeDiffer = (check-time)/1000/60/60/24;
|
||||
if (4>timeDiffer&&timeDiffer>0) {
|
||||
obj = 'warning';
|
||||
}else if (timeDiffer<0) {
|
||||
obj = "danger";
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
//组员列表
|
||||
getUserList() {
|
||||
getUserList({ page: 0 }).then((res) => {
|
||||
this.keeperOptions = genTree(res.data);
|
||||
});
|
||||
},
|
||||
//部门列表
|
||||
getOrgList() {
|
||||
getOrgList({ page: 0 }).then((res) => {
|
||||
this.depOptions = genTree(res.data);
|
||||
this.keeperOptions = res.data;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
|
@ -1,18 +1,21 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<el-card >
|
||||
<el-card>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleorder"
|
||||
>选择订单
|
||||
</el-button>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="iproductData.results"
|
||||
ref="multipleTable"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
|
||||
height="100"
|
||||
v-el-height-adaptive-table="{bottomOffset: 42}"
|
||||
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 label="成品编号">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
|
@ -21,48 +24,79 @@
|
|||
<el-table-column label="成品批次">
|
||||
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成品名称">
|
||||
<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.warehouse_.name }}</template>
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.warehouse_.name
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否已军检">
|
||||
|
||||
<el-table-column label="订单">
|
||||
<template slot-scope="scope">
|
||||
|
||||
|
||||
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
|
||||
<el-tag v-else>已军检</el-tag></template>
|
||||
|
||||
<el-span v-if="scope.row.to_order_">{{
|
||||
scope.row.to_order_.number
|
||||
}}</el-span>
|
||||
<el-tag
|
||||
v-else-if="
|
||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
||||
"
|
||||
>
|
||||
需要确定订单
|
||||
</el-tag>
|
||||
<el-span v-else></el-span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否售出">
|
||||
<el-table-column label="合同">
|
||||
<template slot-scope="scope">
|
||||
|
||||
|
||||
<el-tag v-if="scope.row.is_saled == false">未售出</el-tag>
|
||||
<el-tag v-else>已售出</el-tag></template>
|
||||
|
||||
<el-span v-if="scope.row.to_order_">{{
|
||||
scope.row.to_order_.contract_.name
|
||||
}}</el-span>
|
||||
<el-span
|
||||
v-else-if="
|
||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
||||
"
|
||||
>
|
||||
</el-span>
|
||||
<el-span v-else></el-span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="军检">
|
||||
<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></template>
|
||||
|
||||
<el-span v-if="scope.row.to_order_">{{
|
||||
scope.row.to_order_.customer_.name
|
||||
}}</el-span>
|
||||
<el-span
|
||||
v-else-if="
|
||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
||||
"
|
||||
>
|
||||
</el-span>
|
||||
<el-span v-else></el-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>
|
||||
|
||||
</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>
|
||||
<el-span v-else></el-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>
|
||||
</template>
|
||||
</el-table-column>!-->
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="iproductData.count > 0"
|
||||
|
@ -71,31 +105,82 @@
|
|||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<el-dialog title="军检" :visible.sync="dialogVisible">
|
||||
<el-form :model="mtestform" label-width="130px"
|
||||
label-position="right">
|
||||
<el-form-item label="是否军检合格" prop="name">
|
||||
<el-switch v-model="mtestform.is_mtestok"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="军检备注" prop="name">
|
||||
<el-input type="textarea" v-model="mtestform.remark_mtest"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submtest">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog title="军检" :visible.sync="dialogVisible">
|
||||
<el-form :model="mtestform" label-width="130px" label-position="right">
|
||||
<el-form-item label="是否军检合格" prop="name">
|
||||
<el-switch v-model="mtestform.is_mtestok"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="军检备注" prop="name">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="mtestform.remark_mtest"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submtest">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="指定发货订单"
|
||||
: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-table
|
||||
v-loading="listLoading"
|
||||
:data="orderList"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
height="100"
|
||||
v-el-height-adaptive-table="{ bottomOffset: 42 }"
|
||||
>
|
||||
<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>
|
||||
</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>
|
||||
</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>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getiproductList} from "@/api/inm";
|
||||
import { getiproductList } from "@/api/inm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
import { mtest } from "@/api/wpm";
|
||||
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
|
||||
|
||||
|
@ -103,22 +188,30 @@ export default {
|
|||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
|
||||
iproductData: {
|
||||
count: 0,
|
||||
},
|
||||
listQuery: {
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
mtest: {},
|
||||
salesdetail:"",
|
||||
saleproduct:"",
|
||||
dialogVisible:false,
|
||||
mtestform:{
|
||||
is_mtestok:false,
|
||||
}
|
||||
|
||||
mtest: {},
|
||||
salesdetail: "",
|
||||
saleproduct: "",
|
||||
dialogVisible: false,
|
||||
mtestform: {
|
||||
is_mtestok: false,
|
||||
},
|
||||
form1: {},
|
||||
dialogFormVisibleorder: false,
|
||||
orderList: [],
|
||||
mutipID1: [],
|
||||
mutipID: [],
|
||||
mtmId: [],
|
||||
ordershow: "",
|
||||
customershow:"",
|
||||
contractshow:"",
|
||||
materialshow: [],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
|
@ -131,28 +224,64 @@ export default {
|
|||
//半成品列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
this.listQuery.material__type=1;
|
||||
this.listQuery.material__type = 1;
|
||||
this.listQuery.is_saled = false;
|
||||
getiproductList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.iproductData= 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;
|
||||
}
|
||||
});
|
||||
}
|
||||
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].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();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,263 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<el-card>
|
||||
<div slot="header" class="clearfix">
|
||||
<span>用户</span>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<el-input
|
||||
v-model="listQuery.name"
|
||||
placeholder="姓名"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleFilter"
|
||||
size="small"
|
||||
>搜索</el-button>
|
||||
<el-button
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter"
|
||||
size="small"
|
||||
>重置</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="userList.results"
|
||||
style="width: 100%;margin-top:6px;"
|
||||
highlight-current-row
|
||||
row-key="id"
|
||||
height="100"
|
||||
stripe
|
||||
border
|
||||
v-el-height-adaptive-table="{bottomOffset: 50}"
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column align="center" label="工号">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="姓名">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="header-center" label="照片">
|
||||
<template slot-scope="scope"> <img :src="scope.row.photo" min-width="70" height="70"/></template>
|
||||
</el-table-column>
|
||||
<el-table-column align="header-center" label="电子签名">
|
||||
<template slot-scope="scope"> <img :src="scope.row.signature" min-width="70" height="40"/></template>
|
||||
</el-table-column>
|
||||
<el-table-column align="header-center" label="部门">
|
||||
<template
|
||||
v-if="scope.row.dept_"
|
||||
slot-scope="scope"
|
||||
>{{ scope.row.dept_.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="!scope.row.is_superuser"
|
||||
:disabled="!checkPermission(['user_update'])"
|
||||
type="primary"
|
||||
size="small"
|
||||
|
||||
@click="handleEdit(scope)"
|
||||
>编辑</el-link>
|
||||
<el-link
|
||||
v-if="!scope.row.is_superuser"
|
||||
:disabled="!checkPermission(['user_delete'])"
|
||||
type="danger"
|
||||
size="small"
|
||||
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="userList.count>0"
|
||||
:total="userList.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
line-height: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import { getUserList, createUser, deleteUser, updateUser } from "@/api/user";
|
||||
|
||||
import { getEmployeeList, } from "@/api/employee";
|
||||
import { getOrgAll } from "@/api/org"
|
||||
import { getRoleAll } from "@/api/role"
|
||||
import { genTree } from "@/utils"
|
||||
import checkPermission from "@/utils/permission"
|
||||
import { upUrl, upHeaders } from "@/api/file"
|
||||
import Pagination from "@/components/Pagination" // secondary package based on el-pagination
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
const defaultUser = {
|
||||
id: "",
|
||||
name: "",
|
||||
username: "",
|
||||
dept: null,
|
||||
avatar: "/media/default/avatar.png"
|
||||
};
|
||||
export default {
|
||||
components: { Pagination, Treeselect },
|
||||
data() {
|
||||
return {
|
||||
user: defaultUser,
|
||||
upHeaders: upHeaders(),
|
||||
upUrl: upUrl(),
|
||||
userList: {count:0},
|
||||
roles: [],
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
},
|
||||
enabledOptions: [
|
||||
{ key: "true", display_name: "激活" },
|
||||
{ key: "false", display_name: "禁用" }
|
||||
],
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
rule1: {
|
||||
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
||||
username: [{ required: true, message: "请输入账号", trigger: "change" }]
|
||||
// password: [
|
||||
// { required: true, message: '请输入密码', trigger: 'change' }
|
||||
// ],
|
||||
},
|
||||
filterOrgText: "",
|
||||
treeLoding: false,
|
||||
orgData: []
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
filterOrgText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getOrgAll();
|
||||
this.getRoleAll();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
handleAvatarSuccess(res, file) {
|
||||
this.user.avatar = res.data.path
|
||||
},
|
||||
beforeAvatarUpload(file) {
|
||||
const isLt2M = file.size / 1024 / 1024 < 0.5;
|
||||
if (!isLt2M) {
|
||||
this.$message.error("上传头像图片大小不能超过 500KB!");
|
||||
}
|
||||
return isLt2M;
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
handleOrgClick(obj, node, vue) {
|
||||
this.listQuery.page = 1;
|
||||
this.listQuery.dept = obj.id;
|
||||
this.getList();
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getEmployeeList(this.listQuery).then(response => {
|
||||
if (response.data) {
|
||||
this.userList = response.data
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
getOrgAll() {
|
||||
this.treeLoding = true;
|
||||
getOrgAll().then(response => {
|
||||
this.orgData = genTree(response.data);
|
||||
this.treeLoding = false;
|
||||
});
|
||||
},
|
||||
getRoleAll() {
|
||||
getRoleAll().then(response => {
|
||||
this.roles = genTree(response.data);
|
||||
});
|
||||
},
|
||||
resetFilter() {
|
||||
this.listQuery = {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
};
|
||||
this.getList();
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
handleEdit(scope) {
|
||||
this.$router.push({name:"userupdate",params:{id:scope.row.id}})
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error"
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteUser(scope.row.id);
|
||||
this.userList.splice(scope.row.index, 1);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "成功删除!"
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,283 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<div>基础信息</div>
|
||||
<el-form label-width="60px">
|
||||
<el-form-item label="姓名">{{userDate.name}}</el-form-item>
|
||||
<el-form-item label="账户">{{userDate.username}}</el-form-item>
|
||||
|
||||
<el-form-item label="角色">
|
||||
<el-tag
|
||||
v-for="(item, index) in userDate.roles_name"
|
||||
:key="index"
|
||||
style="margin:2px"
|
||||
>{{item}}</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机">{{userDate.phone}}</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
<el-col :span="20">
|
||||
<div>详细信息</div>
|
||||
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工号" prop="number">
|
||||
<el-input
|
||||
v-model="formData.number"
|
||||
placeholder="请输入编号"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="学历" prop="qualification">
|
||||
<el-input
|
||||
v-model="formData.qualification"
|
||||
placeholder="请输入学历"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
</el-col>
|
||||
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<el-select
|
||||
v-model="formData.gender"
|
||||
placeholder="请选择性别"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in genderOptions"
|
||||
:key="item.key"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="在职状态" prop="job_state">
|
||||
<el-select
|
||||
v-model="formData.job_state"
|
||||
placeholder="请选择在职状态"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in jobstateOptions"
|
||||
:key="item.key"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="出生年月" prop="birthday">
|
||||
<el-date-picker
|
||||
v-model="formData.birthday"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width:100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="身份证号" prop="id_number">
|
||||
<el-input
|
||||
v-model="formData.id_number"
|
||||
placeholder="请输入身份证号"
|
||||
clearable
|
||||
:style="{width: '100%'}"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="证件照" prop="photo">
|
||||
<el-upload
|
||||
:action="upUrl"
|
||||
accept=".png, .jpeg, .jpg"
|
||||
:headers="upHeaders"
|
||||
class="avatar-uploader"
|
||||
:show-file-list="false"
|
||||
:on-success="handleSuccess"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<img v-if="formData.photo" :src="formData.photo" class="avatar" />
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="签名图片" prop="signature">
|
||||
<el-upload :action="upUrl" :headers="upHeaders" accept=".png, .jpeg, .jpg" :before-upload="beforeUpload" class="avatar-uploader"
|
||||
:show-file-list="false"
|
||||
:on-success="handleSuccess2"><img v-if="formData.signature" :src="formData.signature" class="avatar2" />
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon2"></i></el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item size="large">
|
||||
<el-button type="primary" @click="submitForm" >保存</el-button>
|
||||
<el-button @click="goBack">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 110px;
|
||||
height: 140px;
|
||||
line-height: 140px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 110px;
|
||||
height: 140px;
|
||||
display: block;
|
||||
}
|
||||
.avatar-uploader-icon2 {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 150px;
|
||||
height: 90px;
|
||||
line-height: 90px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar2 {
|
||||
width: 150px;
|
||||
height: 90px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
|
||||
import { upUrl, upHeaders } from "@/api/file"
|
||||
import { genSignature } from "@/api/util"
|
||||
import { getUser } from "@/api/user";
|
||||
import { getEmployee, updateEmployee } from "@/api/employee";
|
||||
const defaultForm = {
|
||||
user:{},
|
||||
};
|
||||
export default {
|
||||
name: "Employeedetail",
|
||||
components: {},
|
||||
props: ["id"],
|
||||
data() {
|
||||
return {
|
||||
upHeaders: upHeaders(),
|
||||
upUrl: upUrl(),
|
||||
formData: Object.assign({}, defaultForm),
|
||||
userDate:[],
|
||||
genderOptions: [
|
||||
{ value: "男", label: "男" },
|
||||
{ value: "女", label: "女" }
|
||||
],
|
||||
jobstateOptions:[
|
||||
{ value: 1, label: "在职" },
|
||||
{ value: 2, label: "离职" }
|
||||
],
|
||||
rules: {
|
||||
|
||||
ID_number: [
|
||||
{
|
||||
pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,
|
||||
message: "身份证格式错误",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.formData.id = this.$route.params.id;
|
||||
this.getDetail();
|
||||
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
getDetail() {
|
||||
getEmployee(this.$route.params.id).then(res => {
|
||||
this.formData = res.data;
|
||||
getUser(res.data.user).then(Response => {
|
||||
|
||||
this.userDate=Response.data;
|
||||
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
beforeUpload(file) {
|
||||
const isLt1M = file.size / 1024 / 1024 < 1;
|
||||
if (!isLt1M) {
|
||||
this.$message.error("上传头像图片大小不能超过 1MB!");
|
||||
}
|
||||
return isLt1M;
|
||||
},
|
||||
handleSuccess(res, file) {
|
||||
this.formData.photo = res.data.path;
|
||||
},
|
||||
handleSuccess2(res, file) {
|
||||
const loading = this.$loading({text:'上传成功,正在转换..'})
|
||||
genSignature({path:res.data.path}).then(res=>{
|
||||
this.formData.signature = res.data.path
|
||||
loading.close()
|
||||
}).catch(error=>{loading.close()})
|
||||
// this.formData.photo = res.data.path;
|
||||
},
|
||||
|
||||
submitForm() {
|
||||
this.$refs["elForm"].validate(valid => {
|
||||
if (!valid) return;
|
||||
// TODO 提交表单
|
||||
var data = this.formData;
|
||||
|
||||
updateEmployee(this.$route.params.id, data).then(res => {
|
||||
this.$message.success("成功");
|
||||
});
|
||||
});
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs["elForm"].resetFields();
|
||||
},
|
||||
goBack() {
|
||||
this.$router.go(-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -64,7 +64,7 @@
|
|||
<el-table-column label="计划完工时间" width="110">
|
||||
<template slot-scope="scope">{{ scope.row.end_date }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交付截止时间" width="110">
|
||||
<el-table-column label="交货日期" width="110">
|
||||
<template slot-scope="scope">{{ scope.row.order_.delivery_date }}</template>
|
||||
</el-table-column>
|
||||
|
||||
|
|
|
@ -110,10 +110,15 @@
|
|||
<el-table-column label="生产所需数量">
|
||||
<template slot-scope="scope">{{ scope.row.count }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存量">
|
||||
<template slot-scope="scope">{{ scope.row.inv_count }}</template>
|
||||
<el-table-column label="剩余量" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.count_safe!=null&&scope.row.count_safe>(scope.row.inv_count-scope.row.count)" type="danger"> {{ scope.row.inv_count-scope.row.count }}</el-tag>
|
||||
<el-tag v-else> {{ scope.row.inv_count-scope.row.count }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="安全库存">
|
||||
<template slot-scope="scope">{{ scope.row.count_safe }}</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
</el-table>
|
||||
|
||||
|
@ -143,6 +148,31 @@
|
|||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备状态">
|
||||
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.equip_.type===2">
|
||||
<el-tag v-if="scope.row.equip_.state===40" type="danger">
|
||||
禁用
|
||||
</el-tag>
|
||||
<el-tag v-else type="success">
|
||||
合格
|
||||
</el-tag>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-tag v-if="scope.row.state===10" type="success">
|
||||
{{ state_[scope.row.state] }}
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row.state===20">
|
||||
{{ state_[scope.row.state] }}
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row.state===30" type="warning">
|
||||
{{ state_[scope.row.state] }}
|
||||
</el-tag>
|
||||
<el-tag v-else type="danger">
|
||||
{{ state_[scope.row.state] }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
<template slot-scope="scope"> {{state_[scope.row.state]}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备编号">
|
||||
|
@ -200,12 +230,12 @@ export default {
|
|||
"6":'辅助工具',
|
||||
|
||||
},
|
||||
state_:{
|
||||
0:'完好',
|
||||
1:'限用',
|
||||
2:'在修',
|
||||
3:'禁用',
|
||||
},
|
||||
state_: {
|
||||
10: '完好',
|
||||
20: '限用',
|
||||
30: '在修',
|
||||
40: '禁用',
|
||||
},
|
||||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
|
|
|
@ -8,67 +8,66 @@
|
|||
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="任务编号">
|
||||
<el-table-column label="任务编号" align="center">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品名称">
|
||||
<el-table-column label="产品名称" align="center">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.product_.name
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号">
|
||||
<el-table-column label="规格型号" align="center">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.product_.specification
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合格率">
|
||||
<el-table-column label="冷加工">
|
||||
<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
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="热弯">
|
||||
<el-table-column label="热弯" align="center">
|
||||
<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="化学钢化">
|
||||
<el-table-column label="化学钢化" align="center">
|
||||
<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="镀膜">
|
||||
<el-table-column label="镀膜" align="center">
|
||||
<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="夹层">
|
||||
<el-table-column label="夹层" align="center">
|
||||
<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="包边">
|
||||
<el-table-column label="包边" align="center">
|
||||
<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="装框">
|
||||
<el-table-column label="装框" align="center">
|
||||
<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="创建时间">
|
||||
<el-table-column label="创建时间" align="center">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.create_time
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-link
|
||||
v-if="checkPermission(['material_update'])"
|
||||
|
|
|
@ -2,9 +2,56 @@
|
|||
<div class="app-container">
|
||||
|
||||
<el-card>
|
||||
<el-table
|
||||
<el-tabs v-model="activeName" type="card">
|
||||
<el-tab-pane label="待军检" name="first">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleorder"
|
||||
>申请
|
||||
</el-button>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="iproductData.results"
|
||||
ref="multipleTable"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
max-height="700"
|
||||
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 label="成品编号">
|
||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<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.warehouse_.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
|
||||
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="iproductData.count > 0"
|
||||
:total="iproductData.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="军检列表" name="second">
|
||||
<el-table
|
||||
v-loading="listLoading2"
|
||||
:data="iproductData2.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
|
@ -28,21 +75,57 @@
|
|||
<el-table-column label="所在仓库">
|
||||
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否已军检">
|
||||
<template slot-scope="scope">
|
||||
|
||||
|
||||
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
|
||||
<el-tag v-else>已军检</el-tag></template>
|
||||
|
||||
<el-table-column label="订单">
|
||||
<template slot-scope="scope">
|
||||
<el-span v-if="scope.row.to_order_">{{
|
||||
scope.row.to_order_.number
|
||||
}}</el-span>
|
||||
<el-tag
|
||||
v-else-if="
|
||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
||||
"
|
||||
>
|
||||
需要确定订单
|
||||
</el-tag>
|
||||
<el-span v-else></el-span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同">
|
||||
<template slot-scope="scope">
|
||||
<el-span v-if="scope.row.to_order_">{{
|
||||
scope.row.to_order_.contract_.name
|
||||
}}</el-span>
|
||||
<el-span
|
||||
v-else-if="
|
||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
||||
"
|
||||
>
|
||||
</el-span>
|
||||
<el-span v-else></el-span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户">
|
||||
<template slot-scope="scope">
|
||||
<el-span v-if="scope.row.to_order_">{{
|
||||
scope.row.to_order_.customer_.name
|
||||
}}</el-span>
|
||||
<el-span
|
||||
v-else-if="
|
||||
scope.row.to_order_ == null && scope.row.need_to_order == true
|
||||
"
|
||||
>
|
||||
</el-span>
|
||||
<el-span v-else></el-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></template>
|
||||
<el-tag v-else-if="scope.row.is_mtestok == true">合格</el-tag>
|
||||
<el-span v-else></el-span></template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
@ -53,21 +136,25 @@
|
|||
<template slot-scope="scope">
|
||||
|
||||
<el-link
|
||||
v-if="scope.row.is_mtested == false"
|
||||
v-if="scope.row.is_mtestok==null"
|
||||
@click="handleMtest(scope)"
|
||||
>军检</el-link
|
||||
>
|
||||
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="iproductData.count > 0"
|
||||
:total="iproductData.count"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.page_size"
|
||||
@pagination="getList"
|
||||
v-show="iproductData2.count > 0"
|
||||
:total="iproductData2.count"
|
||||
:page.sync="listQuery2.page"
|
||||
:limit.sync="listQuery2.page_size"
|
||||
@pagination="getList2"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
|
||||
<el-dialog
|
||||
:visible.sync="dialogVisible"
|
||||
:close-on-click-modal="false"
|
||||
|
@ -87,7 +174,7 @@
|
|||
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="mtest.remark" placeholder="备注" />
|
||||
<el-input v-model="mtest.remark_mtest" placeholder="备注" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
@ -103,7 +190,7 @@
|
|||
<script>
|
||||
import { getiproductList,saleMtest} from "@/api/inm";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
import { mtest, needtoorder, } from "@/api/wpm";
|
||||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
|
||||
|
@ -118,47 +205,84 @@ export default {
|
|||
listQuery: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
iproductData2: {
|
||||
count: 0,
|
||||
},
|
||||
listQuery2: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
mtest: {},
|
||||
salesdetail:"",
|
||||
saleproduct:"",
|
||||
dialogVisible:false,
|
||||
|
||||
activeName: 'first',
|
||||
mutipID1:[],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getList2();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
//半成品列表
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
this.listQuery.material__type=1;
|
||||
getList(){
|
||||
|
||||
this.listQuery.material__type = 1;
|
||||
this.listQuery.need_to_order=false;
|
||||
getiproductList(this.listQuery).then((response) => {
|
||||
if (response.data) {
|
||||
this.iproductData= response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
|
||||
});
|
||||
},
|
||||
},
|
||||
getList2(){
|
||||
|
||||
this.listQuery2.material__type = 1;
|
||||
getiproductList(this.listQuery2).then((response) => {
|
||||
if (response.data) {
|
||||
this.iproductData2= response.data;
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
handleMtest(scope){
|
||||
this.saleproduct=scope.row.id;
|
||||
this.saleproduct=scope.row.wproduct;
|
||||
this.dialogVisible=true;
|
||||
},
|
||||
smtconfirm(){
|
||||
|
||||
saleMtest(this.saleproduct,this.mtest).then((res) => {
|
||||
mtest(this.saleproduct,this.mtest).then((res) => {
|
||||
|
||||
if (res.code >= 200) {
|
||||
this.getList();
|
||||
this.getList2();
|
||||
this.dialogVisible = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
//批量申请
|
||||
handleorder() {
|
||||
let _this = this;
|
||||
_this.mutipID1 = [];
|
||||
this.$refs.multipleTable.selection.forEach((item) => {
|
||||
_this.mutipID1.push(item.wproduct);
|
||||
|
||||
});
|
||||
needtoorder({
|
||||
wproducts: this.mutipID1,
|
||||
}).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.$message.success("申请成功!");
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -23,12 +23,7 @@
|
|||
<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_mtested==false">未军检</el-tag>
|
||||
<el-tag v-if="scope.row.is_mtested==true">已军检</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="军检结论">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.is_mtestok==false">不合格</el-tag>
|
||||
|
|
|
@ -25,12 +25,7 @@
|
|||
<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_mtested==false">未军检</el-tag>
|
||||
<el-tag v-if="scope.row.is_mtested==true">已军检</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="军检结论">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.is_mtestok==false">不合格</el-tag>
|
||||
|
@ -132,7 +127,7 @@
|
|||
/>
|
||||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="入场不合格" name="4">
|
||||
<el-tab-pane label="入厂不合格" name="4">
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="fifodetailList4.results"
|
||||
|
|
|
@ -66,7 +66,11 @@
|
|||
<el-table-column label="已交货数量" width="150" >
|
||||
<template slot-scope="scope">{{ scope.row.delivered_count }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="是否需要军检" width="150" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.need_mtest == false">否</el-tag>
|
||||
<el-tag v-else-if="scope.row.need_mtest == true">是</el-tag></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" width="160" >
|
||||
<template slot-scope="scope">{{ scope.row.create_time }}</template>
|
||||
</el-table-column>
|
||||
|
@ -167,7 +171,9 @@
|
|||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="是否军检">
|
||||
<el-switch v-model="order.need_mtest"></el-switch>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div style="text-align: right">
|
||||
|
@ -186,6 +192,7 @@ import checkPermission from "@/utils/permission";
|
|||
import { genTree } from "@/utils";
|
||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||
const defaulteorder = {
|
||||
need_mtest:false,
|
||||
};
|
||||
export default {
|
||||
components: { Pagination },
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
</el-table-column>
|
||||
|
||||
<el-table-column label="合同名称" show-overflow-tooltip>
|
||||
<template slot-scope="scope" v-if="scope.row.order&&scope.row.order_.contract">{{ scope.row.order_.contract_.name }}</template>
|
||||
<template slot-scope="scope" v-if="scope.row.order_">{{ scope.row.order_.contract_.name }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="是否审核" >
|
||||
|
@ -227,7 +227,7 @@ export default {
|
|||
orderoptions:[],
|
||||
customeroptions:[],
|
||||
materialoptions:[],
|
||||
iproductoptions:"",
|
||||
iproductoptions:[],
|
||||
dialogVisible: false,
|
||||
dialogType: "new",
|
||||
|
||||
|
@ -238,7 +238,7 @@ export default {
|
|||
created() {
|
||||
this.getList();
|
||||
this.getCustomerLists();
|
||||
this.getproductList();
|
||||
// this.getproductList();
|
||||
this.getOrderLists();
|
||||
this.getMaterialList();
|
||||
},
|
||||
|
@ -307,15 +307,15 @@ export default {
|
|||
|
||||
|
||||
//成品
|
||||
getproductList() {
|
||||
// getproductList() {
|
||||
|
||||
getiproductList({page:0,material__type:1}).then((response) => {
|
||||
if (response.data) {
|
||||
this.iproductoptions=response.data;
|
||||
}
|
||||
// getiproductList({page:0,material__type:1}).then((response) => {
|
||||
// if (response.data) {
|
||||
// this.iproductoptions=response.data;
|
||||
// }
|
||||
|
||||
});
|
||||
},
|
||||
// });
|
||||
// },
|
||||
//根据选择的产品弹出对应库里的产品
|
||||
selectproduct(){
|
||||
getiproductList({page:0,material__type:1,material:this.sale.product}).then((response) => {
|
||||
|
@ -344,7 +344,8 @@ selectproduct(){
|
|||
this.dialogVisible = true;
|
||||
this.iproducts=[];
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
this.$refs["Form"].resetFields();
|
||||
this.iproductoptions=[];
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -354,7 +355,7 @@ selectproduct(){
|
|||
this.dialogType = "edit";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
this.$refs["Form"].resetFields();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='edit'?'编辑用户':'新增用户'">
|
||||
<el-dialog :visible.sync="dialogVisible" :title="dialogType==='update'?'编辑用户':'新增用户'">
|
||||
<el-form ref="Form" :model="user" label-width="80px" label-position="right" :rules="rule1">
|
||||
<el-form-item label="姓名" prop="name">
|
||||
<el-input v-model="user.name" placeholder="姓名" />
|
||||
|
@ -320,7 +320,13 @@ export default {
|
|||
});
|
||||
},
|
||||
handleEdit(scope) {
|
||||
this.$router.push({name:"userupdate",params:{id:scope.row.employee_user}})
|
||||
this.user = Object.assign({}, scope.row); // copy obj
|
||||
|
||||
this.dialogType = "update";
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
|
@ -343,7 +349,7 @@ export default {
|
|||
async confirm(form) {
|
||||
this.$refs[form].validate(valid => {
|
||||
if (valid) {
|
||||
const isEdit = this.dialogType === "edit";
|
||||
const isEdit = this.dialogType === "update";
|
||||
if (isEdit) {
|
||||
updateUser(this.user.id, this.user).then(res => {
|
||||
this.getList();
|
||||
|
|
|
@ -131,19 +131,29 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="设备状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.state===0" type="success">
|
||||
{{ state_[scope.row.equip_.state] }}
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row.state===1" type="warning">
|
||||
{{ state_[scope.row.equip_.state] }}
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row.state===2" >
|
||||
{{ state_[scope.row.equip_.state] }}
|
||||
</el-tag>
|
||||
<el-tag v-else type="danger">
|
||||
{{ state_[scope.row.equip_.state] }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<div v-if="scope.row.equip_.type===2">
|
||||
<el-tag v-if="scope.row.equip_.state===40" type="danger">
|
||||
禁用
|
||||
</el-tag>
|
||||
<el-tag v-else type="success">
|
||||
合格
|
||||
</el-tag>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-tag v-if="scope.row.equip_.state===10" type="success">
|
||||
{{ state_[scope.row.equip_.state] }}
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row.equip_.state===20">
|
||||
{{ state_[scope.row.equip_.state] }}
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row.equip_.state===30" type="warning">
|
||||
{{ state_[scope.row.equip_.state] }}
|
||||
</el-tag>
|
||||
<el-tag v-else type="danger">
|
||||
{{ state_[scope.row.equip_.state] }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="操作" width="100px">
|
||||
|
@ -572,8 +582,12 @@
|
|||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.word-wrap {
|
||||
padding: 25px;
|
||||
};
|
||||
.box-card {
|
||||
height: 300px;
|
||||
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
|
@ -619,12 +633,12 @@ export default {
|
|||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
state_:{
|
||||
0:'完好',
|
||||
1:'限用',
|
||||
2:'在修',
|
||||
3:'禁用',
|
||||
},
|
||||
state_: {
|
||||
10: '完好',
|
||||
20: '限用',
|
||||
30: '在修',
|
||||
40: '禁用',
|
||||
},
|
||||
scrap: [
|
||||
{ lable: "使用", value: true },
|
||||
{ lable: "不使用", value: false },
|
||||
|
|
|
@ -65,9 +65,7 @@
|
|||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||
>批量入库
|
||||
</el-button>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleorder"
|
||||
>批量选择订单
|
||||
</el-button>
|
||||
|
||||
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
|
@ -282,33 +280,7 @@
|
|||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
title="指定发货订单"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="dialogFormVisibleorder"
|
||||
>
|
||||
<el-form :model="form">
|
||||
<el-form-item label="订单">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="form.order"
|
||||
placeholder="请选择订单"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in orderList"
|
||||
:key="item.id"
|
||||
:label="item.number"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisibleorder = false">取 消</el-button>
|
||||
<el-button type="primary" @click="toorders">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -341,6 +313,7 @@ export default {
|
|||
return {
|
||||
testitem: defaultetestitem,
|
||||
form: { remark: "", warehouse: "" },
|
||||
form1: {},
|
||||
wproductList: {
|
||||
count: 0,
|
||||
},
|
||||
|
@ -411,11 +384,7 @@ export default {
|
|||
testrecord: {},
|
||||
formName: "检验表",
|
||||
WarehouseData: "",
|
||||
dialogFormVisibleorder: false,
|
||||
orderList: [],
|
||||
mutipID1: [],
|
||||
mutipID: [],
|
||||
mtmId: [],
|
||||
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
|
@ -451,37 +420,7 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
//批量选择成品发给谋订单
|
||||
handleorder() {
|
||||
this.dialogFormVisibleorder = true;
|
||||
let _this = this;
|
||||
_this.mutipID1 = [];
|
||||
_this.mtmId = [];
|
||||
this.$refs.multipleTable.selection.forEach((item) => {
|
||||
_this.mutipID1.push(item.id);
|
||||
_this.mtmId.push(item.material_.id);
|
||||
});
|
||||
|
||||
getOrderList({ page: 0, material: _this.mtmId[0] }).then((response) => {
|
||||
if (response.data) {
|
||||
this.orderList = response.data;
|
||||
}
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
//提交批量产品选择的订单
|
||||
toorders() {
|
||||
toorder({
|
||||
order: this.form.order,
|
||||
wproducts: this.mutipID1,
|
||||
}).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.$message.success("成功!");
|
||||
this.dialogFormVisibleorder = false;
|
||||
this.getList1();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//成品批量入库
|
||||
handleCreate() {
|
||||
this.dialogFormVisibles = true;
|
||||
|
|
|
@ -9,7 +9,7 @@ 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)
|
||||
dept_ = OrganizationSimpleSerializer(source='user.dept', read_only=True)
|
||||
class Meta:
|
||||
model = Employee
|
||||
exclude = ['face_data']
|
||||
|
|
|
@ -21,7 +21,7 @@ class HRMService:
|
|||
os.remove(filepath)
|
||||
except:
|
||||
os.remove(filepath)
|
||||
return None, '头像解码失败'
|
||||
return None, '人脸识别失败'
|
||||
|
||||
# 匹配人脸库
|
||||
face_datas = cache.get('face_datas')
|
||||
|
@ -32,20 +32,21 @@ class HRMService:
|
|||
results = face_recognition.compare_faces(face_datas,
|
||||
unknown_face_encoding, tolerance=0.5)
|
||||
except:
|
||||
return None, '识别失败'
|
||||
return None, '人脸匹配失败'
|
||||
for index, value in enumerate(results):
|
||||
if value:
|
||||
# 识别成功
|
||||
user = User.objects.get(id=face_users[index])
|
||||
return user, ''
|
||||
return None, '识别失败'
|
||||
return None, '人脸匹配失败'
|
||||
|
||||
def get_facedata_from_img(cls, img_rpath):
|
||||
@classmethod
|
||||
def get_facedata_from_img(cls, img_path):
|
||||
try:
|
||||
photo_path = settings.BASE_DIR + img_rpath
|
||||
photo_path = settings.BASE_DIR + img_path
|
||||
picture_of_me = face_recognition.load_image_file(photo_path)
|
||||
my_face_encoding = face_recognition.face_encodings(picture_of_me)[0]
|
||||
face_data_list = my_face_encoding.tolist()
|
||||
return face_data_list
|
||||
return face_data_list, ''
|
||||
except:
|
||||
return None
|
||||
return None, '人脸识别失败'
|
|
@ -20,11 +20,11 @@ from rest_framework import exceptions
|
|||
from apps.system.models import User
|
||||
from apps.system.serializers import UserSimpleSerializer
|
||||
from rest_framework.permissions import AllowAny
|
||||
|
||||
from rest_framework.decorators import action
|
||||
|
||||
|
||||
# Create your views here.
|
||||
class EmployeeViewSet(CreateUpdateModelAMixin, OptimizationMixin, UpdateModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||
class EmployeeViewSet(CreateUpdateModelAMixin, OptimizationMixin, UpdateModelMixin, ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
||||
"""
|
||||
员工详细信息
|
||||
"""
|
||||
|
@ -32,6 +32,7 @@ class EmployeeViewSet(CreateUpdateModelAMixin, OptimizationMixin, UpdateModelMix
|
|||
queryset = Employee.objects.all()
|
||||
filterset_class = EmployeeFilterSet
|
||||
serializer_class = EmployeeSerializer
|
||||
search_fields = ['user__name', 'number', 'user__username']
|
||||
ordering = ['-pk']
|
||||
|
||||
def update(self, request, *args, **kwargs):
|
||||
|
@ -42,13 +43,13 @@ class EmployeeViewSet(CreateUpdateModelAMixin, OptimizationMixin, UpdateModelMix
|
|||
serializer.is_valid(raise_exception=True)
|
||||
photo = data.get('photo', None)
|
||||
if instance.photo != photo:
|
||||
f_l = HRMService.get_facedata_from_img(photo)
|
||||
f_l, msg = HRMService.get_facedata_from_img(img_path=photo)
|
||||
if f_l:
|
||||
serializer.save(update_by=request.user, face_data = f_l)
|
||||
# 更新人脸缓存
|
||||
update_all_user_facedata_cache.delay()
|
||||
return Response()
|
||||
return Response('头像识别失败', status=status.HTTP_400_BAD_REQUEST)
|
||||
return Response(msg, status=status.HTTP_400_BAD_REQUEST)
|
||||
serializer.save(update_by=request.user)
|
||||
return Response()
|
||||
|
||||
|
@ -79,16 +80,16 @@ class ClockRecordViewSet(CreateModelMixin, ListModelMixin, GenericViewSet):
|
|||
user, msg = HRMService.face_compare_from_base64(base64_data)
|
||||
if user:
|
||||
ins, created = ClockRecord.objects.get_or_create(
|
||||
create_by=request.user, create_time__hour__range = [8,18],
|
||||
create_time__year=now.year, create_time__month=now.month,
|
||||
create_time__day=now.day,
|
||||
create_by = user, create_time__hour__range = [8,18],
|
||||
create_time__year=now_local.year, create_time__month=now_local.month,
|
||||
create_time__day=now_local.day,
|
||||
defaults={
|
||||
'type':ClockRecord.ClOCK_WORK1,
|
||||
'create_by':user,
|
||||
'create_time':now
|
||||
})
|
||||
if not created:
|
||||
ins.create_time = now
|
||||
ins.update_time = now
|
||||
ins.save()
|
||||
# 设为在岗
|
||||
user.is_atwork = True
|
||||
|
|
|
@ -33,6 +33,8 @@ class OrderFilterSet(DynamicFieldsFilterMixin, filters.FilterSet):
|
|||
elif value == 'out_delivery':
|
||||
queryset = queryset.filter(delivered_count__lt=F('count'),
|
||||
delivery_date__gt = datetime.date(datetime.now()))
|
||||
elif value == 'not_done':
|
||||
queryset = queryset.filter(delivered_count__lt=F('count'))
|
||||
return queryset
|
||||
|
||||
class ContractFilterSet(filters.FilterSet):
|
||||
|
|
|
@ -32,17 +32,10 @@ class Contract(CommonAModel):
|
|||
"""
|
||||
合同信息
|
||||
"""
|
||||
state_choices = (
|
||||
(0, '完好'),
|
||||
(1, '限用'),
|
||||
(2, '在修'),
|
||||
(3, '禁用')
|
||||
)
|
||||
name = models.CharField('合同名称', max_length=100)
|
||||
number = models.CharField('合同编号', max_length=100, unique=True)
|
||||
amount = models.IntegerField('合同金额', default=0)
|
||||
invoice = models.IntegerField('开票金额', default=0)
|
||||
#state = models.CharField('合同状态', choices= state_choices, max_length=20, default=1)
|
||||
customer = models.ForeignKey(Customer, verbose_name='关联客户', on_delete=models.CASCADE, related_name='contact_customer')
|
||||
sign_date = models.DateField('签订日期')
|
||||
description = models.CharField('描述', max_length=200, blank=True, null=True)
|
||||
|
|
|
@ -13,6 +13,7 @@ from django.utils import timezone
|
|||
from apps.system.mixins import CreateUpdateModelAMixin
|
||||
from apps.inm.signals import update_inm
|
||||
from rest_framework import serializers
|
||||
from django.db.models import Count
|
||||
|
||||
class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, CreateModelMixin, DestroyModelMixin, GenericViewSet):
|
||||
"""
|
||||
|
@ -41,6 +42,8 @@ class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, C
|
|||
with transaction.atomic():
|
||||
iproducts = vdata.pop('iproducts')
|
||||
vdata['count'] = len(iproducts)
|
||||
if vdata['count'] + vdata['order'].delivered_count > vdata['order'].count:
|
||||
raise exceptions.APIException('超过订单所需数量')
|
||||
sale = Sale.objects.create(**vdata)
|
||||
i_l = []
|
||||
for i in iproducts:
|
||||
|
|
|
@ -23,4 +23,9 @@ class PlanGanttSerializer(serializers.ModelSerializer):
|
|||
|
||||
class ProcessYieldSerializer(serializers.Serializer):
|
||||
datetime_start = serializers.DateField(label='开始时间', required=False, allow_null=True)
|
||||
datetime_end = serializers.DateField(label='结束时间', required=False, allow_null=True)
|
||||
datetime_end = serializers.DateField(label='结束时间', required=False, allow_null=True)
|
||||
|
||||
|
||||
class AtWorkCountSerializer(serializers.Serializer):
|
||||
year = serializers.IntegerField(label='年')
|
||||
month = serializers.IntegerField(label='月')
|
|
@ -3,12 +3,13 @@ from rest_framework import urlpatterns
|
|||
from django.urls import path, include
|
||||
from rest_framework.routers import DefaultRouter
|
||||
|
||||
from apps.srm.views import GanttPlan, ProcessYieldView
|
||||
from apps.srm.views import AtWorkCountView, GanttPlan, ProcessYieldView
|
||||
|
||||
router = DefaultRouter()
|
||||
urlpatterns = [
|
||||
path('gantt/plan/', GanttPlan.as_view()),
|
||||
path('process/yield/', ProcessYieldView.as_view()),
|
||||
path('at_work/', AtWorkCountView.as_view()),
|
||||
path('', include(router.urls)),
|
||||
]
|
||||
|
||||
|
|
|
@ -4,11 +4,12 @@ from rest_framework import serializers
|
|||
from rest_framework.generics import ListAPIView, CreateAPIView
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
from apps.hrm.models import ClockRecord
|
||||
from apps.mtm.models import Process, Step
|
||||
from apps.pm.models import ProductionPlan, SubProductionPlan
|
||||
from apps.srm.serializers import PlanGanttSerializer, ProcessYieldSerializer
|
||||
from apps.srm.serializers import AtWorkCountSerializer, PlanGanttSerializer, ProcessYieldSerializer
|
||||
from apps.wpm.models import WProduct, WproductFlow
|
||||
from django.db.models import Count
|
||||
from django.db.models import Count, F
|
||||
# Create your views here.
|
||||
|
||||
class GanttPlan(ListAPIView):
|
||||
|
@ -65,3 +66,26 @@ class ProcessYieldView(CreateAPIView):
|
|||
return Response(ret)
|
||||
|
||||
|
||||
class AtWorkCountView(CreateAPIView):
|
||||
"""
|
||||
到岗天数统计
|
||||
"""
|
||||
perms_map = {'get':'*'}
|
||||
serializer_class = AtWorkCountSerializer
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
vdata = serializer.validated_data
|
||||
ret = ClockRecord.objects.filter(
|
||||
create_time__year = vdata['year'],
|
||||
create_time__month = vdata['month']
|
||||
).values(
|
||||
user_id = F('create_by'),
|
||||
username = F('create_by__username'),
|
||||
name = F('create_by__name'),
|
||||
dept_name = F('create_by__dept__name')).annotate(
|
||||
count = Count('id')
|
||||
)
|
||||
return Response(list(ret))
|
||||
|
||||
|
|
|
@ -137,14 +137,14 @@ class UserListSerializer(DynamicFieldsSerializerMixin, serializers.ModelSerializ
|
|||
"""
|
||||
用户列表序列化
|
||||
"""
|
||||
dept_name = serializers.StringRelatedField(source='dept')
|
||||
roles_name = serializers.StringRelatedField(source='roles', many=True)
|
||||
dept_ = OrganizationSimpleSerializer(source='dept', read_only=True)
|
||||
roles_ = RoleSerializer(source='roles', many=True)
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ['id', 'name', 'phone', 'email', 'position',
|
||||
'username', 'is_active', 'date_joined',
|
||||
'dept_name', 'dept', 'roles', 'avatar',
|
||||
'roles_name', 'is_atwork', 'last_check_time']
|
||||
'dept_', 'dept', 'roles', 'avatar',
|
||||
'roles_', 'is_atwork', 'last_check_time']
|
||||
|
||||
@staticmethod
|
||||
def setup_eager_loading(queryset):
|
||||
|
|
|
@ -261,7 +261,7 @@ class UserViewSet(ModelViewSet):
|
|||
# 根据请求类型动态变更serializer
|
||||
if self.action == 'create':
|
||||
return UserCreateSerializer
|
||||
elif self.action == 'list':
|
||||
elif self.action in ['list', 'retrieve']:
|
||||
return UserListSerializer
|
||||
return UserModifySerializer
|
||||
|
||||
|
|
|
@ -470,8 +470,6 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
|
|||
serializer.is_valid(raise_exception=True)
|
||||
vdata = serializer.validated_data
|
||||
wps = WProduct.objects.filter(id__in = [i.id for i in vdata.get('wproducts')])
|
||||
if wps.filter(need_to_order = False).exists():
|
||||
raise exceptions.ValidationError('存在不需要指派订单的产品')
|
||||
wp = wps.first()
|
||||
order = vdata['order']
|
||||
if wp.material != order.product:
|
||||
|
|
Loading…
Reference in New Issue