form.vue 25 KB

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