form.vue 14 KB

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