form.vue 27 KB

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