form.vue 25 KB

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