form.vue 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012
  1. <template>
  2. <view class="page-container uni-column">
  3. <view class="carrier-info uni-column">
  4. <view class="carrier-code uni-row">
  5. <text>箱号</text>
  6. <text style="margin-left: 24rpx;">{{processInspecion.lot.allCarrierName}}</text>
  7. </view>
  8. <view class="info-row uni-row">
  9. <view class="label">图号</view>
  10. <view class="value">{{ processInspecion.lot.drawingNumber }}</view>
  11. </view>
  12. <view class="info-row uni-row">
  13. <view class="label">批次号</view>
  14. <view class="value">{{ processInspecion.lot.lotCode }}</view>
  15. </view>
  16. <view class="info-row uni-row">
  17. <view class="label">工艺版本</view>
  18. <view class="value">{{ processInspecion.lot.technologyVersion }}</view>
  19. </view>
  20. <view class="info-row uni-row">
  21. <view class="label">产品描述</view>
  22. <view class="value">{{processInspecion.lot.productDescription }}</view>
  23. </view>
  24. <view class="info-row uni-row">
  25. <view class="label">外协工序</view>
  26. <view class="value">{{ processInspecion.processNames }}</view>
  27. </view>
  28. <view class="info-row uni-row">
  29. <view class="label">投产数量</view>
  30. <view class="value">{{ processInspecion.lot.pudName }}</view>
  31. </view>
  32. <view class="info-row uni-row">
  33. <view class="label">检查载具</view>
  34. <view class="value">{{ processInspecion.inspectionCarrierCode }}
  35. {{ processInspecion.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
  36. </view>
  37. </view>
  38. <view class="info-row uni-row">
  39. <view class="drawing-btn" @click="handleDrawingMenu">图纸信息</view>
  40. </view>
  41. </view>
  42. <!-- 废品信息 -->
  43. <view class="title unfit-title uni-row">
  44. <text>检查信息</text>
  45. <view v-if="editable()" class="add-btn" @click="handleAddWaste">添加</view>
  46. </view>
  47. <view class="unfit-container">
  48. <view class="unfit-item-container uni-column" v-for="(item, index) in oldUnfitInfos" :key="index">
  49. <view class="resu uni-row">
  50. <view class="label">检查标准</view>
  51. <view class="value">{{ item.checkStandard }}</view>
  52. </view>
  53. <view class="resu uni-row">
  54. <view class="label">检查结果</view>
  55. <view class="value">{{ item.checkResult }}</view>
  56. </view>
  57. <view class="resu uni-row">
  58. <view class="label">超差范围</view>
  59. <view class="value">{{ item.exceedLimits }}</view>
  60. </view>
  61. <view class="resu uni-row">
  62. <view :class="'label'">检查量</view>
  63. <view class="number value">{{ item.examiningNum }}</view>
  64. <view :class="'label'">不良品量</view>
  65. <view class="value">{{ item.disqualificationNum }}</view>
  66. <view :class="'label'">废品量</view>
  67. <view class="value">{{ item.rejectNum }}</view>
  68. </view>
  69. </view>
  70. <view class="unfit-item-container uni-column" v-for="(item, index) in unfitInfos" :key="index">
  71. <!-- 暂时注释,后续会使用 -->
  72. <!-- <view class="title uni-row">
  73. <text>检查项-{{ item.title }}</text>
  74. <uni-icons type="trash" size="24" color="#fc6565" @click="handleDelWaste(index)" />
  75. </view> -->
  76. <!-- <view class="standard">检查标准:{{ item.standard }}</view> -->
  77. <view class="resu uni-row">
  78. <view class="label">检查标准</view>
  79. <view class="value" style="margin-left:16rpx;width: 400rpx;">{{ item.checkStandard }}</view>
  80. <uni-icons v-if="editable()" type="trash" size="24" style="margin-left: 55rpx;" color="#fc6565"
  81. @click="handleDelWaste(index)" />
  82. </view>
  83. <!-- <view class="result uni-row">
  84. <view class="label">检查结果</view>
  85. <input v-model="item.checkResult" placeholder="请输入检查结果" />
  86. <view class="label" style="text-align: right; padding-right: 16rpx;">数量
  87. </view>
  88. <input class="number" type="number" @blur="rejectNumberChange" v-model="item.rejectNum"
  89. placeholder="" />
  90. </view> -->
  91. <view class="resu uni-row">
  92. <view class="label">检查结果</view>
  93. <input v-if="editable()" v-model="item.checkResult" placeholder="请输入检查结果" maxlength="50" />
  94. <view v-else class="value" style="margin-left:16rpx;">{{ item.checkResult }}</view>
  95. </view>
  96. <view class="resu uni-row">
  97. <view class="label">超差范围</view>
  98. <input v-if="editable()" v-model="item.exceedLimits" placeholder="请输入超差范围" maxlength="50" />
  99. <view v-else class="value" style="margin-left:16rpx;">{{ item.exceedLimits }}</view>
  100. </view>
  101. <view class="resu uni-row">
  102. <view :class="!editable() ? 'label' : ''">检查量</view>
  103. <input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
  104. v-model="item.examiningNum" placeholder="" />
  105. <view v-else class="number value" style="margin-left:16rpx;">{{ item.examiningNum }}</view>
  106. <view :class="!editable() ? 'label' : ''">不良品量</view>
  107. <input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
  108. v-model="item.disqualificationNum" placeholder="" />
  109. <view v-else class="number value" style="margin-left:16rpx;">{{ item.disqualificationNum }}</view>
  110. <view :class="!editable() ? 'label' : ''">废品量</view>
  111. <input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
  112. v-model="item.rejectNum" placeholder="" />
  113. <view v-else class="number value" style="margin-left:16rpx;">{{ item.rejectNum }}</view>
  114. </view>
  115. </view>
  116. </view>
  117. <!-- 拍照上传部分 -->
  118. <view class="title unfit-title uni-row">
  119. <text>拍照上传</text>
  120. </view>
  121. <view class=" uni-row" style="padding: 24rpx;
  122. margin: 0 16rpx;
  123. background-color: #ffffff;
  124. border-radius: 12rpx;">
  125. <uni-file-picker v-model="photoList" :readonly="!editable()" return-type="array" :image-styles="imageStyles" @select="select" file-mediatype="image" class="my-files" @delete="handleDeletedPhoto" ></uni-file-picker>
  126. </view>
  127. <!-- 咨询部分 -->
  128. <view class="title">咨询</view>
  129. <view class="consultation-container uni-column">
  130. <view class="consultation-item-container" v-for="(item, index) in consultations" :key="index">
  131. <view class="question uni-column">
  132. <view class="label uni-row">
  133. <text>问题描述</text>
  134. <text :style="selectType(item)">{{item.consultDepartment == 0?'技术':'品管'}}
  135. {{ selectText(item) }}</text>
  136. </view>
  137. <view class="content">{{ item.content }}</view>
  138. </view>
  139. <!-- 不需要暂时注释 -->
  140. <!-- <view v-if="item.answer !== ''" class="answer"
  141. style="margin-top: 24rpx; padding-top: 24rpx; border-top: 1px dotted #aaaaaa;">
  142. <view class="label">回复</view>
  143. <view class="content">{{ item.answer }}</view>
  144. </view> -->
  145. </view>
  146. </view>
  147. <!-- 报工部分 -->
  148. <view class="daywork-container">
  149. <!-- 此处后续要加上条件限制,当状态为合格或不合格的时候不能修改状态,需要有权限的人来进行修改 -->
  150. <!-- <view class="result uni-row">
  151. <view class="label">检测量</view>
  152. <input type="number" v-model="processInspecion.examiningNum" placeholder="请输入检测量" />
  153. <view class="label" style="text-align: right; padding-right: 24rpx">废品量</view>
  154. <input type="number" v-model="processInspecion.rejectNum" placeholder="请输入废品量" />
  155. </view> -->
  156. <view class="result resu uni-row" style="margin-top: 20rpx;">
  157. <view class="label" style="width: 170rpx;">外协检状态</view>
  158. <uni-data-checkbox v-if="editable()" v-model="processInspecion.status" :localdata="range"
  159. @change="change"></uni-data-checkbox>
  160. <view v-else class="value">{{ processInspecion.status == 1 ? '合格' : '不合格' }}
  161. </view>
  162. </view>
  163. <view v-if="editable()">
  164. <view v-if="showTransfer" class="list-title uni-row" style="margin-top: 16rpx;">
  165. <text class="label">是否移交仪器室</text><text>&nbsp;否</text>
  166. <switch class="switch" @change="switchChange" style="transform:scale(0.7);margin-top: -16rpx;"
  167. color="rgba(255,85,85,1)" />
  168. <text>是</text>
  169. </view>
  170. <view v-else class="list-title uni-row" style="margin-top: 16rpx;">
  171. <text class="label">已经移交给仪器室</text>
  172. </view>
  173. </view>
  174. <view class="result uni-row">
  175. <view class="label">废品总数</view>
  176. <view class="value" style="margin-left: 10px;">{{ processInspecion.rejectNum }}</view>
  177. </view>
  178. <view class="remark uni-row">
  179. <view class="label">备注</view>
  180. <textarea v-if="editable()" v-model="processInspecion.remark" />
  181. <view v-else class="value">{{ processInspecion.remark }}</view>
  182. </view>
  183. <view class="btns-container uni-row">
  184. <view v-if="editable()" class="finished-btn" @click="endWork">结束报工</view>
  185. <view v-if="editable()" class="question-btn uni-column" @click.stop="handleAddConsultation">
  186. <uni-icons type="headphones" size="24" />
  187. <text>咨询</text>
  188. </view>
  189. </view>
  190. </view>
  191. <dialog-inspectionChamber ref='selectInspectionChamber'
  192. @handleSelectInspectionChamber='handleSelectInspectionChamber'></dialog-inspectionChamber>
  193. </view>
  194. </template>
  195. <script setup>
  196. import {
  197. ref,
  198. onMounted,
  199. getCurrentInstance
  200. } from 'vue'
  201. import {
  202. onLoad,
  203. onReady,
  204. onUnload,
  205. onShow
  206. } from '@dcloudio/uni-app'
  207. import {
  208. store
  209. } from '@/store/index.js'
  210. import {
  211. saveOutsourcedInspecion,
  212. getInstrumentRoomInspection,
  213. selectOutsourcedInspecion
  214. } from '@/api/business/processInspection.js'
  215. import {getURL} from '@/api/sys/user.js'
  216. const lot = ref({})
  217. const unfitInfos = ref([]) //废品信息
  218. const oldUnfitInfos = ref([])
  219. const isEventTriggered = ref(false); // 创建一个标志位
  220. // 创建一个引用来存储最后一次请求的时间戳
  221. const lastRequestTimestamp = ref(0);
  222. const selectInspectionChamber = ref(null)
  223. const consultations = ref([]) //咨询信息
  224. const flag = ref(false)
  225. const showTransfer = ref(true)
  226. const processInspecion = ref({
  227. remark: "",
  228. rejectNum: 0,
  229. examiningNum: 0,
  230. status: 0,
  231. })
  232. const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
  233. const webHost = ref(urlList.baseUrl)
  234. const photoList = ref([])
  235. const selected = ref([]);
  236. const selectedPhotos = ref([])
  237. const imageStyles = {
  238. width:60,
  239. height:60
  240. }
  241. const initStatus = ref(0)
  242. const editable = () => {
  243. if (processInspecion.value.auditStatus == 1) {
  244. return false
  245. }
  246. if (store.userInfo.permissions.some(item => item === 'business:outsourcedInspection:edit')) {
  247. return true
  248. }
  249. if (initStatus.value == 0) {
  250. return true
  251. }
  252. if (processInspecion.value.firstUpdaterId == store.userInfo.userId) {
  253. return true
  254. }
  255. return false
  256. }
  257. const consul = [{
  258. value: 0,
  259. text: "待确认",
  260. type: "color: #fcab53"
  261. }, {
  262. value: 2,
  263. text: "合格",
  264. type: "color: #55ff7f"
  265. }, {
  266. value: 1,
  267. text: "不合格",
  268. type: "color: #ff0c2c"
  269. }]
  270. const range = [{
  271. value: 0,
  272. text: "待确认",
  273. type: "color: #fcab53"
  274. }, {
  275. value: 1,
  276. text: "合格",
  277. type: "color: #55ff7f"
  278. }, {
  279. value: 2,
  280. text: "不合格",
  281. type: "color: #ff0c2c"
  282. }]
  283. /***************************** 页面生命周期函数 *****************************/
  284. onMounted(() => {
  285. const instance = getCurrentInstance().proxy
  286. const eventChannel = instance.getOpenerEventChannel();
  287. eventChannel.on('outsourcedInspectionFrom', function(data) {
  288. console.log('outsourcedInspectionFrom', data)
  289. if (data && data.data) {
  290. processInspecion.value.lot = data.data;
  291. }
  292. })
  293. })
  294. onLoad(() => {
  295. uni.$off('addWasteInfoEvent');
  296. if (!flag.value) {
  297. if (store.processInspection != null) {
  298. uni.showLoading({
  299. title: '加载中'
  300. });
  301. processInspecion.value = store.processInspection
  302. selectOutsourcedInspecion(processInspecion.value).then(res => {
  303. console.log("res", res);
  304. if (res.code == 200) {
  305. processInspecion.value = res.data;
  306. initStatus.value = res.data.status
  307. unfitInfos.value = res.data.rejects;
  308. oldUnfitInfos.value = res.data.oldRejects;
  309. consultations.value = res.data.dayworkItemConsults;
  310. selectedPhotos.value = res.data.processInspectionPictureList
  311. photoList.value = res.data.processInspectionPictureList.map(item => {
  312. return { ...item, url: webHost.value + item.url };
  313. });
  314. console.log("res", res);
  315. //判断是否移交到了仪器室
  316. getInstrumentRoomInspectionList()
  317. uni.hideLoading();
  318. // getInspecion();
  319. } else {
  320. uni.showToast({
  321. icon: 'none',
  322. title: res.msg,
  323. duration: 2000
  324. })
  325. }
  326. });
  327. }
  328. }
  329. })
  330. /***************************** 定义了一些方法 *****************************/
  331. //咨询文本
  332. function selectText(item) {
  333. for (var i = 0; i < consul.length; i++) {
  334. if (item.status == consul[i].value) {
  335. return consul[i].text
  336. }
  337. }
  338. }
  339. function upLoadImageHandler(arg) {
  340. getURL(arg).then(res =>{
  341. let data = JSON.parse(res)
  342. selectedPhotos.value.push({
  343. url:data.fileName,
  344. pictureName:data.originalFilename
  345. })
  346. console.log(selectedPhotos.value)
  347. })
  348. }
  349. function select (e) {
  350. console.log(e)
  351. const {
  352. tempFilePaths,
  353. tempFiles
  354. } = e
  355. tempFiles.forEach((item,index)=>{
  356. upLoadImageHandler({ filePath: tempFilePaths[index],name:item.name})
  357. })
  358. }
  359. function handleDeletedPhoto(e) {
  360. let fileName = selectedPhotos.value.map(info => info.name)
  361. let index = fileName.findIndex(name => name === e.tempFile.name);
  362. selectedPhotos.value.splice(index,1)
  363. }
  364. //打开电子图纸
  365. function handleDrawingMenu() {
  366. var outsourceOrderDetailId = encodeURIComponent(processInspecion.value.outsourceOrderDetailId);
  367. var lotCode = encodeURIComponent(processInspecion.value.lot.lotCode);
  368. var technologyVersion = encodeURIComponent(processInspecion.value.lot.technologyVersion)
  369. // 构建查询参数字符串
  370. var queryParam =
  371. `param1=${outsourceOrderDetailId}&param2=${lotCode}&param3=${processInspecion.value.lot.productId}&param4=${technologyVersion}`;
  372. // 使用模板字符串构建完整的URL
  373. var navigateUrl = `/pages/outsourcedDrawingMenu/index?${queryParam}`;
  374. // 导航到指定页面
  375. uni.navigateTo({
  376. url: navigateUrl
  377. });
  378. }
  379. function getInstrumentRoomInspectionList() {
  380. getInstrumentRoomInspection(processInspecion.value).then(res => {
  381. if (res.data.length > 0) {
  382. showTransfer.value = false
  383. } else {
  384. showTransfer.value = true
  385. }
  386. })
  387. }
  388. function switchChange(event) {
  389. if (event.detail.value) {
  390. processInspecion.value.flag = true
  391. } else {
  392. processInspecion.value.flag = false
  393. }
  394. }
  395. const rejectNumberChange = () => {
  396. let sumReject = 0
  397. let sumDisqualificationNum = 0
  398. let sumExaminingNum = 0
  399. unfitInfos.value.forEach(v => {
  400. sumReject += (v.rejectNum != null ? Number(v.rejectNum) : 0)
  401. sumDisqualificationNum += (v.disqualificationNum != null ? Number(v.disqualificationNum) : 0)
  402. sumExaminingNum += (v.examiningNum != null ? Number(v.examiningNum) : 0)
  403. })
  404. processInspecion.value.rejectNum = sumReject
  405. processInspecion.value.disqualificationNum = sumDisqualificationNum
  406. processInspecion.value.examiningNum = sumExaminingNum
  407. console.log(processInspecion.value)
  408. }
  409. //查询咨询列表
  410. function getInspecion() {
  411. processInspecion.value = store.processInspection
  412. selectInspecion(processInspecion.value).then(res => {
  413. console.log("咨询", res);
  414. if (res.code == 200) {
  415. console.log("res", res);
  416. } else {
  417. uni.showToast({
  418. icon: 'none',
  419. title: res.msg,
  420. duration: 2000
  421. })
  422. }
  423. });
  424. }
  425. //结束报工按钮
  426. function endWork() {
  427. let unf = unfitInfos.value;
  428. for (var i = 0; i < unfitInfos.value.length; i++) {
  429. console.log("废品信息");
  430. // if (!unf[i].checkStandard && !unf[i].checkResult && !unf[i].rejectNum) {
  431. // uni.showToast({
  432. // icon: 'none',
  433. // title: "废品信息不能为空",
  434. // duration: 2000
  435. // })
  436. // return;
  437. // }
  438. if (unf[i].checkStandard == '' || unf[i].checkStandard == null) {
  439. uni.showToast({
  440. icon: 'none',
  441. title: "检查标准不能为空",
  442. duration: 2000
  443. })
  444. return;
  445. }
  446. // if (unf[i].checkResult == '' || unf[i].checkResult == null) {
  447. // uni.showToast({
  448. // icon: 'none',
  449. // title: "检查结果不能为空",
  450. // duration: 2000
  451. // })
  452. // return;
  453. // }
  454. if (unf[i].rejectNum == null) {
  455. uni.showToast({
  456. icon: 'none',
  457. title: "废品量不能为空",
  458. duration: 2000
  459. })
  460. return;
  461. }
  462. if (unf[i].rejectNum < 0 || unf[i].examiningNum < 0 || unf[i].disqualificationNum < 0) {
  463. uni.showToast({
  464. icon: 'none',
  465. title: '检查量,不良品量,废品量不能小于0',
  466. duration: 2000
  467. })
  468. return
  469. }
  470. if (unf[i].examiningNum > processInspecion.value.lot.pudName) {
  471. uni.showToast({
  472. icon: 'none',
  473. title: '检查量不能大于投产量'
  474. })
  475. return
  476. }
  477. }
  478. let sumReject = 0
  479. unfitInfos.value.forEach(v => {
  480. sumReject += Number(v.rejectNum)
  481. })
  482. if (processInspecion.value.rejectNum != sumReject) {
  483. uni.showToast({
  484. icon: 'none',
  485. title: "废品量与废品信息不一致",
  486. duration: 2000
  487. })
  488. return;
  489. }
  490. if (processInspecion.value.rejectNum > processInspecion.value.lot.pudName) {
  491. uni.showToast({
  492. icon: 'none',
  493. title: '废品量不能大于投产量'
  494. })
  495. return
  496. }
  497. if (processInspecion.value.disqualificationNum > processInspecion.value.lot.pudName) {
  498. uni.showToast({
  499. icon: 'none',
  500. title: '不良品量不能大于投产量'
  501. })
  502. return
  503. }
  504. save();
  505. }
  506. function save() {
  507. const currentTime = Date.now();
  508. // 检查是否已经过去了 2 秒
  509. if (currentTime - lastRequestTimestamp.value < 2000) {
  510. // 如果在 2 秒 内已经点击,那么不执行
  511. uni.showToast({
  512. icon: 'none',
  513. title: `请勿重复点击`,
  514. duration: 2000
  515. })
  516. return;
  517. }
  518. let pages = getCurrentPages();
  519. processInspecion.value.dayworkItemConsults = consultations.value;
  520. processInspecion.value.dayworkItemRejects = unfitInfos.value;
  521. processInspecion.value.user = store.userInfo;
  522. processInspecion.value.processInspectionPictureList = selectedPhotos.value
  523. if (processInspecion.value.flag) {
  524. //打开选择仪器室的弹窗
  525. selectInspectionChamber.value.open()
  526. console.log(processInspecion.value)
  527. } else {
  528. saveOutsourcedInspecion(processInspecion.value).then(res => {
  529. if (res.code == 200) {
  530. let index = 0;
  531. for (let i = 0; i < pages.length; i++) {
  532. if (pages[i].$page.fullPath == "/pages/outsourcedInspection/index") {
  533. index = pages.length - i - 1;
  534. }
  535. }
  536. console.log("index", index);
  537. uni.navigateBack({
  538. delta: index
  539. });
  540. } else {
  541. uni.showToast({
  542. icon: 'none',
  543. title: res.msg,
  544. duration: 2000
  545. })
  546. }
  547. });
  548. }
  549. }
  550. function handleSelectInspectionChamber(data) {
  551. processInspecion.value.inspectionChamberId = data
  552. console.log(processInspecion.value)
  553. saveOutsourcedInspecion(processInspecion.value).then(res => {
  554. if (res.code == 200) {
  555. let index = 0;
  556. let pages = getCurrentPages();
  557. for (let i = 0; i < pages.length; i++) {
  558. if (pages[i].$page.fullPath == "/pages/outsourcedInspection/index") {
  559. index = pages.length - i - 1;
  560. }
  561. }
  562. console.log("index", index);
  563. uni.navigateBack({
  564. delta: index
  565. });
  566. } else {
  567. uni.showToast({
  568. icon: 'none',
  569. title: res.msg,
  570. duration: 2000
  571. })
  572. }
  573. });
  574. }
  575. //咨询样式
  576. function selectType(item) {
  577. for (var i = 0; i < consul.length; i++) {
  578. if (item.status == consul[i].value) {
  579. return consul[i].type
  580. }
  581. }
  582. }
  583. // const addWasteInfo = (data) => {
  584. // const info = {
  585. // title: data.title,
  586. // checkStandard: data.standard
  587. // }
  588. // unfitInfos.value.push(info)
  589. // }
  590. const addConsultation = (data) => {
  591. console.log(data)
  592. let info = data
  593. info.forEach(item => {
  594. item.status = 0
  595. })
  596. consultations.value = consultations.value.concat(info)
  597. isEventTriggered.value = true; // 更新标志位状态
  598. }
  599. /***************************** 定义了一些事件 *****************************/
  600. // 添加不合格信息
  601. // const handleAddWaste = () => {
  602. // let info = {}
  603. // unfitInfos.value.push(info)
  604. // // 监听事件,暂时不用,后续会使用
  605. // // uni.$once('addWasteInfoEvent', (data) => {
  606. // // addWasteInfo(data)
  607. // // })
  608. // // uni.navigateTo({
  609. // // url: "/pages/processInspection/options"
  610. // // })
  611. // }
  612. const handleAddWaste = () => {
  613. flag.value = true
  614. // 监听事件,暂时不用,后续会使用
  615. uni.$once('addWasteInfoEvent', (data) => {
  616. addWasteInfo(data)
  617. })
  618. var encodedId = encodeURIComponent(processInspecion.value.lot.productId);
  619. var enprocessId = encodeURIComponent(processInspecion.value.lot.processId);
  620. // 构建查询参数字符串
  621. var queryParam = `param1=${encodedId}&param2=${enprocessId}`;
  622. // 使用模板字符串构建完整的URL
  623. var navigateUrl = `/pages/outsourcedInspection/options?${queryParam}`;
  624. // 导航到指定页面
  625. uni.navigateTo({
  626. url: navigateUrl
  627. });
  628. }
  629. const addWasteInfo = (data) => {
  630. console.log(data, "55555555")
  631. flag.value = true
  632. var info = {
  633. inspectionStandardsId: data.id,
  634. checkStandard: data.standard
  635. }
  636. unfitInfos.value.push(info)
  637. console.log(data)
  638. }
  639. // 删除不合格信息
  640. const handleDelWaste = (index) => {
  641. uni.showModal({
  642. title: '提示',
  643. content: '确定删除该项?',
  644. success: function(res) {
  645. if (res.confirm) {
  646. unfitInfos.value.splice(index, 1)
  647. rejectNumberChange()
  648. } else if (res.cancel) {
  649. return
  650. }
  651. }
  652. })
  653. }
  654. // 咨询
  655. const handleAddConsultation = () => {
  656. isEventTriggered.value = false;
  657. // 监听事件
  658. uni.$once('wasteConsultationEvent', (data) => {
  659. if (!isEventTriggered.value) {
  660. // 如果事件尚未触发,则执行事件触发逻辑
  661. addConsultation(data)
  662. }
  663. })
  664. uni.navigateTo({
  665. url: "/pages/outsourcedInspection/consultation",
  666. success: (res) => {
  667. // 通过eventChannel向被打开页面传送数据
  668. res.eventChannel.emit("outsourcedInspectionConsultation", {
  669. data: processInspecion.value.lot
  670. })
  671. }
  672. })
  673. }
  674. </script>
  675. <style lang="scss">
  676. .page-container {
  677. // height: 100%;
  678. background-color: #ececec;
  679. font-size: 28rpx;
  680. >.title {
  681. font-weight: 700;
  682. margin: 24rpx 16rpx;
  683. }
  684. }
  685. .carrier-info {
  686. margin: 32rpx 16rpx 0 16rpx;
  687. padding: 24rpx;
  688. background-color: #ffffff;
  689. border-radius: 8rpx;
  690. .carrier-code {
  691. font-size: 32rpx;
  692. font-weight: 700;
  693. }
  694. .info-row {
  695. margin-top: 16rpx;
  696. color: #767676;
  697. .label {
  698. width: 160rpx;
  699. }
  700. .drawing-btn {
  701. padding: 12rpx 32rpx;
  702. background-color: #0055ff;
  703. color: #ffffff;
  704. border-radius: 12rpx;
  705. margin-left: auto;
  706. font-size: 28rpx;
  707. }
  708. .value {
  709. flex: 1;
  710. textarea {
  711. flex: 1;
  712. border: 1px solid #888888;
  713. box-sizing: border-box;
  714. padding: 16rpx;
  715. }
  716. }
  717. }
  718. }
  719. .unfit-title {
  720. margin-bottom: 24rpx;
  721. justify-content: space-between;
  722. align-items: center;
  723. text {
  724. font-size: 28rpx;
  725. font-weight: 700;
  726. }
  727. .add-btn {
  728. margin-right: 26rpx;
  729. padding: 12rpx 32rpx;
  730. background-color: #a4adb3;
  731. color: #ffffff;
  732. border-radius: 12rpx;
  733. font-size: 24rpx;
  734. }
  735. }
  736. .unfit-container {
  737. padding: 24rpx;
  738. margin: 0 16rpx;
  739. background-color: #ffffff;
  740. border-radius: 12rpx;
  741. .unfit-item-container {
  742. position: relative;
  743. >* {
  744. margin-bottom: 24rpx;
  745. }
  746. .title {
  747. font-weight: 700;
  748. justify-content: space-between;
  749. align-items: center;
  750. image {
  751. width: 40rpx;
  752. height: 40rpx;
  753. }
  754. }
  755. .standard {}
  756. .resu {
  757. width: 100%;
  758. align-items: center;
  759. input {
  760. margin-left: 20rpx;
  761. width: 200rpx;
  762. height: 56rpx;
  763. flex: 1;
  764. border: 1px solid #9f9f9f;
  765. font-size: 28rpx;
  766. }
  767. .label {
  768. width: 160rpx;
  769. }
  770. .value {
  771. flex: 1;
  772. textarea {
  773. flex: 1;
  774. border: 1px solid #888888;
  775. box-sizing: border-box;
  776. padding: 16rpx;
  777. }
  778. }
  779. }
  780. .result {
  781. border-bottom: 1px solid #9f9f9f;
  782. padding-bottom: 32rpx;
  783. align-items: center;
  784. .label {
  785. width: 160rpx;
  786. }
  787. .value {
  788. flex: 1;
  789. textarea {
  790. flex: 1;
  791. border: 1px solid #888888;
  792. box-sizing: border-box;
  793. padding: 16rpx;
  794. }
  795. }
  796. input {
  797. width: 280rpx;
  798. height: 56rpx;
  799. border: 1px solid #9f9f9f;
  800. font-size: 28rpx;
  801. &.number {
  802. width: 104rpx;
  803. text-align: center;
  804. }
  805. }
  806. }
  807. }
  808. .unfit-item-container:last-child {
  809. .result {
  810. border-bottom: none;
  811. padding-bottom: 0;
  812. }
  813. }
  814. }
  815. .consultation-container {
  816. margin: 0 16rpx;
  817. padding: 24rpx;
  818. background-color: #ffffff;
  819. border-radius: 8rpx;
  820. .consultation-item-container {
  821. margin-bottom: 24rpx;
  822. border-bottom: 2px solid #888888;
  823. padding-bottom: 24rpx;
  824. }
  825. .consultation-item-container:last-child {
  826. margin-bottom: 0;
  827. border-bottom: 0;
  828. padding-bottom: 0;
  829. }
  830. .question,
  831. .answer {
  832. .label {
  833. justify-content: space-between;
  834. margin-bottom: 16rpx;
  835. font-weight: 700;
  836. }
  837. .content {
  838. line-height: 40rpx;
  839. }
  840. }
  841. .answer {
  842. margin-top: 24rpx;
  843. }
  844. }
  845. .daywork-container {
  846. margin-top: 24rpx;
  847. padding: 24rpx;
  848. background-color: #ffffff;
  849. border: 1px solid #bcbcbc;
  850. .result {
  851. align-items: center;
  852. .label {
  853. width: 112rpx;
  854. }
  855. input {
  856. flex: 1;
  857. height: 56rpx;
  858. border: 1px solid #9f9f9f;
  859. font-size: 28rpx;
  860. text-align: center;
  861. }
  862. }
  863. .remark {
  864. margin-top: 24rpx;
  865. .label {
  866. width: 112rpx;
  867. }
  868. textarea {
  869. flex: 1;
  870. border: 1px solid #9f9f9f;
  871. height: 168rpx;
  872. }
  873. }
  874. .btns-container {
  875. margin-top: 24rpx;
  876. .finished-btn {
  877. display: flex;
  878. flex: 1;
  879. height: 80rpx;
  880. background-color: #fc6565;
  881. color: #ffffff;
  882. text-align: center;
  883. justify-content: center;
  884. align-items: center;
  885. border-radius: 8rpx;
  886. }
  887. .question-btn {
  888. width: 80rpx;
  889. align-items: flex-end;
  890. image {
  891. width: 48rpx;
  892. height: 48rpx;
  893. }
  894. text {
  895. font-size: 24rpx;
  896. }
  897. }
  898. }
  899. }
  900. .uni-input-input:disabled {
  901. background-color: #f5f7fa;
  902. }
  903. .my-files {
  904. display: flex;
  905. justify-content: center;
  906. :deep(.uni-file-picker__container) {
  907. flex-direction: row;
  908. }
  909. }
  910. </style>