| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533 |
- <template>
- <gui-page :custom-header="true" :is-header-sized="false"
- :header-class="['gui-theme-background-color', isLandscapeScreen?'width: 100vmax;':'']"
- :style="[isLandscapeScreen?'width: 100vmax':'']">
- <template #gHeader>
- <view :style="[isLandscapeScreen?'height:44px;width: 100vmax':'height:44px;']"
- class="gui-flex gui-nowrap gui-rows gui-align-items-center">
- <!-- 使用组件实现返回按钮及返回首页按钮 -->
- <!-- <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
- @tap="goBack"></text> -->
- <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
- @tap="goHome"></text>
- <!-- 导航文本此处也可以是其他自定义内容 -->
- <text :style="[isPad?'font-size: 18px':'font-size: 14px']"
- class="gui-h4 gui-blod gui-flex1 gui-text-center gui-color-white gui-ellipsis gui-primary-text">IPQC检验</text>
- <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
- <!-- 实际宽度请根据自己情况设置 -->
- <view style="width:40px;" />
- </view>
- </template>
- <template #gBody>
- <view class="ipqc-checkout">
- <view class="bind-button">
- <view v-if="!IPQCParams.processNo" class="scan-button"
- :style="[isPad?'font-size: 18px':'font-size: 14px']" @click="handleBindIPQCUser">
- <text class="font-icons" :style="[isPad?'font-size: 18px':'font-size: 14px']"></text>
- 绑定产线
- </view>
- </view>
- <view v-if="IPQCParams.processNo" class="card-list-flexbox">
- <text class="card-list-title" :style="[isPad?'font-size: 18px':'font-size: 14px']">IPQC检验人信息</text>
- <view class="card-list-item">
- <text>日期</text>
- <text>{{ $parseTime(IPQCParams.createTime) }}</text>
- </view>
- <view class="card-list-item">
- <text>线体</text>
- <text>{{ IPQCParams.location }}</text>
- </view>
- <view class="card-list-item">
- <text>生产料号</text>
- <text>{{ IPQCParams.materialNo }}</text>
- </view>
- <view class="card-list-item">
- <text>IPQC检验员</text>
- <text>{{ IPQCParams.nickName }}</text>
- </view>
- <view class="card-list-item">
- <text>作业员</text>
- <text>{{ IPQCParams.operator }}</text>
- </view>
- <view class="card-list-item">
- <text>QC组长审核</text>
- <text>{{ IPQCParams.auditor }}</text>
- </view>
- <view v-if="IPQCParams.firstInspectionControl === true && IPQCParams.timeSplot === 0"
- class="card-list-item">
- <text>允许生成次数</text>
- <text>{{ IPQCParams.firstInspectionRetrialTimes }}</text>
- </view>
- <view v-if="IPQCParams.firstInspectionControl === true && IPQCParams.timeSplot === 0"
- class="card-list-item">
- <text>已生成次数</text>
- <text>{{ IPQCParams.firstInspectionSubmitTimes }}</text>
- </view>
- </view>
- <view v-if="IPQCParams.processNo" class="scan">
- <view class="scan-card">
- <uni-easyinput ref="easyinput" v-model="userNumber" :input-border="false" :clearable="false"
- type="text" focus placeholder="绑定员工工号" @focus="handleInputFocus" @confirm="confirmUser" />
- <text class="font-icons" @click="handleBindUser"></text>
- </view>
- </view>
- <view v-if="IPQCParams.processNo" class="select-group">
- <view class="select-item">
- <text class="store-text">检验时间</text>
- <view class="custom-select">
- <uni-data-select v-model="IPQCParams.timeSplot" :localdata="IPQCTime"
- @change="handleSelectTime" />
- </view>
- <view v-if="IPQCParams.auditStatus !== -1" style="
- width: 75px;
- height: 30px;
- display: flex;
- align-items: center;
- justify-content: center;
- border: 1px solid gray;
- border-radius: 6px;
- font-size: 14px;
- margin-left: 8px;
- color: gray;
- ">{{ computedBtnText(timeSelect) }}</view>
- <picker v-else mode="time"
- style="width: 20%;min-width: 85px;height: 40px;display: flex;justify-content: center;align-items: center;"
- :value="timeSelect.time" @change="bindTimeChange($event)">
- <view class="uni-input" style="
- width: 75px;
- height: 30px;
- display: flex;
- align-items: center;
- justify-content: center;
- border: 1px solid #6a6a6a;
- border-radius: 6px;
- font-size: 14px;
- ">
- {{ computedBtnText(timeSelect) }}
- </view>
- </picker>
- </view>
- </view>
- <view v-if="IPQCItemList?.length > 0" class="custom-table">
- <uni-table border stripe empty-text="暂无更多数据">
- <!-- 表头行 -->
- <uni-tr class="custom-table-head">
- <uni-th align="center" width="60px">序号</uni-th>
- <uni-th align="center" width="120px">是否检验</uni-th>
- <uni-th align="center" width="240px">{{ IPQCParams.processName }}</uni-th>
- <uni-th align="center" width="140px">巡检频次</uni-th>
- <uni-th align="center" width="140px">检验工具</uni-th>
- </uni-tr>
- <!-- 表格数据行 -->
- <uni-tr v-for="(item, key) in IPQCItemList" :key="key" @click="handleShowModal(item)">
- <uni-td align="center" width="120px">{{ ++key }}</uni-td>
- <uni-td align="center">
- <view style="display: flex;justify-content: center;align-items: center;">
- <text v-if="item.completed" class="font-icons"
- :style="[isPad?'font-size: 24px':'font-size: 22px', 'color: #2dc252']"></text>
- <text v-else class="font-icons"
- :style="[isPad?'font-size: 24px':'font-size: 22px', 'color: #6a6a6a']"></text>
- <text v-if="item.voidOrNot * 1 === 1" style="margin-left: 4px;">报废</text>
- <text v-else style="margin-left: 4px;">{{ item.completed? '已检': '未检' }}</text>
- </view>
- </uni-td>
- <uni-td align="center"
- :style="[item.voidOrNot * 1 === 1?'text-decoration: line-through;':'']">{{ item.inspectionName }}</uni-td>
- <uni-td align="center"
- :style="[item.voidOrNot * 1 === 1?'text-decoration: line-through;':'']">{{ item.checkQuantity }}</uni-td>
- <uni-td align="center"
- :style="[item.voidOrNot * 1 === 1?'text-decoration: line-through;':'']">{{ item.tool }}</uni-td>
- </uni-tr>
- </uni-table>
- </view>
- </view>
- <uni-popup ref="popup" background-color="#fff" :mask-click="false">
- <view class="popup-content">
- <view class="card-list-flexbox-popup">
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">{{ submitIPQCItem.inspectionName }}</text>
- </view>
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">检验方法</text>
- <text class="text-2 gui-color-gray">{{ IPQCParams.processName }}</text>
- </view>
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">检验工具</text>
- <text class="text-2 gui-color-gray">{{ submitIPQCItem.tool }}</text>
- </view>
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">检验频次</text>
- <text class="text-2 gui-color-gray">{{ submitIPQCItem.checkQuantity }}</text>
- </view>
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">检验标准</text>
- <text class="text-2 gui-color-gray">{{ submitIPQCItem.standard }}</text>
- </view>
- <view class="card-list-item">
- <text class="text-1 gui-color-gray">是否合格</text>
- <text class="text-2 gui-color-gray">
- <radio-group style="width: inherit;" @change="radioChange">
- <view
- style="display: grid;grid-template-rows: 1fr; grid-template-columns: 1fr 1fr;">
- <label>
- <view style="display: flex;justify-content: center;align-items: center;">
- <radio value="1"
- :checked="submitIPQCItem.singleResult * 1 === 1?true:false" />
- <view>合格</view>
- </view>
- </label>
- <label>
- <view style="display: flex;justify-content: center;align-items: center;">
- <radio value="0"
- :checked="submitIPQCItem.singleResult * 1 === 0?true:false" />
- <view>不合格</view>
- </view>
- </label>
- </view>
- </radio-group>
- </text>
- </view>
- <view v-if="submitIPQCItem.inspectionModel === 0" class="card-list-item-input">
- <view v-for="(item, key) in submitIPQCItem.actualCreateReqVOS" :key="key"
- style="margin: 4px 0;">
- <textarea v-model="submitIPQCItem.actualCreateReqVOS[key].actual"
- class="text-3 gui-color-gray" inputmode="decimal" placeholder="请输入检验内容"
- style="border-radius: 4px;border: 1px dotted gray;" auto-height maxlength="14" />
- <view v-if="key === submitIPQCItem.actualCreateReqVOS.length - 1" class="operation-icon"
- @click="appendRow(item)">
- <text class="font-icons"
- :style="[isPad?'font-size: 18px':'font-size: 14px']"></text>
- </view>
- <view v-else class="operation-icon-2" @click="deleteRow(item, key)">
- <text class="font-icons"
- :style="[isPad?'font-size: 18px':'font-size: 14px']"></text>
- </view>
- </view>
- </view>
- <view v-if="submitIPQCItem.inspectionModel === 1" class="card-list-item-input">
- <textarea v-model="submitIPQCItem.measuredResults" class="text-3 gui-color-gray"
- inputmode="text" placeholder="请输入检验内容"
- style="border-radius: 4px;border: 1px dotted gray;margin: 2px 4px;" auto-height
- maxlength="14" />
- </view>
- <view v-if="submitIPQCItem.src?.length > 0" class="card-list-item">
- <text class="text-1">上传图片预览:</text>
- </view>
- <view v-if="submitIPQCItem.src?.length > 0" class="card-list-item grid-image"
- style="margin: 12px 0">
- <image v-for="(item, key) in submitIPQCItem.src" :key="key" :src="item" mode="scaleToFill"
- @click="handleRemoveImage(item, key)" />
- </view>
- <view v-if="IPQCParams.auditStatus === -1" class="card-list-item">
- <button class="text-1 btn-mg" type="primary" @click="takePhoto">拍照</button>
- </view>
- <view class="card-list-item" style="margin: 12px 0">
- <button v-if="IPQCParams.auditStatus === -1" class="text-1 btn-mg" type="primary"
- :disabled="reLoading" @click="handleSubmit">提交数据</button>
- <button class="text-1 btn-mg" type="default" @click="$refs['popup'].close()">关闭</button>
- </view>
- </view>
- </view>
- </uni-popup>
- <uni-popup ref="popupProcess" background-color="#fff">
- <view class="popup-process-content">
- <view class="list-title" style="margin-bottom: 8px;">
- <span class="font-icons"
- style="font-size: 20px;color: #00a0e9;width: 40px;text-align: center;"></span>
- <span>工序列表</span>
- </view>
- <view>
- <view class="grid-box">
- <view v-for="(item, key) in processList" :key="key" class="box"
- @click="handleClickProcessName(item)">{{ item.processName }}</view>
- </view>
- </view>
- </view>
- </uni-popup>
- <gui-right-menus v-if="IPQCParams.version">
- <!-- 扩展按钮 -->
- <template #menus-more>
- <view v-if="IPQCParams.auditStatus === -1" hover-class="gui-tap"
- class="menu-items gui-bg-green gui-flex gui-columns gui-justify-content-center"
- @click="handleShowSubmitApprovalModal">
- <text class="menu-text gui-block gui-text-center gui-color-white">送审</text>
- </view>
- <view v-else hover-class="gui-tap"
- class="menu-items gui-flex gui-columns gui-justify-content-center"
- style="background-color: #717171;">
- <text class="menu-text gui-block gui-text-center gui-color-white">送审</text>
- </view>
- </template>
- <!-- 核心按钮 -->
- <template #menus-primary>
- <view class="menu-items gui-bg-primary gui-flex gui-columns gui-justify-content-center">
- <text class="menu-icon gui-color-white gui-block gui-text-center gui-icons"></text>
- <text class="menu-text gui-color-white gui-block gui-text-center">操作</text>
- </view>
- </template>
- </gui-right-menus>
- <gui-modal ref="modalForm" :custom-class="['gui-bg-white', 'gui-dark-bg-level-3', 'gui-border-radius']"
- title="提示">
- <template #content>
- <view class="gui-padding gui-bg-gray gui-dark-bg-level-2">
- <text class="gui-block gui-text-center gui-text gui-color-gray"
- style="line-height:100rpx; padding:10rpx;">您确定要立即送审吗?</text>
- </view>
- </template>
- <!-- 利用 flex 布局 可以放置多个自定义按钮哦 -->
- <template #btns>
- <view class="gui-flex gui-row gui-space-between operation-flex">
- <view hover-class="gui-tap" class="modal-btns gui-flex1" @tap="handleCancelApprovalModal">
- <text class="modal-btns gui-color-gray">取消</text>
- </view>
- <view class="line" />
- <view hover-class="gui-tap" class="modal-btns gui-flex1" @tap="handleSubmitApprovalModal">
- <text class="modal-btns gui-primary-color">确认</text>
- </view>
- </view>
- </template>
- </gui-modal>
- <uni-popup ref="errorTip" type="dialog">
- <uni-popup-dialog type="error" cancel-text="关闭" confirm-text="确认" title="提示" :content="errorTipMessage"
- @confirm="handleCloseErrorTipsModal" @close="handleCloseErrorTipsModal" />
- </uni-popup>
- </template>
- </gui-page>
- </template>
- <script>
- import axios from 'axios'
- import {
- computed,
- defineComponent,
- onMounted,
- ref,
- watch
- } from 'vue'
- export default defineComponent({
- onLoad() {
- // // #ifdef APP-PLUS
- // plus.screen.lockOrientation('default');
- // // #endif
- },
- onUnload() {
- // // #ifdef APP-PLUS
- // plus.screen.lockOrientation('portrait-primary');
- // // #endif
- },
- onResize() {
- if ([90, -90].includes(plus.navigator.getOrientation())) {
- this.isLandscapeScreen = true
- } else {
- this.isLandscapeScreen = false
- }
- },
- setup(options) {
- const popup = ref()
- const popupProcess = ref()
- const modalForm = ref()
- const userNumber = ref()
- const easyinput = ref()
- const errorState = ref(0)
- const errorTip = ref('')
- const errorTipMessage = ref('')
- const isLandscapeScreen = ref(false)
- const parentRow = options?.params ?? {}
- const processList = ref([])
- // 是否禁用提交数据按钮
- const reLoading = ref(false)
- // 绑定的检查人信息
- const IPQCParams = ref({
- operator: '',
- createTime: '',
- location: '',
- materialNo: '',
- nickName: '',
- mesroutingListId: '',
- processNo: '',
- mesHotPressId: '',
- productionCode: '',
- ipqcDate: '',
- timeSplot: 0,
- time: '',
- processName: '',
- auditStatus: null,
- auditor: '',
- version: '',
- materialLots: '',
- erpWorkOrderNo: '',
- firstInspectionControl: '',
- firstInspectionSubmitTimes: '',
- firstInspectionRetrialTimes: '',
- erpProductionWorkOrderDetailId: '',
- wmsIncomingReceiptInspectionId: ''
- })
- const IPQCItemList = ref([])
- // 待巡检项信息
- const submitIPQCItem = ref({
- src: [],
- singleResult: '',
- measuredResults: null,
- id: '',
- inspectionModel: null,
- timeSplot: null,
- actualCreateReqVOS: [{
- id: '',
- actual: 0
- }],
- fileIds: []
- })
- // 检验时间右边的按钮存放的信息
- const timeSelect = ref({
- id: 0,
- text: '首件时间',
- value: 0,
- time: ''
- })
- const IPQCTime = ref([{
- id: 0,
- text: '首件时间',
- value: 0,
- time: ''
- },
- {
- id: 1,
- text: '巡检时间',
- value: 1,
- time: ''
- },
- {
- id: 2,
- text: '巡检时间',
- value: 2,
- time: ''
- },
- {
- id: 3,
- text: '巡检时间',
- value: 3,
- time: ''
- },
- {
- id: 4,
- text: '巡检时间',
- value: 4,
- time: ''
- }, {
- id: 5,
- text: '尾件时间',
- value: 5,
- time: ''
- }
- ])
- const computedBtnText = computed(() => {
- return item => {
- const fdIndex = IPQCTime.value.findIndex(opt => opt.id === item.id)
- if (fdIndex !== -1 && IPQCTime.value[fdIndex].time) {
- return IPQCTime.value[fdIndex].time
- }
- return '设置时间'
- }
- })
- onMounted(() => {
- IPQCParams.value.materialNo = JSON.parse(parentRow)?.materialNo
- IPQCParams.value.erpProductionWorkOrderDetailId = JSON.parse(parentRow)?.id
- })
- // 根据时间选择器选择的数据进行填充
- watch([timeSelect.value], ([opt]) => {
- const fdIndex = IPQCTime.value.findIndex(item => item.id === opt.id)
- if (!['', null, undefined, NaN].includes(opt.id)) {
- Object.assign(IPQCTime.value[fdIndex], opt)
- }
- IPQCParams.value.timeSplot = opt?.id
- IPQCParams.value.time = opt?.time
- })
- const goHome = function() {
- uni.$goHome()
- }
- const goBack = function() {
- uni.$goBack('/pages/workbranch/production/IPQC/ipqcList')
- }
- const appendRow = function(row) {
- submitIPQCItem.value.actualCreateReqVOS.push({
- id: '',
- actual: ''
- })
- }
- const deleteRow = function(row, index) {
- submitIPQCItem.value.actualCreateReqVOS.splice(index, 1)
- // if (row?.id) {
- // // 走删除接口
- // } else {
- // submitIPQCItem.value.actualCreateReqVOS.splice(index, 1);
- // }
- }
- const confirmUser = function(e) {
- const submitParams = {
- wmsIncomingReceiptInspectionId: IPQCParams.value
- .wmsIncomingReceiptInspectionId,
- timeSplot: IPQCParams.value.timeSplot,
- operator: e
- }
- uni.$reqPost('ipqcBindUserNumber', submitParams)
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- uni.showToast({
- title: '员工绑定成功',
- icon: 'none',
- duration: 2000
- })
- errorState.value = 0;
- setInputFocus()
- getItemList()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- }
- const handleBindUser = function() {
- // #ifdef APP-PLUS
- const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
- 'scanType': ['qrCode', 'barCode'],
- // 是否隐藏相册,默认false不隐藏
- 'hideAlbum': false
- },
- (ret) => {
- if (ret.resp_code === 1000) {
- const submitParams = {
- wmsIncomingReceiptInspectionId: IPQCParams.value
- .wmsIncomingReceiptInspectionId,
- timeSplot: IPQCParams.value.timeSplot,
- operator: ret.resp_result
- }
- uni.$reqPost('ipqcBindUserNumber', submitParams)
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- uni.showToast({
- title: '员工绑定成功',
- icon: 'none',
- duration: 2000
- })
- errorState.value = 0;
- setInputFocus()
- getItemList()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- }
- })
- // #endif
- // #ifdef H5
- const submitParams = {
- wmsIncomingReceiptInspectionId: IPQCParams.value
- .wmsIncomingReceiptInspectionId,
- timeSplot: IPQCParams.value.timeSplot,
- operator: 'MTY2OTYwODI3MDg0MTA5ODI0MQ=='
- }
- uni.$reqPost('ipqcBindUserNumber', submitParams)
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- uni.showToast({
- title: '员工绑定成功',
- icon: 'none',
- duration: 2000
- })
- errorState.value = 0;
- setInputFocus()
- getItemList()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- // #endif
- }
- const getItemList = async function() {
- if (!['', null, undefined, NaN].includes(IPQCParams.value.timeSplot)) {
- const params = JSON.parse(JSON.stringify(IPQCParams.value))
- Reflect.deleteProperty(params, 'createTime')
- Reflect.deleteProperty(params, 'time')
- Reflect.deleteProperty(params, 'nickName')
- Reflect.deleteProperty(params, 'location')
- Reflect.deleteProperty(params, 'id')
- Reflect.deleteProperty(params, 'auditor')
- Reflect.deleteProperty(params, 'auditStatus')
- Reflect.deleteProperty(params, 'wmsIncomingReceiptInspectionId')
- const month = new Date().getMonth() + 1
- const day = new Date().getDate()
- params.ipqcDate = new Date().getFullYear() + '' + (month < 10 ? ('0' + month) :
- month) + '' + (day < 10 ? ('0' + day) : day)
- await uni.$reqPost('getIPQCItemList', params)
- .then(({ code, data, msg }) => {
- IPQCItemList.value = data?.list
- IPQCParams.value.wmsIncomingReceiptInspectionId = data
- ?.wmsIncomingReceiptInspectionId
- IPQCParams.value.operator = data
- ?.operator
- IPQCParams.value.createTime = data?.createTime
- IPQCParams.value.nickName = data?.inspector
- IPQCParams.value.time = data?.inspectionTime
- IPQCParams.value.auditor = data?.auditor
- IPQCParams.value.auditStatus = data?.auditStatus
- IPQCParams.value.materialLots = data?.materialLots
- IPQCParams.value.version = data?.version
- timeSelect.value.time = data?.inspectionTime
- })
- }
- }
- // 检验时间下拉框选择事件
- const handleSelectTime = function(e) {
- const selectItem = IPQCTime.value.find(item => item.id === e)
- Object.assign(timeSelect.value, selectItem ?? {})
- const month = new Date().getMonth() + 1
- const day = new Date().getDate()
- const params = {
- 'timeSplot': e,
- 'ipqcDate': new Date().getFullYear() + '' + (
- month < 10 ? ('0' +
- month) :
- month) + '' + (day < 10 ? ('0' + day) : day),
- 'productionCode': IPQCParams.value.productionCode,
- 'mesHotPressId': IPQCParams.value.mesHotPressId,
- 'processNo': IPQCParams.value.processNo,
- 'mesRoutingListId': IPQCParams.value.mesRoutingListId,
- 'materialNo': IPQCParams.value.materialNo,
- 'erpWorkOrderNo': IPQCParams.value.erpWorkOrderNo ?? '',
- 'firstInspectionControl': IPQCParams.value.firstInspectionControl,
- 'firstInspectionRetrialTimes': IPQCParams.value.firstInspectionRetrialTimes,
- 'erpProductionWorkOrderDetailId': IPQCParams.value.erpProductionWorkOrderDetailId
- }
- uni.$reqPost('getListRule', params).then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- getItemList()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 0
- }
- })
- }
- // 时间选择器选择事件
- const bindTimeChange = async function(e) {
- if (!['', null, undefined, NaN].includes(IPQCParams.value.timeSplot) && IPQCParams.value
- .auditStatus === -1) {
- timeSelect.value.time = e.detail.value
- const params = {
- wmsIncomingReceiptInspectionId: IPQCParams.value
- .wmsIncomingReceiptInspectionId,
- timeSplot: IPQCParams.value.timeSplot,
- inspectionTime: e.detail.value
- }
- try {
- await uni.$reqPost('insertIPQCTimeSplot', params)
- } catch (e) {
- uni.$grace.msg(e)
- }
- }
- }
- // 绑定检验执行人
- const handleBindIPQCUser = function() {
- uni.$reqGet('scanBindProduction', {
- // id: "1668903422169890817"
- id: '1605796881528524802'
- })
- .then(async ({
- data
- }) => {
- await uni.$reqGet('getProductionWorkOrderProcessList', {
- id: IPQCParams.value.erpProductionWorkOrderDetailId
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- processList.value = data
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- if (popupProcess.value?.showPopup === false) {
- popupProcess.value.open('bottom')
- }
- })
- }
- // 选择工序
- const handleClickProcessName = async function(data) {
- IPQCParams.value.id = data?.id
- // IPQCParams.value.location = data?.productionName;
- IPQCParams.value.productionCode = data?.productionCode ?? '1605796881528524802'
- IPQCParams.value.mesRoutingListId = data?.mesRoutingListId ?? ''
- IPQCParams.value.processNo = data?.processNo ?? ''
- IPQCParams.value.processName = data?.processName ?? ''
- IPQCParams.value.mesHotPressId = data?.mesHotPressId ?? ''
- IPQCParams.value.erpWorkOrderNo = data?.erpWorkOrderNo ?? ''
- IPQCParams.value.firstInspectionControl = data?.firstInspectionControl ?? ''
- IPQCParams.value.firstInspectionRetrialTimes = data?.firstInspectionRetrialTimes ?? ''
- const month = new Date().getMonth() + 1
- const day = new Date().getDate()
- const params = {
- 'timeSplot': 0,
- 'ipqcDate': new Date().getFullYear() + '' + (
- month < 10 ? ('0' +
- month) :
- month) + '' + (day < 10 ? ('0' + day) : day),
- 'productionCode': data?.productionCode ?? '1605796881528524802',
- 'mesHotPressId': data?.mesHotPressId,
- 'processNo': IPQCParams.value.processNo,
- 'mesRoutingListId': IPQCParams.value.mesRoutingListId,
- 'materialNo': IPQCParams.value.materialNo,
- 'erpWorkOrderNo': data?.erpWorkOrderNo ?? '',
- 'firstInspectionControl': data?.firstInspectionControl,
- 'firstInspectionRetrialTimes': data?.firstInspectionRetrialTimes,
- 'erpProductionWorkOrderDetailId': IPQCParams.value.erpProductionWorkOrderDetailId
- }
- await uni.$reqPost('getListRule', params).then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- getItemList()
- Object.assign(IPQCParams.value, data)
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 0
- }
- popupProcess.value.close()
- })
- }
- const scinumToFloat = function(num) {
- // 处理非数字
- if (isNaN(num)) {
- return num
- }
- // 处理不需要转换的数字
- var str = '' + num
- if (!/e/i.test(str)) {
- return num
- }
- return (num).toFixed(18).replace(/\.?0+$/, '')
- }
- // 开始检验
- const handleShowModal = function(opt) {
- if (opt?.voidOrNot * 1 !== 1) {
- Object.assign(submitIPQCItem.value, opt)
- submitIPQCItem.value.id = opt?.id
- submitIPQCItem.value.timeSplot = IPQCParams.value?.timeSplot
- submitIPQCItem.value.inspectionModel = opt?.inspectionModel
- uni.$reqGet('getResult', {
- id: opt?.id
- })
- .then((data) => {
- if (data.actualDOS !== null && Object.prototype.toString.call(data
- .actualDOS) ===
- '[object Array]' && data.actualDOS.length > 0) {
- submitIPQCItem.value.actualCreateReqVOS.length = 0
- data?.actualDOS.forEach(item => {
- const actual = scinumToFloat(item?.actual)
- submitIPQCItem.value.actualCreateReqVOS.push({
- ...item,
- actual
- })
- })
- } else {
- submitIPQCItem.value.actualCreateReqVOS = [{
- id: '',
- actual: ''
- }]
- }
- if (data.fileIds !== null) {
- submitIPQCItem.value.fileIds = data?.fileIds ?? []
- }
- submitIPQCItem.value.measuredResults = data?.measuredResults ?? ''
- if (data?.urlList !== null) {
- submitIPQCItem.value.src = data?.urlList
- } else {
- submitIPQCItem.value.src = []
- }
- })
- if (popup.value?.showPopup === false) {
- popup.value.open('bottom')
- }
- }
- }
- const handleSubmit = async function() {
- reLoading.value = true
- const actualCreateReqVOS = []
- if (submitIPQCItem.value.inspectionModel === 0) {
- try {
- submitIPQCItem.value
- .actualCreateReqVOS.forEach(item => {
- if (isNaN(Number(item.actual))) {
- throw new Error('请填写正确的数值!')
- } else {
- actualCreateReqVOS.push({
- id: '',
- ...item,
- actual: item.actual
- })
- }
- })
- reLoading.value = false
- } catch (e) {
- uni.$grace.msg(e.message)
- return
- }
- }
- const params = {
- fileIds: submitIPQCItem.value.fileIds,
- actualCreateReqVOS,
- singleResult: submitIPQCItem.value.singleResult,
- measuredResults: submitIPQCItem.value.measuredResults,
- id: submitIPQCItem.value.id,
- materialLots: IPQCParams.value.materialLots,
- inspectionModel: submitIPQCItem.value.inspectionModel,
- timeSplot: submitIPQCItem.value.timeSplot,
- processNo: IPQCParams.value.processNo
- }
- const data = await uni.$reqPut('submitItem', params)
- if (data?.code === 0) {
- reLoading.value = false
- uni.$grace.msg('数据提交成功!')
- popup.value.close()
- // 重新获取检验项数据
- const month = new Date().getMonth() + 1
- const day = new Date().getDate()
- const params = {
- 'timeSplot': 0,
- 'ipqcDate': new Date().getFullYear() + '' + (
- month < 10 ? ('0' +
- month) :
- month) + '' + (day < 10 ? ('0' + day) : day),
- 'productionCode': IPQCParams.value.productionCode,
- 'mesHotPressId': IPQCParams.value.mesHotPressId,
- 'processNo': IPQCParams.value.processNo,
- 'mesRoutingListId': IPQCParams.value.mesRoutingListId,
- 'materialNo': IPQCParams.value.materialNo,
- 'erpWorkOrderNo': IPQCParams.value.erpWorkOrderNo ?? '',
- 'firstInspectionControl': IPQCParams.value.firstInspectionControl,
- 'firstInspectionRetrialTimes': IPQCParams.value.firstInspectionRetrialTimes,
- 'erpProductionWorkOrderDetailId': IPQCParams.value
- .erpProductionWorkOrderDetailId
- }
- setTimeout(async () => {
- await uni.$reqPost('getListRule', params)
- await getItemList()
- }, 500)
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data?.msg
- errorTip.value.open()
- errorState.value = -1
- }
- }
- // 拍照
- const takePhoto = function() {
- uni.chooseImage({
- count: 6, // count: 6, //默认9
- sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album', 'camera'], // 从相册选择
- success: function(res) {
- res.tempFilePaths.forEach(async item => {
- // #ifdef APP-PLUS
- // 移动端无法使用FormData类型
- // 使用uniapp官方提供的uploadFile函数替代实现文件上传
- await uni.uploadFile({
- url: uni.$baseUrl +
- '/admin-api/minio/files/uploadFiles',
- name: 'file',
- filePath: item,
- header: {
- 'Authorization': 'Bearer ' + uni
- .getStorageSync('token')
- },
- success: function(uploadFileRes) {
- const resultJSON = JSON.parse(
- uploadFileRes.data)
- if (submitIPQCItem.value.fileIds ===
- null) {
- submitIPQCItem.value.fileIds = []
- }
- submitIPQCItem.value.fileIds.push(
- resultJSON.data
- .fileId)
- }
- })
- // #endif
- submitIPQCItem.value.src.push(item)
- })
- res.tempFiles.forEach(async (item) => {
- // #ifdef H5
- const formData = new FormData()
- formData.append('file', item)
- // 上传文件
- const {
- data
- } = await axios({
- url: uni.$baseUrl +
- '/admin-api/minio/files/uploadFiles',
- name: '上传文件',
- method: 'post',
- headers: {
- 'Authorization': 'Bearer ' + uni
- .getStorageSync('token'),
- 'Content-Type': 'multipart/form-data;'
- },
- data: formData
- })
- if (submitIPQCItem.value.fileIds === null) {
- submitIPQCItem.value.fileIds = []
- }
- submitIPQCItem.value.fileIds.push(data.data.fileId)
- // #endif
- })
- }
- })
- }
- const radioChange = function(item) {
- submitIPQCItem.value.singleResult = item?.detail?.value
- }
- const handleRemoveImage = function(opt, index) {
- submitIPQCItem.value.fileIds.splice(index, 1)
- submitIPQCItem.value.src.splice(index, 1)
- }
- const handleShowSubmitApprovalModal = function() {
- modalForm.value.open()
- }
- const handleCancelApprovalModal = function() {
- modalForm.value.close()
- }
- const handleSubmitApprovalModal = function() {
- const params = {
- version: IPQCParams.value.version,
- materialLots: IPQCParams.value.materialLots,
- processNo: IPQCParams.value.processNo,
- materialNo: IPQCParams.value.materialNo
- }
- uni.$reqPost('submitApproval', params)
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- uni.showToast({
- title: '送审成功!',
- icon: 'none',
- duration: 2000
- })
- setTimeout(() => {
- goBack()
- }, 1000)
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- .finally(() => {
- modalForm.value.close()
- })
- }
- const setInputFocus = function() {
- if (errorState.value === 0) {
- userNumber.value = ''
- easyinput.value.onBlur()
- easyinput.value.onFocus()
- }
- }
- // 关闭错误信息弹窗
- const handleCloseErrorTipsModal = async function() {
- errorTip.value.close()
- await setInputFocus()
- }
-
- // 禁用软键盘
- const handleInputFocus = function() {
- setTimeout(() => {
- uni.hideKeyboard()
- }, 100)
- }
- return {
- goHome,
- popup,
- easyinput,
- errorTip,
- errorState,
- errorTipMessage,
- popupProcess,
- handleInputFocus,
- goBack,
- IPQCTime,
- reLoading,
- modalForm,
- takePhoto,
- timeSelect,
- IPQCItemList,
- processList,
- appendRow,
- deleteRow,
- userNumber,
- isLandscapeScreen,
- IPQCParams,
- radioChange,
- handleBindIPQCUser,
- handleShowModal,
- bindTimeChange,
- handleSelectTime,
- computedBtnText,
- confirmUser,
- handleBindUser,
- handleSubmit,
- submitIPQCItem,
- handleRemoveImage,
- handleClickProcessName,
- handleShowSubmitApprovalModal,
- handleCancelApprovalModal,
- handleSubmitApprovalModal,
- handleCloseErrorTipsModal
- }
- }
- })
- </script>
- <style lang="scss" scoped>
- .gui-header-leader-btns {
- color: black;
- font-size: 24px !important;
- margin-left: 24rpx;
- }
- .gui-sbody {
- background-color: rgba(234, 239, 242, 1);
- }
- .gui-relative {
- overflow: visible;
- height: 100vh;
- .ipqc-checkout {
- width: 100vw;
- height: calc(100vh - 75px);
- position: absolute;
- top: 95px;
- overflow: hidden;
- .bind-button {
- display: flex;
- justify-content: center;
- .scan-button {
- width: 40vw;
- min-width: 50px;
- height: 35px;
- display: flex;
- justify-content: center;
- align-items: center;
- color: white;
- background-color: rgba(0, 160, 233, 1);
- border-radius: 6px;
- box-shadow: 2px 2px 3px 1px rgba(0, 156, 223, 1.0);
- }
- }
- }
- }
- .card-list-flexbox {
- width: calc(100vw - 24px);
- height: 295px;
- margin: 0 12px;
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- overflow-y: scroll;
- .card-list-title {
- width: 100%;
- height: 35px;
- line-height: 35px;
- margin: 0 4px 0 4px;
- border-radius: 4px 4px 0 0;
- text-align: center;
- color: white;
- background-color: rgba(0, 160, 233, 1.0);
- }
- .card-list-item,
- .card-list-item-operation {
- width: 100%;
- height: 35px;
- margin: 0 4px 3rpx 4px;
- border-radius: 4px;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- background-color: #fff;
- uni-text {
- font-size: 14px;
- height: 50rpx;
- text-align: left;
- padding: 0 8px;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- .text-1 {
- flex: 1;
- height: 35px;
- justify-content: flex-start;
- }
- .text-2 {
- flex: 3;
- height: 35px;
- justify-content: flex-end;
- margin-right: 4px;
- padding: 2px 6px;
- }
- }
- }
- .popup-content {
- width: 100vw;
- height: 55vh;
- overflow-y: scroll;
- }
- .popup-process-content {
- width: 100vw;
- height: 85vh;
- overflow-y: scroll;
- .list-title {
- position: fixed;
- top: 0;
- left: 0;
- z-index: 99999;
- width: 100%;
- display: flex;
- align-items: center;
- height: 45px;
- line-height: 45px;
- font-size: 16px;
- font-weight: bold;
- border-top-left-radius: 16px;
- border-top-right-radius: 16px;
- border-bottom: 1px solid #d4d4d4;
- background-color: white;
- .block {
- width: 6px;
- height: 60%;
- margin: 0 4px;
- background-color: rgb(0, 160, 233);
- }
- }
- .grid-box {
- margin-top: 45px;
- display: grid;
- grid-template-columns: 1fr 1fr 1fr;
- .box {
- position: relative;
- height: 40px;
- padding: 10px 6px;
- border: 1px solid rgb(250, 250, 251);
- box-sizing: border-box;
- margin: 12px;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 14px;
- font-weight: bold;
- border-radius: 4px;
- color: white;
- box-shadow: 0 3px 6px 0 rgba(121, 118, 118, 0.34);
- background-color: rgb(0, 160, 233);
- }
-
- .box::before {
- content: '';
- position: absolute;
- top: 20px;
- left: 0;
- bottom: 0;
- transform: translate(-50%, -50%);
- width: 12px;
- height: 12px;
- border-radius: 50%;
- z-index: 1;
- background-color: #ffffff;
- }
- }
- }
- .card-list-flexbox-popup {
- width: 100vw;
- display: flex;
- flex-direction: row;
- align-items: center;
- flex-wrap: wrap;
- .card-list-item,
- .card-list-item-input {
- width: 100vw;
- height: 100%;
- min-height: 40px;
- display: flex;
- flex-direction: row;
- align-items: center;
- background-color: #fff;
- uni-text {
- font-size: 14px;
- height: 50rpx;
- text-align: left;
- padding: 0 12px;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- uni-image {
- width: calc(100vw / 2 - 4px);
- height: calc(100vw / 3.2 - 2px);
- pointer-events: none;
- }
- uni-image::after {
- content: "×";
- width: 22px;
- height: 22px;
- position: absolute;
- top: 5px;
- right: 5px;
- display: flex;
- justify-content: center;
- align-items: center;
- color: rgba(255, 255, 255, 0.9);
- background-color: rgba(0, 0, 0, 0.5);
- border-radius: 50%;
- font-size: 24px;
- /*给伪元素开启鼠标事件,将事件冒泡到父元素的点击事件中*/
- pointer-events: auto;
- }
- .text-1 {
- flex: 1;
- height: 40px;
- justify-content: flex-start;
- }
- .text-2 {
- flex: 3;
- height: 40px;
- justify-content: flex-end;
- margin-right: 4px;
- padding: 2px 6px;
- }
- .text-3 {
- width: calc(100% - 15%);
- min-height: 35px;
- justify-content: flex-end;
- padding: 2px 6px;
- }
- .text-3::before {}
- .btn-mg {
- margin: 0 5px;
- }
- }
- .card-list-item {
- justify-content: center;
- }
- .card-list-item-input {
- margin: 10px 0 10px 2%;
- display: flex;
- flex-direction: column;
- uni-view {
- width: 100%;
- height: 100%;
- display: flex;
- uni-textarea {
- flex: 8;
- }
- uni-view {
- flex: 1;
- }
- .operation-icon,
- .operation-icon-2 {
- height: auto;
- uni-text {
- width: 22px;
- height: 100%;
- padding: 0 !important;
- text-align: center;
- display: flex;
- justify-content: center;
- align-items: center;
- border-top-right-radius: 4px;
- border-bottom-right-radius: 4px;
- color: white;
- background-color: #80b7ff;
- }
- }
- .operation-icon-2 {
- uni-text {
- background-color: #ff5962;
- }
- }
- }
- }
- .grid-image {
- /* 设置容器布局为grid布局 */
- display: grid;
- /* 指定每一行的宽度 每个宽度中间用空格隔开 */
- grid-template-rows: repeat(auto-fill, 1fr);
- /* 指定每一列的宽度 每个宽度中间用空格隔开 */
- grid-template-columns: repeat(2, 1fr);
- padding: 0 4px;
- }
- .card-list-item:nth-of-type(1) {
- .text-1 {
- flex: 9;
- font-weight: bold;
- color: black !important;
- }
- .text-1::before {
- content: "";
- width: 4px;
- height: 20px;
- border-radius: 4px;
- margin-right: 4px;
- background-color: skyblue;
- }
- .text-2 {
- flex: 4;
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- align-items: center;
- color: limegreen !important;
- }
- }
- }
- .custom-table {
- height: calc(100vh - 485px);
- // min-height: 600px;
- overflow-y: scroll;
- }
- .select-group {
- display: flex;
- flex-direction: column;
- align-items: center;
- flex: 1;
- .select-item {
- width: 100%;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- margin: 5px 0;
- background-color: white;
- .store-text {
- min-width: 60px;
- margin: 0 7px;
- font-size: 14px;
- }
- }
- }
- .uni-list-cell {
- width: 100vw;
- height: 35px;
- margin: 4px 0;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- border-bottom: 2px solid #eaeff2;
- background-color: #fff;
- view {
- font-size: 14px;
- height: 50rpx;
- text-align: left;
- padding: 0 8px;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- .uni-list-cell-left {
- flex: 1;
- height: 35px;
- justify-content: flex-start;
- }
- .uni-list-cell-db {
- flex: 3;
- height: 35px;
- justify-content: flex-end;
- margin-right: 4px;
- padding: 2px 6px;
- uni-picker {
- width: 100%;
- display: flex;
- flex-direction: row;
- justify-content: center;
- }
- }
- }
- .modal-btns {
- height: 100rpx;
- line-height: 100rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .line {
- margin-top: 10rpx;
- height: 80rpx;
- width: 1rpx;
- background-color: #dcdcdc;
- }
- .scan {
- height: 45px;
- width: calc(100% - 24px);
- padding: 0 12px;
- margin-top: 4px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-radius: 6px;
- background-color: white;
- .scan-card {
- width: 100%;
- display: grid;
- grid-template-rows: 1fr;
- grid-template-columns: 7fr 2fr;
- align-items: center;
- input {
- height: 35px;
- line-height: 35px;
- }
- text {
- width: 100%;
- text-align: right;
- }
- }
- }
- </style>
|