fqcCheckout.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. <template>
  2. <gui-page :custom-header="true" :is-header-sized="false"
  3. :header-class="['gui-theme-background-color', isLandscapeScreen?'width: 100vmax;':'']"
  4. :style="[isLandscapeScreen?'width: 100vmax':'']">
  5. <template #gHeader>
  6. <view :style="[isLandscapeScreen?'height:44px;width: 100vmax':'height:44px;']"
  7. class="gui-flex gui-nowrap gui-rows gui-align-items-center">
  8. <!-- 使用组件实现返回按钮及返回首页按钮 -->
  9. <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
  10. @tap="goBack">&#xe6c5;</text>
  11. <!-- 导航文本此处也可以是其他自定义内容 -->
  12. <text :style="[isPad?'font-size: 18px':'font-size: 14px']"
  13. class="gui-h4 gui-blod gui-flex1 gui-text-center gui-color-white gui-ellipsis gui-primary-text">FQC检验</text>
  14. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  15. <!-- 实际宽度请根据自己情况设置 -->
  16. <view style="width:40px;" />
  17. </view>
  18. </template>
  19. <template #gBody>
  20. <view class="oqc-checkout">
  21. <view class="card-list-flexbox">
  22. <text class="card-list-title" :style="[isPad?'font-size: 18px':'font-size: 14px']">FQC检验信息</text>
  23. <view class="card-list-item">
  24. <text>日期</text>
  25. <text>{{ $parseTime(OQCParams.produceDateStr) }}</text>
  26. </view>
  27. <!-- <view class="card-list-item">
  28. <text>订单号</text>
  29. <text>{{ OQCParams.saleOutNo }}</text>
  30. </view>
  31. <view class="card-list-item">
  32. <text>客户名称</text>
  33. <text>{{ OQCParams.customerName }}</text>
  34. </view> -->
  35. <view class="card-list-item">
  36. <text>产品批号</text>
  37. <text>{{ OQCParams.materialLotsStr }}</text>
  38. </view>
  39. <view class="card-list-item">
  40. <text>产品名称</text>
  41. <text>{{ OQCParams.materialName }}</text>
  42. </view>
  43. <!-- <view class="card-list-item">
  44. <text>出货数量</text>
  45. <text>{{ OQCParams.deliveredQty }}</text>
  46. </view> -->
  47. <view class="card-list-item">
  48. <text>产品阶段</text>
  49. <text>{{ OQCParams.productPhase }}</text>
  50. </view>
  51. <view class="card-list-item">
  52. <text>班别</text>
  53. <text>{{ OQCParams.classFlag }}</text>
  54. </view>
  55. <!-- <view class="card-list-item">
  56. <text>有效期</text>
  57. <text>{{ OQCParams.expirationDate }}</text>
  58. </view> -->
  59. </view>
  60. <view class="custom-table">
  61. <uni-table border stripe empty-text="暂无更多数据">
  62. <!-- 表头行 -->
  63. <uni-tr class="custom-table-head">
  64. <uni-th align="center" width="60px">序号</uni-th>
  65. <uni-th align="center" width="140px">是否检验</uni-th>
  66. <uni-th align="center" width="240px">检验名称</uni-th>
  67. <uni-th align="center" width="140px">巡检频次</uni-th>
  68. <uni-th align="center" width="140px">检验工具</uni-th>
  69. <uni-th align="center" width="140px">标准值</uni-th>
  70. <uni-th align="center" width="140px">修饰符</uni-th>
  71. </uni-tr>
  72. <!-- 表格数据行 -->
  73. <uni-tr v-for="(item, key) in OQCItemList" :key="key" @click="handleShowModal(item)">
  74. <uni-td align="center" width="120px">{{ ++key }}</uni-td>
  75. <uni-td align="center">
  76. <view style="display: flex;justify-content: center;align-items: center;">
  77. <text v-if="item.completed" class="font-icons"
  78. :style="[isPad?'font-size: 24px':'font-size: 22px', 'color: #2dc252']">&#xe6dd;</text>
  79. <text v-else class="font-icons"
  80. :style="[isPad?'font-size: 24px':'font-size: 22px', 'color: #6a6a6a']">&#xe6e0;</text>
  81. <text v-if="item.voidOrNot *1 === 1" style="margin-left: 4px;">报废</text>
  82. <text v-else style="margin-left: 4px;">{{ item.completed? '已检': '未检' }}</text>
  83. </view>
  84. </uni-td>
  85. <uni-td align="center"
  86. :style="[item.voidOrNot *1 === 1?'text-decoration: line-through;':'']">{{ item.inspectionName }}</uni-td>
  87. <uni-td align="center"
  88. :style="[item.voidOrNot *1 === 1?'text-decoration: line-through;':'']">{{ item.checkQuantity }}</uni-td>
  89. <uni-td align="center"
  90. :style="[item.voidOrNot *1 === 1?'text-decoration: line-through;':'']">{{ item.tool }}</uni-td>
  91. <uni-td align="center"
  92. :style="[item.voidOrNot *1 === 1?'text-decoration: line-through;':'']">{{ item.standValue }}</uni-td>
  93. <uni-td align="center"
  94. :style="[item.voidOrNot *1 === 1?'text-decoration: line-through;':'']">{{ item.standard }}</uni-td>
  95. </uni-tr>
  96. </uni-table>
  97. </view>
  98. </view>
  99. <uni-popup ref="popup" background-color="#fff" :mask-click="false">
  100. <view class="popup-content">
  101. <view class="card-list-flexbox-popup">
  102. <view class="card-list-item">
  103. <text class="text-1 gui-color-gray">{{ submitOQCItem.inspectionName }}</text>
  104. </view>
  105. <view class="card-list-item">
  106. <text class="text-1 gui-color-gray">检验工具</text>
  107. <text class="text-2 gui-color-gray">{{ submitOQCItem.tool }}</text>
  108. </view>
  109. <view class="card-list-item">
  110. <text class="text-1 gui-color-gray">检验频次</text>
  111. <text class="text-2 gui-color-gray">{{ submitOQCItem.checkQuantity }}</text>
  112. </view>
  113. <view class="card-list-item">
  114. <text class="text-1 gui-color-gray">检验标准</text>
  115. <text class="text-2 gui-color-gray">{{ submitOQCItem.standard }}</text>
  116. </view>
  117. <view class="card-list-item">
  118. <text class="text-1 gui-color-gray">是否合格</text>
  119. <text class="text-2 gui-color-gray">
  120. <radio-group style="width: inherit;" @change="radioChange">
  121. <view
  122. style="display: grid;grid-template-rows: 1fr; grid-template-columns: 1fr 1fr;">
  123. <label>
  124. <view style="display: flex;justify-content: center;align-items: center;">
  125. <radio value="1"
  126. :checked="submitOQCItem.singleResult *1 === 1?true:false" />
  127. <view>合格</view>
  128. </view>
  129. </label>
  130. <label>
  131. <view style="display: flex;justify-content: center;align-items: center;">
  132. <radio value="0"
  133. :checked="submitOQCItem.singleResult *1 === 0?true:false" />
  134. <view>不合格</view>
  135. </view>
  136. </label>
  137. </view>
  138. </radio-group>
  139. </text>
  140. </view>
  141. <view v-if="submitOQCItem.inspectionModel === 0" class="card-list-item-input">
  142. <view v-for="(item, key) in submitOQCItem.actualCreateReqVOS" :key="key"
  143. style="margin: 4px 0;">
  144. <text v-if="item.qualified === 1" class="font-icons"
  145. style="font-size: 22px;height: auto;color: #2dc252;padding: 0 6px;">&#xe6dd;</text>
  146. <text v-else class="font-icons"
  147. style="font-size: 22px;height: auto;color: red;padding: 0 6px;">&#xe6e0;</text>
  148. <textarea v-model="submitOQCItem.actualCreateReqVOS[key].actual"
  149. class="text-3 gui-color-gray" inputmode="decimal" placeholder="请输入检验内容"
  150. style="border-radius: 4px;border: 1px dotted gray;" auto-height maxlength="14" />
  151. <view v-if="key === submitOQCItem.actualCreateReqVOS.length - 1" class="operation-icon"
  152. @click="appendRow(item)">
  153. <text class="font-icons"
  154. :style="[isPad?'font-size: 18px':'font-size: 14px']">&#xe664;</text>
  155. </view>
  156. <view v-else class="operation-icon-2" @click="deleteRow(item, key)">
  157. <text class="font-icons"
  158. :style="[isPad?'font-size: 18px':'font-size: 14px']">&#xe677;</text>
  159. </view>
  160. </view>
  161. </view>
  162. <view v-if="submitOQCItem.inspectionModel === 1" class="card-list-item-input">
  163. <textarea v-model="submitOQCItem.measuredResults" class="text-3 gui-color-gray"
  164. inputmode="text" placeholder="请输入检验内容"
  165. style="border-radius: 4px;border: 1px dotted gray;margin: 2px 4px;" auto-height
  166. maxlength="14" />
  167. </view>
  168. <view v-if="submitOQCItem.src?.length > 0" class="card-list-item">
  169. <text class="text-1">上传图片预览:</text>
  170. </view>
  171. <view v-if="submitOQCItem.src?.length > 0" class="card-list-item grid-image"
  172. style="margin: 12px 0">
  173. <image v-for="(item, key) in submitOQCItem.src" :key="key" :src="item" mode="scaleToFill"
  174. @click="handleRemoveImage(item, key)" />
  175. </view>
  176. <view v-if="OQCParams.auditStatus === -1" class="card-list-item">
  177. <button class="text-1 btn-mg" type="primary" @click="takePhoto">拍照</button>
  178. </view>
  179. <view class="card-list-item" style="margin: 12px 0">
  180. <button v-if="OQCParams.auditStatus === -1" class="text-1 btn-mg" type="primary"
  181. @click="handleSubmit">提交数据</button>
  182. <button class="text-1 btn-mg" type="default" @click="$refs['popup'].close()">关闭</button>
  183. </view>
  184. </view>
  185. </view>
  186. </uni-popup>
  187. <gui-right-menus>
  188. <!-- 扩展按钮 -->
  189. <template #menus-more>
  190. <view v-if="OQCParams.auditStatus === -1" hover-class="gui-tap"
  191. class="menu-items gui-bg-green gui-flex gui-columns gui-justify-content-center"
  192. @click="handleShowSubmitApprovalModal">
  193. <text class="menu-text gui-block gui-text-center gui-color-white">送审</text>
  194. </view>
  195. <view v-else hover-class="gui-tap"
  196. class="menu-items gui-flex gui-columns gui-justify-content-center"
  197. style="background-color: #717171;">
  198. <text class="menu-text gui-block gui-text-center gui-color-white">送审</text>
  199. </view>
  200. </template>
  201. <!-- 核心按钮 -->
  202. <template #menus-primary>
  203. <view class="menu-items gui-bg-primary gui-flex gui-columns gui-justify-content-center">
  204. <text class="menu-icon gui-color-white gui-block gui-text-center gui-icons">&#xe614;</text>
  205. <text class="menu-text gui-color-white gui-block gui-text-center">操作</text>
  206. </view>
  207. </template>
  208. </gui-right-menus>
  209. <gui-modal ref="modalForm" :custom-class="['gui-bg-white', 'gui-dark-bg-level-3', 'gui-border-radius']"
  210. title="提示">
  211. <template #content>
  212. <view class="gui-padding gui-bg-gray gui-dark-bg-level-2">
  213. <text class="gui-block gui-text-center gui-text gui-color-gray"
  214. style="line-height:100rpx; padding:10rpx;">您确定要立即送审吗?</text>
  215. </view>
  216. </template>
  217. <!-- 利用 flex 布局 可以放置多个自定义按钮哦 -->
  218. <template #btns>
  219. <view class="gui-flex gui-row gui-space-between operation-flex">
  220. <view hover-class="gui-tap" class="modal-btns gui-flex1" @tap="handleCancelApprovalModal">
  221. <text class="modal-btns gui-color-gray">取消</text>
  222. </view>
  223. <view class="line" />
  224. <view hover-class="gui-tap" class="modal-btns gui-flex1" @tap="handleSubmitApprovalModal">
  225. <text class="modal-btns gui-primary-color">确认</text>
  226. </view>
  227. </view>
  228. </template>
  229. </gui-modal>
  230. <uni-popup ref="errorTip" type="dialog">
  231. <uni-popup-dialog type="error" cancel-text="关闭" confirm-text="确认" title="提示" :content="errorTipMessage"
  232. @confirm="handleCloseErrorTipsModal" @close="handleCloseErrorTipsModal" />
  233. </uni-popup>
  234. </template>
  235. </gui-page>
  236. </template>
  237. <script>
  238. import axios from 'axios'
  239. import {
  240. computed,
  241. defineComponent,
  242. ref,
  243. onMounted,
  244. onBeforeMount
  245. } from 'vue'
  246. export default defineComponent({
  247. onLoad() {
  248. // // #ifdef APP-PLUS
  249. // plus.screen.lockOrientation('default');
  250. // // #endif
  251. },
  252. onUnload() {
  253. // // #ifdef APP-PLUS
  254. // plus.screen.lockOrientation('portrait-primary');
  255. // // #endif
  256. },
  257. onResize() {
  258. if ([90, -90].includes(plus.navigator.getOrientation())) {
  259. this.isLandscapeScreen = true
  260. } else {
  261. this.isLandscapeScreen = false
  262. }
  263. },
  264. setup(options) {
  265. const popup = ref()
  266. const modalForm = ref()
  267. const isLandscapeScreen = ref(false)
  268. const parentRow = options?.params ?? {}
  269. // 绑定的检查人信息
  270. const OQCParams = ref({
  271. auditStatus: null,
  272. materialLots: '',
  273. materialLotsStr: '',
  274. customerName: '',
  275. deliveredQty: '',
  276. expirationDate: '',
  277. materialName: '',
  278. produceDateStr: '',
  279. saleOutNo: '',
  280. version: 0,
  281. productPhase: '',
  282. processNo: '',
  283. materialNo: '',
  284. classFlag: '', // 班别
  285. wmsSaleOutOrderId: ''
  286. })
  287. const OQCItemList = ref([])
  288. // 待巡检项信息
  289. const submitOQCItem = ref({
  290. src: [],
  291. singleResult: '',
  292. measuredResults: null,
  293. id: '',
  294. inspectionModel: null,
  295. actualCreateReqVOS: [{
  296. id: '',
  297. actual: 0
  298. }],
  299. fileIds: []
  300. })
  301. const errorState = ref(0)
  302. const errorTip = ref('')
  303. const errorTipMessage = ref('')
  304. onBeforeMount(() => {
  305. // OQCParams.value.saleOutNo = JSON.parse(parentRow)?.saleOutNo;
  306. // OQCParams.value.materialNo = JSON.parse(parentRow)?.materialNo;
  307. OQCParams.value.wmsSaleOutOrderId = JSON.parse(parentRow)?.id
  308. })
  309. onMounted(() => {
  310. handleBindOQCHeader()
  311. })
  312. const goBack = function() {
  313. uni.$goBack('/pages/workbranch/production/FQC/fqcList')
  314. }
  315. const appendRow = function(row) {
  316. submitOQCItem.value.actualCreateReqVOS.push({
  317. id: '',
  318. actual: ''
  319. })
  320. }
  321. const deleteRow = function(row, index) {
  322. submitOQCItem.value.actualCreateReqVOS.splice(index, 1)
  323. }
  324. // 绑定FQC检验表头
  325. const handleBindOQCHeader = async function() {
  326. // const params = {
  327. // "wmsSaleOutOrderId": OQCParams.value.wmsSaleOutOrderId,
  328. // "processNo": "FQC",
  329. // "saleOutNo": OQCParams.value.saleOutNo,
  330. // "materialLots": JSON.parse(parentRow)?.materialLots,
  331. // "materialNo": OQCParams.value.materialNo,
  332. // // "wmsMaterialItemMasterId": "1658763849743671297"
  333. // }
  334. // await uni.$reqPost("getFQCRule", params);
  335. await uni.$reqPost('getFQCItem', {
  336. 'wmsIncomingReceiptInspectionId': OQCParams.value.wmsSaleOutOrderId
  337. })
  338. .then((data) => {
  339. OQCItemList.value = data?.list
  340. OQCParams.value.customerName = data
  341. ?.customerName
  342. OQCParams.value.classFlag = data?.classFlag
  343. OQCParams.value.version = data?.version
  344. OQCParams.value.materialNo = data?.materialNo
  345. OQCParams.value.productPhase = data?.productPhase
  346. OQCParams.value.processNo = data?.processNo
  347. OQCParams.value.deliveredQty = data?.deliveredQty
  348. OQCParams.value.expirationDate = data?.expirationDate
  349. OQCParams.value.materialLotsStr = data?.materialLotsStr
  350. OQCParams.value.materialLots = data?.materialLots
  351. OQCParams.value.materialName = data?.materialName
  352. OQCParams.value.auditStatus = data?.auditStatus
  353. OQCParams.value.produceDateStr = data?.produceDateStr
  354. OQCParams.value.saleOutNo = data?.saleOutNo
  355. })
  356. }
  357. const scinumToFloat = function(num) {
  358. // 处理非数字
  359. if (isNaN(num)) {
  360. return num
  361. }
  362. // 处理不需要转换的数字
  363. var str = '' + num
  364. if (!/e/i.test(str)) {
  365. return num
  366. }
  367. return (num).toFixed(18).replace(/\.?0+$/, '')
  368. }
  369. // 开始检验
  370. const handleShowModal = function(opt) {
  371. if (opt?.voidOrNot * 1 !== 1) {
  372. Object.assign(submitOQCItem.value, opt)
  373. submitOQCItem.value.id = opt?.id
  374. submitOQCItem.value.inspectionModel = opt?.inspectionModel
  375. uni.$reqGet('getResult', {
  376. id: opt?.id
  377. })
  378. .then(({
  379. code,
  380. data,
  381. msg
  382. }) => {
  383. if (code === 0) {
  384. if (popup.value?.showPopup === false) {
  385. popup.value.open('bottom')
  386. }
  387. if (data.actualDOS !== null && Object.prototype.toString.call(data
  388. .actualDOS) ===
  389. '[object Array]' && data.actualDOS.length > 0) {
  390. submitOQCItem.value.actualCreateReqVOS.length = 0
  391. data?.actualDOS.forEach(item => {
  392. const actual = scinumToFloat(item?.actual)
  393. submitOQCItem.value.actualCreateReqVOS.push({
  394. ...item,
  395. actual
  396. })
  397. })
  398. } else {
  399. submitOQCItem.value.actualCreateReqVOS = [{
  400. id: '',
  401. actual: ''
  402. }]
  403. }
  404. if (data.fileIds !== null) {
  405. submitOQCItem.value.fileIds = data?.fileIds ?? []
  406. }
  407. submitOQCItem.value.measuredResults = data?.measuredResults ?? ''
  408. if (data?.urlList !== null) {
  409. submitOQCItem.value.src = data?.urlList
  410. } else {
  411. submitOQCItem.value.src = []
  412. }
  413. } else {
  414. // #ifdef APP-PLUS
  415. plus.device.beep(2)
  416. // #endif
  417. errorTipMessage.value = msg
  418. errorTip.value.open()
  419. errorState.value = -1
  420. }
  421. })
  422. }
  423. }
  424. const handleSubmit = async function() {
  425. const actualCreateReqVOS = []
  426. if (submitOQCItem.value.inspectionModel === 0) {
  427. try {
  428. submitOQCItem.value
  429. .actualCreateReqVOS.forEach(item => {
  430. if (isNaN(Number(item.actual))) {
  431. throw new Error('请填写正确的数值!')
  432. } else {
  433. actualCreateReqVOS.push({
  434. id: '',
  435. ...item,
  436. actual: item.actual
  437. })
  438. }
  439. })
  440. } catch (e) {
  441. uni.showToast({
  442. title: e.message,
  443. duration: 2000,
  444. icon: 'none'
  445. })
  446. return
  447. }
  448. }
  449. const params = {
  450. fileIds: submitOQCItem.value.fileIds,
  451. actualCreateReqVOS,
  452. singleResult: submitOQCItem.value.singleResult,
  453. measuredResults: submitOQCItem.value.measuredResults,
  454. id: submitOQCItem.value.id,
  455. materialLots: OQCParams.value.materialLots,
  456. inspectionModel: submitOQCItem.value.inspectionModel,
  457. processNo: OQCParams.value.processNo
  458. }
  459. if (params.singleResult === '□OK ■NG') {
  460. params.singleResult = '0'
  461. } else if (params.singleResult === '■OK □NG') {
  462. params.singleResult = '1'
  463. }
  464. const data = await uni.$reqPut('submitItem', params)
  465. if (data?.code === 0) {
  466. uni.showToast({
  467. title: '数据提交成功!',
  468. duration: 2000,
  469. icon: 'none'
  470. })
  471. popup.value.close()
  472. handleBindOQCHeader()
  473. } else {
  474. // #ifdef APP-PLUS
  475. plus.device.beep(2)
  476. // #endif
  477. errorTipMessage.value = data?.msg ?? ''
  478. errorTip.value.open()
  479. errorState.value = -1
  480. }
  481. }
  482. // 拍照
  483. const takePhoto = function() {
  484. uni.chooseImage({
  485. count: 6, // count: 6, //默认9
  486. sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
  487. sourceType: ['album', 'camera'], // 从相册选择
  488. success: function(res) {
  489. res.tempFilePaths.forEach(async item => {
  490. // #ifdef APP-PLUS
  491. // 移动端无法使用FormData类型
  492. // 使用uniapp官方提供的uploadFile函数替代实现文件上传
  493. await uni.uploadFile({
  494. url: uni.$baseUrl +
  495. '/admin-api/minio/files/uploadFiles',
  496. name: 'file',
  497. filePath: item,
  498. header: {
  499. 'Authorization': 'Bearer ' + uni
  500. .getStorageSync('token')
  501. },
  502. success: function(uploadFileRes) {
  503. const resultJSON = JSON.parse(
  504. uploadFileRes.data)
  505. if (submitOQCItem.value.fileIds ===
  506. null) {
  507. submitOQCItem.value.fileIds = []
  508. }
  509. submitOQCItem.value.fileIds.push(
  510. resultJSON.data
  511. .fileId)
  512. }
  513. })
  514. // #endif
  515. submitOQCItem.value.src.push(item)
  516. })
  517. res.tempFiles.forEach(async (item) => {
  518. // #ifdef H5
  519. const formData = new FormData()
  520. formData.append('file', item)
  521. // 上传文件
  522. const {
  523. data
  524. } = await axios({
  525. url: uni.$baseUrl +
  526. '/admin-api/minio/files/uploadFiles',
  527. name: '上传文件',
  528. method: 'post',
  529. headers: {
  530. 'Authorization': 'Bearer ' + uni
  531. .getStorageSync('token'),
  532. 'Content-Type': 'multipart/form-data;'
  533. },
  534. data: formData
  535. })
  536. if (submitOQCItem.value.fileIds === null) {
  537. submitOQCItem.value.fileIds = []
  538. }
  539. submitOQCItem.value.fileIds.push(data.data.fileId)
  540. // #endif
  541. })
  542. }
  543. })
  544. }
  545. const radioChange = function(item) {
  546. submitOQCItem.value.singleResult = item?.detail?.value
  547. }
  548. const handleRemoveImage = function(opt, index) {
  549. submitOQCItem.value.fileIds.splice(index, 1)
  550. submitOQCItem.value.src.splice(index, 1)
  551. }
  552. const handleShowSubmitApprovalModal = function() {
  553. modalForm.value.open()
  554. }
  555. const handleCancelApprovalModal = function() {
  556. modalForm.value.close()
  557. }
  558. const handleSubmitApprovalModal = function() {
  559. const params = {
  560. version: OQCParams.value.version,
  561. materialLots: OQCParams.value.materialLots,
  562. processNo: OQCParams.value.processNo,
  563. materialNo: OQCParams.value.materialNo
  564. }
  565. uni.$reqPost('submitApproval', params)
  566. .then(({
  567. code,
  568. data,
  569. msg
  570. }) => {
  571. if (code === 0) {
  572. uni.showToast({
  573. title: '送审成功!',
  574. duration: 2000,
  575. icon: 'none'
  576. })
  577. handleBindOQCHeader()
  578. } else {
  579. uni.showToast({
  580. title: msg,
  581. duration: 2000,
  582. icon: 'none'
  583. })
  584. }
  585. })
  586. .finally(() => {
  587. modalForm.value.close()
  588. })
  589. }
  590. // 关闭错误信息弹窗
  591. const handleCloseErrorTipsModal = async function() {
  592. errorTip.value.close()
  593. }
  594. return {
  595. popup,
  596. goBack,
  597. modalForm,
  598. takePhoto,
  599. OQCItemList,
  600. errorState,
  601. errorTip,
  602. errorTipMessage,
  603. appendRow,
  604. deleteRow,
  605. isLandscapeScreen,
  606. OQCParams,
  607. radioChange,
  608. handleBindOQCHeader,
  609. handleShowModal,
  610. handleSubmit,
  611. submitOQCItem,
  612. handleRemoveImage,
  613. handleShowSubmitApprovalModal,
  614. handleCancelApprovalModal,
  615. handleSubmitApprovalModal,
  616. handleCloseErrorTipsModal
  617. }
  618. }
  619. })
  620. </script>
  621. <style lang="scss" scoped>
  622. .gui-header-leader-btns {
  623. color: black;
  624. font-size: 24px !important;
  625. margin-left: 24rpx;
  626. }
  627. .gui-sbody {
  628. background-color: rgba(234, 239, 242, 1);
  629. }
  630. .gui-relative {
  631. overflow: visible;
  632. height: 100vh;
  633. .oqc-checkout {
  634. width: 100vw;
  635. height: calc(100vh - 75px);
  636. position: absolute;
  637. top: 95px;
  638. overflow: hidden;
  639. }
  640. }
  641. .card-list-flexbox {
  642. width: calc(100vw - 24px);
  643. // height: 325px;
  644. height: 215px;
  645. margin: 0 12px;
  646. display: flex;
  647. justify-content: center;
  648. flex-direction: column;
  649. align-items: center;
  650. overflow-y: scroll;
  651. .card-list-title {
  652. width: 100%;
  653. height: 35px;
  654. line-height: 35px;
  655. margin: 0 4px 0 4px;
  656. border-radius: 4px 4px 0 0;
  657. text-align: center;
  658. color: white;
  659. background-color: rgba(0, 160, 233, 1.0);
  660. }
  661. .card-list-item,
  662. .card-list-item-operation {
  663. width: 100%;
  664. height: 35px;
  665. margin: 0 4px 3rpx 4px;
  666. border-radius: 4px;
  667. display: flex;
  668. flex-direction: row;
  669. align-items: center;
  670. justify-content: space-between;
  671. background-color: #fff;
  672. uni-text {
  673. font-size: 14px;
  674. height: 50rpx;
  675. text-align: left;
  676. padding: 0 8px;
  677. display: flex;
  678. flex-direction: row;
  679. align-items: center;
  680. }
  681. .text-1 {
  682. flex: 1;
  683. height: 35px;
  684. justify-content: flex-start;
  685. }
  686. .text-2 {
  687. flex: 3;
  688. height: 35px;
  689. justify-content: flex-end;
  690. margin-right: 4px;
  691. padding: 2px 6px;
  692. }
  693. }
  694. }
  695. .popup-content {
  696. width: 100vw;
  697. height: 55vh;
  698. overflow-y: scroll;
  699. }
  700. .card-list-flexbox-popup {
  701. width: 100vw;
  702. display: flex;
  703. flex-direction: row;
  704. align-items: center;
  705. flex-wrap: wrap;
  706. .card-list-item,
  707. .card-list-item-input {
  708. width: 100vw;
  709. height: 100%;
  710. min-height: 40px;
  711. display: flex;
  712. flex-direction: row;
  713. align-items: center;
  714. background-color: #fff;
  715. uni-text {
  716. font-size: 14px;
  717. height: 50rpx;
  718. text-align: left;
  719. padding: 0 12px;
  720. display: flex;
  721. flex-direction: row;
  722. align-items: center;
  723. }
  724. uni-image {
  725. width: calc(100vw / 2 - 4px);
  726. height: calc(100vw / 3.2 - 2px);
  727. pointer-events: none;
  728. }
  729. uni-image::after {
  730. content: "×";
  731. width: 22px;
  732. height: 22px;
  733. position: absolute;
  734. top: 5px;
  735. right: 5px;
  736. display: flex;
  737. justify-content: center;
  738. align-items: center;
  739. color: rgba(255, 255, 255, 0.9);
  740. background-color: rgba(0, 0, 0, 0.5);
  741. border-radius: 50%;
  742. font-size: 24px;
  743. /*给伪元素开启鼠标事件,将事件冒泡到父元素的点击事件中*/
  744. pointer-events: auto;
  745. }
  746. .text-1 {
  747. flex: 1;
  748. height: 40px;
  749. justify-content: flex-start;
  750. }
  751. .text-2 {
  752. flex: 3;
  753. height: 40px;
  754. justify-content: flex-end;
  755. margin-right: 4px;
  756. padding: 2px 6px;
  757. }
  758. .text-3 {
  759. width: calc(100% - 15%);
  760. min-height: 35px;
  761. justify-content: flex-end;
  762. padding: 2px 6px;
  763. }
  764. .text-3::before {}
  765. .btn-mg {
  766. margin: 0 5px;
  767. }
  768. }
  769. .card-list-item {
  770. justify-content: center;
  771. }
  772. .card-list-item-input {
  773. margin: 10px 0 10px 2%;
  774. display: flex;
  775. flex-direction: column;
  776. uni-view {
  777. width: 100%;
  778. height: 100%;
  779. display: flex;
  780. uni-textarea {
  781. flex: 8;
  782. }
  783. uni-view {
  784. flex: 1;
  785. }
  786. .operation-icon,
  787. .operation-icon-2 {
  788. height: auto;
  789. uni-text {
  790. width: 22px;
  791. height: 100%;
  792. padding: 0 !important;
  793. text-align: center;
  794. display: flex;
  795. justify-content: center;
  796. align-items: center;
  797. border-top-right-radius: 4px;
  798. border-bottom-right-radius: 4px;
  799. color: white;
  800. background-color: #80b7ff;
  801. }
  802. }
  803. .operation-icon-2 {
  804. uni-text {
  805. background-color: #ff5962;
  806. }
  807. }
  808. }
  809. }
  810. .grid-image {
  811. /* 设置容器布局为grid布局 */
  812. display: grid;
  813. /* 指定每一行的宽度 每个宽度中间用空格隔开 */
  814. grid-template-rows: repeat(auto-fill, 1fr);
  815. /* 指定每一列的宽度 每个宽度中间用空格隔开 */
  816. grid-template-columns: repeat(2, 1fr);
  817. padding: 0 4px;
  818. }
  819. .card-list-item:nth-of-type(1) {
  820. .text-1 {
  821. flex: 9;
  822. font-weight: bold;
  823. color: black !important;
  824. }
  825. .text-1::before {
  826. content: "";
  827. width: 4px;
  828. height: 20px;
  829. border-radius: 4px;
  830. margin-right: 4px;
  831. background-color: skyblue;
  832. }
  833. .text-2 {
  834. flex: 4;
  835. display: flex;
  836. flex-direction: row;
  837. justify-content: flex-end;
  838. align-items: center;
  839. color: limegreen !important;
  840. }
  841. }
  842. }
  843. .custom-table {
  844. // height: calc(100vh - 355px);
  845. height: calc(100vh - 300px);
  846. margin: 5px 0;
  847. overflow-y: scroll;
  848. }
  849. .uni-list-cell {
  850. width: 100vw;
  851. height: 35px;
  852. margin: 4px 0;
  853. display: flex;
  854. flex-direction: row;
  855. align-items: center;
  856. justify-content: space-between;
  857. border-bottom: 2px solid #eaeff2;
  858. background-color: #fff;
  859. view {
  860. font-size: 14px;
  861. height: 50rpx;
  862. text-align: left;
  863. padding: 0 8px;
  864. display: flex;
  865. flex-direction: row;
  866. align-items: center;
  867. }
  868. .uni-list-cell-left {
  869. flex: 1;
  870. height: 35px;
  871. justify-content: flex-start;
  872. }
  873. .uni-list-cell-db {
  874. flex: 3;
  875. height: 35px;
  876. justify-content: flex-end;
  877. margin-right: 4px;
  878. padding: 2px 6px;
  879. uni-picker {
  880. width: 100%;
  881. display: flex;
  882. flex-direction: row;
  883. justify-content: center;
  884. }
  885. }
  886. }
  887. .modal-btns {
  888. height: 100rpx;
  889. line-height: 100rpx;
  890. display: flex;
  891. justify-content: center;
  892. align-items: center;
  893. }
  894. .line {
  895. margin-top: 10rpx;
  896. height: 80rpx;
  897. width: 1rpx;
  898. background-color: #dcdcdc;
  899. }
  900. </style>