|
|
@@ -1,4 +1,4 @@
|
|
|
-<!-- @desc:新建编辑成型记录 @auth:付斌 @time:2023/2/15 13:52 -->
|
|
|
+<!-- @desc:新建编辑报工 @auth:付斌 @time:2023年6月13日14:33:01 -->
|
|
|
<template>
|
|
|
<div class="main-div" ref="mainDiv">
|
|
|
<loading :loading="loading" v-if="!modalVisible"></loading>
|
|
|
@@ -6,7 +6,7 @@
|
|
|
<template #left>
|
|
|
<!-- 清空明细 -->
|
|
|
<BaseIndexButton ref="clearDetail" name="clearDetail" :disabled="editFlag"
|
|
|
- @click="open($config.routeUrl.moldingRecord.clearDetail)"></BaseIndexButton>
|
|
|
+ @click="open($config.routeUrl.workBook.clearDetail)"></BaseIndexButton>
|
|
|
</template>
|
|
|
</BaseIndexButtonGroup>
|
|
|
<DkPageButton :total="editKeys?editKeys.length:0"
|
|
|
@@ -44,7 +44,7 @@
|
|
|
</DkFormItem>
|
|
|
<!-- 报工金额 -->
|
|
|
<DkFormItem prop="bookAmount">
|
|
|
- <InputPop v-model="formData.bookAmount" readonly ref="bookAmount"/>
|
|
|
+ <InputNumberPop v-model="formData.bookAmount" readonly ref="bookAmount"/>
|
|
|
</DkFormItem>
|
|
|
<!--报工日期-->
|
|
|
<!-- :data-type="$config.dataType.date" -->
|
|
|
@@ -53,7 +53,7 @@
|
|
|
</DkFormItem>
|
|
|
<!-- :required="true"-->
|
|
|
<DkFormItem prop="bookStaff">
|
|
|
- <SelectMagnifier ref="bookStaff" v-model="formData.workBookStaffList1"
|
|
|
+ <SelectMagnifier ref="bookStaff" v-model="formData.workBookStaffList"
|
|
|
:type="this.$config.MagnifierType.staff" searchType="M" @on-ok="staffOk"
|
|
|
:multiple="true" :display-text="formData.staffName"/>
|
|
|
</DkFormItem>
|
|
|
@@ -62,22 +62,20 @@
|
|
|
<DkPanel prop="workBookStaff">
|
|
|
<div slot="content" :style="'height: ' + tableHeight + 'px'">
|
|
|
<!-- 报工员工 -->
|
|
|
- <EditTable ref="moldingRecord" :data="formData.workBookStaffList"
|
|
|
- :columns="staffColumns"
|
|
|
+ <EditTable ref="workBookStaff" :data="formData.workBookStaffList"
|
|
|
+ :columns="formData.projectKind === $config.projectKind.shuLiang ? staffShuLiangColumns: staffJinEColumns"
|
|
|
:height="tableHeight"
|
|
|
:operate-flag="false"
|
|
|
:new-row-flag="false"
|
|
|
- :freeze="false"
|
|
|
- @current-change="currentChange"
|
|
|
- @chooseData="chooseData"
|
|
|
- @changeValue="changeValue"></EditTable>
|
|
|
+ :freeze="false"></EditTable>
|
|
|
</div>
|
|
|
</DkPanel>
|
|
|
<DkPanel prop="workBookItem">
|
|
|
<div slot="content" :style="'height: ' + tableHeight + 'px'">
|
|
|
+
|
|
|
<div v-if="formData.projectKind === $config.projectKind.zhiLiang">
|
|
|
<DkTable v-if="flgVisible" :id="'table-'+$options.name"
|
|
|
- ref="table-select" :data="zhiLiangWorkItemList"
|
|
|
+ ref="table-select" :data="formData.workBookItemList"
|
|
|
primaryKey="itemId"
|
|
|
:pageFlag="false"
|
|
|
:choose-flag="false"
|
|
|
@@ -85,62 +83,68 @@
|
|
|
:height="tableHeight">
|
|
|
<DkTableColumn field="modelName" :title="$t('modelName')"></DkTableColumn>
|
|
|
<DkTableColumn field="unitName" :title="$t('modelUnitName')"></DkTableColumn>
|
|
|
- <DkTableColumn field="unitQty" :title="$t('unitQty')"></DkTableColumn>
|
|
|
- <DkTableColumn field="unitPrice" :title="$t('unitPrice')"></DkTableColumn>
|
|
|
- <DkTableColumn field="bookQty" :title="$t('bookQty')"></DkTableColumn>
|
|
|
- <DkTableColumn field="bookAmt" :title="$t('bookAmt')"></DkTableColumn>
|
|
|
+ <DkTableColumn field="unitQty" :title="$t('unitQty')"
|
|
|
+ :data-type="$config.dataType.number"></DkTableColumn>
|
|
|
+ <DkTableColumn field="unitPrice" :title="$t('unitPrice')" :digits="2"
|
|
|
+ :data-type="$config.dataType.number"></DkTableColumn>
|
|
|
+ <DkTableColumn field="bookQty" :title="$t('bookQty')"
|
|
|
+ :data-type="$config.dataType.number"></DkTableColumn>
|
|
|
+ <DkTableColumn field="bookAmt" :title="$t('bookAmt')" :digits="2"
|
|
|
+ :data-type="$config.dataType.number"></DkTableColumn>
|
|
|
<DkTableColumn field="remarks" :title="$t('remarks')"></DkTableColumn>
|
|
|
|
|
|
<vxe-colgroup title="产品分级">
|
|
|
- <vxe-column v-for="(cItem,cIndex) in dataFenJi" width="100" height="100" min-width="80" :key="cIndex" show-overflow="ellipsis" :field="cItem.field"
|
|
|
+ <vxe-column v-for="(cItem,cIndex) in dataFenJi" width="100" height="100" min-width="80" :key="cIndex"
|
|
|
+ show-overflow="ellipsis" :field="cItem.field"
|
|
|
class-name="setting-value-class"
|
|
|
:title="cItem.title">
|
|
|
<template #default="{ row }">
|
|
|
<!--数字类型-->
|
|
|
<vxe-input size="mini"
|
|
|
type="integer"
|
|
|
- :min="0"
|
|
|
- :max="100" v-model="row[cItem.field]"></vxe-input>
|
|
|
+ :min="-9999999"
|
|
|
+ :max="9999999" v-model="row[cItem.field]"
|
|
|
+ @blur="handleBlur(row, cItem,'grade')"></vxe-input>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
-<!-- <DkTableColumn-->
|
|
|
-<!-- v-for="(cItem,cIndex) in dataFenJi"-->
|
|
|
-<!-- ref="col"-->
|
|
|
-<!-- :key="cIndex"-->
|
|
|
-<!-- :field="cItem.field"-->
|
|
|
-<!-- :digits="cItem.digits"-->
|
|
|
-<!-- :sum="cItem.sum"-->
|
|
|
-<!-- :dataType="cItem.dataType"-->
|
|
|
-<!-- :align="cItem.align"-->
|
|
|
-<!-- width="auto" :filter="false"-->
|
|
|
-<!-- :title="cItem.title"></DkTableColumn>-->
|
|
|
+ <!-- <DkTableColumn-->
|
|
|
+ <!-- v-for="(cItem,cIndex) in dataFenJi"-->
|
|
|
+ <!-- ref="col"-->
|
|
|
+ <!-- :key="cIndex"-->
|
|
|
+ <!-- :field="cItem.field"-->
|
|
|
+ <!-- :digits="cItem.digits"-->
|
|
|
+ <!-- :sum="cItem.sum"-->
|
|
|
+ <!-- :dataType="cItem.dataType"-->
|
|
|
+ <!-- :align="cItem.align"-->
|
|
|
+ <!-- width="auto" :filter="false"-->
|
|
|
+ <!-- :title="cItem.title"></DkTableColumn>-->
|
|
|
</vxe-colgroup>
|
|
|
|
|
|
<vxe-colgroup title="产品缺陷">
|
|
|
- <DkTableColumn
|
|
|
- v-for="(cItem,cIndex) in dataQueXian"
|
|
|
- ref="col"
|
|
|
- :key="cIndex"
|
|
|
- :field="cItem.field"
|
|
|
- :digits="cItem.digits"
|
|
|
- :sum="cItem.sum"
|
|
|
- :dataType="cItem.dataType"
|
|
|
- :align="cItem.align"
|
|
|
- width="auto" :filter="false"
|
|
|
- :title="cItem.title"></DkTableColumn>
|
|
|
+ <vxe-column v-for="(cItem,cIndex) in dataQueXian" width="100" height="100" min-width="80" :key="cIndex"
|
|
|
+ show-overflow="ellipsis" :field="cItem.field"
|
|
|
+ class-name="setting-value-class"
|
|
|
+ :title="cItem.title">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <!--数字类型-->
|
|
|
+ <vxe-input size="mini"
|
|
|
+ type="integer"
|
|
|
+ :min="-9999999"
|
|
|
+ :max="9999999" v-model="row[cItem.field]"
|
|
|
+ @blur="handleBlur(row, cItem,'defect')"></vxe-input>
|
|
|
+ </template>
|
|
|
+ </vxe-column>
|
|
|
</vxe-colgroup>
|
|
|
</DkTable>
|
|
|
</div>
|
|
|
<!--数量、金额报工信息-->
|
|
|
- <EditTable v-else ref="moldingRecord" :data="formData.workBookItemList"
|
|
|
+ <EditTable v-else ref="workBookItem" :data="formData.workBookItemList"
|
|
|
:columns="formData.projectKind === $config.projectKind.shuLiang ? shuLiangColumns: jinEColumns"
|
|
|
:height="tableHeight"
|
|
|
:operate-flag="false"
|
|
|
:new-row-flag="false"
|
|
|
:freeze="false"
|
|
|
- @current-change="currentChange"
|
|
|
- @chooseData="chooseData"
|
|
|
- @changeValue="changeValue"></EditTable>
|
|
|
+ @changeValue="workBookItemChangeValue"></EditTable>
|
|
|
</div>
|
|
|
</DkPanel>
|
|
|
</DkCollapse>
|
|
|
@@ -154,6 +158,7 @@
|
|
|
|
|
|
import {formMixin} from '@/mixins/form'
|
|
|
import TableSelect from '@/components/business/table-select'
|
|
|
+import {forEach} from "@/libs/tools/tools";
|
|
|
|
|
|
export default {
|
|
|
components: {TableSelect},
|
|
|
@@ -161,33 +166,8 @@ export default {
|
|
|
data() {
|
|
|
let self = this
|
|
|
return {
|
|
|
- dataFenJi: [
|
|
|
- {
|
|
|
- field: '产品分级-良',
|
|
|
- title: '良品',
|
|
|
- },
|
|
|
- {
|
|
|
- field: '产品分级-优',
|
|
|
- title: '优品',
|
|
|
- },
|
|
|
- ],
|
|
|
- dataQueXian: [
|
|
|
- {
|
|
|
- field: '裂',
|
|
|
- title: '裂',
|
|
|
- },
|
|
|
- {
|
|
|
- field: '铜脏',
|
|
|
- title: '铜脏',
|
|
|
- },
|
|
|
- {
|
|
|
- field: '123',
|
|
|
- title: '123',
|
|
|
- },
|
|
|
- ],
|
|
|
- // dataFenJi: [],
|
|
|
- // dataQueXian: [],
|
|
|
- zhiLiangWorkItemList: [],
|
|
|
+ dataFenJi: [],
|
|
|
+ dataQueXian: [],
|
|
|
loading: false,
|
|
|
moldlineList: [],// 选择成型线列
|
|
|
userList: [], // 成型工号选择页面数据源
|
|
|
@@ -213,29 +193,39 @@ export default {
|
|
|
itemKind: '',
|
|
|
bookAmount: '',
|
|
|
bookStatus: this.$config.bookStatus.zanCun,
|
|
|
- bookDate: new Date().toDateStr(),
|
|
|
+ bookDate: new Date(),
|
|
|
bookUserId: self.$store.state.user.id,
|
|
|
ftyId: self.$store.state.user.ftyId,
|
|
|
workBookItemList: [], //报工项目明细
|
|
|
- workBookStaffList1: [], // 报工员工
|
|
|
workBookStaffList: [], // 报工员工
|
|
|
},
|
|
|
bookWayList: [
|
|
|
{bookWayId: '统一报工', bookWayName: '统一报工'},
|
|
|
{bookWayId: '自主报工', bookWayName: '自主报工'},
|
|
|
],
|
|
|
- paramslist: [],//保存的参数
|
|
|
|
|
|
// 报工员工
|
|
|
- staffColumns: [
|
|
|
+ staffShuLiangColumns: [
|
|
|
+ // 员工名称
|
|
|
+ {field: 'staffName', type: 'disabled', width: 'auto'},
|
|
|
+ // 员工工种
|
|
|
+ {field: 'jobName', type: 'disabled', width: 'auto'},
|
|
|
+ // 报工数量
|
|
|
+ {field: 'bookQty', type: 'number', min: -9999999, max: 9999999, digits: 0, negative: true, width: 'auto'},
|
|
|
+ // 备注
|
|
|
+ {field: 'remarks', type: 'text', width: 'auto'},
|
|
|
+ ],
|
|
|
+
|
|
|
+ // 报工员工
|
|
|
+ staffJinEColumns: [
|
|
|
// 员工名称
|
|
|
{field: 'staffName', type: 'disabled', width: 'auto'},
|
|
|
// 员工工种
|
|
|
{field: 'jobName', type: 'disabled', width: 'auto'},
|
|
|
// 报工数量
|
|
|
- {field: 'bookQty', title: self.$t('bookQty'), type: 'text', width: 'auto'},
|
|
|
+ {field: 'bookQty', type: 'number', min: -9999999, max: 9999999, digits: 0, negative: true, width: 'auto'},
|
|
|
// 报工金额
|
|
|
- {field: 'bookAmt', title: self.$t('bookAmt'), type: 'text', width: 'auto'},
|
|
|
+ {field: 'bookAmt', type: 'number', min: -9999999, max: 9999999, digits: 2, negative: true, width: 'auto'},
|
|
|
// 备注
|
|
|
{field: 'remarks', type: 'text', width: 'auto'},
|
|
|
],
|
|
|
@@ -248,12 +238,8 @@ export default {
|
|
|
{field: 'unitName', type: 'disabled', width: 'auto'},
|
|
|
// 单位数量
|
|
|
{field: 'unitQty', type: 'disabled', width: 'auto'},
|
|
|
- // 单位价格
|
|
|
- {field: 'unitPrice', type: 'disabled', width: 'auto'},
|
|
|
// 报工数量
|
|
|
- {field: 'bookQty', title: self.$t('bookQty'), type: 'text', width: 'auto'},
|
|
|
- // 报工金额
|
|
|
- {field: 'bookAmt', title: self.$t('bookAmt'), type: 'text', width: 'auto'},
|
|
|
+ {field: 'bookQty', type: 'number', min: -9999999, max: 9999999, digits: 0, negative: true, width: 'auto'},
|
|
|
// 备注
|
|
|
{field: 'remarks', type: 'text', width: 'auto'},
|
|
|
],
|
|
|
@@ -266,11 +252,22 @@ export default {
|
|
|
// 单位数量
|
|
|
{field: 'unitQty', type: 'disabled', width: 'auto'},
|
|
|
// 单位价格
|
|
|
- {field: 'unitPrice', type: 'disabled', width: 'auto'},
|
|
|
+ {field: 'unitPrice', type: 'disabled', digits: 2, number: true, width: 'auto'},
|
|
|
// 报工数量
|
|
|
- {field: 'bookQty', title: self.$t('bookQty'), type: 'text', width: 'auto'},
|
|
|
+ {
|
|
|
+ field: 'bookQty',
|
|
|
+ type: 'number',
|
|
|
+ min: -9999999,
|
|
|
+ max: 9999999,
|
|
|
+ digits: 0,
|
|
|
+ negative: true,
|
|
|
+ width: 'auto',
|
|
|
+ formula: {
|
|
|
+ bookAmt: ['unitPrice*bookQty', 'unitPrice', 'bookQty']
|
|
|
+ }
|
|
|
+ },
|
|
|
// 报工金额
|
|
|
- {field: 'bookAmt', title: self.$t('bookAmt'), type: 'text', width: 'auto'},
|
|
|
+ {field: 'bookAmt', type: 'disabled', width: 'auto', digits: 2, number: true},
|
|
|
// 备注
|
|
|
{field: 'remarks', type: 'text', width: 'auto'},
|
|
|
],
|
|
|
@@ -299,12 +296,12 @@ export default {
|
|
|
|
|
|
this.excuteNoParam(this.$service.workBookService, this.$service.workBookService.getWorkProjectItemByProjectId, [parseInt(this.formData.projectId)]).then(res => {
|
|
|
if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- console.log("res.data", res.data);
|
|
|
if (this.formData.projectKind === this.$config.projectKind.zhiLiang) {
|
|
|
this.flgVisible = false;
|
|
|
- this.zhiLiangWorkItemList = res.data["WorkProjectItem"].copy();
|
|
|
+ this.formData.workBookItemList = res.data["WorkProjectItem"].copy();
|
|
|
this.dataFenJi = res.data["ProductGrade"].copy();
|
|
|
this.dataQueXian = res.data["ProductDefect"].copy();
|
|
|
+
|
|
|
setTimeout(() => {
|
|
|
this.flgVisible = true;
|
|
|
}, 300)
|
|
|
@@ -323,6 +320,61 @@ export default {
|
|
|
this.formData.itemKind = null
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 输入后处理数据
|
|
|
+ * @author : 付斌
|
|
|
+ * @date : 2023-06-28 13:41
|
|
|
+ */
|
|
|
+ handleBlur(row, col, type) {
|
|
|
+ if (type === 'grade') {
|
|
|
+ let workBookItemGradeList = row.workBookItemGradeList || [];
|
|
|
+ let filters = workBookItemGradeList.filter(it => it.pdtGradeId === col.value);
|
|
|
+ // 已经存在
|
|
|
+ if (filters && filters.length > 0) {
|
|
|
+ filters[0].bookQty = row[col.field]
|
|
|
+ } else {
|
|
|
+ workBookItemGradeList.push(
|
|
|
+ {
|
|
|
+ pdtGradeId: col.value,
|
|
|
+ bookQty: row[col.field]
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ this.$set(row, 'workBookItemGradeList', workBookItemGradeList);
|
|
|
+
|
|
|
+ var sumQty = 0;
|
|
|
+ for (var name in row) {
|
|
|
+ if (name.slice(0, 5) === "grade") {
|
|
|
+ var qty = parseInt(row[name]);
|
|
|
+ if (qty.toString() === "NaN") {
|
|
|
+ qty = 0;
|
|
|
+ }
|
|
|
+ sumQty += qty;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ row["bookQty"] = sumQty;
|
|
|
+ row["bookAmt"] = sumQty * parseFloat(row["unitPrice"]);
|
|
|
+
|
|
|
+ } else if (type === 'defect') {
|
|
|
+ let workBookItemDefectList = row.workBookItemDefectList || [];
|
|
|
+ let filters = workBookItemDefectList.filter(it => it.pdtDefectId === col.value);
|
|
|
+ // 已经存在
|
|
|
+ if (filters && filters.length > 0) {
|
|
|
+ filters[0].bookQty = row[col.field]
|
|
|
+ } else {
|
|
|
+ workBookItemDefectList.push(
|
|
|
+ {
|
|
|
+ pdtDefectId: col.value,
|
|
|
+ bookQty: row[col.field]
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ this.$set(row, 'workBookItemDefectList', workBookItemDefectList);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* @desc :
|
|
|
* @author : 付斌
|
|
|
@@ -332,14 +384,15 @@ export default {
|
|
|
if (val && val.length > 0) {
|
|
|
val.forEach(it => {
|
|
|
it.remarks = null
|
|
|
+ this.$set(it, 'bookQty', 0);
|
|
|
+ this.$set(it, 'bookAmt', 0);
|
|
|
})
|
|
|
- this.formData.workBookStaffList1 = val;
|
|
|
this.formData.workBookStaffList = val;
|
|
|
} else {
|
|
|
- this.formData.workBookStaffList1 = null;
|
|
|
this.formData.workBookStaffList = null;
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
// region 选择列表
|
|
|
/**
|
|
|
* @desc : 加载数据
|
|
|
@@ -347,171 +400,7 @@ export default {
|
|
|
* @date : 2023/1/29 16:33
|
|
|
*/
|
|
|
initData() {
|
|
|
- //获取未注浆原因
|
|
|
- this.getUnmoldedReason()
|
|
|
- //获取成型工号
|
|
|
- this.getMoldingUser()
|
|
|
- //获取产品釉色
|
|
|
- this.getProductColour()
|
|
|
- // 获取产品商标
|
|
|
- this.getProductLogo()
|
|
|
- // 编辑获取损坯原因
|
|
|
- if (this.type === this.$config.formMode.edit) {
|
|
|
- this.getScrapReason()
|
|
|
- }
|
|
|
- },
|
|
|
- /**
|
|
|
- * @desc : 获取未注浆原因
|
|
|
- * @author : 付斌
|
|
|
- * @date : 2023/6/25 9:02
|
|
|
- */
|
|
|
- getUnmoldedReason() {
|
|
|
- let params = {
|
|
|
- ftyId: this.$store.state.user.ftyId,
|
|
|
- dictCode: this.$config.dictType.unmoldedReason
|
|
|
- }
|
|
|
- this.excute(this.$service.commonService, this.$service.commonService.getDictionaryData, params).then(res => {
|
|
|
- if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- this.unmoldedReasonList = res.data.copy()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- /**
|
|
|
- * @desc : 获取生产-未成型原因
|
|
|
- * @date : 2023/6/5 14:34
|
|
|
- * @author : 付斌
|
|
|
- */
|
|
|
- // getUnmoldedReason() {
|
|
|
- // let params = {
|
|
|
- // ftyId: this.$config.defaultFty.id,
|
|
|
- // dictCode: this.$config.dictType.unmoldedReason
|
|
|
- // }
|
|
|
- // this.excute(this.$service.commonService, this.$service.commonService.getDictionaryData, params).then(res => {
|
|
|
- // if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- // this.defaultUnmoldedReasonList = res.data.copy()
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
- /**
|
|
|
- * @desc : 获取成型工号
|
|
|
- * @author : 付斌
|
|
|
- * @date : 2023/6/25 11:49
|
|
|
- */
|
|
|
- getMoldingUser() {
|
|
|
- let params = {
|
|
|
- ftyId: this.$store.state.user.ftyId,
|
|
|
- userType: this.$config.userType.workTeam
|
|
|
- }
|
|
|
- this.excute(this.$service.commonService, this.$service.commonService.getUser, params).then(res => {
|
|
|
- if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- this.userAddList = res.data.copy()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- /**
|
|
|
- * @desc : 获取产品釉色
|
|
|
- * @author : 付斌
|
|
|
- * @date : 2023/6/25 13:47
|
|
|
- */
|
|
|
- getProductColour() {
|
|
|
- let params = {
|
|
|
- ftyId: this.$store.state.user.ftyId,
|
|
|
- }
|
|
|
- this.excute(this.$service.commonService, this.$service.commonService.getProductColour, params).then(res => {
|
|
|
- if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- this.pdtColourList = res.data.copy()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- /**
|
|
|
- * @desc : 获取产品商标
|
|
|
- * @author : 付斌
|
|
|
- * @date : 2023/6/25 13:47
|
|
|
- */
|
|
|
- getProductLogo() {
|
|
|
- let params = {
|
|
|
- ftyId: this.$store.state.user.ftyId,
|
|
|
- }
|
|
|
- this.excute(this.$service.commonService, this.$service.commonService.getProductLogo, params).then(res => {
|
|
|
- if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- this.pdtLogoList = res.data.copy()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- /**
|
|
|
- * @desc : 获取损坯原因
|
|
|
- * @author : 付斌
|
|
|
- * @date : 2023/2/22 10:19
|
|
|
- */
|
|
|
- getScrapReason() {
|
|
|
- let params = {
|
|
|
- ftyId: this.$store.state.user.ftyId,
|
|
|
- defectKind: this.$config.defectKind.moldDamageReason
|
|
|
- }
|
|
|
- this.excute(this.$service.commonService, this.$service.commonService.getProductDefect, params).then(res => {
|
|
|
- if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- this.scrapReasonList = res.data.copy()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
|
|
|
- /**
|
|
|
- * @desc : 校验选择数据是否合法
|
|
|
- * @author : 付斌
|
|
|
- * @date : 2023/6/25 17:11
|
|
|
- */
|
|
|
- checkData() {
|
|
|
- let batchRows = this.$refs['moldlineTable'].batchRows
|
|
|
- // 判断信息是否为空
|
|
|
- if (!batchRows || batchRows.length === 0) {
|
|
|
- this.$Message.warning(this.$t('W_012'))
|
|
|
- return false
|
|
|
- }
|
|
|
- let batchKeys = this.$refs['moldlineTable'].batchKeys
|
|
|
- for (let index in this.moldlineList) {
|
|
|
- let it = this.moldlineList[index]
|
|
|
- if (!batchKeys.includes(it.groupId)) {
|
|
|
- continue
|
|
|
- }
|
|
|
- let rows = 1 + parseInt(index)
|
|
|
- if (index >= 0 && it.userBindKind == this.$config.userBindKind.fenZu && !it.moldingUserId) {
|
|
|
- this.$Message.warning(this.$t('W_089', {
|
|
|
- 'param1': rows + this.$t('rowNo'),
|
|
|
- 'param2': this.$t('moldingUserId')
|
|
|
- }))
|
|
|
- this.setErrToRow(it, this.$t('W_093', {
|
|
|
- 'param': this.$t('moldingUserId')
|
|
|
- }))// 给行增加错误提示信息
|
|
|
- return false
|
|
|
- }
|
|
|
- if (index >= 0 && !it.moldingCount || it.moldingCount === 0) {
|
|
|
- this.$Message.warning(this.$t('W_089', {
|
|
|
- 'param1': rows + this.$t('rowNo'),
|
|
|
- 'param2': this.$t('moldingCount')
|
|
|
- }))
|
|
|
- this.setErrToRow(it, this.$t('W_093', {
|
|
|
- 'param': this.$t('moldingCount')
|
|
|
- }))// 给行增加错误提示信息
|
|
|
- return false
|
|
|
- }
|
|
|
- // 成型次数输入范围1-10
|
|
|
- if (index >= 0 && it.moldingCount > 10) {
|
|
|
- this.$Message.warning(this.$t('W_051', {
|
|
|
- 'param1': this.$t('sequence') + rows + this.$t('rowNo') + this.$t('moldingCount'),
|
|
|
- 'param2': 10
|
|
|
- }))
|
|
|
- return false
|
|
|
- }
|
|
|
- // 多批次标识为false的成型次数只能为1
|
|
|
- if (index >= 0 && !it.flgCanBatches && it.moldingCount > 1) {
|
|
|
- this.$Message.warning(this.$t('W_051', {
|
|
|
- 'param1': this.$t('sequence') + rows + this.$t('rowNo') + this.$t('moldingCount'),
|
|
|
- 'param2': 1
|
|
|
- }))
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
- return true
|
|
|
},
|
|
|
// endregion
|
|
|
|
|
|
@@ -526,140 +415,95 @@ export default {
|
|
|
this.formData.bookDate = new Date().toDateStr()
|
|
|
this.formData.workBookItemList = null
|
|
|
},
|
|
|
+
|
|
|
/**
|
|
|
* @desc : 值改变
|
|
|
* @author : 付斌
|
|
|
* @date : 2023/6/25 13:11
|
|
|
*/
|
|
|
- changeValue(field, row, rowIndex, val) {
|
|
|
- // 如果成型标识打开,那么清空掉未成型原因原因
|
|
|
- if (field === 'flgMolding') {
|
|
|
- if (row[field]) {
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'unmoldedReasonId', null)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'unmoldedReasonId_Name', null)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'readOnly', [])
|
|
|
- }
|
|
|
- // 如果成型标识关闭,则开模损标识必须关闭
|
|
|
- else {
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'flgScrap', false)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'scrapReasonId', null)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'scrapReasonId_Name', null)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'readOnly', ['flgScrap', 'scrapReasonId'])
|
|
|
- }
|
|
|
- }
|
|
|
- // 损坯原因
|
|
|
- if (field === 'flgScrap') {
|
|
|
- // 如果开模损标识关闭,那么清空掉开模损原因
|
|
|
- if (!row[field]) {
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'scrapReasonId', null)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'scrapReasonId_Name', null)
|
|
|
- }
|
|
|
- // 如果开磨损标识开启,则模具必须是成型状态
|
|
|
- else {
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'flgMolding', true)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'unmoldedReasonId', null)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'unmoldedReasonId_Name', null)
|
|
|
- }
|
|
|
+ workBookItemChangeValue(field, row, rowIndex, val) {
|
|
|
+ if (field === 'bookQty') {
|
|
|
+ //row["bookAmt"] = parseFloat(row["unitPrice"]) * parseFloat(row["bookQty"]);
|
|
|
+ // this.$set(this.formData.workBookItemList[rowIndex], 'bookAmt', parseFloat(row["unitPrice"]) * parseFloat(row["bookQty"]))
|
|
|
}
|
|
|
},
|
|
|
+ // endregion
|
|
|
+
|
|
|
+ // region 查询基础数据
|
|
|
+
|
|
|
+ // endregion
|
|
|
+
|
|
|
+ // region 保存方法
|
|
|
/**
|
|
|
- * @desc : 选择改变事件
|
|
|
+ * @desc : 校验数据
|
|
|
* @author : 付斌
|
|
|
- * @date : 2023/6/25 14:24
|
|
|
+ * @date : 2023-06-29 9:47
|
|
|
*/
|
|
|
- chooseData(row, rowIndex, colItem) {
|
|
|
- // 如果未成型原因赋值,那么成型标识关闭
|
|
|
- if (colItem.field === 'unmoldedReasonId') {
|
|
|
- if (row[colItem.field]) {
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'flgMolding', false)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'flgScrap', false)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'scrapReasonId', null)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'scrapReasonId_Name', null)
|
|
|
- }
|
|
|
- }
|
|
|
- // 如果开模损标识关闭,那么清空掉开模损原因
|
|
|
- if (colItem.field === 'scrapReasonId') {
|
|
|
- if (row[colItem.field]) {
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'flgScrap', true)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'flgMolding', true) // 已开磨损,不能取消注浆
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'unmoldedReasonId', null)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'unmoldedReasonId_Name', null)
|
|
|
- }
|
|
|
+ validData() {
|
|
|
+ debugger;
|
|
|
+ // 判断信息是否为空
|
|
|
+ if (!this.formData.workBookStaffList || this.formData.workBookStaffList.length === 0) {
|
|
|
+ this.$Message.warning(this.$t('W_007', {'param': "报工员工不能为空"}))
|
|
|
+ return false
|
|
|
}
|
|
|
- // 如果改变产品编码,则产品名称,产品商标和釉色都需要更改
|
|
|
- if (colItem.field === 'modelId' && row.repPdtModelList) {
|
|
|
- let list = row.repPdtModelList.copy()
|
|
|
- let temp = list.filter(it => it.modelId === parseInt(row[colItem.field])) // id类型不一致,所以需要转型
|
|
|
- if (temp && temp.length > 0) {
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'modelName', temp[0].modelName)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'pdtColourId', temp[0].colourId)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'pdtColourId_Name', temp[0].colourName)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'pdtLogoId', temp[0].logoId)
|
|
|
- this.$set(this.formData.workBookItemList[rowIndex], 'pdtLogoId_Name', temp[0].logoName)
|
|
|
+
|
|
|
+ var workBookStaffSumQty = 0;
|
|
|
+ var workBookStaffSumAmt = 0;
|
|
|
+
|
|
|
+ for (let i = 0; i < this.formData.workBookStaffList.length; i++) {
|
|
|
+ let it = this.formData.workBookStaffList[i];
|
|
|
+ var qty = parseFloat(it["bookQty"]);
|
|
|
+ var amt = parseFloat(it["bookAmt"]);
|
|
|
+
|
|
|
+ if (qty.toString() === "NaN") {
|
|
|
+ this.$Message.warning(this.$t('W_007', {'param': "报工数量不能为空"}))
|
|
|
+ return false
|
|
|
}
|
|
|
- }
|
|
|
- },
|
|
|
- /**
|
|
|
- * @desc : 行改变事件
|
|
|
- * @author : 付斌
|
|
|
- * @date : 2023/6/25 15:34
|
|
|
- */
|
|
|
- currentChange(e) {
|
|
|
- this.repPdtModelList = e.row.repPdtModelList
|
|
|
- // 可替换产品编码为空,则不可更改产品编码
|
|
|
- if (!this.repPdtModelList && this.type === this.$config.formMode.add) {
|
|
|
- if (e.row && e.row.readOnly != 'all') {
|
|
|
- this.$set(e.row, 'readOnly', ['modelId'])
|
|
|
+ if (amt.toString() === "NaN") {
|
|
|
+ amt = 0;
|
|
|
}
|
|
|
+ workBookStaffSumQty += qty;
|
|
|
+ workBookStaffSumAmt += amt;
|
|
|
}
|
|
|
- },
|
|
|
- // endregion
|
|
|
|
|
|
- // region 查询基础数据
|
|
|
+ var workBookItemSumQty = 0;
|
|
|
+ var workBookItemSumAmt = 0;
|
|
|
+ for (let i = 0; i < this.formData.workBookItemList.length; i++) {
|
|
|
+ let it = this.formData.workBookItemList[i];
|
|
|
+ var qty = parseFloat(it["bookQty"]);
|
|
|
+ var amt = parseFloat(it["bookAmt"]);
|
|
|
|
|
|
- // endregion
|
|
|
+ if (qty.toString() === "NaN") {
|
|
|
+ this.$Message.warning(this.$t('W_007', {'param': "报工数量不能为空"}))
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (amt.toString() === "NaN") {
|
|
|
+ amt = 0;
|
|
|
+ }
|
|
|
+ workBookItemSumQty += qty;
|
|
|
+ workBookItemSumAmt += amt;
|
|
|
+ }
|
|
|
+ if (workBookStaffSumQty != workBookItemSumQty) {
|
|
|
+ this.$Message.warning(this.$t('W_007', {'param': "报工员工报工数量合计不等于报名明细报工数量合计"}))
|
|
|
+ return false
|
|
|
+ }
|
|
|
|
|
|
- // region 保存方法
|
|
|
+ if (workBookStaffSumAmt != workBookItemSumAmt) {
|
|
|
+ this.$Message.warning(this.$t('W_007', {'param': "报工员工报工金额合计不等于报名明细报工金额合计"}))
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
/**
|
|
|
* @desc : 给参数赋值
|
|
|
* @author : 付斌
|
|
|
* @date : 2023/6/25 14:31
|
|
|
*/
|
|
|
setParams() {
|
|
|
- // 新建的参数
|
|
|
- if (this.type === this.$config.formMode.add) {
|
|
|
- // let list = []
|
|
|
- // let table = this.$refs['moldingRecord'].getTableData()
|
|
|
- // this.moldlineItemList.forEach(itt => {
|
|
|
- // let templist = {}
|
|
|
- // // 按成型线分组,获取总单信息
|
|
|
- // this.addTotalColumns.forEach(it => {
|
|
|
- // templist[it] = itt[it]
|
|
|
- // })
|
|
|
- // templist.ftyId = this.formData.ftyId
|
|
|
- // templist.manageUser =this.$store.state.user.id
|
|
|
- // // 取出当前成型线对应的模具记录明细
|
|
|
- // let temp = table.filter(it => it.groupId === itt.groupId)
|
|
|
- // if (temp && temp.length > 0) {
|
|
|
- // // 遍历明细给参数赋值
|
|
|
- // let itemParam = temp.filterColumns(this.addItemColumns)
|
|
|
- // itemParam.forEach(it => {
|
|
|
- // it.ftyId = this.formData.ftyId
|
|
|
- // it.flgScrap = false
|
|
|
- // it.scrapDate = null
|
|
|
- // it.moldingDate = this.formData.moldingDate
|
|
|
- // it.outputMoldedNum = it.outputMoldedNum + it.moldingBatch - it.lastMoldingBatch
|
|
|
- // })
|
|
|
- // templist.list = itemParam
|
|
|
- // }
|
|
|
- // list.push(templist)
|
|
|
- // })
|
|
|
- this.paramslist = this.formData;
|
|
|
- }
|
|
|
- // 编辑的参数
|
|
|
- else {
|
|
|
- this.params = this.formData;
|
|
|
- }
|
|
|
+ debugger;
|
|
|
+ this.params = {...this.formData};
|
|
|
+ this.params.bookDate = this.formData.bookDate.toDateStr();
|
|
|
+
|
|
|
},
|
|
|
/**
|
|
|
* @desc : 保存数据
|
|
|
@@ -669,7 +513,7 @@ export default {
|
|
|
saveData() {
|
|
|
|
|
|
if (this.type === this.$config.formMode.add) {
|
|
|
- return this.excute(this.$service.workBookService, this.$service.workBookService.insertWorkBook, this.paramslist);
|
|
|
+ return this.excute(this.$service.workBookService, this.$service.workBookService.insertWorkBook, this.params);
|
|
|
} else {
|
|
|
return this.excute(this.$service.workBookService, this.$service.workBookService.updateWorkBook, this.params)
|
|
|
}
|
|
|
@@ -702,9 +546,27 @@ export default {
|
|
|
*/
|
|
|
setValuesByEdit(data) {
|
|
|
if (data) {
|
|
|
- this.formData = data;
|
|
|
- this.formData.workBookItemList = data.wbItemList;
|
|
|
- this.formData.workBookStaffList = data.wbStaffList;
|
|
|
+ console.log("data", data)
|
|
|
+ this.formData = data["workBook"];
|
|
|
+ this.formData.workBookItemList = data["workBook"].wbItemList;
|
|
|
+ this.formData.workBookStaffList = data["workBook"].wbStaffList;
|
|
|
+
|
|
|
+ if (this.formData.projectKind === this.$config.projectKind.zhiLiang) {
|
|
|
+ this.dataFenJi = data["ProductGrade"]?.copy();
|
|
|
+ this.dataQueXian = data["ProductDefect"]?.copy();
|
|
|
+ this.formData.workBookItemList.forEach(it => {
|
|
|
+ // 产品分级
|
|
|
+ it.workBookItemGradeList.forEach(item => {
|
|
|
+ this.$set(it, 'grade_' + item.pdtGradeId, item.bookQty);
|
|
|
+ // it['grade_' + item.pdtGradeId] = item.bookQty
|
|
|
+ })
|
|
|
+
|
|
|
+ // 产品缺陷
|
|
|
+ it.workBookItemDefectList.forEach(item => {
|
|
|
+ this.$set(it, 'defect_' + item.pdtDefectId, item.bookQty);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
},
|