form.vue 15 KB

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