form.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  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(255,85,85,1)"
  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(255,85,85,1)" :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. // 构建查询参数字符串
  402. var queryParam =
  403. `param1=${encodedId}&param2=${encodeCode}&param3=${enprocessCode}&param4=${enTechnologicalProcessId}&param5=${enProcessAlias}`;
  404. // 使用模板字符串构建完整的URL
  405. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  406. // 导航到指定页面
  407. uni.navigateTo({
  408. url: navigateUrl
  409. });
  410. }
  411. function switchChange(event) {
  412. console.log(event)
  413. // if (event.detail.value) {
  414. if (event) {
  415. processInspecion.value.flag = true
  416. processInspecion.value.isAllChecked = 0
  417. isAllChecked.value = false
  418. } else {
  419. processInspecion.value.flag = false
  420. }
  421. }
  422. function switchAllCheckChange(event) {
  423. console.log(event)
  424. // if (event.detail.value) {
  425. if (event) {
  426. processInspecion.value.isAllChecked = 1
  427. } else {
  428. processInspecion.value.isAllChecked = 0
  429. }
  430. }
  431. const rejectNumberChange = () => {
  432. let sumDisqualificationNum = 0
  433. let sumExaminingNum = 0
  434. unfitInfos.value.forEach(v => {
  435. sumDisqualificationNum += (v.disqualificationNum != null ? Number(v.disqualificationNum) : 0)
  436. sumExaminingNum += (v.examiningNum != null ? Number(v.examiningNum) : 0)
  437. })
  438. processInspecion.value.disqualificationNum = sumDisqualificationNum
  439. processInspecion.value.examiningNum = sumExaminingNum
  440. console.log(processInspecion.value)
  441. }
  442. function getInstrumentRoomInspectionList() {
  443. getInstrumentRoomInspection(processInspecion.value).then(res => {
  444. if (res.data.length > 0) {
  445. showTransfer.value = false
  446. // processInspecion.value.flag = true
  447. } else {
  448. showTransfer.value = true
  449. // processInspecion.value.flag = false
  450. }
  451. })
  452. }
  453. //查询咨询列表
  454. function getInspecion() {
  455. processInspecion.value = store.processInspection
  456. selectInspecion(processInspecion.value).then(res => {
  457. console.log("咨询", res);
  458. if (res.code == 200) {
  459. console.log("res", res);
  460. } else {
  461. uni.showToast({
  462. icon: 'none',
  463. title: res.msg,
  464. duration: 2000
  465. })
  466. }
  467. });
  468. }
  469. //结束报工按钮
  470. function endWork() {
  471. let unf = unfitInfos.value;
  472. for (var i = 0; i < unfitInfos.value.length; i++) {
  473. if (unf[i].examiningNum < 0 || unf[i].disqualificationNum < 0) {
  474. uni.showToast({
  475. icon: 'none',
  476. title: '检查量,不良品量不能小于0',
  477. duration: 2000
  478. })
  479. return
  480. }
  481. if (unf[i].examiningNum > processInspecion.value.lot.pudName) {
  482. uni.showToast({
  483. icon: 'none',
  484. title: '检查量不能大于投产量'
  485. })
  486. return
  487. }
  488. }
  489. if (processInspecion.value.disqualificationNum > processInspecion.value.lot.pudName) {
  490. uni.showToast({
  491. icon: 'none',
  492. title: '不良品量不能大于投产量'
  493. })
  494. return
  495. }
  496. save();
  497. }
  498. function save() {
  499. const currentTime = Date.now();
  500. // 检查是否已经过去了 2 秒
  501. if (currentTime - lastRequestTimestamp.value < 2000) {
  502. // 如果在 2 秒 内已经点击,那么不执行
  503. uni.showToast({
  504. icon: 'none',
  505. title: `请勿重复点击`,
  506. duration: 2000
  507. })
  508. return;
  509. }
  510. let pages = getCurrentPages();
  511. processInspecion.value.dayworkItemConsults = consultations.value;
  512. processInspecion.value.processInspectionDetails = unfitInfos.value;
  513. processInspecion.value.user = store.userInfo;
  514. processInspecion.value.tenantId = store.tenantId
  515. processInspecion.value.inspectionCarrierId = processInspecion.value.lot.inspectionCarrierId
  516. processInspecion.value.inspectionCarrierCode = processInspecion.value.lot.inspectionCarrierCode
  517. processInspecion.value.processInspectionPictureList = selectedPhotos.value
  518. console.log(processInspecion.value)
  519. if (processInspecion.value.flag) {
  520. //打开选择仪器室的弹窗
  521. selectInspectionChamber.value.open()
  522. console.log(processInspecion.value)
  523. } else {
  524. saveDeliveryInspecion(processInspecion.value).then(res => {
  525. if (res.code == 200) {
  526. let index = 0;
  527. for (let i = 0; i < pages.length; i++) {
  528. if (pages[i].$page.fullPath == "/pages/deliveryInspection/index") {
  529. index = pages.length - i - 1;
  530. }
  531. }
  532. console.log("index", index);
  533. uni.navigateBack({
  534. delta: index
  535. });
  536. } else {
  537. uni.showToast({
  538. icon: 'none',
  539. title: res.msg,
  540. duration: 2000
  541. })
  542. }
  543. });
  544. }
  545. }
  546. //仪器室带回
  547. function handleSelectInspectionChamber(data) {
  548. processInspecion.value.inspectionChamberId = data
  549. console.log(processInspecion.value)
  550. saveDeliveryInspecion(processInspecion.value).then(res => {
  551. if (res.code == 200) {
  552. let index = 0;
  553. let pages = getCurrentPages();
  554. for (let i = 0; i < pages.length; i++) {
  555. if (pages[i].$page.fullPath == "/pages/deliveryInspection/index") {
  556. index = pages.length - i - 1;
  557. }
  558. }
  559. console.log("index", index);
  560. uni.navigateBack({
  561. delta: index
  562. });
  563. } else {
  564. uni.showToast({
  565. icon: 'none',
  566. title: res.msg,
  567. duration: 2000
  568. })
  569. }
  570. });
  571. }
  572. //咨询样式
  573. function selectType(item) {
  574. for (var i = 0; i < consul.length; i++) {
  575. if (item.status == consul[i].value) {
  576. return consul[i].type
  577. }
  578. }
  579. }
  580. const addWasteInfo = (data) => {
  581. console.log(data, "55555555")
  582. flag.value = true
  583. var info = {
  584. inspectionStandardsId: data.id,
  585. checkStandard: data.standard
  586. }
  587. unfitInfos.value.push(info)
  588. console.log(data)
  589. }
  590. const addConsultation = (data) => {
  591. let info = data
  592. info.forEach(item => {
  593. item.status = 0
  594. })
  595. consultations.value = consultations.value.concat(info)
  596. isEventTriggered.value = true; // 更新标志位状态
  597. }
  598. /***************************** 定义了一些事件 *****************************/
  599. // 添加不合格信息
  600. const handleAddWaste = () => {
  601. flag.value = true
  602. // 监听事件,暂时不用,后续会使用
  603. uni.$on('addWasteInfoEvent', (data) => {
  604. addWasteInfo(data)
  605. })
  606. var encodedId = encodeURIComponent(processInspecion.value.lot.productId);
  607. var enprocessId = encodeURIComponent(processInspecion.value.lot.processId);
  608. // 构建查询参数字符串
  609. var queryParam = `param1=${encodedId}&param2=${enprocessId}`;
  610. // 使用模板字符串构建完整的URL
  611. var navigateUrl = `/pages/deliveryInspection/options?${queryParam}`;
  612. // 导航到指定页面
  613. uni.navigateTo({
  614. url: navigateUrl
  615. });
  616. }
  617. // 删除不合格信息
  618. const handleDelWaste = (index) => {
  619. uni.showModal({
  620. title: '提示',
  621. content: '确定删除该项?',
  622. success: function(res) {
  623. if (res.confirm) {
  624. unfitInfos.value.splice(index, 1)
  625. } else if (res.cancel) {
  626. return
  627. }
  628. }
  629. })
  630. }
  631. // 咨询
  632. const handleAddConsultation = () => {
  633. console.log("9999")
  634. isEventTriggered.value = false;
  635. // 监听事件
  636. uni.$once('addWasteConsultationEvent', (data) => {
  637. if (!isEventTriggered.value) {
  638. // 如果事件尚未触发,则执行事件触发逻辑
  639. addConsultation(data)
  640. }
  641. })
  642. uni.navigateTo({
  643. url: "/pages/deliveryInspection/consultation",
  644. success: (res) => {
  645. // 通过eventChannel向被打开页面传送数据
  646. res.eventChannel.emit("deliveryInpsectionConsultation", {
  647. data: processInspecion.value.lot
  648. })
  649. }
  650. })
  651. }
  652. </script>
  653. <style lang="scss">
  654. .page-container {
  655. // height: 100%;
  656. background-color: #ececec;
  657. font-size: 28rpx;
  658. >.title {
  659. font-weight: 700;
  660. margin: 24rpx 16rpx;
  661. }
  662. }
  663. .carrier-info {
  664. margin: 32rpx 16rpx 0 16rpx;
  665. padding: 24rpx;
  666. background-color: #ffffff;
  667. border-radius: 8rpx;
  668. .carrier-code {
  669. font-size: 32rpx;
  670. font-weight: 700;
  671. }
  672. .info-row {
  673. margin-top: 16rpx;
  674. color: #767676;
  675. .label {
  676. width: 160rpx;
  677. }
  678. .drawing-btn {
  679. padding: 12rpx 32rpx;
  680. background-color: #0055ff;
  681. color: #ffffff;
  682. border-radius: 12rpx;
  683. margin-left: auto;
  684. font-size: 28rpx;
  685. }
  686. .value {
  687. flex: 1;
  688. textarea {
  689. flex: 1;
  690. border: 1px solid #888888;
  691. box-sizing: border-box;
  692. padding: 16rpx;
  693. }
  694. }
  695. }
  696. }
  697. .unfit-title {
  698. margin-bottom: 24rpx;
  699. justify-content: space-between;
  700. align-items: center;
  701. text {
  702. font-size: 28rpx;
  703. font-weight: 700;
  704. }
  705. .add-btn {
  706. padding: 12rpx 32rpx;
  707. background-color: #a4adb3;
  708. color: #ffffff;
  709. border-radius: 12rpx;
  710. font-size: 24rpx;
  711. }
  712. }
  713. .unfit-container {
  714. padding: 24rpx;
  715. margin: 0 16rpx;
  716. background-color: #ffffff;
  717. border-radius: 12rpx;
  718. .unfit-item-container {
  719. position: relative;
  720. >* {
  721. margin-bottom: 24rpx;
  722. }
  723. .title {
  724. font-weight: 700;
  725. justify-content: space-between;
  726. align-items: center;
  727. image {
  728. width: 40rpx;
  729. height: 40rpx;
  730. }
  731. }
  732. .standard {}
  733. .resu {
  734. width: 100%;
  735. align-items: center;
  736. input {
  737. margin-left: 20rpx;
  738. width: 200rpx;
  739. height: 56rpx;
  740. flex: 1;
  741. border: 1px solid #9f9f9f;
  742. font-size: 28rpx;
  743. }
  744. }
  745. .result {
  746. align-items: center;
  747. border-bottom: 1px solid #9f9f9f;
  748. padding-bottom: 32rpx;
  749. .label {
  750. flex: 1;
  751. }
  752. input {
  753. width: 280rpx;
  754. height: 56rpx;
  755. border: 1px solid #9f9f9f;
  756. font-size: 28rpx;
  757. &.number {
  758. width: 104rpx;
  759. text-align: center;
  760. }
  761. }
  762. }
  763. }
  764. .unfit-item-container:last-child {
  765. .result {
  766. border-bottom: none;
  767. padding-bottom: 0;
  768. }
  769. }
  770. }
  771. .consultation-container {
  772. margin: 0 16rpx;
  773. padding: 24rpx;
  774. background-color: #ffffff;
  775. border-radius: 8rpx;
  776. .consultation-item-container {
  777. margin-bottom: 24rpx;
  778. border-bottom: 2px solid #888888;
  779. padding-bottom: 24rpx;
  780. }
  781. .consultation-item-container:last-child {
  782. margin-bottom: 0;
  783. border-bottom: 0;
  784. padding-bottom: 0;
  785. }
  786. .question,
  787. .answer {
  788. .label {
  789. justify-content: space-between;
  790. margin-bottom: 16rpx;
  791. font-weight: 700;
  792. }
  793. .content {
  794. line-height: 40rpx;
  795. }
  796. }
  797. .answer {
  798. margin-top: 24rpx;
  799. }
  800. }
  801. .daywork-container {
  802. margin-top: 24rpx;
  803. padding: 24rpx;
  804. background-color: #ffffff;
  805. border: 1px solid #bcbcbc;
  806. .result {
  807. align-items: center;
  808. .label {
  809. width: 112rpx;
  810. }
  811. input {
  812. flex: 1;
  813. height: 56rpx;
  814. border: 1px solid #9f9f9f;
  815. font-size: 28rpx;
  816. text-align: center;
  817. }
  818. }
  819. .switch {
  820. margin-top: -8rpx;
  821. align-items: center;
  822. }
  823. .remark {
  824. margin-top: 24rpx;
  825. .label {
  826. width: 112rpx;
  827. }
  828. textarea {
  829. flex: 1;
  830. border: 1px solid #9f9f9f;
  831. height: 168rpx;
  832. }
  833. }
  834. .btns-container {
  835. margin-top: 24rpx;
  836. .finished-btn {
  837. display: flex;
  838. flex: 1;
  839. height: 80rpx;
  840. background-color: #fc6565;
  841. color: #ffffff;
  842. text-align: center;
  843. justify-content: center;
  844. align-items: center;
  845. border-radius: 8rpx;
  846. }
  847. .question-btn {
  848. width: 80rpx;
  849. align-items: flex-end;
  850. image {
  851. width: 48rpx;
  852. height: 48rpx;
  853. }
  854. text {
  855. font-size: 24rpx;
  856. }
  857. }
  858. }
  859. }
  860. input:disabled {
  861. background-color: #aaaaff !important;
  862. color: #ccc !important;
  863. /* 假设您想要设置文本颜色 */
  864. }
  865. .my-files {
  866. display: flex;
  867. justify-content: center;
  868. :deep(.uni-file-picker__container) {
  869. flex-direction: row;
  870. }
  871. }
  872. </style>