form.vue 25 KB

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