form.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  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.lot.processAlias }}</view>
  27. </view>
  28. <view class="info-row uni-row">
  29. <view class="label">操作者</view>
  30. <view class="value">{{ processInspecion.lot.nickName }}</view>
  31. </view>
  32. <view class="info-row uni-row">
  33. <view class="label">设备</view>
  34. <view class="value">{{ processInspecion.lot.equipmentDetailCode }}</view>
  35. </view>
  36. <view class="info-row uni-row">
  37. <view class="label">检查载具</view>
  38. <view class="value">{{ processInspecion.lot.inspectionCarrierCode }}
  39. {{ processInspecion.isInspectionCarrierChanged == 1 ? '(已解绑)' : ''}}
  40. </view>
  41. </view>
  42. <view class="info-row uni-row">
  43. <view class="drawing-btn" @click="handleDrawingMenu">图纸信息</view>
  44. </view>
  45. </view>
  46. <!-- 废品信息 -->
  47. <view class="title unfit-title uni-row">
  48. <text>检查信息</text>
  49. </view>
  50. <view class="unfit-container">
  51. <view class="unfit-item-container uni-column" v-for="(item, index) in unfitInfos" :key="index">
  52. <view class="resu uni-row">
  53. <view class="label">检查标准</view>
  54. <view class="value" style="margin-left:16rpx;width: 400rpx;">{{ item.checkStandard }}</view>
  55. </view>
  56. <!-- <view class="result uni-row">
  57. <view class="label">检查结果</view>
  58. <input v-model="item.checkResult" placeholder="请输入检查结果" />
  59. <view class="label" style="text-align: right; padding-right: 16rpx;">数量
  60. </view>
  61. <input class="number" type="number" @blur="rejectNumberChange" v-model="item.rejectNum"
  62. placeholder="" />
  63. </view> -->
  64. <view class="resu uni-row">
  65. <view class="label">检查结果</view>
  66. <input v-if="editable()" v-model="item.checkResult" maxlength="50" />
  67. <view v-else class="value" style="margin-left:16rpx;">{{ item.checkResult }}</view>
  68. </view>
  69. <view class="resu uni-row">
  70. <view class="label">超差范围</view>
  71. <input v-if="editable()" v-model="item.exceedLimits" maxlength="50" />
  72. <view v-else class="value" style="margin-left:16rpx;">{{ item.exceedLimits }}</view>
  73. </view>
  74. <view class="resu uni-row">
  75. <view :class="!editable() ? 'label' : ''">检查量</view>
  76. <input v-if="editable()" class="number" type="number"
  77. v-model="item.examiningNum" />
  78. <view v-else class="number value" style="margin-left:16rpx;">{{ item.examiningNum }}</view>
  79. <view :class="!editable() ? 'label' : ''">不良品量</view>
  80. <input v-if="editable()" class="number" type="number"
  81. v-model="item.disqualificationNum" />
  82. <view v-else class="value" style="margin-left:16rpx;">{{ item.disqualificationNum }}</view>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 拍照上传部分 -->
  87. <view class="title unfit-title uni-row">
  88. <text>拍照上传</text>
  89. </view>
  90. <view class=" uni-row" style="padding: 24rpx;
  91. margin: 0 16rpx;
  92. background-color: #ffffff;
  93. border-radius: 12rpx;">
  94. <uni-file-picker v-model="photoList" :readonly="true" return-type="array" :image-styles="imageStyles" file-mediatype="image" class="my-files" ></uni-file-picker>
  95. </view>
  96. <!-- 咨询部分 -->
  97. <view class="title unfit-title uni-row">
  98. <text>咨询</text>
  99. </view>
  100. <view class="consultation-container uni-column">
  101. <view class="consultation-item-container" v-for="(item, index) in consultations" :key="index">
  102. <view class="question uni-column">
  103. <view class="label uni-row">
  104. <text>问题描述</text>
  105. <text :style="selectType(item)">{{item.consultDepartment == 0?'技术':'品管'}} {{ selectText(item) }}</text>
  106. </view>
  107. <view class="content">{{ item.content }}</view>
  108. </view>
  109. <!-- 不需要暂时注释 -->
  110. <!-- <view v-if="item.answer !== ''" class="answer"
  111. style="margin-top: 24rpx; padding-top: 24rpx; border-top: 1px dotted #aaaaaa;">
  112. <view class="label">回复</view>
  113. <view class="content">{{ item.answer }}</view>
  114. </view> -->
  115. </view>
  116. </view>
  117. <!-- 报工部分 -->
  118. <view class="daywork-container">
  119. <view class="result uni-row">
  120. <view class="label" style="margin-top: 20rpx; margin-right: 10rpx;">交检状态</view>
  121. <uni-data-checkbox disabled="true" style="margin-top: 20rpx;" v-model="processInspecion.status"
  122. :localdata="range"></uni-data-checkbox>
  123. </view>
  124. <view class="remark uni-row">
  125. <view class="label">备注</view>
  126. <textarea v-if="editable()" v-model="processInspecion.remark" />
  127. <view v-else class="value">{{ processInspecion.remark }}</view>
  128. </view>
  129. <view class="btns-container uni-row">
  130. <view class="finished-btn" v-if="processInspecion.adoptStatus != 1" style="background-color: #1684fc;" @click="handlePass">通过</view>
  131. <view class="finished-btn" v-if="processInspecion.adoptStatus != 2" style="margin-left: 16rpx;" @click="handleFailed">不通过</view>
  132. </view>
  133. </view>
  134. </view>
  135. </template>
  136. <script setup>
  137. import {
  138. ref,
  139. onMounted,
  140. getCurrentInstance
  141. } from 'vue'
  142. import {
  143. onLoad,
  144. onReady,
  145. onUnload,
  146. onShow
  147. } from '@dcloudio/uni-app'
  148. import {
  149. store
  150. } from '@/store/index.js'
  151. import {
  152. updateAdoptStatus,
  153. selectInspecion
  154. } from '@/api/business/processInspection.js'
  155. import {
  156. getInspectionStandardsList
  157. } from '@/api/business/inspectionStandards.js'
  158. const lot = ref({})
  159. const isEventTriggered = ref(false); // 创建一个标志位
  160. const unfitInfos = ref([]) //废品信息
  161. const consultations = ref([]) //咨询信息
  162. const flag = ref(false)
  163. // 创建一个引用来存储最后一次请求的时间戳
  164. const lastRequestTimestamp = ref(0);
  165. const processInspecion = ref({
  166. remark: "",
  167. rejectNum: 0,
  168. examiningNum: 0,
  169. status: 0,
  170. })
  171. const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
  172. const webHost = ref(urlList.baseUrl)
  173. const photoList = ref([])
  174. const selected = ref([]);
  175. const selectedPhotos = ref([])
  176. const initStatus = ref(0)
  177. const imageStyles = {
  178. width:60,
  179. height:60
  180. }
  181. const editable = () => {
  182. return false
  183. }
  184. const consul = [{
  185. value: 0,
  186. text: "待确认",
  187. type: "color: #fcab53"
  188. }, {
  189. value: 2,
  190. text: "合格",
  191. type: "color: #55ff7f"
  192. }, {
  193. value: 1,
  194. text: "不合格",
  195. type: "color: #ff0c2c"
  196. }]
  197. const range = [{
  198. value: 0,
  199. text: "待确认",
  200. type: "color: #fcab53"
  201. }, {
  202. value: 1,
  203. text: "合格",
  204. type: "color: #55ff7f"
  205. }, {
  206. value: 2,
  207. text: "不合格",
  208. type: "color: #ff0c2c"
  209. }]
  210. /***************************** 页面生命周期函数 *****************************/
  211. onShow(() => {
  212. console.log(store.processInspection)
  213. console.log(flag.value)
  214. uni.showLoading({
  215. title: '加载中'
  216. });
  217. processInspecion.value = store.processInspection
  218. selectInspecion(processInspecion.value).then(res => {
  219. if (res.code == 200) {
  220. processInspecion.value = res.data;
  221. unfitInfos.value = res.data.processInspectionDetails;
  222. initStatus.value = res.data.status
  223. consultations.value = res.data.dayworkItemConsults;
  224. selectedPhotos.value = res.data.processInspectionPictureList
  225. photoList.value = res.data.processInspectionPictureList.map(item => {
  226. return { ...item, url: webHost.value + item.url };
  227. });
  228. console.log("res", res);
  229. console.log(processInspecion.value)
  230. uni.hideLoading();
  231. // getInspecion();
  232. } else {
  233. uni.showToast({
  234. icon: 'none',
  235. title: res.msg,
  236. duration: 2000
  237. })
  238. }
  239. });
  240. })
  241. function getOringicalList() {
  242. console.log(processInspecion.value)
  243. //查询该产品,当前工序,当前检查绑定的检查
  244. getInspectionStandardsList({
  245. productId:processInspecion.value.lot.productId,
  246. processId:processInspecion.value.lot.processId,
  247. inspectionCode:"deliveryInspection"
  248. }).then(res =>{
  249. unfitInfos.value = res.rows.map(item => {
  250. // 映射新的数组,包含 inspectionStandardsId 和 checkStandard 属性
  251. return {
  252. inspectionStandardsId: item.id, // 从 item 中获取 id
  253. checkStandard: item.standard // 从 item 中获取 standard
  254. };
  255. });
  256. })
  257. }
  258. /***************************** 定义了一些方法 *****************************/
  259. //咨询文本
  260. function selectText(item) {
  261. // for (var i = 0; i < consul.length; i++) {
  262. // if (item.status == consul[i].value) {
  263. // return consul[i].text
  264. // }
  265. // }
  266. if(item.consultResultId == 0) {
  267. return '待确认'
  268. }else{
  269. return item.result
  270. }
  271. }
  272. function handleDrawingMenu() {
  273. // 对 technologicalProcessDetailId 进行URL编码
  274. var encodedId = encodeURIComponent(processInspecion.value.lot.productId);
  275. var enTechnologicalProcessId = encodeURIComponent(processInspecion.value.lot.technologicalProcessId);
  276. var enprocessCode = encodeURIComponent(processInspecion.value.lot.processCode);
  277. var encodeCode = encodeURIComponent(processInspecion.value.lot.lotCode);
  278. var enProcessAlias = encodeURIComponent(processInspecion.value.lot.processAlias);
  279. var enIsWasteRecycling = encodeURIComponent(processInspecion.value.lot.isWasteRecycling);
  280. var enIsAmend = encodeURIComponent(processInspecion.value.lot.isAmend);
  281. // 构建查询参数字符串
  282. var queryParam =
  283. `param1=${encodedId}&param2=${encodeCode}&param3=${enprocessCode}&param4=${enTechnologicalProcessId}&param5=${enProcessAlias}&param6=${enIsWasteRecycling}&param7=${enIsAmend}`;
  284. // 使用模板字符串构建完整的URL
  285. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  286. // 导航到指定页面
  287. uni.navigateTo({
  288. url: navigateUrl
  289. });
  290. }
  291. //查询咨询列表
  292. function getInspecion() {
  293. processInspecion.value = store.processInspection
  294. selectInspecion(processInspecion.value).then(res => {
  295. console.log("咨询", res);
  296. if (res.code == 200) {
  297. console.log("res", res);
  298. } else {
  299. uni.showToast({
  300. icon: 'none',
  301. title: res.msg,
  302. duration: 2000
  303. })
  304. }
  305. });
  306. }
  307. //交检审核通过
  308. function handlePass() {
  309. let data = processInspecion.value
  310. data.adoptStatus = 1
  311. updateAdoptStatus(data).then(res =>{
  312. let pages = getCurrentPages();
  313. let index = 0
  314. for (let i = 0; i < pages.length; i++) {
  315. if (pages[i].$page.fullPath == "/pages/deliveryExamine/index") {
  316. index = pages.length - i - 1;
  317. }
  318. }
  319. console.log("index", index);
  320. uni.navigateBack({
  321. delta: index
  322. });
  323. })
  324. }
  325. //交检不通过
  326. function handleFailed() {
  327. let data = processInspecion.value
  328. data.adoptStatus = 2
  329. updateAdoptStatus(data).then(res =>{
  330. let pages = getCurrentPages();
  331. let index = 0
  332. for (let i = 0; i < pages.length; i++) {
  333. if (pages[i].$page.fullPath == "/pages/deliveryExamine/index") {
  334. index = pages.length - i - 1;
  335. }
  336. }
  337. console.log("index", index);
  338. uni.navigateBack({
  339. delta: index
  340. });
  341. })
  342. }
  343. //咨询样式
  344. function selectType(item) {
  345. for (var i = 0; i < consul.length; i++) {
  346. if (item.status == consul[i].value) {
  347. return consul[i].type
  348. }
  349. }
  350. }
  351. </script>
  352. <style lang="scss">
  353. .page-container {
  354. // height: 100%;
  355. background-color: #ececec;
  356. font-size: 28rpx;
  357. >.title {
  358. font-weight: 700;
  359. margin: 24rpx 16rpx;
  360. }
  361. }
  362. .carrier-info {
  363. margin: 32rpx 16rpx 0 16rpx;
  364. padding: 24rpx;
  365. background-color: #ffffff;
  366. border-radius: 8rpx;
  367. .carrier-code {
  368. font-size: 32rpx;
  369. font-weight: 700;
  370. }
  371. .info-row {
  372. margin-top: 16rpx;
  373. color: #767676;
  374. .label {
  375. width: 160rpx;
  376. }
  377. .drawing-btn {
  378. padding: 12rpx 32rpx;
  379. background-color: #0055ff;
  380. color: #ffffff;
  381. border-radius: 12rpx;
  382. margin-left: auto;
  383. font-size: 28rpx;
  384. }
  385. .value {
  386. flex: 1;
  387. textarea {
  388. flex: 1;
  389. border: 1px solid #888888;
  390. box-sizing: border-box;
  391. padding: 16rpx;
  392. }
  393. }
  394. }
  395. }
  396. .unfit-title {
  397. margin-bottom: 24rpx;
  398. justify-content: space-between;
  399. align-items: center;
  400. text {
  401. font-size: 28rpx;
  402. font-weight: 700;
  403. }
  404. .add-btn {
  405. padding: 12rpx 32rpx;
  406. background-color: #a4adb3;
  407. color: #ffffff;
  408. border-radius: 12rpx;
  409. font-size: 24rpx;
  410. }
  411. }
  412. .unfit-container {
  413. padding: 24rpx;
  414. margin: 0 16rpx;
  415. background-color: #ffffff;
  416. border-radius: 12rpx;
  417. .unfit-item-container {
  418. position: relative;
  419. >* {
  420. margin-bottom: 24rpx;
  421. }
  422. .title {
  423. font-weight: 700;
  424. justify-content: space-between;
  425. align-items: center;
  426. image {
  427. width: 40rpx;
  428. height: 40rpx;
  429. }
  430. }
  431. .standard {}
  432. .resu {
  433. width: 100%;
  434. align-items: center;
  435. input {
  436. margin-left: 20rpx;
  437. width: 200rpx;
  438. height: 56rpx;
  439. flex: 1;
  440. border: 1px solid #9f9f9f;
  441. font-size: 28rpx;
  442. }
  443. }
  444. .result {
  445. align-items: center;
  446. border-bottom: 1px solid #9f9f9f;
  447. padding-bottom: 32rpx;
  448. .label {
  449. flex: 1;
  450. }
  451. input {
  452. width: 280rpx;
  453. height: 56rpx;
  454. border: 1px solid #9f9f9f;
  455. font-size: 28rpx;
  456. &.number {
  457. width: 104rpx;
  458. text-align: center;
  459. }
  460. }
  461. }
  462. }
  463. .unfit-item-container:last-child {
  464. .result {
  465. border-bottom: none;
  466. padding-bottom: 0;
  467. }
  468. }
  469. }
  470. .consultation-container {
  471. margin: 0 16rpx;
  472. padding: 24rpx;
  473. background-color: #ffffff;
  474. border-radius: 8rpx;
  475. .consultation-item-container {
  476. margin-bottom: 24rpx;
  477. border-bottom: 2px solid #888888;
  478. padding-bottom: 24rpx;
  479. }
  480. .consultation-item-container:last-child {
  481. margin-bottom: 0;
  482. border-bottom: 0;
  483. padding-bottom: 0;
  484. }
  485. .question,
  486. .answer {
  487. .label {
  488. justify-content: space-between;
  489. margin-bottom: 16rpx;
  490. font-weight: 700;
  491. }
  492. .content {
  493. line-height: 40rpx;
  494. }
  495. }
  496. .answer {
  497. margin-top: 24rpx;
  498. }
  499. }
  500. .daywork-container {
  501. margin-top: 24rpx;
  502. padding: 24rpx;
  503. background-color: #ffffff;
  504. border: 1px solid #bcbcbc;
  505. .result {
  506. align-items: center;
  507. .label {
  508. width: 112rpx;
  509. }
  510. input {
  511. flex: 1;
  512. height: 56rpx;
  513. border: 1px solid #9f9f9f;
  514. font-size: 28rpx;
  515. text-align: center;
  516. }
  517. }
  518. .remark {
  519. margin-top: 24rpx;
  520. .label {
  521. width: 112rpx;
  522. }
  523. textarea {
  524. flex: 1;
  525. border: 1px solid #9f9f9f;
  526. height: 168rpx;
  527. }
  528. }
  529. .btns-container {
  530. margin-top: 24rpx;
  531. .finished-btn {
  532. display: flex;
  533. flex: 1;
  534. height: 80rpx;
  535. background-color: #fc6565;
  536. color: #ffffff;
  537. text-align: center;
  538. justify-content: center;
  539. align-items: center;
  540. border-radius: 8rpx;
  541. }
  542. .question-btn {
  543. width: 80rpx;
  544. align-items: flex-end;
  545. image {
  546. width: 48rpx;
  547. height: 48rpx;
  548. }
  549. text {
  550. font-size: 24rpx;
  551. }
  552. }
  553. }
  554. }
  555. .my-files {
  556. display: flex;
  557. justify-content: center;
  558. :deep(.uni-file-picker__container) {
  559. flex-direction: row;
  560. }
  561. }
  562. </style>