form.vue 14 KB

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