form.vue 13 KB

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