form.vue 25 KB

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