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

This commit is contained in:
caoqianming 2021-09-22 14:45:52 +08:00
commit 9ed53b3df0
11 changed files with 437 additions and 22 deletions

View File

@ -20,7 +20,7 @@
"axios": "^0.21.1", "axios": "^0.21.1",
"cache-loader": "^4.1.0", "cache-loader": "^4.1.0",
"compression-webpack-plugin": "^5.0.1", "compression-webpack-plugin": "^5.0.1",
"d3": "^5.16.0", "d3": "^5.14.2",
"dagre-d3": "^0.6.4", "dagre-d3": "^0.6.4",
"element-ui": "^2.15.5", "element-ui": "^2.15.5",
"file-saver": "^2.0.2", "file-saver": "^2.0.2",

View File

@ -27,3 +27,13 @@ export default {
} }
} }
</script> </script>
<style>
.el-step__head.is-process>.is-text{
color: #ffffff;
background: #409EFF;
border-color: #409EFF;
}
.el-step__title.is-process{
color: #409EFF;
}
</style>

View File

@ -35,6 +35,14 @@ export function getWfStateList(id) {
method: 'get' method: 'get'
}) })
} }
//工单流转step
export function getWfFlowSteps(id) {
return request({
url: `/wf/ticket/${id}/flowsteps/`,
method: 'get'
})
}
//流转状态创建 //流转状态创建
export function createWfState(data) { export function createWfState(data) {
return request({ return request({
@ -43,6 +51,15 @@ export function createWfState(data) {
data data
}) })
} }
//处理工单
export function ticketHandle(id,data) {
return request({
url: `/wf/ticket/${id}/handle/`,
method: 'post',
data
})
}
//流转状态更新 //流转状态更新
export function updateWfState(id, data) { export function updateWfState(id, data) {
return request({ return request({
@ -121,7 +138,7 @@ export function deleteWfTransition(id, data) {
data data
}) })
} }
//工单详情 //工单列表
export function getTickets(query) { export function getTickets(query) {
return request({ return request({
url: `/wf/ticket/`, url: `/wf/ticket/`,
@ -129,3 +146,17 @@ export function getTickets(query) {
params:query params:query
}) })
} }
//工单详情
export function getTicketDetail(id) {
return request({
url: `/wf/ticket/${id}/`,
method: 'get'
})
}
//工单详情
export function getTicketTransitions(id) {
return request({
url: `/wf/ticket/${id}/transitions/`,
method: 'get'
})
}

View File

@ -176,6 +176,13 @@ export const asyncRoutes = [
meta: { title: '合同信息', icon: 'example', perms: ['index_manage'] } meta: { title: '合同信息', icon: 'example', perms: ['index_manage'] }
} }
, ,
{
path: 'review',
name: 'review',
component: () => import('@/views/sam/review'),
meta: { title: '合同评审', icon: 'example', perms: ['index_manage'] }
}
,
{ {
path: 'order', path: 'order',
name: 'order', name: 'order',

View File

@ -6,7 +6,7 @@
font-weight: 700; font-weight: 700;
">子工序列表</span> ">子工序列表</span>
</div> </div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate" <el-button type="primary" icon="el-icon-plus" @click="handleCreateStep"
>新增子工序</el-button> >新增子工序</el-button>
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
@ -109,7 +109,7 @@
font-weight: 700; font-weight: 700;
">过程记录表</span> ">过程记录表</span>
</div> </div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreateStep" <el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增</el-button> >新增</el-button>
<el-table <el-table
:data="recordformList.results" :data="recordformList.results"

View File

@ -48,9 +48,13 @@
<el-table-column label="合同编号"> <el-table-column label="合同编号">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="合同金额"> <el-table-column label="合同金额(元)">
<template slot-scope="scope">{{ scope.row.amount }}</template> <template slot-scope="scope">{{ scope.row.amount }}</template>
</el-table-column> </el-table-column>
<el-table-column label="开票金额(元)">
<template slot-scope="scope">{{ scope.row.invoice }}</template>
</el-table-column>
<el-table-column label="客户名称"> <el-table-column label="客户名称">
<template slot-scope="scope">{{ scope.row.customer_.name }}</template> <template slot-scope="scope">{{ scope.row.customer_.name }}</template>
</el-table-column> </el-table-column>

View File

@ -53,6 +53,9 @@
</el-table-column> </el-table-column>
<el-table-column label="所需产品"> <el-table-column label="所需产品">
<template slot-scope="scope">{{ scope.row.product_.name }}</template> <template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column>
<el-table-column label="产品型号">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="所需数量"> <el-table-column label="所需数量">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
@ -117,6 +120,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所需数量" prop="count"> <el-form-item label="所需数量" prop="count">
<el-input type="number" v-model="order.count"></el-input> <el-input type="number" v-model="order.count"></el-input>
</el-form-item> </el-form-item>

View File

@ -0,0 +1,284 @@
<template>
<div class="app-container">
<el-card>
<div>
<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>
<div style="margin-top: 10px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增客户</el-button
>
</div>
</el-card>
<el-card style="margin-top: 10px">
<el-table
v-loading="listLoading"
:data="contractList.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<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.number }}</template>
</el-table-column>
<el-table-column label="合同金额(元)">
<template slot-scope="scope">{{ scope.row.amount }}</template>
</el-table-column>
<el-table-column label="开票金额(元)">
<template slot-scope="scope">{{ scope.row.invoice }}</template>
</el-table-column>
<el-table-column label="客户名称">
<template slot-scope="scope">{{ scope.row.customer_.name }}</template>
</el-table-column>
<el-table-column label="签订日期">
<template slot-scope="scope">{{ scope.row.sign_date }}</template>
</el-table-column>
<el-table-column label="描述">
<template slot-scope="scope">{{ scope.row.description }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleEdit(scope)"
>编辑</el-link
>
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="danger"
@click="handleDelete(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="contractList.count > 0"
:total="contractList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑合同' : '新增合同'"
>
<el-form
ref="Form"
:model="contract"
label-width="80px"
label-position="right"
:rules="rule1"
>
<el-form-item label="合同名称" prop="name">
<el-input v-model="contract.name" placeholder="合同名称" />
</el-form-item>
<el-form-item label="合同编号" prop="number">
<el-input v-model="contract.number" placeholder="合同编号" />
</el-form-item>
<el-form-item label="合同金额" prop="amount">
<el-input v-model="contract.amount" placeholder="合同金额" />
</el-form-item>
<el-form-item label="开票金额" prop="invoice">
<el-input v-model="contract.invoice" placeholder="开票金额" />
</el-form-item>
<el-form-item label="签订日期" prop="sign_date">
<el-date-picker
v-model="contract.sign_date"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item label="客户" prop="sign_date">
<el-select style="width: 100%" v-model="contract.customer" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="contract.description" placeholder="描述" />
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getContractList, createContract,updateContract,deleteContract,getCustomerList } from "@/api/sam";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultecontract = {
};
export default {
components: { Pagination },
data() {
return {
contract: defaultecontract,
contractList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
options:[],
listLoading: true,
dialogVisible: false,
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
},
};
},
computed: {},
watch: {},
created() {
this.getLists();
this.getList();
},
methods: {
checkPermission,
getList() {
this.listLoading = true;
getContractList(this.listQuery).then((response) => {
if (response.data) {
this.contractList = response.data;
}
this.listLoading = false;
});
},
getLists() {
getCustomerList({pageoff:true}).then((response) => {
this.options = genTree(response.data);
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
},
resetFilter() {
this.listQuery = {
page: 1,
page_size: 20,
}
this.getList();
},
handleCreate() {
this.contract = Object.assign({}, defaultecontract);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.contract = 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 deleteContract(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) {
updateContract(this.contract.id, this.contract).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createContract(this.contract).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
},
};
</script>

View File

@ -7,7 +7,11 @@
<template slot-scope="scope">{{ scope.row.title }}</template> <template slot-scope="scope">{{ scope.row.title }}</template>
</el-table-column> </el-table-column>
<el-table-column label="当前状态"> <el-table-column label="当前状态">
<template slot-scope="scope">{{ scope.row.act_state }}</template> <template slot-scope="scope">
<span v-if="scope.row.act_state===1">已提交</span>
<span v-else-if="scope.row.act_state===4">已完成</span>
<span v-else>审批中</span>
</template>
</el-table-column> </el-table-column>
<el-table-column width="180" label="创建时间"> <el-table-column width="180" label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template> <template slot-scope="scope">{{ scope.row.create_time }}</template>
@ -15,6 +19,7 @@
<el-table-column align="center" label="操作" width="220px"> <el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link v-if="stateSteps==scope.row.act_state" type="danger" @click="handlePicture(scope)">查看流程图</el-link> <el-link v-if="stateSteps==scope.row.act_state" type="danger" @click="handlePicture(scope)">查看流程图</el-link>
<el-link v-else type="danger" @click="handleDetail(scope)">工单详情</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -35,20 +40,50 @@
</svg> </svg>
</div> </div>
</div> </div>
<el-dialog :visible.sync="limitedStep"
title="工单流程">
<el-steps :active="actives" spac="400px" align-center="" style="padding-top: 20px;">
<el-step :title="item.name" v-for="item in flowSteps "
:key="item.id" @click.native=stepclick(item.id)>
</el-step>
</el-steps>
<el-row>
<el-col :span="1" style="height: 1px;"></el-col>
<el-col :span="11">
<div class="listItem"><span>流水号</span>{{ticketDetail.sn}}</div>
<div class="listItem"><span>开始时间</span>{{}}</div>
<div class="listItem" v-if="ticketDetail.workflow_"><span>请假类型</span>{{ticketDetail.workflow_.name}}</div>
<div class="listItem"><span>创建人</span>{{}}</div>
<div class="listItem" v-if="ticketDetail.workflow_"><span>请假原因</span>{{ticketDetail.workflow_.name}}</div>
</el-col>
<el-col :span="11">
<div class="listItem"><span>标题</span>{{ticketDetail.title}}</div>
<div class="listItem"><span>结束时间</span>{{}}</div>
<div class="listItem"><span>创建时间</span>{{ticketDetail.create_time}}</div>
<div class="listItem" v-if="ticketDetail.ticket_data"><span>请假天数</span>{{ticketDetail.ticket_data.days}}</div>
</el-col>
</el-row>
<div style="text-align: center">
<el-button v-for="item in operationBtn" :key="item.id" class="filter-item" type="primary" @click="operationSubmit">{{item.name}}</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script src="https://d3js.org/d3.v4.min.js"></script> <!--<script src="https://d3js.org/d3.v4.min.js"></script>-->
<script> <script>
import {getWfStateList,getTickets } from "@/api/workflow"; import {getWfStateList,getTickets,ticketHandle,getWfFlowSteps,getTicketDetail,getTicketTransitions } from "@/api/workflow";
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
import dagreD3 from 'dagre-d3' import dagreD3 from 'dagre-d3'
import * as d3 from 'd3' import * as d3 from 'd3'
export default { export default {
name: "ticket", name: "ticket",
components: { Pagination }, components: { Pagination },
inject:['reload'],
data(){ data(){
return{ return{
total:0, total:0,
actives:4,
ticketId:0,
pageForm:{ pageForm:{
page:1, page:1,
page_size:20, page_size:20,
@ -58,24 +93,27 @@
stateSteps:0, stateSteps:0,
keyword:'', keyword:'',
tickets:[], tickets:[],
ticketDetail:{},
dialogVisible:false, dialogVisible:false,
listLoading:false, listLoading:false,
limitedStep:false,
nodes: [], nodes: [],
tooltip:null, tooltip:null,
edges: [] edges: [],
flowSteps:[],
operationBtn:[],
} }
}, },
created(){ activated(){
this.workflow = this.$route.params.workflow; this.workflow = this.$route.params.workflow;
let workflow = localStorage.getItem('workflow'); let workflow = localStorage.getItem('workflow');
if(this.workflow){ if(this.workflow){
this.pageForm.workflow = parseInt(this.workflow); this.pageForm.workflow = parseInt(this.workflow);
if(workflow){ if(workflow){
localStorage.removeItem('workflow'); localStorage.removeItem('workflow');
localStorage.setItem('workflow',this.$route.params.workflow) localStorage.setItem('workflow',this.pageForm.workflow)
}else{ }else{
localStorage.setItem('workflow',this.$route.params.workflow) localStorage.setItem('workflow',this.pageForm.workflow)
} }
}else{ }else{
this.workflow =workflow ; this.workflow =workflow ;
@ -86,9 +124,11 @@
}, },
methods:{ methods:{
getList(){ getList(){
this.listLoading = true;
getTickets( this.pageForm).then((res)=>{ getTickets( this.pageForm).then((res)=>{
if(res.data.results){ if(res.data.results){
this.tickets = res.data.results; this.tickets = res.data.results;
this.listLoading = false;
} }
}) })
}, },
@ -106,7 +146,6 @@
nodes.push(obj) nodes.push(obj)
} }
this.nodes = nodes; this.nodes = nodes;
console.log(nodes)
this.getEdges(nodes); this.getEdges(nodes);
} }
}); });
@ -121,7 +160,6 @@
edge.push(obj); edge.push(obj);
} }
this.edges = edge; this.edges = edge;
console.log(edge)
}, },
handleFilter(){}, handleFilter(){},
handlePicture(){ handlePicture(){
@ -137,7 +175,6 @@
marginx: 50, marginx: 50,
marginy: 50, marginy: 50,
}); });
console.log(g);
// 添加节点 // 添加节点
this.nodes.forEach((item) => { this.nodes.forEach((item) => {
g.setNode(item.id, { g.setNode(item.id, {
@ -181,13 +218,36 @@
}) })
}, },
handleDetail(scope){
// this.limitedStep = true;
this.ticketId = scope.row.id;
getWfFlowSteps( scope.row.id).then((res)=>{
if(res.data){
this.flowSteps = res.data;
}
});
getTicketDetail( scope.row.id).then((res)=>{
if(res.data){
this.ticketDetail = res.data;
this.actives = res.data.act_state;
this.limitedStep = true;
}
});
getTicketTransitions(scope.row.id).then(res=>{
this.operationBtn = res.data;
})
},
operationSubmit(){
// let transition = {transition:this.operationBtn[0].id};
// ticketHandle(this.ticketId,transition).then(res=>{
// })
},
stepclick(){},
closeMark(){ closeMark(){
this.dialogVisible = false; this.dialogVisible = false;
},
},
mounted() {
} }
} }
}
</script> </script>
<style scoped> <style scoped>
@ -221,12 +281,10 @@
svg { svg {
font-size: 14px; font-size: 14px;
} }
.node rect { .node rect {
stroke: #606266; stroke: #606266;
fill: #fff; fill: #fff;
} }
.edgePath path { .edgePath path {
stroke: #606266; stroke: #606266;
fill: #333; fill: #333;
@ -235,4 +293,14 @@
.el-icon-close{ .el-icon-close{
cursor: pointer; cursor: pointer;
} }
.listItem{
margin-top: 15px;
font-size: 16px;
}
.listItem>span{
width: 100px;
text-align: right;
margin-right: 10px;
display: inline-block;
}
</style> </style>

View File

@ -25,7 +25,7 @@ class MaterialDetailSerializer(serializers.ModelSerializer):
class MaterialSimpleSerializer(serializers.ModelSerializer): class MaterialSimpleSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = Material model = Material
fields = ['id', 'name', 'number', 'unit'] fields = ['id', 'name', 'number', 'unit','specification']
class ProcessSerializer(serializers.ModelSerializer): class ProcessSerializer(serializers.ModelSerializer):
instruction_ = FileSimpleSerializer(source='instruction', read_only=True) instruction_ = FileSimpleSerializer(source='instruction', read_only=True)

View File

@ -31,10 +31,17 @@ class Contract(CommonAModel):
""" """
合同信息 合同信息
""" """
state_choices = (
(0, '完好'),
(1, '限用'),
(2, '在修'),
(3, '禁用')
)
name = models.CharField('合同名称', max_length=100) name = models.CharField('合同名称', max_length=100)
number = models.CharField('合同编号', max_length=100, unique=True) number = models.CharField('合同编号', max_length=100, unique=True)
amount = models.IntegerField('合同金额', default=0) amount = models.IntegerField('合同金额', default=0)
invoice = 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') customer = models.ForeignKey(Customer, verbose_name='关联客户', on_delete=models.CASCADE, related_name='contact_customer')
sign_date = models.DateField('签订日期') sign_date = models.DateField('签订日期')
description = models.CharField('描述', max_length=200, blank=True, null=True) description = models.CharField('描述', max_length=200, blank=True, null=True)