form.vue 13 KB

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