form.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999
  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 v-if="editable()" class="add-btn" @click="handleAddWaste">添加</view>
  50. </view>
  51. <view class="unfit-container">
  52. <view class="unfit-item-container uni-column" v-for="(item, index) in unfitInfos" :key="index">
  53. <view class="resu uni-row">
  54. <view class="label">检查标准</view>
  55. <view class="value" style="margin-left:16rpx;width: 400rpx;">{{ item.checkStandard }}</view>
  56. <uni-icons v-if="editable()" type="trash" size="24" style="margin-left: 55rpx;" color="#fc6565"
  57. @click="handleDelWaste(index)" />
  58. </view>
  59. <!-- <view class="result uni-row">
  60. <view class="label">检查结果</view>
  61. <input v-model="item.checkResult" placeholder="请输入检查结果" />
  62. <view class="label" style="text-align: right; padding-right: 16rpx;">数量
  63. </view>
  64. <input class="number" type="number" @blur="rejectNumberChange" v-model="item.rejectNum"
  65. placeholder="" />
  66. </view> -->
  67. <view class="resu uni-row">
  68. <view class="label">检查结果</view>
  69. <input v-if="editable()" v-model="item.checkResult" placeholder="请输入检查结果" maxlength="50" />
  70. <view v-else class="value" style="margin-left:16rpx;">{{ item.checkResult }}</view>
  71. </view>
  72. <view class="resu uni-row">
  73. <view class="label">超差范围</view>
  74. <input v-if="editable()" v-model="item.exceedLimits" placeholder="请输入超差范围" maxlength="50" />
  75. <view v-else class="value" style="margin-left:16rpx;">{{ item.exceedLimits }}</view>
  76. </view>
  77. <view class="resu uni-row">
  78. <view :class="!editable() ? 'label' : ''">检查量</view>
  79. <input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
  80. v-model="item.examiningNum" placeholder="" />
  81. <view v-else class="number value" style="margin-left:16rpx;">{{ item.examiningNum }}</view>
  82. <view :class="!editable() ? 'label' : ''" style="margin-left: 16rpx;">不良品量</view>
  83. <input v-if="editable()" class="number" type="number" @blur="rejectNumberChange"
  84. v-model="item.disqualificationNum" placeholder="" />
  85. <view v-else class="value" style="margin-left:16rpx;">{{ item.disqualificationNum }}</view>
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 拍照上传部分 -->
  90. <view class="title unfit-title uni-row">
  91. <text>拍照上传</text>
  92. </view>
  93. <view class=" uni-row" style="padding: 24rpx;
  94. margin: 0 16rpx;
  95. background-color: #ffffff;
  96. border-radius: 12rpx;">
  97. <uni-file-picker v-model="photoList" :readonly="!editable()" return-type="array" :image-styles="imageStyles"
  98. @select="select" file-mediatype="image" class="my-files" @delete="handleDeletedPhoto"></uni-file-picker>
  99. </view>
  100. <!-- 咨询部分 -->
  101. <view class="title unfit-title uni-row">
  102. <text>咨询</text>
  103. </view>
  104. <view class="consultation-container uni-column">
  105. <view class="consultation-item-container" v-for="(item, index) in consultations" :key="index">
  106. <view class="question uni-column">
  107. <view class="label uni-row">
  108. <text>问题描述</text>
  109. <text :style="selectType(item)">{{item.consultDepartment == 0?'技术':'品管'}}
  110. {{ selectText(item) }}</text>
  111. </view>
  112. <view class="content">{{ item.content }}</view>
  113. </view>
  114. <!-- 不需要暂时注释 -->
  115. <!-- <view v-if="item.answer !== ''" class="answer"
  116. style="margin-top: 24rpx; padding-top: 24rpx; border-top: 1px dotted #aaaaaa;">
  117. <view class="label">回复</view>
  118. <view class="content">{{ item.answer }}</view>
  119. </view> -->
  120. </view>
  121. </view>
  122. <!-- 报工部分 -->
  123. <view class="daywork-container">
  124. <view class="result uni-row">
  125. <view class="label" style="margin-top: 20rpx; margin-right: 10rpx;">交检状态</view>
  126. <uni-data-checkbox :disabled="!editable()" style="margin-top: 20rpx;" v-model="processInspecion.inspectionStatus"
  127. :localdata="range" @change="handleChangeInspecionStatus"></uni-data-checkbox>
  128. </view>
  129. <view class="result uni-row">
  130. <view class="label" style="margin-top: 20rpx; margin-right: 10rpx;">放行状态</view>
  131. <uni-data-checkbox :disabled="true" style="margin-top: 20rpx;" v-model="processInspecion.status"
  132. :localdata="range"></uni-data-checkbox>
  133. </view>
  134. <view v-if="editable()">
  135. <view v-if="showTransfer" class="list-title uni-row" style="margin-top: 16rpx;">
  136. <text class="label">是否移交仪器室</text><text>&nbsp;否</text>
  137. <!-- <switch class="switch" @change="switchChange" style="transform:scale(0.7);margin-top: -16rpx;"
  138. color="rgba(255,85,85,1)" /> -->
  139. <zero-switch v-model="processInspecion.flag" @change="switchChange" active-color="rgba(103, 195, 55, 1.0)"
  140. :size="18" style="transform:scale(0.9);margin-top: -9rpx;"></zero-switch>
  141. <text>是</text>
  142. </view>
  143. <view v-else class="list-title uni-row" style="margin-top: 16rpx;">
  144. <text class="label">已经移交给仪器室</text>
  145. </view>
  146. <view class="list-title uni-row" style="margin-top: 16rpx;">
  147. <text class="label">检测完成</text><text>&nbsp;否</text>
  148. <!-- <switch :checked="isAllChecked" class="switch" :disabled="!showTransfer || processInspecion.flag"
  149. @change="switchAllCheckChange" style="transform:scale(0.7);margin-top: -16rpx;"
  150. color="rgba(255,85,85,1)" /> -->
  151. <zero-switch v-model="isAllChecked" :disabled="!showTransfer || processInspecion.flag"
  152. @change="switchAllCheckChange" active-color="rgba(103, 195, 55, 1.0)" :size="18"
  153. style="transform:scale(0.9);margin-top: -9rpx;"></zero-switch>
  154. <text>是</text>
  155. </view>
  156. </view>
  157. <view class="remark uni-row">
  158. <view class="label">备注</view>
  159. <textarea v-if="editable()" v-model="processInspecion.remark" maxlength="999" />
  160. <view v-else class="value">{{ processInspecion.remark }}</view>
  161. </view>
  162. <view v-if="editable()" class="btns-container uni-row">
  163. <view class="finished-btn" @click="endWork">提交</view>
  164. <view class="question-btn uni-column" @click.stop="handleAddConsultation">
  165. <uni-icons type="headphones" size="24" />
  166. <text>咨询</text>
  167. </view>
  168. </view>
  169. </view>
  170. <dialog-inspectionChamber ref='selectInspectionChamber'
  171. @handleSelectInspectionChamber='handleSelectInspectionChamber'></dialog-inspectionChamber>
  172. </view>
  173. </template>
  174. <script setup>
  175. import {
  176. ref,
  177. onMounted,
  178. getCurrentInstance
  179. } from 'vue'
  180. import {
  181. onLoad,
  182. onReady,
  183. onUnload,
  184. onShow
  185. } from '@dcloudio/uni-app'
  186. import {
  187. store
  188. } from '@/store/index.js'
  189. import {
  190. saveDeliveryInspecion,
  191. selectInspecion,
  192. getInstrumentRoomInspection
  193. } from '@/api/business/processInspection.js'
  194. import {
  195. getInspectionStandardsList
  196. } from '@/api/business/inspectionStandards.js'
  197. import {
  198. getURL
  199. } from '@/api/sys/user.js'
  200. const lot = ref({})
  201. const isEventTriggered = ref(false); // 创建一个标志位
  202. const unfitInfos = ref([]) //废品信息
  203. const consultations = ref([]) //咨询信息
  204. const flag = ref(false)
  205. const showTransfer = ref(true)
  206. const isAllChecked = ref(false)
  207. const selectInspectionChamber = ref(null)
  208. // 创建一个引用来存储最后一次请求的时间戳
  209. const lastRequestTimestamp = ref(0);
  210. const processInspecion = ref({
  211. remark: "",
  212. rejectNum: 0,
  213. examiningNum: 0,
  214. status: 0,
  215. inspectionStatus:0
  216. })
  217. const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
  218. const webHost = ref(urlList.baseUrl)
  219. const photoList = ref([])
  220. const selected = ref([]);
  221. const selectedPhotos = ref([])
  222. const imageStyles = {
  223. width: 60,
  224. height: 60
  225. }
  226. const initStatus = ref(0)
  227. const editable = () => {
  228. // if (store.userInfo.permissions.some(item => item === 'business:outsourcedInspection:edit')) {
  229. // return true
  230. // }
  231. if (initStatus.value == 0) {
  232. return true
  233. }
  234. if (processInspecion.value.firstUpdaterId == store.userInfo.userId) {
  235. return true
  236. }
  237. return false
  238. }
  239. const consul = [{
  240. value: 0,
  241. text: "待确认",
  242. type: "color: #fcab53"
  243. }, {
  244. value: 2,
  245. text: "合格",
  246. type: "color: #55ff7f"
  247. }, {
  248. value: 1,
  249. text: "不合格",
  250. type: "color: #ff0c2c"
  251. }]
  252. const range = [{
  253. value: 0,
  254. text: "待确认",
  255. type: "color: #fcab53"
  256. }, {
  257. value: 1,
  258. text: "合格",
  259. type: "color: #55ff7f"
  260. }, {
  261. value: 2,
  262. text: "不合格",
  263. type: "color: #ff0c2c"
  264. }]
  265. /***************************** 页面生命周期函数 *****************************/
  266. function init() {
  267. const instance = getCurrentInstance().proxy
  268. const eventChannel = instance.getOpenerEventChannel();
  269. eventChannel.on('deliveryInspectionFrom', function(data) {
  270. console.log('acceptDataFromOpenerPage', data)
  271. if (data && data.data) {
  272. processInspecion.value.lot = data.data;
  273. //getOringicalList()
  274. }
  275. })
  276. }
  277. onShow(() => {
  278. uni.$off('addWasteInfoEvent');
  279. })
  280. onLoad(() => {
  281. uni.$off('addWasteInfoEvent');
  282. console.log(store.processInspection)
  283. console.log(flag.value)
  284. if (!flag.value) {
  285. console.log("888")
  286. if (store.processInspection != null) {
  287. uni.showLoading({
  288. title: '加载中'
  289. });
  290. console.log(store.tenantId)
  291. processInspecion.value = store.processInspection
  292. isAllChecked.value = (processInspecion.value.isAllChecked == 1)
  293. selectInspecion(processInspecion.value).then(res => {
  294. if (res.code == 200) {
  295. processInspecion.value = res.data;
  296. processInspecion.value.flag = false
  297. unfitInfos.value = res.data.processInspectionDetails;
  298. initStatus.value = res.data.inspectionStatus
  299. consultations.value = res.data.dayworkItemConsults;
  300. selectedPhotos.value = res.data.processInspectionPictureList
  301. photoList.value = res.data.processInspectionPictureList.map(item => {
  302. return {
  303. ...item,
  304. url: webHost.value + item.url
  305. };
  306. });
  307. console.log("res", res);
  308. console.log(processInspecion.value)
  309. //是否已经移交仪器室
  310. getInstrumentRoomInspectionList()
  311. uni.hideLoading();
  312. // getInspecion();
  313. } else {
  314. uni.showToast({
  315. icon: 'none',
  316. title: res.msg,
  317. duration: 2000
  318. })
  319. }
  320. });
  321. } else {
  322. console.log("99999")
  323. init()
  324. }
  325. }
  326. })
  327. function getOringicalList() {
  328. console.log(processInspecion.value)
  329. //查询该产品,当前工序,当前检查绑定的检查
  330. getInspectionStandardsList({
  331. productId: processInspecion.value.lot.productId,
  332. processId: processInspecion.value.lot.processId,
  333. inspectionCode: "deliveryInspection"
  334. }).then(res => {
  335. unfitInfos.value = res.rows.map(item => {
  336. // 映射新的数组,包含 inspectionStandardsId 和 checkStandard 属性
  337. return {
  338. inspectionStandardsId: item.id, // 从 item 中获取 id
  339. checkStandard: item.standard // 从 item 中获取 standard
  340. };
  341. });
  342. })
  343. }
  344. /***************************** 定义了一些方法 *****************************/
  345. //咨询文本
  346. function selectText(item) {
  347. // for (var i = 0; i < consul.length; i++) {
  348. // if (item.status == consul[i].value) {
  349. // return consul[i].text
  350. // }
  351. // }
  352. if(item.consultResultId == 0) {
  353. return '待确认'
  354. }else{
  355. return item.result
  356. }
  357. }
  358. function upLoadImageHandler(arg) {
  359. console.log(arg)
  360. getURL(arg).then(res => {
  361. let data = JSON.parse(res)
  362. selectedPhotos.value.push({
  363. url: data.fileName,
  364. pictureName: data.originalFilename,
  365. tenantId: store.tenantId
  366. })
  367. console.log(selectedPhotos.value)
  368. })
  369. }
  370. function select(e) {
  371. console.log(e)
  372. const {
  373. tempFilePaths,
  374. tempFiles
  375. } = e
  376. tempFiles.forEach((item, index) => {
  377. upLoadImageHandler({
  378. filePath: tempFilePaths[index],
  379. name: item.name
  380. })
  381. })
  382. }
  383. function handleChangeInspecionStatus(e){
  384. console.log(e.detail.value)
  385. //没有咨询
  386. if(consultations.value && consultations.value.length == 0){
  387. processInspecion.value.status = e.detail.value
  388. processInspecion.value.adoptStatus = e.detail.value
  389. }
  390. }
  391. function handleDeletedPhoto(e) {
  392. let fileName = selectedPhotos.value.map(info => info.pictureName)
  393. const firstSlashIndex = e.tempFile.url.lastIndexOf('/');
  394. const lastSlashIndex = e.tempFile.url.lastIndexOf('_');
  395. const type = e.tempFile.url.substring(firstSlashIndex + 1, lastSlashIndex)
  396. const pictureName = e.tempFile.url.substring(firstSlashIndex + 1, lastSlashIndex) + e.tempFile.url.substring(e
  397. .tempFile.url.lastIndexOf('.') - 1 + 1);;
  398. let index = -1; // 初始化 index 为 -1,表示未找到
  399. // 首先检查 e.tempFile.name 是否存在
  400. if (fileName.findIndex(name => name === e.tempFile.name) !== -1) {
  401. index = fileName.findIndex(name => name === e.tempFile.name);
  402. }
  403. // 如果 e.tempFile.name 不存在,检查 e.tempFile.pictureName 是否存在
  404. else if (fileName.findIndex(name => name === e.tempFile.pictureName) !== -1) {
  405. index = fileName.findIndex(name => name === e.tempFile.pictureName);
  406. }
  407. // 如果以上两个都不存在,检查 pictureName 是否存在
  408. else if (fileName.findIndex(name => name === pictureName) !== -1) {
  409. index = fileName.findIndex(name => name === pictureName);
  410. }
  411. selectedPhotos.value.splice(index, 1)
  412. }
  413. function handleDrawingMenu() {
  414. // 对 technologicalProcessDetailId 进行URL编码
  415. var encodedId = encodeURIComponent(processInspecion.value.lot.productId);
  416. var enTechnologicalProcessId = encodeURIComponent(processInspecion.value.lot.technologicalProcessId);
  417. var enprocessCode = encodeURIComponent(processInspecion.value.lot.processCode);
  418. var encodeCode = encodeURIComponent(processInspecion.value.lot.lotCode);
  419. var enProcessAlias = encodeURIComponent(processInspecion.value.lot.processAlias);
  420. var enIsWasteRecycling = encodeURIComponent(processInspecion.value.lot.isWasteRecycling);
  421. var enIsAmend = encodeURIComponent(processInspecion.value.lot.isAmend);
  422. // 构建查询参数字符串
  423. var queryParam =
  424. `param1=${encodedId}&param2=${encodeCode}&param3=${enprocessCode}&param4=${enTechnologicalProcessId}&param5=${enProcessAlias}&param6=${enIsWasteRecycling}&param7=${enIsAmend}`;
  425. // 使用模板字符串构建完整的URL
  426. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  427. // 导航到指定页面
  428. uni.navigateTo({
  429. url: navigateUrl
  430. });
  431. }
  432. function switchChange(event) {
  433. console.log(event)
  434. // if (event.detail.value) {
  435. if (event) {
  436. processInspecion.value.flag = true
  437. processInspecion.value.isAllChecked = 0
  438. isAllChecked.value = false
  439. } else {
  440. processInspecion.value.flag = false
  441. }
  442. }
  443. function switchAllCheckChange(event) {
  444. console.log(event)
  445. // if (event.detail.value) {
  446. if (event) {
  447. processInspecion.value.isAllChecked = 1
  448. } else {
  449. processInspecion.value.isAllChecked = 0
  450. }
  451. }
  452. const rejectNumberChange = () => {
  453. let sumDisqualificationNum = 0
  454. let sumExaminingNum = 0
  455. unfitInfos.value.forEach(v => {
  456. sumDisqualificationNum += (v.disqualificationNum != null ? Number(v.disqualificationNum) : 0)
  457. sumExaminingNum += (v.examiningNum != null ? Number(v.examiningNum) : 0)
  458. })
  459. processInspecion.value.disqualificationNum = sumDisqualificationNum
  460. processInspecion.value.examiningNum = sumExaminingNum
  461. console.log(processInspecion.value)
  462. }
  463. function getInstrumentRoomInspectionList() {
  464. getInstrumentRoomInspection(processInspecion.value).then(res => {
  465. if (res.data.length > 0) {
  466. showTransfer.value = false
  467. // processInspecion.value.flag = true
  468. } else {
  469. showTransfer.value = true
  470. // processInspecion.value.flag = false
  471. }
  472. })
  473. }
  474. //查询咨询列表
  475. function getInspecion() {
  476. processInspecion.value = store.processInspection
  477. selectInspecion(processInspecion.value).then(res => {
  478. console.log("咨询", res);
  479. if (res.code == 200) {
  480. console.log("res", res);
  481. } else {
  482. uni.showToast({
  483. icon: 'none',
  484. title: res.msg,
  485. duration: 2000
  486. })
  487. }
  488. });
  489. }
  490. //结束报工按钮
  491. function endWork() {
  492. let unf = unfitInfos.value;
  493. for (var i = 0; i < unfitInfos.value.length; i++) {
  494. if (unf[i].examiningNum < 0 || unf[i].disqualificationNum < 0) {
  495. uni.showToast({
  496. icon: 'none',
  497. title: '检查量,不良品量不能小于0',
  498. duration: 2000
  499. })
  500. return
  501. }
  502. if (unf[i].examiningNum > processInspecion.value.lot.pudName) {
  503. uni.showToast({
  504. icon: 'none',
  505. title: '检查量不能大于投产量'
  506. })
  507. return
  508. }
  509. }
  510. if (processInspecion.value.disqualificationNum > processInspecion.value.lot.pudName) {
  511. uni.showToast({
  512. icon: 'none',
  513. title: '不良品量不能大于投产量'
  514. })
  515. return
  516. }
  517. save();
  518. }
  519. function save() {
  520. const currentTime = Date.now();
  521. // 检查是否已经过去了 2 秒
  522. if (currentTime - lastRequestTimestamp.value < 2000) {
  523. // 如果在 2 秒 内已经点击,那么不执行
  524. uni.showToast({
  525. icon: 'none',
  526. title: `请勿重复点击`,
  527. duration: 2000
  528. })
  529. return;
  530. }
  531. lastRequestTimestamp.value = currentTime;
  532. let pages = getCurrentPages();
  533. processInspecion.value.dayworkItemConsults = consultations.value;
  534. processInspecion.value.processInspectionDetails = unfitInfos.value;
  535. processInspecion.value.user = store.userInfo;
  536. processInspecion.value.tenantId = store.tenantId
  537. processInspecion.value.inspectionCarrierId = processInspecion.value.lot.inspectionCarrierId
  538. processInspecion.value.inspectionCarrierCode = processInspecion.value.lot.inspectionCarrierCode
  539. processInspecion.value.processInspectionPictureList = selectedPhotos.value
  540. console.log(processInspecion.value)
  541. if (processInspecion.value.flag) {
  542. //打开选择仪器室的弹窗
  543. selectInspectionChamber.value.open()
  544. console.log(processInspecion.value)
  545. } else {
  546. saveDeliveryInspecion(processInspecion.value).then(res => {
  547. if (res.code == 200) {
  548. let index = 0;
  549. for (let i = 0; i < pages.length; i++) {
  550. if (pages[i].$page.fullPath == "/pages/deliveryInspection/index") {
  551. index = pages.length - i - 1;
  552. }
  553. }
  554. console.log("index", index);
  555. uni.navigateBack({
  556. delta: index
  557. });
  558. } else {
  559. uni.showToast({
  560. icon: 'none',
  561. title: res.msg,
  562. duration: 2000
  563. })
  564. }
  565. });
  566. }
  567. }
  568. //仪器室带回
  569. function handleSelectInspectionChamber(data) {
  570. processInspecion.value.inspectionChamberId = data
  571. console.log(processInspecion.value)
  572. saveDeliveryInspecion(processInspecion.value).then(res => {
  573. if (res.code == 200) {
  574. let index = 0;
  575. let pages = getCurrentPages();
  576. for (let i = 0; i < pages.length; i++) {
  577. if (pages[i].$page.fullPath == "/pages/deliveryInspection/index") {
  578. index = pages.length - i - 1;
  579. }
  580. }
  581. console.log("index", index);
  582. uni.navigateBack({
  583. delta: index
  584. });
  585. } else {
  586. uni.showToast({
  587. icon: 'none',
  588. title: res.msg,
  589. duration: 2000
  590. })
  591. }
  592. });
  593. }
  594. //咨询样式
  595. function selectType(item) {
  596. for (var i = 0; i < consul.length; i++) {
  597. if (item.status == consul[i].value) {
  598. return consul[i].type
  599. }
  600. }
  601. }
  602. const addWasteInfo = (data) => {
  603. console.log(data, "55555555")
  604. flag.value = true
  605. var info = {
  606. inspectionStandardsId: data.id,
  607. checkStandard: data.standard
  608. }
  609. unfitInfos.value.push(info)
  610. console.log(data)
  611. }
  612. const addConsultation = (data) => {
  613. let info = data
  614. info.forEach(item => {
  615. item.status = 0
  616. })
  617. consultations.value = consultations.value.concat(info)
  618. isEventTriggered.value = true; // 更新标志位状态
  619. processInspecion.value.status = 0
  620. processInspecion.value.adoptStatus = 0
  621. }
  622. /***************************** 定义了一些事件 *****************************/
  623. // 添加不合格信息
  624. const handleAddWaste = () => {
  625. flag.value = true
  626. // 监听事件,暂时不用,后续会使用
  627. uni.$on('addWasteInfoEvent', (data) => {
  628. addWasteInfo(data)
  629. })
  630. var encodedId = encodeURIComponent(processInspecion.value.lot.productId);
  631. var enprocessId = encodeURIComponent(processInspecion.value.lot.processId);
  632. // 构建查询参数字符串
  633. var queryParam = `param1=${encodedId}&param2=${enprocessId}`;
  634. // 使用模板字符串构建完整的URL
  635. var navigateUrl = `/pages/deliveryInspection/options?${queryParam}`;
  636. // 导航到指定页面
  637. uni.navigateTo({
  638. url: navigateUrl
  639. });
  640. }
  641. // 删除不合格信息
  642. const handleDelWaste = (index) => {
  643. uni.showModal({
  644. title: '提示',
  645. content: '确定删除该项?',
  646. success: function(res) {
  647. if (res.confirm) {
  648. unfitInfos.value.splice(index, 1)
  649. } else if (res.cancel) {
  650. return
  651. }
  652. }
  653. })
  654. }
  655. // 咨询
  656. const handleAddConsultation = () => {
  657. console.log("9999")
  658. isEventTriggered.value = false;
  659. // 监听事件
  660. uni.$once('addWasteConsultationEvent', (data) => {
  661. if (!isEventTriggered.value) {
  662. // 如果事件尚未触发,则执行事件触发逻辑
  663. addConsultation(data)
  664. }
  665. })
  666. uni.navigateTo({
  667. url: "/pages/deliveryInspection/consultation",
  668. success: (res) => {
  669. // 通过eventChannel向被打开页面传送数据
  670. res.eventChannel.emit("deliveryInpsectionConsultation", {
  671. data: processInspecion.value.lot
  672. })
  673. }
  674. })
  675. }
  676. </script>
  677. <style lang="scss">
  678. .page-container {
  679. // height: 100%;
  680. background-color: #ececec;
  681. font-size: 28rpx;
  682. >.title {
  683. font-weight: 700;
  684. margin: 24rpx 16rpx;
  685. }
  686. }
  687. .carrier-info {
  688. margin: 32rpx 16rpx 0 16rpx;
  689. padding: 24rpx;
  690. background-color: #ffffff;
  691. border-radius: 8rpx;
  692. .carrier-code {
  693. font-size: 32rpx;
  694. font-weight: 700;
  695. }
  696. .info-row {
  697. margin-top: 16rpx;
  698. color: #767676;
  699. .label {
  700. width: 160rpx;
  701. }
  702. .drawing-btn {
  703. padding: 12rpx 32rpx;
  704. background-color: #0055ff;
  705. color: #ffffff;
  706. border-radius: 12rpx;
  707. margin-left: auto;
  708. font-size: 28rpx;
  709. }
  710. .value {
  711. flex: 1;
  712. textarea {
  713. flex: 1;
  714. border: 1px solid #888888;
  715. box-sizing: border-box;
  716. padding: 16rpx;
  717. }
  718. }
  719. }
  720. }
  721. .unfit-title {
  722. margin-bottom: 24rpx;
  723. justify-content: space-between;
  724. align-items: center;
  725. text {
  726. font-size: 28rpx;
  727. font-weight: 700;
  728. }
  729. .add-btn {
  730. padding: 12rpx 32rpx;
  731. background-color: #a4adb3;
  732. color: #ffffff;
  733. border-radius: 12rpx;
  734. font-size: 24rpx;
  735. }
  736. }
  737. .unfit-container {
  738. padding: 24rpx;
  739. margin: 0 16rpx;
  740. background-color: #ffffff;
  741. border-radius: 12rpx;
  742. .unfit-item-container {
  743. position: relative;
  744. >* {
  745. margin-bottom: 24rpx;
  746. }
  747. .title {
  748. font-weight: 700;
  749. justify-content: space-between;
  750. align-items: center;
  751. image {
  752. width: 40rpx;
  753. height: 40rpx;
  754. }
  755. }
  756. .standard {}
  757. .resu {
  758. width: 100%;
  759. align-items: center;
  760. input {
  761. margin-left: 20rpx;
  762. width: 200rpx;
  763. height: 56rpx;
  764. flex: 1;
  765. border: 1px solid #9f9f9f;
  766. font-size: 28rpx;
  767. }
  768. }
  769. .result {
  770. align-items: center;
  771. border-bottom: 1px solid #9f9f9f;
  772. padding-bottom: 32rpx;
  773. .label {
  774. flex: 1;
  775. }
  776. input {
  777. width: 280rpx;
  778. height: 56rpx;
  779. border: 1px solid #9f9f9f;
  780. font-size: 28rpx;
  781. &.number {
  782. width: 104rpx;
  783. text-align: center;
  784. }
  785. }
  786. }
  787. }
  788. .unfit-item-container:last-child {
  789. .result {
  790. border-bottom: none;
  791. padding-bottom: 0;
  792. }
  793. }
  794. }
  795. .consultation-container {
  796. margin: 0 16rpx;
  797. padding: 24rpx;
  798. background-color: #ffffff;
  799. border-radius: 8rpx;
  800. .consultation-item-container {
  801. margin-bottom: 24rpx;
  802. border-bottom: 2px solid #888888;
  803. padding-bottom: 24rpx;
  804. }
  805. .consultation-item-container:last-child {
  806. margin-bottom: 0;
  807. border-bottom: 0;
  808. padding-bottom: 0;
  809. }
  810. .question,
  811. .answer {
  812. .label {
  813. justify-content: space-between;
  814. margin-bottom: 16rpx;
  815. font-weight: 700;
  816. }
  817. .content {
  818. line-height: 40rpx;
  819. }
  820. }
  821. .answer {
  822. margin-top: 24rpx;
  823. }
  824. }
  825. .daywork-container {
  826. margin-top: 24rpx;
  827. padding: 24rpx;
  828. background-color: #ffffff;
  829. border: 1px solid #bcbcbc;
  830. .result {
  831. align-items: center;
  832. .label {
  833. width: 112rpx;
  834. }
  835. input {
  836. flex: 1;
  837. height: 56rpx;
  838. border: 1px solid #9f9f9f;
  839. font-size: 28rpx;
  840. text-align: center;
  841. }
  842. }
  843. .switch {
  844. margin-top: -8rpx;
  845. align-items: center;
  846. }
  847. .remark {
  848. margin-top: 24rpx;
  849. .label {
  850. width: 112rpx;
  851. }
  852. textarea {
  853. flex: 1;
  854. border: 1px solid #9f9f9f;
  855. height: 168rpx;
  856. }
  857. }
  858. .btns-container {
  859. margin-top: 24rpx;
  860. .finished-btn {
  861. display: flex;
  862. flex: 1;
  863. height: 80rpx;
  864. background-color: #fc6565;
  865. color: #ffffff;
  866. text-align: center;
  867. justify-content: center;
  868. align-items: center;
  869. border-radius: 8rpx;
  870. }
  871. .question-btn {
  872. width: 80rpx;
  873. align-items: flex-end;
  874. image {
  875. width: 48rpx;
  876. height: 48rpx;
  877. }
  878. text {
  879. font-size: 24rpx;
  880. }
  881. }
  882. }
  883. }
  884. input:disabled {
  885. background-color: #aaaaff !important;
  886. color: #ccc !important;
  887. /* 假设您想要设置文本颜色 */
  888. }
  889. .my-files {
  890. display: flex;
  891. justify-content: center;
  892. :deep(.uni-file-picker__container) {
  893. flex-direction: row;
  894. }
  895. }
  896. </style>