| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167 |
- <!-- @desc:半检 @auth:寇珊珊 @time:2023年3月7日09:22:05 -->
- <template>
- <div class="main-div">
- <!--加载中-->
- <loading :loading="loading" v-if="!modalVisible"></loading>
- <DkPaxeButton :total="editKeys?editKeys.length:0"
- :current="editIndex"
- v-if="editKeys && editKeys.length > 1"
- @pageChange="editPageChange"></DkPaxeButton>
- <DkCollapse>
- <DkPanel prop="essentialInformation">
- <!-- 下拉区域 -->
- <DkForm slot="content" ref="formInline" v-model="formData" style="width: 95%">
- <!--选择工位-->
- <DkFormItem v-if="workStationList.length>0 || formData.stationId" :required="true" prop="stationId"
- :data-type="$config.dataType.number" :label="$t('stationId')">
- <SelectMagnifier v-model="formData.stationId" :display-text="formData.stationName"
- :type="this.$config.MagnifierType.station"
- :multiple="false"
- :disabled="stationFlag"
- :other-condition="{flowNodeId:flowNodeId}"
- @ok="chooseStation"></SelectMagnifier>
- </DkFormItem>
- <!--生产工号-->
- <DkFormItem :required="true" prop="prodUserCode">
- <InputPop ref="prodUserCode" name ="prodUserCode" v-model="formData.prodUserCode"
- :readonly="!userKind ||userKind == $config.operationUserType.produceUser"
- @on-enter="onEnterBlur" @on-blur="onProdUserCode"/>
- </DkFormItem>
- <!--产品条码-->
- <DkFormItem :required="true" prop="barCode">
- <InputPop :readonly="!formData.prodUserId" ref="barCode" v-model="formData.barCode" @on-enter="onBarCode"
- @on-blur="onBarCode" @on-clear="clearBarCode"/>
- </DkFormItem>
- <!--商标-->
- <DkFormItem :required="true" prop="logoName">
- <InputPop ref="logoName" v-model="formData.logoName" :readonly="true"/>
- </DkFormItem>
- <!--釉色-->
- <DkFormItem :required="true" prop="colourName">
- <InputPop ref="colourName" v-model="formData.colourName" :readonly="true"/>
- </DkFormItem>
- <!--编码-->
- <DkFormItem :required="true" prop="productCode">
- <InputPop ref="productCode" v-model="formData.productCode" :readonly="true"/>
- </DkFormItem>
- <!--名称-->
- <DkFormItem :required="true" prop="productName">
- <InputPop ref="productName" v-model="formData.productName" :readonly="true"/>
- </DkFormItem>
- <!--产品等级-->
- <DkFormItem prop="opnGradeId" :required="true" :label="$t('gradeClassification')" data-type="number">
- <SelectPop v-model="formData.opnGradeId" ref="gradeName" :multiple="false"
- :options="gradeList"
- :disabled="!gradeFlag"
- @on-select="chooseGrade"
- labelKey="gradeName"
- valueKey="gradeId">
- </SelectPop>
- </DkFormItem>
- </DkForm>
- </DkPanel>
- <div
- v-show="formData.barCode && formData.opnGradeKind&& formData.opnGradeKind != $config.gradeKindType.excellent">
- <DkPanel prop="chooseDefect">
- <!--添加行按钮-->
- <DkButton slot="content" type="success" @click="addRow" size="small"
- style="float: left;position: relative; bottom: 35px;left: 110px;">{{ $v('saveDetail') }}
- </DkButton>
- <!--清空-->
- <DkButton slot="content" type="primary" @click="clearRow" size="small"
- style="float: left;position: relative; bottom: 35px;left: 125px;">{{ $v('clearDefect') }}
- </DkButton>
- <DkSplit slot="content" v-model="split" :height="tableHeight-500">
- <!--缺陷信息-->
- <EditTable slot="left" ref="recordTable" :data="detailList"
- :columns="detailColumns"
- :showSettingFlag="false"
- :height="tableHeight-500"
- :freeze="false"
- :add-flag="false" :delete-flag="false"
- @chooseData="chooseData"
- @clear-select="clearSelect"
- controlId="defectCode"
- @changeValue="changeValue"
- ></EditTable>
- <!--责任员工-->
- <DkTable slot="right" ref="staff-table-select" :data="staffList" multiple
- :height="tableHeight-500" primaryKey="staffId"
- :pageFlag="false"
- :pageTotalFlag="false"
- :linkClickChecked="true"
- name="table">
- <DkTableColumn field="staffName" :title="$t('staffName')" width="auto"></DkTableColumn>
- </DkTable>
- </DkSplit>
- </DkPanel>
- <!--明细-->
- <DkPanel prop="details">
- <div slot="content" :style="'height: ' + tableHeight-120 + 'px'">
- <!--缺陷信息-->
- <EditTable slot="left" ref="submitTable" :data="editDetailList"
- :columns="editDetailColumns"
- :height="tableHeight-120"
- :freeze="false"
- :add-flag="false"
- @delRow="delSubmitTable"
- ></EditTable>
- </div>
- </DkPanel>
- </div>
- </DkCollapse>
- <!-- 下部分按钮区域-->
- <DkSaveButton ref="saveButton" :loading="loading" @save="save" @close="close"></DkSaveButton>
- <!--缺陷位置-->
- <DkModal
- :loading="loading"
- v-model="defectPlaceModal"
- ref="modal_defectPlace"
- @on-visible-change="handleVisibleModal"
- @modalOk="saveDefectPlace"
- :saveFlag="true"
- :title=modalTitle
- >
- </DkModal>
- <!--验证标签-->
- <DkModal
- :loading="loading"
- v-model="labelModal"
- ref="modal_label"
- @on-visible-change="handleVisibleModal"
- @modalOk="saveLabel"
- :saveFlag="true"
- :title=modalTitle
- :maskClosable="false"
- >
- <DkForm ref="labelFormInline" v-model="labelFormData" :col-count="1">
- <DkFormItem required :data-type="$config.dataType.str"
- v-for="(item,index) in pdtLabelKinds" :key="index" :label="item.labelName">
- <InputPop v-model="item.labelCode" ref="item.labelCode"/>
- </DkFormItem>
- </DkForm>
- </DkModal>
- </div>
- </template>
- <script>
- import { formMixin } from '@/mixins/form'
- export default {
- name: 'halfCheck-add',
- mixins: [formMixin],
- data() {
- let self = this
- return {
- gradeFlag: null,//改判权限标识
- tableData: [],
- loading: false,
- tableHeight: 620,
- // 画面表单数据
- formData: {
- stationId: null,
- stationName: '',
- prodUserId: null,
- prodUserCode: '',
- barCode: '',
- ftyId: this.$store.state.user.ftyId,
- productId: null,
- productCode: '',
- productName: '',
- logoName: '',
- colourName: '',
- opnGradeId: null,
- gradeName: null,
- opnGradeKind: null,
- },
- defectCode: null,//缺陷编码
- modelId: null,//产品型号
- flowNodeId: self.$route.meta.menuUuid,
- workStationList: [],//工位数据
- editItemColumns: ['itemId', 'moldingId', 'productUniqueCode'],
- gradeList: [],//产品等级
- detailList: [],// 成型记录明细信息
- defectFines: [],//缺陷扣罚
- defectNodeList: [],//责任工序
- staffList: [],//责任员工
- dutyUserList: [],//责任人
- jobId: null,//责任工种
- split: 0.7,//明细左右宽度比
- // 明细列表
- detailColumns: [
- // 缺陷编码
- { field: 'defectCode', type: 'text', width: 'auto', controlId: 'defectCode', },
- //缺陷名称
- { field: 'defectName', type: 'disabled', width: 'auto', },
- //缺陷扣罚
- {
- field: 'dftFineId',
- type: 'select',
- options: () => self.defectFines,
- labelKey: 'fineName',
- valueKey: 'fineId',
- width: 'auto',
- },
- // 扣除数
- { field: 'deductNum', type: 'disabled', width: 'auto' },
- // 缺陷位置
- {
- field: 'pdtPlaceId',
- type: 'select',
- options: () => self.defectPlaceList,
- labelKey: 'placeName',
- valueKey: 'placeId',
- width: 'auto'
- },
- // 责任工序
- {
- field: 'blameNodeId',
- type: 'select',
- options: () => self.defectNodeList,
- labelKey: 'nodeName',
- valueKey: 'nodeId',
- width: 'auto'
- },
- // 责任工号
- {
- field: 'userName',
- title: self.$t('blameUserId'),
- width: 'auto',
- sortBoolean: false,
- multiple: false,
- type: 'tableSelect',
- param: () => {
- return {
- nodeId: self.blameNodeId ? parseInt(self.blameNodeId) : null,
- productId: self.blameNodeId ? self.formData.productId : null,
- }
- },
- dataType: self.$config.tableSelectType.blameUser,
- fieldUpdate: self.$updateColumns.halfCheckUser,
- searchDetailFlag: false,
- },
- // 责任工种
- {
- field: 'jobName',
- title: self.$t('blameWsJobId'),
- width: 'auto',
- sortBoolean: false,
- multiple: false,
- type: 'tableSelect',
- param: () => {
- return {
- nodeId: self.blameNodeId ? parseInt(self.blameNodeId) : null,
- productId: self.formData.productId,
- userId: self.userId ? parseInt(self.userId) : null,
- defectId: self.pdtDefectId ? parseInt(self.pdtDefectId) : null,
- }
- },
- dataType: self.$config.tableSelectType.job,
- fieldUpdate: self.$updateColumns.halfCheckJob,
- searchDetailFlag: false
- },
- ],
- //用来展示的明细列表
- editDetailColumns: [
- // 缺陷编码
- { field: 'pdtDefectCode', title: self.$t('defectCode'), type: 'disabled', width: 'auto', },
- //缺陷名称
- { field: 'pdtDefectName', title: self.$t('defectName'), type: 'disabled', width: 'auto', },
- //缺陷扣罚
- { field: 'dftFineName', type: 'disabled', width: 'auto', },
- // 扣除数
- { field: 'deductNum', type: 'disabled', width: 'auto' },
- // 缺陷位置
- { field: 'pdtPlaceName', title: self.$t('pdtPlaceId'), type: 'disabled', width: 'auto' },
- // 责任工序
- { field: 'blameNodeName', title: self.$t('blameNodeId'), type: 'disabled', width: 'auto' },
- // 责任工号
- { field: 'blameUserName', title: self.$t('blameUserId'), type: 'disabled', width: 'auto' },
- // 责任工种
- { field: 'blameJobName', title: self.$t('blameWsJobId'), type: 'disabled', width: 'auto' },
- //责任员工
- { field: 'blameStaffName', title: self.$t('blameStaffId'), type: 'disabled', width: 'auto' },
- ],
- editDetailList: [],
- productionDefectDelIdList: [],//被删除的数据
- rowIndex: 0,
- userKind: null,//用户类型
- defectPlaceModal: false,//缺陷弹窗
- modalTitle: self.$config.formMode.setDefectPlace,
- defectPlaceList: [],//缺陷位置
- stationFlag: false,//默认工位标识
- userId: null,//当前选择的工号
- blameNodeId: null,//当前选择的工序
- pdtDefectId: null,//当前选择的缺陷
- labelFlag: false,//默认验证标签
- pdtLabelKinds: [],//开的验证标签
- checkModelPdtLabelJson: {},//校验验证标签
- modelPdtLabelJson: {},//验证标签集合
- labelModal: false,//验证标签modal
- labelFormData: {},
- getBarCodeMessage: null,//产品条码信息
- onProdUserCodeFlag: false,//校验打卡标识
- }
- },
- methods: {
- //region 失焦查询数据
- /**
- * @desc : 回车失焦事件
- * @date : 2023/4/21 16:00
- * @author : 寇珊珊
- */
- onEnterBlur(){
- this.$refs.prodUserCode.$refs.input.blur()
- },
- /**
- * @desc : 生产工号失焦事件
- * @date : 2023/2/28 9:28
- * @author : 寇珊珊
- */
- onProdUserCode() {
- if (this.onProdUserCodeFlag) {
- return
- }
- this.onProdUserCodeFlag = true
- if (this.formData.prodUserCode) {
- let params = {
- ftyId: this.formData.ftyId,
- prodUserCode: this.formData.prodUserCode,
- stationId: this.formData.stationId,
- flowNodeId: this.flowNodeId,
- }
- this.excute(this.$service.collectService, this.$service.collectService.checkProdUserCode, params).then(res => {
- this.formData.prodUserId=null
- if (res.code === this.$config.SUCCESS_CODE) {
- this.formData.prodUserId = parseInt(res.data)
- }
- //没有打卡
- else if (res.code !== this.$config.SUCCESS_CODE &&
- this.$config.processTypeException.CHKCAR008 == res.exception) {
- if (this.$libaray.checkButtonHasRight('ws-clock-user',this)) {
- this.$IBMessage({
- content: this.$t('Q_013'),
- title: this.$t('systemQuestion'),
- },
- {
- ok: () => {
- this.onProdUserCodeFlag = false
- this.$router.push('/pdm/ws-clock/clock-user')
- },
- cancel: () => {
- this.closeTag(this.$route)
- }
- })
- } else {
- this.onProdUserCodeFlag = false
- this.$Modal.warning({
- title: this.$t('systemInfo'),
- content: this.$t('Q_019')
- });
- }
- } else {
- this.onProdUserCodeFlag = false
- this.$Message.error(res.message)
- }
- })
- } else {
- this.onProdUserCodeFlag = false
- }
- },
- /**
- * @desc : 产品条码失焦事件
- * @date : 2023/2/28 9:28
- * @author : 寇珊珊
- */
- onBarCode() {
- if (this.formData.barCode) {
- let params = {
- ftyId: this.formData.ftyId,
- barCode: this.formData.barCode,
- prodUserCode: this.formData.prodUserCode,
- flowNodeId: this.flowNodeId,
- }
- this.excute(this.$service.collectService, this.$service.collectService.checkBarCode, params).then(res => {
- if (res.code === this.$config.SUCCESS_CODE) {
- if (0 == parseInt(res.data.flowNodeNum)) {
- this.gradeFlag = true
- }
- this.getBarCodeMessage = res
- //验证标签开启并且工序类型为产品码
- if (this.$config.processType.productCode == this.opnKind && this.labelFlag) {
- this.modalTitle = this.$t('label') // 给modal标题赋值
- this.labelModal = true
- } else {
- //验证产品条码后赋值
- this.setBarCode(this.getBarCodeMessage)
- }
- } else {
- this.$Message.error(res.message)
- }
- })
- }
- },
- /**
- * @desc : 保存验证标签
- * @date : 2023/3/29 13:48
- * @author : 寇珊珊
- */
- saveLabel() {
- this.$refs['labelFormInline'].validate().then(valid => {
- if (valid) {
- this.checkModelPdtLabelJson[this.formData.barCode] = this.pdtLabelKinds
- let params = {
- flowNodeId: this.flowNodeId,
- ftyId: this.formData.ftyId,
- barCode: this.formData.barCode,
- modelPdtLabelList: this.checkModelPdtLabelJson,
- }
- this.excute(this.$service.collectService, this.$service.collectService.checkLabel, params).then(res => {
- if (res.code === this.$config.SUCCESS_CODE) {
- this.labelModal = false
- this.modelPdtLabelJson[this.formData.barCode] = this.pdtLabelKinds.copy()
- for (let i of this.pdtLabelKinds) {
- i['labelCode'] = ''
- }
- //验证产品条码后赋值
- this.setBarCode(this.getBarCodeMessage)
- } else {
- this.$Message.error(res.message)
- }
- })
- }
- })
- },
- /**
- * @desc : 验证产品条码后赋值
- * @date : 2023/4/4 14:38
- * @author : 寇珊珊
- */
- setBarCode(res) {
- this.modelId = res.data.modelId
- this.formData.productId = res.data.uniqueId
- this.formData.productCode = res.data.modelCode
- this.formData.productName = res.data.modelName
- this.formData.logoName = res.data.logoName
- this.formData.colourName = res.data.colourName
- this.formData.opnGradeId = res.data.opnGradeId
- this.formData.opnGradeKind = res.data.opnGradeKind
- if (res.data.productionDefectList && res.data.productionDefectList.length > 0) {
- let list = res.data.productionDefectList
- for (let i = 0; i < list.length; i++) {
- this.editDetailList = list
- }
- }
- //产品等级不为优
- if (this.formData.opnGradeKind != this.$config.gradeKindType.excellent) {
- //调用查询缺陷位置
- this.getDefectPlace()
- } else {
- this.defectPlaceList = []
- }
- },
- /**
- * @desc : 产品条码清空
- * @date : 2023/3/22 13:27
- * @author : 寇珊珊
- */
- clearBarCode() {
- this.formData.barCode = null
- this.formData.productId = null
- this.formData.productCode = null
- this.formData.productName = null
- this.formData.logoName = null
- this.formData.colourName = null
- this.formData.opnGradeId = null
- this.formData.gradeName = null
- this.formData.opnGradeKind = null
- },
- /**
- * @desc : 查询缺陷数据
- * @date : 2023/3/9 10:46
- * @author : 寇珊珊
- */
- getDefect(index) {
- let params = {
- flowNodeId: this.flowNodeId,
- ftyId: this.formData.ftyId,
- pdtDefectId: this.detailList[index].pdtDefectId,
- barCode: this.formData.barCode,
- barCodeId: this.formData.productId,
- }
- this.excute(this.$service.collectService, this.$service.collectService.getBlameNode, params).then(res => {
- if (res.code === this.$config.SUCCESS_CODE) {
- this.defectNodeList = res.data
- if (this.defectNodeList && this.defectNodeList.length == 1) {
- //赋值责任相关信息
- this.setBlameMessage(this.defectNodeList)
- }
- } else {
- this.$Message.error(res.message)
- }
- })
- },
- /**
- * @desc : 赋值责任相关信息
- * @date : 2023/3/30 16:28
- * @author : 寇珊珊
- */
- setBlameMessage(list) {
- this.blameNodeId = list[0].nodeId
- let obj = Object.assign(this.detailList[0], {
- blameNodeId: list[0].nodeId,
- blameNodeName: list[0].nodeName,
- //责任工号
- blameUserId: list[0].userId,
- blameUserName: list[0].userName,
- userName: list[0].userName,
- //责任工种
- blameWsJobId: list[0].jobId,
- blameWsJobName: list[0].jobName,
- jobName: list[0].jobName,
- })
- this.userId = list[0].userId
- this.jobId = list[0].jobId
- this.detailColumns[6].disabled = true
- this.detailColumns[7].disabled = true
- this.$set(this.detailList, 0, obj)
- //员工
- this.staffList = list[0].clockList
- for (let i of this.staffList) {
- i.blameStaffId = i.staffId
- i.blameWsJobId = i.jobId
- }
- let _this = this
- setTimeout(() => {
- _this.$refs['staff-table-select'].$refs.table.setCheckboxRow(
- _this.staffList.filter(it => it.defaultFlag), true)
- }, 200)
- },
- /**
- * @desc : 查询员工
- * @date : 2023/3/20 13:18
- * @author : 寇珊珊
- */
- getStaff() {
- if (this.blameNodeId) {
- return
- }
- let params = {
- ftyId: this.formData.ftyId,
- userId: this.userId ? parseInt(this.userId) : null,
- }
- this.excute(this.$service.commonService, this.$service.commonService.getTeamStaff, params).then(res => {
- if (res.code === this.$config.SUCCESS_CODE) {
- this.staffList = res.data.list
- for (let i of this.staffList) {
- i.blameStaffId = i.staffId
- i.blameWsJobId = i.jobId
- }
- let _this = this
- setTimeout(() => {
- _this.$refs['staff-table-select'].$refs.table.setCheckboxRow(
- _this.staffList.filter(it => it.defaultFlag), true)
- }, 200)
- } else {
- this.$Message.error(res.message)
- }
- })
- },
- //endregion
- //region 选择数据
- /**
- * @desc : 选择工位
- * @date : 2023/2/28 9:24
- * @author : 寇珊珊
- */
- chooseStation(row) {
- if (row && row[0]) {
- this.formData.stationId = row[0].stationId
- this.formData.stationName = row[0].stationName
- //校验打卡
- this.onProdUserCode()
- }
- },
- /**
- * @desc : 选择产品等级
- * @date : 2023/3/3 9:17
- * @author : 寇珊珊
- */
- chooseGrade(row) {
- if (row) {
- this.formData.opnGradeId = row
- let list = this.gradeList.filter(it => it.gradeId == row)
- if (list.length > 0) {
- this.formData.opnGradeKind = list[0].gradeKind
- //产品等级不为优
- if (this.formData.opnGradeKind != this.$config.gradeKindType.excellent) {
- //调用查询缺陷位置
- this.getDefectPlace()
- } else {
- this.detailList = []
- this.editDetailList = []
- // this.$set(this.detailList[0], 'readOnly', ['pdtPlaceId'])
- }
- }
- }
- },
- /**
- * @desc : 选择改变
- * @date : 2023/3/3 16:30
- * @author : 寇珊珊
- */
- chooseData(row, rowIndex, colItem) {
- this.rowIndex = rowIndex
- this.detailColumns[6].disabled = false
- this.detailColumns[7].disabled = false
- //缺陷扣罚
- if (colItem.field == 'dftFineId') {
- let list = this.defectFines.filter(it => it.fineId == row.dftFineId)
- if (list.length > 0) {
- row.deductNum = list[0].deductNum
- this.detailList[rowIndex] = Object.assign(this.detailList[rowIndex], {
- deductNum: list[0].deductNum,
- dftFineId: list[0].fineId,
- dftFineId_Name: list[0].fineName,
- dftFineName: list[0].fineName
- })
- }
- }
- //责任工序
- else if (colItem.field == 'blameNodeId') {
- let list = this.defectNodeList.filter(it => it.nodeId == row.blameNodeId)
- if (list.length > 0) {
- //赋值责任相关信息
- this.setBlameMessage(list)
- }
- }
- //责任工号
- else if (colItem.field == 'userName') {
- this.userId = row.userId
- this.detailList[rowIndex] = Object.assign(this.detailList[rowIndex], {
- blameUserId: row.userId,
- blameUserName: row.userName,
- })
- if (this.userId) {
- //查询员工
- this.getStaff()
- }
- }
- //责任工种
- else if (colItem.field == 'jobName') {
- this.jobId = row.jobId
- this.detailList[rowIndex] = Object.assign(this.detailList[rowIndex], {
- //责任工种
- blameWsJobId: row.jobId,
- blameWsJobName: row.jobName,
- })
- }
- //缺陷位置
- if (colItem.field == 'pdtPlaceId') {
- let list = this.defectPlaceList.filter(it => it.placeId == row.pdtPlaceId)
- if (list.length > 0) {
- this.detailList[rowIndex] = Object.assign(this.detailList[rowIndex], {
- pdtPlaceId: list[0].placeId,
- pdtPlaceId_Name: list[0].placeName,
- pdtPlaceName: list[0].placeName
- })
- }
- }
- this.$refs.recordTable.$refs.xTable.reloadData(this.$refs.recordTable.tableData)
- },
- /**
- * @desc : 值改变
- * @date : 2023/2/28 11:23
- * @author : 寇珊珊
- */
- changeValue(field, row, rowIndex) {
- this.rowIndex = rowIndex
- if (!this.detailList[rowIndex]) {
- this.detailList.splice(rowIndex, 0, {})
- }
- //缺陷编码
- if (field === 'defectCode') {
- if (!this.defectCode) {
- this.defectCode = row[field]
- } else {
- if (this.defectCode != row[field]) {
- this.detailList = []
- this.staffList = []
- this.defectCode = row[field]
- }
- }
- let params = {
- flowNodeId: this.flowNodeId,
- ftyId: this.formData.ftyId,
- defectCode: row[field],
- }
- this.excute(this.$service.collectService, this.$service.collectService.checkNodeDefectCode, params).then(res => {
- if (res.code === this.$config.SUCCESS_CODE) {
- this.$set(this.detailList[rowIndex], 'defectCode', row[field])
- //扣罚id
- this.$set(this.detailList[rowIndex], 'pdtDefectId', res.data.defectId)
- this.$set(this.detailList[rowIndex], 'defectName', res.data.defectName)
- this.pdtDefectId = res.data.defectId
- this.defectFines = res.data.defectFines
- //如果绑定缺陷扣罚Id 直接赋值
- if (true) {
- this.detailList[rowIndex].deductNum = this.defectFines[0].deductNum
- this.detailList[rowIndex].dftFineName = this.defectFines[0].fineName
- this.detailList[rowIndex].dftFineId = this.defectFines[0].fineId
- this.$set(this.detailList[rowIndex], 'readOnly', ['dftFineId'])
- }
- //查询缺陷数据
- this.getDefect(rowIndex)
- } else {
- this.$Message.error(res.message)
- }
- })
- } else if (field === 'blameNodeId') {
- this.detailList[rowIndex] = Object.assign(this.detailList[rowIndex], {
- blameNodeId: null,
- blameNodeName: null,
- //责任工号
- blameUserId: null,
- blameUserName: null,
- userName: null,
- //责任工种
- blameWsJobId: null,
- blameWsJobName: null,
- jobName: null,
- })
- this.userId = null
- this.jobId = null
- }
- },
- /**
- * @desc : 改变select类型值
- * @date : 2023/3/22 13:45
- * @author : 寇珊珊
- */
- clearSelect(value) {
- //清空 责任工序 和责任工序相关数据
- if (value.column.field === 'blameNodeId') {
- this.detailColumns[6].disabled = false
- this.detailColumns[7].disabled = false
- this.detailList[0] = Object.assign(this.detailList[0], {
- //责任工序
- blameNodeId: null,
- blameNodeName: null,
- //责任工号
- blameUserId: null,
- blameUserName: null,
- userName: null,
- //责任工种
- blameWsJobId: null,
- blameWsJobName: null,
- jobName: null,
- })
- this.$refs.recordTable.$refs.xTable.reloadData(this.$refs.recordTable.tableData)
- this.staffList = null
- this.userId = null
- this.jobId = null
- this.blameNodeId = null
- }
- },
- /**
- * @desc : 删除提交行数据
- * @date : 2023/3/10 11:26
- * @author : 寇珊珊
- */
- delSubmitTable(row, rowIndex) {
- this.editDetailList.splice(rowIndex, 1)
- if (row.prodDefectId) {
- this.productionDefectDelIdList.push(row.prodDefectId)
- }
- },
- //endregion
- //region 添加行+校验
- /**
- * @desc : 判重
- * @date : 2023/4/21 14:59
- * @author : 寇珊珊
- */
- checkRepetition(){
- //缺陷编码 + 缺陷位置 判重
- if(this.editDetailList && this.editDetailList.length>0){
- for(let i of this.editDetailList){
- if(this.detailList.filter(it=>it.placeCode == i.placeCode && it.pdtPlaceId ==i.pdtPlaceId).length>0){
- this.$Message.error(this.$t('W_114'))
- return false
- }
- }
- }
- return true
- },
- /**
- * @desc : 校验添加行数据
- * @date : 2023/3/10 9:09
- * @author : 寇珊珊
- */
- validDataAddRow() {
- let item = this.detailList[0]
- //region 缺陷编码
- if (item.defectCode == null) {
- this.$Message.error(this.$t('W_069', { 'param': this.$t('placeCode') }))
- this.setErrToRow(item, this.$t('W_093', {
- 'param': this.$t('defectCode')
- }))// 给行增加错误提示信息
- return false
- }
- //endregion
- //region 缺陷位置
- if (item && this.formData.opnGradeKind != this.$config.gradeKindType.excellent && item.pdtPlaceId == null) {
- this.$Message.error(this.$t('W_069', { 'param': this.$t('pdtPlaceId') }))
- this.setErrToRow(item, this.$t('W_093', {
- 'param': this.$t('pdtPlaceId')
- }))// 给行增加错误提示信息
- return false
- }
- //endregion
- //region 扣除数
- if (item.deductNum == null) {
- this.$Message.error(this.$t('W_069', { 'param': this.$t('deductNum') }))
- this.setErrToRow(item, this.$t('W_093', {
- 'param': this.$t('deductNum')
- }))// 给行增加错误提示信息
- return false
- }
- //endregion
- //region 责任工序 todo 目前不是必填的
- // if (item.blameNodeId == null) {
- // this.$Message.error(this.$t('W_069', { 'param': this.$t('blameNodeId') }))
- // this.setErrToRow(item, this.$t('W_093', {
- // 'param': this.$t('blameNodeId')
- // }))// 给行增加错误提示信息
- // return false
- // }
- //endregion
- //region 责任工号
- if (item.blameUserId == null) {
- this.$Message.error(this.$t('W_069', { 'param': this.$t('blameUserId') }))
- this.setErrToRow(item, this.$t('W_093', {
- 'param': this.$t('blameUserId')
- }))// 给行增加错误提示信息
- return false
- }
- //endregion
- //region 责任员工
- let list = this.$refs['staff-table-select'].$refs.table.getCheckboxRecords()
- if (list && list.length > 0) {
- for (let index = 0; index < list; index++) {
- let it = list[index]
- if (it.blameStaffId == null) {
- let rows = 1 + parseInt(index)
- this.$Message.error(this.$t('W_089', {
- 'param1': rows + this.$t('rowNo'),
- 'param2': this.$t('blameStaffId')
- }))
- this.setErrToRow(item, this.$t('W_093', {
- 'param': this.$t('blameStaffId')
- }))// 给行增加错误提示信息
- return false
- }
- }
- } else {
- this.$Message.error(this.$t('W_122'))
- return false
- }
- //endregion
- return true
- },
- /**
- * @desc : 添加行选择缺陷
- * @date : 2023/3/10 8:54
- * @author : 寇珊珊
- */
- addRow() {
- //添加行是否存在
- if (this.detailList.length == 0) {
- this.$Message.error(this.$t('W_116'))
- return false
- }
- //判重校验
- if (!this.checkRepetition()) {
- return
- }
- //校验添加行数据
- if (!this.validDataAddRow()) {
- return
- }
- this.detailList[0].info = null
- this.detailList[0].blameStaffName = this.$refs['staff-table-select'].$refs.table.getCheckboxRecords().map(map => map.staffName).toString()
- this.detailList[0].prodDefectStaffList = this.$refs['staff-table-select'].$refs.table.getCheckboxRecords()
- //缺陷编码
- this.detailList[0].pdtDefectCode = this.detailList[0].defectCode
- //缺陷名称
- this.detailList[0].pdtDefectName = this.detailList[0].defectName
- //缺陷扣罚
- this.detailList[0].dftFineName = this.detailList[0].dftFineName
- //责任工序
- this.detailList[0].blameNodeName = this.detailList[0].blameNodeName
- //责任工号
- this.detailList[0].blameUserName = this.detailList[0].blameUserName
- //责任工种
- this.detailList[0].blameWsJobName = this.detailList[0].blameJobName
- //缺陷位置
- this.detailList[0].pdtPlaceName = this.detailList[0].pdtPlaceName
- this.editDetailList.push(this.detailList[0])
- this.detailList = []
- this.staffList = []
- this.defectCode = null
- this.blameNodeId = null
- this.jobId = null
- this.userId = null
- },
- /**
- * @desc : 清空选择缺陷
- * @date : 2023/3/24 10:04
- * @author : 寇珊珊
- */
- clearRow() {
- this.defectCode = null
- this.detailList = []
- this.staffList = []
- },
- //endregion
- //region 缺陷位置
- /**
- * @desc : 查询缺陷位置
- * @date : 2023/3/15 14:56
- * @author : 寇珊珊
- */
- getDefectPlace() {
- let params = {
- modelId: this.modelId,
- ftyId: this.formData.ftyId,
- }
- this.excute(this.$service.collectService, this.$service.collectService.placeListBy, params).then(res => {
- if (res.code === this.$config.SUCCESS_CODE) {
- this.defectPlaceList = res.data
- } else {
- this.$Message.error(res.message)
- }
- })
- },
- /**
- * @desc : 保存缺陷位置
- * @date : 2023/3/13 14:07
- * @author : 寇珊珊
- */
- saveDefectPlace() {
- },
- //endregion
- //region 保存
- /**
- * @desc : 设置传参
- * @date : 2023/2/28 11:29
- * @author : 寇珊珊
- */
- setParams() {
- //校验名称是否重复
- if (!this.validData()) {
- return
- }
- this.params = JSON.parse(JSON.stringify(this.formData))
- this.params.barCodeList = [this.params.barCode]
- delete this.params.barCode
- this.params.productionDefectList = this.editDetailList.filter(it => !it.prodDefectId)
- this.params.productionDefectDelIdList = this.productionDefectDelIdList
- for (let it = 0; it < this.params.productionDefectList.length; it++) {
- //todo 劣品死数据 加上缺陷位置后删掉
- // "pdtViewImageId": 7,
- // "dftCoordinate": {},
- for (let i of this.params.productionDefectList[it].prodDefectStaffList) {
- if (this.params.productionDefectList[it].blameWsJobId) {
- i.blameWsJobId = this.params.productionDefectList[it].blameWsJobId
- } else {
- i.blameWsJobId = 0
- }
- }
- }
- this.params.flowNodeId = this.flowNodeId
- this.params.modelPdtLabelList = this.modelPdtLabelJson
- },
- /**
- * @desc : 校验重复数据
- * @date : 2023/3/8 8:45
- * @author : 寇珊珊
- */
- validData() {
- //判断是否有改判权限
- if (!this.gradeFlag) {
- this.$Message.error(this.$t('W_131'))
- return false
- }
- //判断是否存在明细 并且 产品等级为瑕、劣
- if (this.editDetailList.length == 0 &&
- (this.formData.opnGradeKind == this.$config.gradeKindType.flaw
- || this.formData.opnGradeKind == this.$config.gradeKindType.inferior)
- ) {
- this.$Message.error(this.$t('W_115'))
- return false
- }
- //校验选择缺陷是否有数据
- if (this.detailList && this.detailList.length == 1 && this.detailList[0].defectCode) {
- this.$Message.error(this.$t('W_123'))
- return false
- }
- let noList = []
- noList = noList.concat(this.editDetailList.copy().filter(f => f.pdtDefectId).map(m => m.pdtDefectId + '-' + m.pdtPlaceId))
- if (noList.length != noList.unique().length) {
- this.$Message.error(this.$t('W_114'))
- return false
- }
- return true
- },
- /**
- * @desc : 保存数据
- * @date : 2023/3/16 13:28
- * @author : 寇珊珊
- */
- saveData() {
- return this.excute(this.$service.collectService, '/', this.params)
- },
- //endregion
- //region 清空+初始化数据
- /**
- * @desc : 清空
- * @date : 2023/3/8 10:48
- * @author : 寇珊珊
- */
- clear() {
- //操作用户类型---生产工号不清空
- if (this.userKind != this.$config.operationUserType.produceUser) {
- this.formData.prodUserId = null
- this.formData.prodUserCode = null
- }
- this.detailList = []
- this.editDetailList = []
- //todo 工位先暂时不清空 暂留 zdl 2023年3月29日09:01:41
- // this.formData.stationId = null
- // this.formData.stationName = ''
- this.formData.barCode = ''
- this.formData.productId = null
- this.formData.productCode = ''
- this.formData.productName = ''
- this.formData.logoName = ''
- this.formData.colourName = ''
- this.formData.opnGradeId = null
- this.formData.gradeName = null
- this.formData.opnGradeKind = null
- this.stationFlag = false
- this.labelFlag = false
- },
- /**
- * @desc : 获取工位
- * @date : 2023/3/1 14:54
- * @author : 寇珊珊
- */
- getWorkStation() {
- let params = {
- ftyId: this.formData.ftyId,
- flowNodeId: this.flowNodeId,
- }
- this.excute(this.$service.commonService, this.$service.commonService.getWorkStation, params).then(res => {
- if (res.code === this.$config.SUCCESS_CODE) {
- this.workStationList = res.data
- }
- })
- },
- /**
- * @desc : 查询产品等级
- * @date : 2023/3/3 10:09
- * @author : 寇珊珊
- */
- getGrade() {
- let params = {
- ftyId: this.formData.ftyId,
- nodeId: this.flowNodeId,
- }
- this.excute(this.$service.commonService, this.$service.commonService.getProductGrade, params).then(res => {
- if (res.code === this.$config.SUCCESS_CODE) {
- this.gradeList = res.data
- }
- })
- },
- /**
- * @desc : 根据节点id查询工序节点
- * @date : 2023/3/9 9:55
- * @author : 寇珊珊
- */
- selectProcessNode() {
- this.excuteNoParam(this.$service.processNodeService, this.$service.processNodeService.selectById, [this.flowNodeId], false).then(res => {
- if (res.code === this.$config.SUCCESS_CODE) {
- //验证标签
- if (res.data.flgCheckLabel) {
- this.labelFlag = res.data.flgCheckLabel
- this.pdtLabelKinds = res.data.pdtLabelKindList
- for (let i of this.pdtLabelKinds) {
- i['labelCode'] = ''
- }
- }
- if (res.data.userKind == null) {
- this.$Message.error(this.$t('W_117'))
- return
- }
- this.userKind = res.data.userKind
- //默认工位
- if (res.data.stationId) {
- this.formData.stationId = res.data.stationId
- this.formData.stationName = res.data.stationName
- this.stationFlag = true
- }
- //生产工号赋默认值 节点工号-生产
- if (this.$config.operationUserType.produceUser == this.userKind) {
- this.formData.prodUserCode = this.$store.state.user.userCode
- this.formData.prodUserId = this.$store.state.user.id
- //校验打卡
- this.onProdUserCode()
- }
- } else {
- this.$Message.error(res.message)
- }
- })
- },
- //endregion
- },
- activated() {
- //改判权限标识
- this.gradeFlag = this.$libaray.checkButtonHasRight('half-check-recharge')
- //默认给新建为了保存不关页面
- this.typeData = this.$config.formMode.add
- //查询产品等级
- this.getGrade()
- //获取工位
- this.getWorkStation()
- //根据节点id查询工序节点
- this.selectProcessNode()
- },
- }
- </script>
- <style scoped>
- </style>
|