form.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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. }
  267. function handleDrawingMenu() {
  268. // 对 technologicalProcessDetailId 进行URL编码
  269. var encodedId = encodeURIComponent(processInspecion.value.lot.productId);
  270. var enTechnologicalProcessId = encodeURIComponent(processInspecion.value.lot.technologicalProcessId);
  271. var enprocessCode = encodeURIComponent(processInspecion.value.lot.processCode);
  272. var encodeCode = encodeURIComponent(processInspecion.value.lot.lotCode);
  273. var enProcessAlias = encodeURIComponent(processInspecion.value.lot.processAlias);
  274. var enIsWasteRecycling = encodeURIComponent(processInspecion.value.lot.isWasteRecycling);
  275. var enIsAmend = encodeURIComponent(processInspecion.value.lot.isAmend);
  276. // 构建查询参数字符串
  277. var queryParam =
  278. `param1=${encodedId}&param2=${encodeCode}&param3=${enprocessCode}&param4=${enTechnologicalProcessId}&param5=${enProcessAlias}&param6=${enIsWasteRecycling}&param7=${enIsAmend}`;
  279. // 使用模板字符串构建完整的URL
  280. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  281. // 导航到指定页面
  282. uni.navigateTo({
  283. url: navigateUrl
  284. });
  285. }
  286. //查询咨询列表
  287. function getInspecion() {
  288. processInspecion.value = store.processInspection
  289. selectInspecion(processInspecion.value).then(res => {
  290. console.log("咨询", res);
  291. if (res.code == 200) {
  292. console.log("res", res);
  293. } else {
  294. uni.showToast({
  295. icon: 'none',
  296. title: res.msg,
  297. duration: 2000
  298. })
  299. }
  300. });
  301. }
  302. //交检审核通过
  303. function handlePass() {
  304. let data = processInspecion.value
  305. data.adoptStatus = 1
  306. updateAdoptStatus(data).then(res =>{
  307. let pages = getCurrentPages();
  308. let index = 0
  309. for (let i = 0; i < pages.length; i++) {
  310. if (pages[i].$page.fullPath == "/pages/deliveryExamine/index") {
  311. index = pages.length - i - 1;
  312. }
  313. }
  314. console.log("index", index);
  315. uni.navigateBack({
  316. delta: index
  317. });
  318. })
  319. }
  320. //交检不通过
  321. function handleFailed() {
  322. let data = processInspecion.value
  323. data.adoptStatus = 2
  324. updateAdoptStatus(data).then(res =>{
  325. let pages = getCurrentPages();
  326. let index = 0
  327. for (let i = 0; i < pages.length; i++) {
  328. if (pages[i].$page.fullPath == "/pages/deliveryExamine/index") {
  329. index = pages.length - i - 1;
  330. }
  331. }
  332. console.log("index", index);
  333. uni.navigateBack({
  334. delta: index
  335. });
  336. })
  337. }
  338. //咨询样式
  339. function selectType(item) {
  340. for (var i = 0; i < consul.length; i++) {
  341. if (item.status == consul[i].value) {
  342. return consul[i].type
  343. }
  344. }
  345. }
  346. </script>
  347. <style lang="scss">
  348. .page-container {
  349. // height: 100%;
  350. background-color: #ececec;
  351. font-size: 28rpx;
  352. >.title {
  353. font-weight: 700;
  354. margin: 24rpx 16rpx;
  355. }
  356. }
  357. .carrier-info {
  358. margin: 32rpx 16rpx 0 16rpx;
  359. padding: 24rpx;
  360. background-color: #ffffff;
  361. border-radius: 8rpx;
  362. .carrier-code {
  363. font-size: 32rpx;
  364. font-weight: 700;
  365. }
  366. .info-row {
  367. margin-top: 16rpx;
  368. color: #767676;
  369. .label {
  370. width: 160rpx;
  371. }
  372. .drawing-btn {
  373. padding: 12rpx 32rpx;
  374. background-color: #0055ff;
  375. color: #ffffff;
  376. border-radius: 12rpx;
  377. margin-left: auto;
  378. font-size: 28rpx;
  379. }
  380. .value {
  381. flex: 1;
  382. textarea {
  383. flex: 1;
  384. border: 1px solid #888888;
  385. box-sizing: border-box;
  386. padding: 16rpx;
  387. }
  388. }
  389. }
  390. }
  391. .unfit-title {
  392. margin-bottom: 24rpx;
  393. justify-content: space-between;
  394. align-items: center;
  395. text {
  396. font-size: 28rpx;
  397. font-weight: 700;
  398. }
  399. .add-btn {
  400. padding: 12rpx 32rpx;
  401. background-color: #a4adb3;
  402. color: #ffffff;
  403. border-radius: 12rpx;
  404. font-size: 24rpx;
  405. }
  406. }
  407. .unfit-container {
  408. padding: 24rpx;
  409. margin: 0 16rpx;
  410. background-color: #ffffff;
  411. border-radius: 12rpx;
  412. .unfit-item-container {
  413. position: relative;
  414. >* {
  415. margin-bottom: 24rpx;
  416. }
  417. .title {
  418. font-weight: 700;
  419. justify-content: space-between;
  420. align-items: center;
  421. image {
  422. width: 40rpx;
  423. height: 40rpx;
  424. }
  425. }
  426. .standard {}
  427. .resu {
  428. width: 100%;
  429. align-items: center;
  430. input {
  431. margin-left: 20rpx;
  432. width: 200rpx;
  433. height: 56rpx;
  434. flex: 1;
  435. border: 1px solid #9f9f9f;
  436. font-size: 28rpx;
  437. }
  438. }
  439. .result {
  440. align-items: center;
  441. border-bottom: 1px solid #9f9f9f;
  442. padding-bottom: 32rpx;
  443. .label {
  444. flex: 1;
  445. }
  446. input {
  447. width: 280rpx;
  448. height: 56rpx;
  449. border: 1px solid #9f9f9f;
  450. font-size: 28rpx;
  451. &.number {
  452. width: 104rpx;
  453. text-align: center;
  454. }
  455. }
  456. }
  457. }
  458. .unfit-item-container:last-child {
  459. .result {
  460. border-bottom: none;
  461. padding-bottom: 0;
  462. }
  463. }
  464. }
  465. .consultation-container {
  466. margin: 0 16rpx;
  467. padding: 24rpx;
  468. background-color: #ffffff;
  469. border-radius: 8rpx;
  470. .consultation-item-container {
  471. margin-bottom: 24rpx;
  472. border-bottom: 2px solid #888888;
  473. padding-bottom: 24rpx;
  474. }
  475. .consultation-item-container:last-child {
  476. margin-bottom: 0;
  477. border-bottom: 0;
  478. padding-bottom: 0;
  479. }
  480. .question,
  481. .answer {
  482. .label {
  483. justify-content: space-between;
  484. margin-bottom: 16rpx;
  485. font-weight: 700;
  486. }
  487. .content {
  488. line-height: 40rpx;
  489. }
  490. }
  491. .answer {
  492. margin-top: 24rpx;
  493. }
  494. }
  495. .daywork-container {
  496. margin-top: 24rpx;
  497. padding: 24rpx;
  498. background-color: #ffffff;
  499. border: 1px solid #bcbcbc;
  500. .result {
  501. align-items: center;
  502. .label {
  503. width: 112rpx;
  504. }
  505. input {
  506. flex: 1;
  507. height: 56rpx;
  508. border: 1px solid #9f9f9f;
  509. font-size: 28rpx;
  510. text-align: center;
  511. }
  512. }
  513. .remark {
  514. margin-top: 24rpx;
  515. .label {
  516. width: 112rpx;
  517. }
  518. textarea {
  519. flex: 1;
  520. border: 1px solid #9f9f9f;
  521. height: 168rpx;
  522. }
  523. }
  524. .btns-container {
  525. margin-top: 24rpx;
  526. .finished-btn {
  527. display: flex;
  528. flex: 1;
  529. height: 80rpx;
  530. background-color: #fc6565;
  531. color: #ffffff;
  532. text-align: center;
  533. justify-content: center;
  534. align-items: center;
  535. border-radius: 8rpx;
  536. }
  537. .question-btn {
  538. width: 80rpx;
  539. align-items: flex-end;
  540. image {
  541. width: 48rpx;
  542. height: 48rpx;
  543. }
  544. text {
  545. font-size: 24rpx;
  546. }
  547. }
  548. }
  549. }
  550. .my-files {
  551. display: flex;
  552. justify-content: center;
  553. :deep(.uni-file-picker__container) {
  554. flex-direction: row;
  555. }
  556. }
  557. </style>