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

This commit is contained in:
caoqianming 2021-12-17 15:38:27 +08:00
commit 20dff07fe2
8 changed files with 464 additions and 395 deletions

View File

@ -283,13 +283,13 @@ export function createOutputs(data) {
export function recordInit(id) {
return request({
url: `/wpm/operation_record/${id}/init/`,
url: `/wpm/operation_record/${id}/`,
method: 'GET',
})
}
//半产品复检
export function wproductReview(data) {
//testInit
export function testInit(data) {
return request({
url: '/wpm/wproduct/test_init/',
method: 'post',

View File

@ -155,9 +155,9 @@
<el-radio v-model="is_testok" :label="testokFalse">检查不合格</el-radio>
</el-form-item>
<div class="dialog-footer" style="text-align: right">
<el-button @click="innerVisible = false"> </el-button>
<el-button @click="recordCancel"> </el-button>
<el-button type="primary" @click="submitfield('1')">保存</el-button>
<el-button type="primary" @click="submitfield('2')">提交</el-button>
<el-button type="warning" @click="submitfield('2')">提交</el-button>
</div>
</el-row>
@ -188,21 +188,12 @@
type:Number,
default:null
},
origin_test: {
type:Number,
default:null
},
hasPicture:{
type:Boolean,
default:false
},
recordItem:{
type:Boolean,
default:false
}
},
mounted() {
debugger;
let that = this;
that.checkForm = {};
this.form = this.formID;
@ -214,7 +205,6 @@
that.formData.push(obj)
});
that.formData=[...formData];
debugger;
for(let i=0;i<this.results.length;i++){
let key = this.results[i].field_key;
//checkForm接收表单数据的对象
@ -280,9 +270,10 @@
},
methods:{
filterBlock(parent,rule,index,field_key){
// debugger;
debugger;
let that = this;
if(parent!==''&&parent!==null&&parent!==undefined){
debugger;
if(rule!==''&&rule!==null&&rule!==undefined){
let reg = /\{(.+?)\}/g;
//let str = rule.replace(temp,'').replace('$','');//==''
@ -706,47 +697,28 @@
let that = this;
that.field = []; //检查项目
let submit = isSubmit=='1'?false:true;
if(that.recordItem){//有记录
that.formData.forEach((item) => {
if(!item.is_hidden){
that.field.push({
id: item.id,
field_value: that.checkForm[item.field_key],
is_testok: item.is_testok,//单项检查结果
is_hidden: item.is_hidden
});
}
});
that.testrecord.record_data = that.field;//检查项列表
that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.testrecord.id = that.recordId;//记录id
if(submit){//提交
this.$emit('recordSubmit',that.testrecord);
}else {//保存
this.$emit('recordSave',that.testrecord);
that.formData.forEach((item) => {
if(!item.is_hidden){
that.field.push({
id: item.id,
field_value: that.checkForm[item.field_key],
is_testok: item.is_testok,//单项检查结果
is_hidden: item.is_hidden
});
}
}else{//第一次操作时
that.formData.forEach((item) => {
if(!item.is_hidden){
that.field.push({
form_field: item.id,
field_value: that.checkForm[item.field_key],
is_testok: item.is_testok,//单项检查结果
is_hidden: item.is_hidden
});
}
});
if(that.origin_test!==null){
that.testrecord.origin_test = that.origin_test;
}
that.testrecord.record_data = that.field;//检查项列表
that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.testrecord.form = that.formID;//检查表
that.testrecord.wproduct = that.wproductId;//半成品ID
that.testrecord.is_submited = submit;//提交状态false保存
this.$emit('formFunc',that.testrecord);//第一次保存或提交
});
that.testrecord.record_data = that.field;//检查项列表
that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.testrecord.id = that.recordId;//记录id
if(submit){//提交
this.$emit('recordSubmit',that.testrecord);
}else {//保存
this.$emit('recordSave',that.testrecord);
}
},
recordCancel(){
this.$emit('recordCancel','')
},
}
}
</script>

View File

@ -9,7 +9,7 @@
<el-row>
<el-col
v-for="(item, $index) in formData"
v-show="filterBlock(item.parent,item.display_expression)"
v-show="filterBlock(item.parent,item.display_expression,$index,item.field_key)"
:key="$index"
:span="12"
style="position: relative"
@ -22,7 +22,7 @@
<el-input
disabled
class="halfWidth originBlock"
v-model="originForm[item.field_key]"
v-model="item.origin_value"
placeholder="请输入"
@input="keyChange($index,item.field_key)"
/>
@ -40,7 +40,7 @@
<el-input
disabled
class="halfWidth originBlock"
v-model="originForm[item.field_key]"
v-model="item.origin_value"
type="number"
placeholder="请输入"
@input="keyChange($index,item.field_key)"
@ -60,7 +60,7 @@
<el-input
disabled
class="halfWidth originBlock"
v-model="originForm[item.field_key]"
v-model="item.origin_value"
type="number"
placeholder="请输入"
@input="keyChange($index,item.field_key)"
@ -79,7 +79,7 @@
>
<el-date-picker
disabled
v-model="originForm[item.field_key]"
v-model="item.origin_value"
class="halfWidth originBlock"
type="date"
placeholder="选择日期"
@ -101,7 +101,7 @@
>
<el-date-picker
disabled
v-model="originForm[item.field_key]"
v-model="item.origin_value"
class="halfWidth originBlock"
type="datetime"
placeholder="选择日期"
@ -123,7 +123,7 @@
>
<el-select
disabled
v-model="originForm[item.field_key]"
v-model="item.origin_value"
class="halfWidth originBlock"
placeholder="请选择"
@change="keyChange($index,item.field_key)"
@ -155,7 +155,7 @@
>
<el-select
disabled
v-model="originForm[item.field_key]"
v-model="item.origin_value"
class="halfWidth originBlock"
multiple
placeholder="请选择"
@ -225,8 +225,10 @@
<el-radio v-model="is_testok" :label="testokFalse">检查不合格</el-radio>
</el-form-item>
<div class="dialog-footer" style="text-align: right">
<el-button @click="innerVisible = false"> </el-button>
<el-button type="primary" @click="submitfield">提交检查项目</el-button>
<el-button @click="recordCancel"> </el-button>
<!--<el-button type="primary" @click="submitfield">提交检查项目</el-button>-->
<el-button type="primary" @click="submitfield('1')">保存</el-button>
<el-button type="warning" @click="submitfield('2')">提交</el-button>
</div>
</el-row>
</el-form>
@ -257,7 +259,7 @@
type:Number,
default:0
},
origintest: {
recordId: {
type:Number,
default:0
},
@ -268,9 +270,9 @@
},
mounted() {
let that = this;
this.form = this.formID;
that.form = this.formID;
let formData=this.results;
this.origins=this.originList;
// that.origins=this.originList;
that.wproductId=this.wproduct;
that.origin_test=this.origintest;
formData.forEach(item => {
@ -297,11 +299,11 @@
that.judgeList.push(obj)
});
//原始表的数据
for(let i=0;i<this.origins.length;i++){
/*for(let i=0;i<this.origins.length;i++){
let key = this.origins[i].field_key;
that.originForm[key]=this.origins[i].field_key;
that.$set(that.originForm,key,this.origins[i].field_value)
}
}*/
//图片地址
let imag= this.formData.filter(item => {
return item.field_type === 'draw';
@ -331,10 +333,10 @@
checkForm:{},
originForm:{},
testrecord:{
form:this.formID,
// form:this.formID,
record_data:[],
is_testok:true,
wproduct:null,
// wproduct:null,
},
origin_test:null,
canvas:null,
@ -361,7 +363,7 @@
}
},
methods:{
filterBlock(parent,rule){
filterBlock(parent,rule,index,field_key){
// debugger;
let that = this;
if(parent!==''&&parent!==null&&parent!==undefined){
@ -408,6 +410,12 @@
rea = true;
}
}
if(rea){
that.formData[index].is_hidden = false;
}else{
that.formData[index].is_hidden = true;
that.checkForm[field_key] = null;
}
return rea;
}else{
let temp =rule.match(reg)[0];
@ -415,13 +423,21 @@
let a = rule.replace(key, 'yy');
a = a.replace(key, 'yy');
let yy = "'"+that.checkForm[key]+"'";
if(eval(eval(a))){
that.formData[index].is_hidden = false;
}else{
that.formData[index].is_hidden = true;
that.checkForm[field_key] = null;
}
return eval(eval(a));
// return eval("'"+y+"'"+str);
}
}else{
that.formData[index].is_hidden = true;
that.checkForm[field_key] = null;
return false;
}
}else{
that.formData[index].is_hidden = false;
return true;
}
},
@ -741,7 +757,7 @@
}
},
//提交检查项目
submitfield() {
submitfield(isSubmit) {
let that = this;
let drawArr = that.formData.filter(item=>{
return item.field_type==='draw';
@ -765,24 +781,39 @@
}
});
}else{
that.fieldData();
that.fieldData(isSubmit);
}
},
fieldData(){
fieldData(isSubmit){
let that = this;
that.field = []; //检查项目
let submit = isSubmit=='1'?false:true;
that.formData.forEach((item) => {
that.field.push({
form_field: item.id,
field_value: that.checkForm[item.field_key],
is_testok: item.is_testok//单项检查结果
});
if(!item.is_hidden){
that.field.push({
id: item.id,
field_value: that.checkForm[item.field_key],
is_testok: item.is_testok,//单项检查结果
is_hidden: item.is_hidden
});
}
});
that.testrecord.form = that.formID;//检查表
// that.testrecord.form = that.formID;//检查表
that.testrecord.record_data = that.field;//检查项列表
that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.testrecord.wproduct = that.wproductId;//半成品ID
this.$emit('formFunc',that.testrecord);
// that.testrecord.wproduct = that.wproductId;//半成品ID
// that.testrecord.is_submited = true;
that.testrecord.id = that.recordId;
debugger;
if(submit){//提交
this.$emit('recordSubmit',that.testrecord);
}else {//保存
this.$emit('recordSave',that.testrecord);
}
},
recordCancel(){
this.$emit('recordCancel','')
},
}
}

View File

@ -183,8 +183,8 @@ export const asyncRoutes = [
path: 'gantt',
name: 'gantt',
component: () => import('@/views/pm/gantt'),
meta: { title: '甘特图', perms: ['vendor_manage'] },
hidden: true
meta: { title: '甘特图', icon: 'example',perms: ['vendor_manage'] },
// hidden: true
}
]
}

View File

@ -2,7 +2,6 @@
<div
class="slider"
ref="slider"
:style="{ width: '100%', display: inline-block}"
>
<div
class="process"
@ -113,6 +112,8 @@ export default {
border-radius: 3px;
cursor: text;
user-select: none;
width: 100%;
display: inline-block
}
.slider .process {
position: absolute;

View File

@ -1,44 +1,45 @@
<template>
<div class="chart" ref="chart">
<div class="left" :style="{ width: rightLineX + 'px' }">
<leftMenu
:list="list"
ref="leftMenu"
:BGScrollTop.sync="BGScrollTop"
@TableScrollTop="TableScrollTop"
@handlerRowClick="handlerRowClick"
@handlerGroup="handlerGroup"
@handlerExpand="handlerExpand"
></leftMenu>
<div class="rightLine" :style="{ left: rightLineX + 'px' }"></div>
<div
class="rightLine"
:style="{ left: rightLineX + 'px' }"
ref="rightLine"
@mousedown="rightLineMousedown"
></div>
</div>
<div class="date" :style="{ left: rightLineX + 2 + 'px' }">
<div class="years" v-for="item in allDays" :key="item.year">
<div>
<div class="chart" ref="chart">
<div class="left" :style="{ width: rightLineX + 'px' }">
<leftMenu
:list="list"
ref="leftMenu"
:BGScrollTop.sync="BGScrollTop"
@TableScrollTop="TableScrollTop"
@handlerRowClick="handlerRowClick"
@handlerGroup="handlerGroup"
@handlerExpand="handlerExpand"
></leftMenu>
<div class="rightLine" :style="{ left: rightLineX + 'px' }"></div>
<div
class="month"
v-for="(value, key) in item.month[0]"
:key="value + 'zz' + key"
:style="{ width: value.length * currentDaySize.value + 'px' }"
>
<div class="month-top">{{ item.year }}{{ key }}</div>
</div>
class="rightLine"
:style="{ left: rightLineX + 'px' }"
ref="rightLine"
@mousedown="rightLineMousedown"
></div>
</div>
<div class="topMonth" v-if="showFixdTopMonth">{{ fixdTopMonth }}</div>
<div class="allDaysArray">
<div class="alldays">
<div class="date" :style="{ left: rightLineX + 2 + 'px' }">
<div class="years" v-for="item in allDays" :key="item.year">
<div
v-for="(j, index) in days"
:key="index"
class="day"
:style="{ width: currentDaySize.value + 'px' }"
class="month"
v-for="(value, key) in item.month[0]"
:key="value + 'zz' + key"
:style="{ width: value.length * currentDaySize.value + 'px' }"
>
<template v-if="currentDaySize.value === 20">
<div class="month-top">{{ item.year }}{{ key }}</div>
</div>
</div>
<div class="topMonth" v-if="showFixdTopMonth">{{ fixdTopMonth }}</div>
<div class="allDaysArray">
<div class="alldays">
<div
v-for="(j, index) in days"
:key="index"
class="day"
:style="{ width: currentDaySize.value + 'px' }"
>
<template v-if="currentDaySize.value === 20">
<span
v-if="j.today"
class="dateNum todayDateNum"
@ -46,34 +47,34 @@
>
今天
</span>
<span
v-else
class="dateNum"
:style="{
<span
v-else
class="dateNum"
:style="{
borderLeft: index == 0 ? 'none' : '1px solid #d7d7d7'
}"
:class="{
:class="{
weekday: j.weekday == 0 || j.weekday == 6,
isHover:
j.width >= currentLineDay.start &&
j.width <= currentLineDay.end
}"
>{{ j.date }}</span>
<span
class="dateBG"
:class="{
>{{ j.date }}</span>
<span
class="dateBG"
:class="{
weekday2: j.weekday == 0,
weekday1: j.weekday == 6,
today: j.today
}"
:style="{
:style="{
width: currentDaySize.value + 'px',
height:
j.weekday == 0 || j.weekday == 6 ? lineBGHeight : '0px'
}"
></span>
</template>
<template v-if="currentDaySize.value == 10">
></span>
</template>
<template v-if="currentDaySize.value == 10">
<span
class="dateNum"
:class="{
@ -100,21 +101,21 @@
{{ j.date }}
</div>
</span>
<span
class="dateBG"
:class="{
<span
class="dateBG"
:class="{
weekday2: j.weekday === 0,
weekday1: j.weekday === 6,
today: j.today
}"
:style="{
:style="{
width: currentDaySize.value + 'px',
height:
j.weekday === 0 || j.weekday === 6 ? lineBGHeight : '0px'
}"
></span>
</template>
<template v-if="currentDaySize.value === 2">
></span>
</template>
<template v-if="currentDaySize.value === 2">
<span
class="dateNum"
:class="{
@ -140,34 +141,36 @@
{{ j.date }}
</div>
</span>
<span
class="dateBG weekday2"
:class="{
<span
class="dateBG weekday2"
:class="{
today: j.today
}"
style="border-right:none;"
:style="{
style="border-right:none;"
:style="{
width: currentDaySize.value + 'px',
height:
j.weekday === 0 || j.weekday === 6 ? lineBGHeight : '0px'
}"
></span>
</template>
></span>
</template>
</div>
</div>
</div>
<div class="lineBG" @scroll="handlerBGScroll" ref="lineBG">
<template v-for="(item, index) in computedList">
<!--<div :key="item.id" class="tetst">{{item.id}}</div>-->
<div
:ref="'line' + item.id"
:key="item.id + index"
class="line"
:style="{
<div class="lineBG" @scroll="handlerBGScroll" ref="lineBG">
<template v-for="(item, index) in computedList">
<!--<div :key="item.id" class="tetst">{{item.isShow}}</div>-->
<div
v-show="item.isShow"
:ref="'line' + item.id"
:key="item.id + index"
class="line"
:style="{
left: item.left + 'px',
width: item.widthMe + 'px',
top: item.top + 'px'
}"
@mouseover="
@mouseover="
lineMouseover(
`line${item.id}`,
$event,
@ -176,8 +179,8 @@
index
)
"
@mouseleave="lineMouseleave"
@mouseenter="
@mouseleave="lineMouseleave"
@mouseenter="
lineMouseenter(
`line${item.id}`,
$event,
@ -186,88 +189,89 @@
index
)
"
>
<slider
v-show="item.type == 1"
:id="item.id"
v-model="item.per"
:min="0"
:max="item.per"
:per1="item.per1"
:disabled="disable"
:widths="item.widthChild"
></slider>
</div>
<div
v-if="item.type == 3"
:key="item.id"
class="group"
:style="{
>
<slider
v-show="item.type == 1"
:id="item.id"
v-model="item.per"
:min="0"
:max="item.per"
:per1="item.per1"
:disabled="disable"
:widths="item.widthChild"
></slider>
</div>
<div
v-if="item.type == 3"
:key="item.id"
class="group"
:style="{
top: item.top + 'px',
left: item.left + 'px',
width: item.widthMe + 'px'
}"
>
<div class="progress" :style="{ width: item.per + '%' }"></div>
</div>
</template>
>
<div class="progress" :style="{ width: item.per + '%' }"></div>
</div>
</template>
</div>
</div>
</div>
<div class="toolTip">
<!--<div class="today base" @click="handleGoToday">今天</div>-->
<el-dropdown trigger="click">
<div class="toolTip">
<!--<div class="today base" @click="handleGoToday">今天</div>-->
<el-dropdown trigger="click">
<span class="base">
{{this.currentDaySize.label}}
<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu
slot="dropdown"
:style="{ left: this.left + 'px !important' }"
>
<el-dropdown-item
v-for="item in currentDaySizeOptions"
:key="item.value + 'ck'"
@click.native="handleSetDaySize(item)"
<el-dropdown-menu
slot="dropdown"
:style="{ left: this.left + 'px !important' }"
>
{{ item.label }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<transition name="el-zoom-in-center">
<div
v-show="isShowMsg"
:style="{
<el-dropdown-item
v-for="item in currentDaySizeOptions"
:key="item.value + 'ck'"
@click.native="handleSetDaySize(item)"
>
{{ item.label }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<transition name="el-zoom-in-center">
<div
v-show="isShowMsg"
:style="{
left: currentProjectMsg.left + 'px',
top: currentProjectMsg.top + 'px'
}"
class="projectMsg"
>
<div class="lineMsg projectName">
{{ currentProjectMsg.name }}
class="projectMsg"
>
<div class="lineMsg projectName">
{{ currentProjectMsg.name }}
</div>
<div class="lineMsg">
<span class="title">工作周期</span>
<span>{{ currentProjectMsg.allTime }}</span>
</div>
<div class="lineMsg">
<span class="title">当前进度</span>
<span>{{ currentProjectMsg.per }}</span>
</div>
<div class="lineMsg">
<span class="title">合格数量</span>
<span>{{ currentProjectMsg.per1 }}</span>
</div>
<div class="lineMsg">
<span class="title">开始时间</span>
<span>{{ currentProjectMsg.startTime }}</span>
</div>
<div class="lineMsg">
<span class="title">结束时间</span>
<span>{{ currentProjectMsg.endTime }}</span>
</div>
</div>
<div class="lineMsg">
<span class="title">工作周期</span>
<span>{{ currentProjectMsg.allTime }}</span>
</div>
<div class="lineMsg">
<span class="title">当前进度</span>
<span>{{ currentProjectMsg.per }}</span>
</div>
<div class="lineMsg">
<span class="title">合格数量</span>
<span>{{ currentProjectMsg.per1 }}</span>
</div>
<div class="lineMsg">
<span class="title">开始时间</span>
<span>{{ currentProjectMsg.startTime }}</span>
</div>
<div class="lineMsg">
<span class="title">结束时间</span>
<span>{{ currentProjectMsg.endTime }}</span>
</div>
</div>
</transition>
</transition>
</div>
</div>
</div>
</template>
@ -284,8 +288,8 @@
},
data() {
return {
//当前项是否是子集
disable: true,
//当前项是否是子集
isChildren: false,
dialogVal: false,
//title
@ -375,33 +379,35 @@
let that = this;
getPlanGantt({}).then(res=>{
if(res.code===200){
debugger;
// debugger;
let arr =[];
let list = res.data.results;
list.forEach(item => {
if (!item.children || item.children.length < 1) {
let startTime = new Date(item.startTime).getTime();
let endTime = new Date(item.endDate).getTime();
let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime();
let obj=new Object();
obj.name=item.number;
obj.id=item.id;
obj.top=20;
obj.startTime=startTime;
obj.endTime=endTime;
obj.planTime = [startTime,endTime];
obj.per=item.count;
obj.per1=item.count_real;
obj.type=3;
obj.type=1;
obj.isShow= true;
arr.push(obj);
} else if (item.children && item.children.length >= 1) {
let startTime = new Date(item.start_date).getTime();
let endTime = new Date(item.start_date).getTime();
let endTime = new Date(item.end_date).getTime();
debugger;
let temp =[];
let parentId = item.id;
let children = item.children;
children.forEach(child => {
let start = new Date(item.start_date).getTime();
let end = new Date(item.end_date).getTime();
let start = new Date(child.start_date).getTime();
let end = new Date(child.end_date).getTime();
let objChild = new Object();
objChild.name = child.number;
objChild.id = child.id;
@ -409,6 +415,7 @@
objChild.parentId=parentId;
objChild.startTime = start;
objChild.endTime = end;
objChild.planTime = [start,end];
objChild.per = child.count;
objChild.per1 = child.count_real;
objChild.type = 1;
@ -422,6 +429,7 @@
obj.top=20;
obj.startTime=startTime;
obj.endTime=endTime;
obj.planTime = [startTime,endTime];
obj.per=item.count;
obj.per1=item.count_real;
obj.type=3;
@ -430,7 +438,7 @@
arr.push(obj);
}
that.list = arr;
that.handlerCheckList(arr);
that.handlerCheckList(that.list);
});
console.log(that.list);
}else{
@ -440,7 +448,7 @@
},
computed: {
computedList() {
debugger;
// debugger;
console.log(this.list);
let arr = [];
this.list.forEach(item => {
@ -485,7 +493,7 @@
//过滤导入的数据
handlerCheckList(list) {
list.forEach((item, index) => {
item.planTime = [];
item.planTime = [item.startTime, item.endTime];
item.left = this.computedTimeWidth(item.startTime);
item.widthMe = item.widthChild = this.computedTimeWidth(item.startTime, item.endTime) ;
item.isShow = true;
@ -495,14 +503,11 @@
item.isexpand = true;
if (item.children.length > 0) {
item.children.forEach((k, i) => {
k.planTime = [];
k.top = item.top + i * 40 + 35;
k.planTime = [k.startTime, k.endTime];
k.top = item.top + i * 40 + 40;
k.isShow = true;
k.left = this.computedTimeWidth(k.startTime);
k.widthMe = k.widthChild = this.computedTimeWidth(
k.startTime,
k.endTime
);
k.widthMe = k.widthChild = this.computedTimeWidth(k.startTime,k.endTime,k);
});
}
}
@ -514,14 +519,11 @@
item.isexpand = true;
if (item.children.length > 0) {
item.children.forEach((z, o) => {
z.planTime = [];
z.top = item.top + o * 40;
z.planTime = [z.startTime, z.endTime];
z.top = item.top + o * 40+40;
z.isShow = true;
z.left = this.computedTimeWidth(z.startTime);
z.widthMe = z.widthChild = this.computedTimeWidth(
z.startTime,
z.endTime
);
z.widthMe = z.widthChild = this.computedTimeWidth(z.startTime, z.endTime,z);
});
}
}
@ -564,34 +566,17 @@
}
this.resetTop(rowIndex, !expand, true);
},
//分组添加子集
handleGroupAdd(row) {
this.$nextTick(() => {
this.$refs.dialogAdd.resetFields();
});
this.currentListIndex = this.list.findIndex(item => {
return item.id == row.id;
});
this.dialogVal = true;
this.isChildren = true;
},
// 根据时间计算距离
computedTimeWidth(startTime, endTime) {
let start = new Date(startTime).getTime();
let end = new Date(endTime).getTime();
let left =
(Math.floor(
start - new Date(`${this.currentYear - 1}/01/01`).getTime()
) /
(1000 * 60 * 60 * 24)) *
this.currentDaySize.value;
let width =
(Math.floor(end - start) / (1000 * 60 * 60 * 24)) *
this.currentDaySize.value +
this.currentDaySize.value;
if (!endTime) {
let left =
(Math.floor( startTime - new Date(`${this.currentYear - 1}/01/01`).getTime() ) /
(1000 * 60 * 60 * 24)) *this.currentDaySize.value;
return left;
} else {
let width = (Math.floor(endTime - startTime) / (1000 * 60 * 60 * 24)) * this.currentDaySize.value + this.currentDaySize.value;
debugger;
console.log(width);
return width;
}
},
@ -704,9 +689,8 @@
behavior: "smooth"
});
},
//更改daySize
//更改daySize-----按天/按周/按月
handleSetDaySize(item) {
// console.log(item);
this.currentDaySize = item;
this.days.forEach((item, index) => {
item.width = (index + 1) * this.currentDaySize.value;
@ -804,8 +788,7 @@
* @param {Boolean|String} time
*/
computedWithTime(width, time) {
let startTime =
(width / this.currentDaySize.value) * (1000 * 60 * 60 * 24) +
let startTime = (width / this.currentDaySize.value) * (1000 * 60 * 60 * 24) +
new Date(`${this.currentYear - 1}/01/01`).getTime();
let s = new Date(startTime);
if (time && time == true) {

View File

@ -40,7 +40,7 @@
</el-link>
<el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope)"
@click="checkRecord(scope,'1')"
>检验记录
</el-link>
</template>
@ -85,11 +85,22 @@
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])&&scope.row.test===null"
@click="handleInspection(scope,'2')"
>检验
</el-link>
<el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope,'2')"
>检验记录
</el-link>
<!--<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleInspection(scope,'2')"
>
检验
</el-link>
</el-link>-->
</template>
</el-table-column>
</el-table>
@ -146,8 +157,12 @@
v-if="checkPermission(['warehouse_update'])"
@click="handlePutin(scope)"
>入库
</el-link
>
</el-link>
<el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope)"
>检验记录
</el-link>
</template>
</el-table-column>
</el-table>
@ -194,8 +209,12 @@
v-if="checkPermission(['warehouse_update'])"
@click="handleInspection(scope)"
>检验
</el-link
>
</el-link>
<el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope,'1')"
>检验记录
</el-link>
</template>
</el-table-column>
</el-table>
@ -220,7 +239,7 @@
>
</el-option>
</el-select>
<!--第一次操作时的展示-->
<!-- &lt;!&ndash;第一次操作时的展示&ndash;&gt;
<el-dialog
width="60%"
:title="formName"
@ -232,11 +251,12 @@
:hasPicture="hasPicture"
:formID="recordform"
:wproduct="wproduct"
:origin_test="origin_test"
@formFunc="formFunc"
:recordId="recordId"
@recordSubmit="recordSubmit"
@recordSave="recordSave"
/>
</el-dialog>
<!--复检检验表单-->
&lt;!&ndash;复检检验表单&ndash;&gt;
<el-dialog
width="60%"
:title="formName"
@ -248,12 +268,11 @@
:originList="originList"
:formID="recordform"
:hasPicture="hasPicture"
:recordItem="recordItem"
:wproduct="wproduct"
:origintest="origintest"
@formFunc="formFunc"
/>
</el-dialog>
</el-dialog>-->
<div slot="footer" class="dialog-footer">
<el-button @click="outerVisible = false">
@ -261,22 +280,43 @@
<el-button type="primary" @click="submitrecordform(innerIndex)">填写检查项目</el-button>
</div>
</el-dialog>
<!--保存过的检查表显示-->
<!--复检检验表单-->
<el-dialog
width="60%"
:title="formName"
@close="recordCancel"
:visible.sync="limitedReview"
:close-on-click-modal="false"
>
<reviewForm
:results="fieldList"
:originList="originList"
:formID="recordform"
:hasPicture="hasPicture"
:wproduct="wproduct"
:recordId="recordId"
@recordSave="recordSave"
@recordSubmit="recordSubmit"
@recordCancel="recordCancel"
/>
</el-dialog>
<!--非检查表显示-->
<el-dialog
width="60%"
:title="formName"
:visible.sync="recordVisible"
:close-on-click-modal="false"
@close="recordCancel"
>
<customForm
v-if="recordVisible"
:results="fieldList"
:hasPicture="hasPicture"
:formID="recordform"
:wproduct="wproduct"
:recordId="recordId"
:recordItem="recordItem"
@recordSubmit="recordSubmit"
@recordSave="recordSave"
@recordCancel="recordCancel"
/>
</el-dialog>
@ -314,8 +354,6 @@
:data="recordList"
border
height="400"
@close="pageRefresh"
@closed="pageRefresh"
>
<el-table-column type="index" width="50"/>
<el-table-column label="表单名称">
@ -387,7 +425,7 @@
<script>
import customForm from '@/components/customForm/index';
import reviewForm from '@/components/customForm/review';
import {getwproductList, wproductTest, wproductPutin, createputins,wproductReview} from "@/api/wpm";
import {getwproductList, wproductTest, wproductPutin, createputins,testInit} from "@/api/wpm";
import checkPermission from "@/utils/permission";
import {getWarehouseList} from "@/api/inm";
import {getMaterialList, getrecordformList, getrffieldList} from "@/api/mtm";
@ -481,7 +519,6 @@
isPost: false,
origin_test: null,
hasPicture: false,
recordItem: false,
outerVisible: false,
innerVisible: false,
limitedReview: false,
@ -554,7 +591,7 @@
},
//批量入库
putins() {
let _this = this
let _this = this;
_this.mutipID = []
this.$refs.multipleTable.selection.forEach((item) => {
_this.mutipID.push(item.id);
@ -585,28 +622,43 @@
//点击检验:如果有一个直接进入如果有多个表再进行选择
handleInspection(scope,index) {
//调该物料对应的检查表
debugger;
let that = this;
this.innerIndex = index;
this.outerVisible = true;
// this.outerVisible = true;
this.wproduct = scope.row.id;//半成品ID
this.wproductactstate = scope.row.act_state;//半成品状态
this.listQueryrecordform.material = scope.row.material;//
this.listQueryrecordform.material = scope.row.material_.id;//
this.listQueryrecordform.type = 2;
this.recordform = null;
getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) {
debugger;
this.recordformList = response.data;
if(response.data.length===1){
that.recordform = response.data[0].id;
that.formName = response.data[0].name;
that.submitrecordform(index);
}else{
//弹出列表选择框
this.outerVisible = true;
}
}
});
},
//检验记录
checkRecord(scope){
//选择物料检查表
recordformChange() {
let that = this;
let arr = this.recordformList.filter(item => {
return item.id === that.recordform;
});
that.formName = arr[0].name;
// this.outerVisible = false;
// that.submitrecordform(that.innerIndex);
},
//检验记录
checkRecord(scope,index){
let that = this;
that.innerIndex = index;
that.wproduct = scope.row.id;//半成品ID
that.limitedCheckRecord = true;
getTestRecord({wproduct:scope.row.id}).then(res=>{
@ -620,46 +672,79 @@
},
//点击记录里的检验
handleInspectionRecord(scope){
debugger;
let that =this;
that.recordVisible = false;
that.recordId = scope.row.id;
that.recordform = scope.row.form;
getrffieldList({form: this.recordform, page: 1, page_size: 100}).then((response) => {
if (response.data) {
that.hasPicture = false;
let fieldList = response.data.results;
that.fieldList = [...fieldList];
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
that.formName = scope.row.form_.name;
if(that.innerIndex==='1'){//非复检
getrffieldList({form: this.recordform, page: 1, page_size: 100}).then((response) => {
if (response.data) {
that.hasPicture = false;
let fieldList = response.data.results;
that.fieldList = [...fieldList];
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
getTestRecordItem(scope.row.id).then((res) => {
debugger;
let arr = [];
let fieldList = res.data.record_data;
for(let i=0;i<that.fieldList.length;i++){
let obj = that.fieldList[i];
obj.is_testok = null;
for(let j=0;j<fieldList.length;j++){
if(that.fieldList[i].field_key===fieldList[j].field_key){
obj.id = fieldList[j].id;
obj.is_testok = fieldList[j].is_testok;
obj.field_value = fieldList[j].field_value;
}
}
arr.push(obj)
}
that.fieldList = arr;
that.$nextTick(()=>{
that.recordVisible = true;
});
})
}
getTestRecordItem(scope.row.id).then((res) => {
debugger;
let arr = [];
});
}else if(that.innerIndex==='2'){//复检
getTestRecordItem(scope.row.id).then((res) => {
if (res.data) {
that.hasPicture = false;
let fieldList = res.data.record_data;
for(let i=0;i<that.fieldList.length;i++){
that.fieldList = [...fieldList];
that.origintest = res.data.origin_test;
that.recordform = res.data.origin_test_.form;
let originList = res.data.origin_test_.record_data;
that.originList = [...originList];
for (let i = 0; i < that.fieldList.length; i++) {
let obj = that.fieldList[i];
obj.is_testok = null;
for(let j=0;j<fieldList.length;j++){
if(that.fieldList[i].field_key===fieldList[j].field_key){
obj.id = fieldList[j].id;
obj.is_testok = fieldList[j].is_testok;
obj.field_value = fieldList[j].field_value;
for (let j = 0; j < originList.length; j++) {
if (that.fieldList[i].field_key === originList[j].field_key) {
obj.id = originList[j].id;
obj.is_testok = originList[j].is_testok;
obj.field_value = originList[j].field_value;
obj.origin_value = originList[j].field_value;
}
}
arr.push(obj)
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
this.limitedReview = true;
}
that.fieldList = arr;
that.recordItem = true;
that.$nextTick(()=>{
that.recordVisible = true;
});
})
}
});
}
})
}
},
//点击记录里的查看
handleRecordDetail(scope){
@ -667,15 +752,18 @@
},
//半产品复检
handleReview() {
debugger;
let that = this;
wproductReview({ wproduct: this.wproduct,form: that.recordform}).then((response) => {
testInit({ wproduct: this.wproduct,form: that.recordform}).then((response) => {
if (response.data) {
debugger;
that.hasPicture = false;
that.formName = response.data.name;
let fieldList = response.data.form_fields;
that.recordId = response.data.id;
that.formName = response.data.form_.name;
let fieldList = response.data.record_data;
that.fieldList = [...fieldList];
that.origintest = response.data.origin_test;
that.recordform = response.data.origin_test_.form;
// that.recordform = response.data.origin_test_.form;
let originList = response.data.origin_test_.record_data;
that.originList = [...originList];
let arr = fieldList.filter(item => {
@ -688,47 +776,36 @@
}
});
},
//选择物料检查表
recordformChange() {
let that = this;
let arr = this.recordformList.filter(item => {
return item.id === that.recordform;
});
that.formName = arr[0].name;
},
//根据选择的表渲染检查项目
submitrecordform(index) {
debugger;
let that = this;
this.outerVisible = false;
if (that.recordform != "") {
if(index==='1'){
wproductReview({ wproduct: that.wproduct,form: that.recordform}).then((response) => {
if(index==='1'){//非复检
testInit({ wproduct: that.wproduct,form: that.recordform}).then((response) => {
if (response.data) {
debugger;
that.hasPicture = false;
that.origin_test = response.data.origin_test;
that.formName = response.data.name;
/* let fieldList = response.data.form_fields;
that.fieldList = [...fieldList];*/
let list = [];
let fieldList = response.data.form_fields;
for(let i=0;i<fieldList.length;i++){
let obj = fieldList[i];
obj.is_testok = true;
obj.field_value = null;
list.push(obj)
}
that.fieldList = list;
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
that.recordItem =false;
that.innerVisible = true;
that.recordId = response.data.id;
getTestRecordItem(response.data.id).then((res) => {
that.formName = res.data.form_.name;
let fieldList = res.data.record_data;
that.fieldList = [...fieldList];
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
that.$nextTick(()=>{
that.recordVisible = true;
});
})
}
});
}else if(index==='2'){
}else if(index==='2'){//复检
debugger;
that.handleReview();
}
} else this.$message.error("请选择检查表!");
@ -761,6 +838,10 @@
if(res.code>=200){
that.$message.success("成功");
that.refreshRecord();
that.getList();
that.getList2();
that.getList1();
that.getList3();
}else{
this.$message.error(res.msg);
}
@ -781,17 +862,23 @@
}
})
},
//记录保存检查项目
//保存检查项目
recordSave(value) {
debugger;
let that = this;
let id = value.id;
let params = {};
params.record_data = value.record_data;
params.is_testok = value.is_testok;
putTestRecordItem(id,params).then((res) => {
debugger;
if (res.code >= 200) {
that.recordVisible = false;
that.reload();
that.limitedReview = false;
that.getList();
that.getList2();
that.getList1();
that.getList3();
that.refreshRecord();
}else{
this.$message.error(res.msg)
@ -812,7 +899,12 @@
subTestRecordItem(id,params).then((res) => {
if (res.code >= 200) {
that.recordVisible = false;
that.reload();
that.limitedReview = false;
that.limitedCheckRecord = false;
that.getList();
that.getList2();
that.getList1();
that.getList3();
that.refreshRecord();
}
});
@ -824,23 +916,13 @@
});
},
//第一次保存提交检查项目
formFunc(value) {
let that = this;
if(that.isPost){
return;
}else{
that.isPost = true;
wproductTest(value).then((res) => {
that.isPost = false;
if (res.code >= 200) {
that.innerVisible = false;
that.outerVisible = false;
that.reload()
}
}).catch(()=>{
this.isPost = true;
});
}
recordCancel() {
this.recordVisible = false;
this.limitedReview = false;
this.getList();
this.getList2();
this.getList1();
this.getList3();
},
pageRefresh(){
this.reload()

View File

@ -181,7 +181,7 @@
:title="fieldList.name"
>
<el-form label-width="80px" label-position="right">
<el-row v-for="(item, $index) in fieldList.form_fields" :key="$index">
<el-row v-for="(item, $index) in fieldList.record_data" :key="$index">
<el-form-item
v-if="item.field_type === 'string'"
:label="item.field_name"
@ -782,10 +782,10 @@ export default {
recordconfirm() {
let _this = this;
_this.record_data = []; //检查项目
this.fieldList.form_fields.forEach((item) => {
this.fieldList.record_data.forEach((item) => {
_this.record_data.push({
form_field: item.id,
field_value: item.sort,
id: item.id,
field_value: item.field_value,
});
});
this.record.record_data = _this.record_data;