form.vue 25 KB

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