form.vue 12 KB

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