addStock.vue 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="新增入库单" @clickLeft="back">
  4. <!-- @clickRight="handleScan"
  5. right-icon="scan"
  6. > -->
  7. <!--右菜单-->
  8. <template slot="float">
  9. <!-- <view class="nav-icon-caozuo rightNav" @click="getsure">
  10. <u-button type="success" size="small" class="u-reset-button" text="确定"></u-button>
  11. </view> -->
  12. </template>
  13. </uni-nav-bar>
  14. <u-form labelPosition="left" :model="formData" :rules="rules" ref="formRef" labelWidth="240" labelAlign="right"
  15. class="baseForm">
  16. <u-form-item label="物品类型" class="required-form" borderBottom prop="assetType">
  17. <view :style="{ color: assetTypeName ? 'black' : '#c0c4cc' }" class="assetType_box" @click="openPicker">
  18. {{ assetTypeName ? assetTypeName : '请选择产品类型' }}
  19. </view>
  20. </u-form-item>
  21. <u-form-item label="入库场景" class="required-form" prop="bizType" borderBottom>
  22. <uni-data-select v-model="formData.bizType" :localdata="sceneState"></uni-data-select>
  23. <!-- <picker :disabled="!!(productList && productList.length)" @change="e => handlePicker(e, sceneState, 'bizType')" :value="pickerIndex" :range="sceneState" range-key="text">
  24. <u-input :value="sceneStateFilter(formData.bizType)" :disableColor="!!(productList && productList.length) ? '#F5F7FA' : '#fff'" placeholder="请选择" disabled type="select" />
  25. </picker>
  26. <u-icon slot="right" name="arrow-right"></u-icon> -->
  27. </u-form-item>
  28. <u-form-item label="来源单据" prop="documentSource" borderBottom>
  29. <u-input type="text" placeholder="请输入" v-model="formData.sourceBizNo" @click.native="goToRequisition" />
  30. </u-form-item>
  31. <u-form-item label="入库时间" prop="storageTime" borderBottom>
  32. <view class="assetType_box" @click="timeShow = true">{{ storageTime ? formatter(storageTime) : '请选择' }}
  33. </view>
  34. </u-form-item>
  35. <u-form-item label="入库登记人" prop="createUserName" borderBottom>
  36. <u-input disableColor="#ffffff" :value="formData.extInfo.createUserName" placeholder="请选择" disabled
  37. type="text" />
  38. </u-form-item>
  39. <!-- <u-form-item label="送货人" prop="deliveryName" borderBottom>
  40. <u-input type="text" placeholder="请输入" v-model="formData.fromUser" />
  41. </u-form-item>
  42. <u-form-item label="送货人联系方式" prop="deliveryPhone" borderBottom>
  43. <u-input type="text" placeholder="请输入" v-model="formData.extInfo.deliveryPhone" />
  44. </u-form-item> -->
  45. <u-form-item label="备注" prop="remark" borderBottom>
  46. <u-input disableColor="#ffffff" v-model="formData.remark" placeholder="请输入内容" type="text" />
  47. </u-form-item>
  48. </u-form>
  49. <uni-collapse ref="collapse" v-model="collapseOpen">
  50. <uni-collapse-item :typeOpen="1" title="" name="collapse1" :open="true" :key="detailOpen"
  51. :show-animation="true">
  52. <template v-slot:title>
  53. <view class="detail-box">
  54. <view data-v-41027c34="" class="uni-collapse-item__title-wrap">
  55. <view data-v-41027c34=""
  56. class="uni-collapse-item__title-box uni-collapse-item__title-box-base">
  57. <text data-v-41027c34="" class="tag tag-base"><text></text></text>
  58. <text data-v-41027c34="" class="uni-collapse-item__title-text"><text>入库明细</text></text>
  59. </view>
  60. </view>
  61. <u-button type="primary" size="small" text="扫码添加"
  62. @click.native.stop="goToScanCodeList"></u-button>
  63. <u-button type="success" size="small" class="selectEnterType" text="手动添加"
  64. @click.native.stop="selectType"></u-button>
  65. </view>
  66. </template>
  67. <u-form labelPosition="left" :model="{ productList: productList }" ref="lisrFormRef" labelWidth="120"
  68. :rules="listRules" errorType="none" labelAlign="right" :labelStyle="{
  69. fontSize: '28rpx'
  70. }">
  71. <view class="listContent">
  72. <view class="listBox" v-for="(item, index) in productList" :key="index">
  73. <view class="listTit">
  74. <view class="name">{{ item.categoryName }}</view>
  75. <view class="btn">
  76. <u-button v-if="item.isSave" type="primary" size="small" :hairline="true" text="编辑"
  77. @click="listEdit(index)"></u-button>
  78. <u-button v-else type="primary" size="small" :hairline="true" text="保存"
  79. @click="listSave(item, index)"></u-button>
  80. <u-button type="error" size="small" :hairline="true" text="删除"
  81. @click="getDelete(index)"></u-button>
  82. </view>
  83. </view>
  84. <view class="listCont" :class="{ save: item.isSave }">
  85. <view class="item w100">
  86. <u-form-item :label="`物品编码`">
  87. {{ item.categoryCode }}
  88. </u-form-item>
  89. </view>
  90. <view class="item w100">
  91. <u-form-item label="包装规格" prop="packingSpecificationLabel">
  92. <u-tag style="margin-right: 5rpx" v-for="ite in item.packingSpecificationLabel"
  93. :text="ite"></u-tag>
  94. </u-form-item>
  95. </view>
  96. <view class="item">
  97. <u-form-item label="批次号" :prop="`productList.${index}.batchNo`" required>
  98. <u--input :disabled="item.isSave" placeholder="请输入" border="surround"
  99. v-model="item.batchNo"></u--input>
  100. </u-form-item>
  101. </view>
  102. <view class="item">
  103. <u-form-item label="数量" :prop="`productList.${index}.packingQuantity`" required>
  104. <u--input :disabled="item.isSave" placeholder="请输入" border="surround"
  105. v-model="item.packingQuantity"
  106. @change="computeNum(item, index, true)"></u--input>
  107. </u-form-item>
  108. </view>
  109. <view class="item">
  110. <u-form-item label="包装单位" :prop="`productList.${index}.packingUnit`" required>
  111. <u--input :disabled="item.isSave" placeholder="请选择" border="surround"
  112. v-model="item.packingUnit"
  113. @click.native="showPackingUnitPicker(item, index)"></u--input>
  114. </u-form-item>
  115. </view>
  116. <view class="item">
  117. <u-form-item label="仓库" :prop="`productList.${index}.warehouseId`" required>
  118. <u--input :disabled="item.isSave" placeholder="请选择" border="surround"
  119. v-model="item.warehouseName"
  120. @click.native="showWarehousePicker(index)"></u--input>
  121. </u-form-item>
  122. </view>
  123. <view class="item w100">
  124. <u-form-item label="供应商" :prop="`productList.${index}.supplierName`">
  125. <u--input :disabled="item.isSave" placeholder="请选择" border="surround"
  126. v-model="item.supplierName"
  127. @click.native="showSupplierPicker(item, index)"></u--input>
  128. </u-form-item>
  129. </view>
  130. <view class="item">
  131. <u-form-item label="计量数量"
  132. prop="measureQuantity">{{ item.measureQuantity }}</u-form-item>
  133. </view>
  134. <view class="item">
  135. <u-form-item label="计量单位" prop="measureUnit">{{ item.measureUnit }}</u-form-item>
  136. </view>
  137. <view class="item">
  138. <u-form-item label="重量" prop="weight">{{ item.weight }}</u-form-item>
  139. </view>
  140. <view class="item">
  141. <u-form-item label="重量单位" prop="weightUnit">{{ item.weightUnit }}</u-form-item>
  142. </view>
  143. <view class="item">
  144. <u-form-item label="是否拆包"
  145. prop="isUnpack">{{ item.isUnpack ? '是' : '否' }}</u-form-item>
  146. </view>
  147. </view>
  148. <view class="selectTime" v-if="item.outInDetailRecordRequestList.length > 0">
  149. <view class="title">包装列表</view>
  150. <view class="timeBox">
  151. <u-button class="firstBtn" size="small" type="primary" text="选择时间类型"
  152. @click="timeTypeShow = true"></u-button>
  153. <u-button type="warning" size="small" :text="`批量设置${curDateTypeLabel[curDateType]}`"
  154. @click="typeTimeClick(index)"></u-button>
  155. </view>
  156. </view>
  157. <u-list @scrolltolower="scrolltolower" class="z_list" style="height: 100% !important">
  158. <view class="material rx-ss" v-for="(ite, idx) in item.outInDetailRecordRequestList"
  159. :key="idx">
  160. <!-- <view class="left rx-ss" @click="deletePacking(index, idx)">
  161. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
  162. </view> -->
  163. <view class="content_table">
  164. <view class="item">
  165. <view class="lable rx-cc">序号</view>
  166. <view class="content">{{ idx + 1 }}</view>
  167. </view>
  168. <view class="item">
  169. <view class="lable rx-cc">包装编码</view>
  170. <view class="content">{{ ite.packageNo }}</view>
  171. </view>
  172. <view class="item">
  173. <view class="lable rx-cc">包装数量({{ ite.packingUnit }})</view>
  174. <view class="content">{{ ite.packingQuantity }}</view>
  175. </view>
  176. <view class="item">
  177. <view class="lable rx-cc">计量数量({{ ite.measureUnit }})</view>
  178. <view class="content">{{ ite.measureQuantity }}</view>
  179. </view>
  180. <view class="item">
  181. <view class="lable rx-cc">物料代号</view>
  182. <view class="content input_box"><u--input clearable placeholder="请输入"
  183. border="surround" v-model="ite.materielDesignation"></u--input>
  184. </view>
  185. </view>
  186. <view class="item">
  187. <view class="lable rx-cc">客户代号</view>
  188. <view class="content input_box"><u--input clearable placeholder="请输入"
  189. border="surround" v-model="ite.clientCode"></u--input></view>
  190. </view>
  191. <view class="item">
  192. <view class="lable rx-cc">刻码</view>
  193. <view class="content input_box"><u--input clearable placeholder="请输入"
  194. border="surround" v-model="ite.engrave"></u--input></view>
  195. </view>
  196. <view class="item">
  197. <view class="lable rx-cc">重量({{ ite.weightUnit }})</view>
  198. <view class="content input_box">
  199. <u--input clearable placeholder="请输入" border="surround"
  200. v-model="ite.weight"
  201. @change="weightInput($event, ite, index)"></u--input>
  202. </view>
  203. </view>
  204. <view class="item">
  205. <view class="lable rx-cc">质检状态</view>
  206. <view class="content" @click="statusClick(index, idx)">
  207. {{ qualityResults[ite.status] }}
  208. </view>
  209. </view>
  210. <view class="item">
  211. <view class="lable rx-cc">{{ curDateTypeLabel[curDateType] }}</view>
  212. <view class="content input_box">
  213. <u--input clearable placeholder="请选择" border="surround"
  214. v-model="ite[curDateType]"
  215. @click.native="typeTimeClick(index, idx)"></u--input>
  216. </view>
  217. </view>
  218. </view>
  219. </view>
  220. </u-list>
  221. </view>
  222. </view>
  223. </u-form>
  224. </uni-collapse-item>
  225. </uni-collapse>
  226. <view class="footBox">
  227. <view class="reg" @click="submit">
  228. <uni-icons custom-prefix="iconfont" size="20" color="#fff"></uni-icons>
  229. 提交
  230. </view>
  231. </view>
  232. <!-- 选择物品类型 -->
  233. <ba-tree-picker ref="treePicker" :multiple="true" @select-change="confirm" title="选择物品类型"
  234. :localdata="goodsLists" valueKey="id" textKey="name" childrenKey="child" />
  235. <!-- 选择入库时间 -->
  236. <u-datetime-picker @confirm="timeConfirm" @cancel="timeCancel" :show="timeShow" v-model="storageTime"
  237. mode="datetime"></u-datetime-picker>
  238. <!-- 选择包装单位 -->
  239. <u-picker :show="packingUnitsShow" visibleItemCount="10" :columns="currentPackingSpecificationOption"
  240. keyName="conversionUnit" @confirm="selectPackingUnitInfo" @cancel="packingUnitsShow = false"
  241. title="选择包装单位"></u-picker>
  242. <!-- 选择供应商单位 -->
  243. <u-picker :show="suppliersShow" visibleItemCount="10" :columns="currentSupplierListOption" keyName="name"
  244. @confirm="selectSuppliersInfo" @cancel="suppliersShow = false" title="选择供应商"></u-picker>
  245. <!-- 选择仓库 -->
  246. <u-picker :show="warehouseShow" visibleItemCount="10" :columns="warehouseListOption" keyName="name"
  247. @confirm="selectWarehouseInfo" @cancel="warehouseShow = false" title="选择仓库"></u-picker>
  248. <!-- 选择时间类型 -->
  249. <u-picker :show="timeTypeShow" visibleItemCount="10" :columns="timeTypeOption" keyName="name"
  250. @confirm="selectTimeTypeInfo" @cancel="timeTypeShow = false" title="选择时间类型"></u-picker>
  251. <!-- 选择生产/采购日期 -->
  252. <u-datetime-picker @confirm="typeTimeConfirm" @cancel="typeTimeShow = false" :show="typeTimeShow"
  253. v-model="currentTypeTime" mode="datetime"></u-datetime-picker>
  254. <!-- 选择质检状态 -->
  255. <u-picker :show="statusShow" visibleItemCount="10" :columns="qualityResultsOption" keyName="label"
  256. @confirm="selectStautsInfo" @cancel="statusShow = false" title="选择质检状态"></u-picker>
  257. </view>
  258. </template>
  259. <script>
  260. // import ScanCode from '@/components/ScanCode.vue'
  261. import {
  262. getTreeByGroup,
  263. contactQueryByCategoryIdsAPI,
  264. getCode,
  265. getCategoryPackageDisposition,
  266. getWarehouseList,
  267. getAssetNum,
  268. storage,
  269. qualityInspectionTwo,
  270. submitTwo
  271. } from '@/api/warehouseManagement'
  272. import {
  273. getByCode
  274. } from '@/api/pda/common'
  275. import dayjs from 'dayjs'
  276. import {
  277. sceneState
  278. } from '../common'
  279. import {
  280. post,
  281. postJ,
  282. get,
  283. getJ
  284. } from '@/utils/api.js'
  285. import WarehouseChoose from '@/components/WarehouseChoose'
  286. import {
  287. warehousingType,
  288. inputStatus,
  289. emergencyState,
  290. warehousingMaterialListTable,
  291. getDictName,
  292. materialType
  293. } from '../enum.js'
  294. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  295. // import addDetails from '@/components/addDetails'
  296. import UploadFileNew from '@/components/UploadFileNew'
  297. // import { getRuleNo } from '@/utils/utils.js'
  298. import {
  299. tableHeader
  300. } from '../common'
  301. // import dictMixins from '@/mixins/dictMixins.js'
  302. export default {
  303. components: {
  304. WarehouseChoose,
  305. baTreePicker,
  306. UploadFileNew
  307. },
  308. // mixins: [dictMixins],
  309. data() {
  310. return {
  311. goodsLists: [], // 物品类型
  312. assetTypeName: '', // 物品类型名称
  313. timeShow: false,
  314. packingSpecificationOption: [], // 包装规格
  315. currentPackingSpecificationOption: [], // 当前包装规格
  316. currentSupplierListOption: [], // 当前供货商
  317. warehouseListOption: [], // 仓库列表
  318. currentTypeTime: Number(new Date()), // 当前时间类型的时间
  319. storageTime: '', // 入库时间
  320. currentProductIndex: null, // 当前产品索引
  321. currentPackingIndex: null, // 当前包装索引
  322. packingUnitsShow: false,
  323. typeTimeShow: false,
  324. suppliersShow: false,
  325. warehouseShow: false,
  326. timeTypeShow: false,
  327. statusShow: false,
  328. dictCodeList: [], // 字典列表
  329. curDateType: 'purchaseDate',
  330. qualityResultsOption: [
  331. [{
  332. label: '合格',
  333. value: 1
  334. },
  335. {
  336. label: '不合格',
  337. value: 2
  338. }
  339. ]
  340. ], // 质检状态 0未检 1已检
  341. qualityResults: {
  342. 1: '合格',
  343. 2: '不合格'
  344. }, // 质检结果 1合格 2不合格
  345. curDateTypeLabel: {
  346. purchaseDate: '采购日期',
  347. productionDate: '生产日期'
  348. },
  349. timeTypeOption: [
  350. [{
  351. name: '采购日期',
  352. prop: 'purchaseDate'
  353. },
  354. {
  355. name: '生产日期',
  356. prop: 'productionDate'
  357. }
  358. ]
  359. ], // 时间类型
  360. collapseOpen: 'collapse1',
  361. emergencyState,
  362. warehousingType,
  363. materialType,
  364. sceneState,
  365. inputStatus,
  366. getDictName,
  367. detailOpen: false,
  368. codeOpen: false,
  369. deptList: [], //部门
  370. supplierList: [], //供应商
  371. formData: {
  372. type: 1, // 入库
  373. bizType: '', // 入库场景
  374. storageTime: '', // 入库时间
  375. extInfo: {}, // 扩展信息
  376. sourceBizNo: '', // 来源单据编号
  377. fromUser: '', // 送货人
  378. remark: '' // 备注
  379. },
  380. statusList: [{
  381. id: 1,
  382. name: '紧急'
  383. },
  384. {
  385. id: 2,
  386. name: '中等'
  387. },
  388. {
  389. id: 1,
  390. name: '普通'
  391. }
  392. ], //紧急状态
  393. pickerIndex: 0,
  394. productList: [],
  395. userList: [],
  396. rules: {
  397. assetType: {
  398. type: 'number',
  399. required: true,
  400. message: '请选择入库产品类型',
  401. trigger: ['blur', 'change']
  402. },
  403. bizType: {
  404. type: 'number',
  405. required: true,
  406. message: '请选择入库场景',
  407. trigger: ['blur', 'change']
  408. }
  409. // contentImage: {
  410. // type: 'array',
  411. // required: true,
  412. // message: '请上传附件',
  413. // trigger: ['blur', 'change']
  414. // }
  415. },
  416. settingIndex: 0
  417. }
  418. },
  419. onShow() {
  420. // const _this = this
  421. // uni.$off('scancode') // 每次进来先 移除全局自定义事件监听器
  422. // uni.$on('scancode', function (data) {
  423. // uni.navigateBack({
  424. // delta: 1
  425. // })
  426. // _this.qrContent = data.code.trim()
  427. // _this.handleScan()
  428. // })
  429. this.collapseOpen = 'collapse1'
  430. },
  431. beforeDestroy() {
  432. uni.$off('setSelectList')
  433. uni.$off('requisitionSelect')
  434. },
  435. async onLoad(options) {
  436. await this.getListItems() // 物品类型
  437. await this.getwarehouseList() // 仓库列表
  438. await this.requireDictCode() // 字典列表
  439. // this.requestDict('物品类型')
  440. // this.getDept()
  441. // this.getSupplier()
  442. const userInfo = uni.getStorageSync('userInfo')
  443. console.log()
  444. this.formData.extInfo.createUserName = userInfo.name
  445. this.formData.createUserId = userInfo.name
  446. this.storageTime = Number(new Date())
  447. this.formData.storageTime = this.formatter(this.storageTime)
  448. // this.formData.registerId = userInfo.id
  449. uni.$on('setSelectList', async data => {
  450. if (data?.length) {
  451. this.formData.sourceBizNo = ''
  452. // 获取批次号
  453. const batchNo = await getCode('lot_number_code')
  454. // 获取供应商
  455. const supplierList = await contactQueryByCategoryIdsAPI({
  456. categoryIds: data.map(item => item.id)
  457. })
  458. // 获取包装规格
  459. let packingSpecification = await getCategoryPackageDisposition({
  460. categoryIds: data.map(item => item.id)
  461. })
  462. this.packingSpecificationOption = data.map(item => {
  463. return packingSpecification.filter(ite => item.id == ite.categoryId).sort((
  464. a, b) => a.sort - b.sort)
  465. })
  466. let productList = data.map((item, index) => {
  467. // 显示规格
  468. let packingSpecificationLabel = this.packingSpecificationOption[index]
  469. .map(item => {
  470. if (item.sort > 0) {
  471. return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`
  472. }
  473. })
  474. .filter(item => !!item)
  475. return {
  476. index: this.productList.length - 1 > -1 ? this.productList[this
  477. .productList.length - 1].index + index + 1 : this.productList
  478. .length + index,
  479. categoryId: item.id, // 物品id
  480. categoryName: item.name, // 物品名称
  481. categoryCode: item.code, // 物品编码
  482. categoryModel: item.modelType, // 物品型号
  483. specification: item.specification, // 规格
  484. brandNum: item.brandNum, // 牌号
  485. batchNo: batchNo, // 批次号
  486. supplierListOptions: supplierList[item.id], // 供应商列表
  487. supplierId: '', // 供应商id
  488. supplierName: '', // 供应商名称
  489. approvalNumber: item.approvalNumber, // 批准文号
  490. packingSpecification: item.packingSpecification, // 包装规格
  491. packingSpecificationOption: this.packingSpecificationOption[
  492. index], // 包装规格选项
  493. packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
  494. minPackingQuantity: '', // 最小包装单元数量
  495. packingQuantity: '', // 包装数量
  496. packingUnit: '', // 包装单位
  497. measureQuantity: 0, // 计量数量
  498. measureUnit: item.measuringUnit, // 计量单位
  499. netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
  500. weight: 0, // 重量
  501. weightUnit: item.weightUnit, // 重量单位
  502. totalMoney: '', // 总价
  503. price: item.price, // 单价
  504. purpose: '', // 用途
  505. isUnpack: item.isUnpack, // 是否允许拆包
  506. outInDetailRecordRequestList: []
  507. }
  508. })
  509. this.productList = this.productList.concat(productList)
  510. console.log(this.productList, '------------------this.productList----111-----')
  511. setTimeout(() => {
  512. this.detailOpen = !this.detailOpen
  513. this.$refs.collapse && this.$refs.collapse.resize()
  514. }, 0)
  515. }
  516. })
  517. uni.$on('requisitionSelect', async (data, query) => {
  518. console.log(data)
  519. console.log(query)
  520. this.formData.sourceBizNo = query.sourceBizNo
  521. this.formData.bizType = query.bizType
  522. this.formData.extInfo.assetType = query.assetType.split(',')
  523. let filterArray = this.formData.extInfo.assetType.map(item => {
  524. return this.goodsLists.find(ite => ite.id == item).name
  525. })
  526. this.assetTypeName = Array.from(new Set(filterArray)).join('/')
  527. const batchNo = await getCode('lot_number_code')
  528. // 获取包装规格
  529. let packingSpecification = await getCategoryPackageDisposition({
  530. categoryIds: data.map(item => item.categoryId)
  531. })
  532. this.packingSpecificationOption = data.map(item => {
  533. return packingSpecification.filter(ite => item.categoryId == ite.categoryId)
  534. .sort((a, b) => a.sort - b.sort)
  535. })
  536. this.productList = data.map((productItem, productIndex) => {
  537. // 显示规格
  538. let packingSpecificationLabel = this.packingSpecificationOption[productIndex]
  539. .map(item => {
  540. if (item.sort > 0) {
  541. return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`
  542. }
  543. })
  544. .filter(item => !!item)
  545. return {
  546. ...productItem,
  547. index: this.productList.length + productIndex,
  548. isSave: productItem.outInDetailRecordRequestList?.length > 0 ? true :
  549. false,
  550. batchNo: batchNo, // 批次号
  551. warehouseIds: [productItem.warehouseId], // 仓库Id
  552. warehouseNames: [productItem.warehouseName], // 仓库名称
  553. packingSpecificationOption: this.packingSpecificationOption[
  554. productIndex], // 包装规格选项
  555. packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
  556. outInDetailRecordRequestList: productItem.outInDetailRecordRequestList
  557. ?.length > 0 ?
  558. productItem.outInDetailRecordRequestList.map((packingItem,
  559. packingIndex) => {
  560. return {
  561. ...packingItem,
  562. index: this.productList.length + productIndex + '-' +
  563. packingIndex, // 包装索引
  564. batchNo: batchNo, // 批次号
  565. parentIndex: this.productList.length +
  566. productIndex, // 物品索引
  567. categoryName: productItem.categoryName,
  568. categoryCode: productItem.categoryCode,
  569. materialDetailList: packingItem.materialDetailList.map((
  570. materialItem, materialIndex) => {
  571. return {
  572. ...materialItem,
  573. index: this.productList.length +
  574. productIndex + '-' + packingIndex +
  575. '——' + materialIndex, // 包装索引
  576. parentIndex: this.productList.length +
  577. productIndex + '-' +
  578. packingIndex, // 物品索引
  579. batchNo: batchNo, // 批次号
  580. categoryName: productItem.categoryName,
  581. categoryCode: productItem.categoryCode
  582. }
  583. })
  584. }
  585. }) : []
  586. }
  587. })
  588. setTimeout(() => {
  589. this.detailOpen = !this.detailOpen
  590. this.$refs.collapse && this.$refs.collapse.resize()
  591. }, 0)
  592. })
  593. // 明细信息填写
  594. uni.$on('batchNumBack', productList => {
  595. if (productList?.length) {
  596. this.productList = productList
  597. }
  598. })
  599. },
  600. mounted() {
  601. // this.getAddDetails();
  602. },
  603. computed: {
  604. tableHeader() {
  605. return tableHeader(this.formData.assetType)
  606. },
  607. materialCodeReqList() {
  608. return this.productList.map(i => i.warehouseLedgerDetails || []).flat()
  609. },
  610. isMaterial() {
  611. return this.formData.assetType == 3
  612. },
  613. warehousingName() {
  614. return []
  615. this.productList = []
  616. return this.getDictValue('物品类型', this.formData.assetType)
  617. },
  618. listRules() {
  619. return this.productList.reduce((cur, pre, index) => {
  620. return {
  621. ...cur,
  622. [`productList.${index}.batchNo`]: {
  623. type: 'string',
  624. required: true,
  625. trigger: ['blur', 'change']
  626. },
  627. [`productList.${index}.packingQuantity`]: {
  628. type: 'number',
  629. required: true,
  630. trigger: ['blur', 'change']
  631. },
  632. [`productList.${index}.packingUnit`]: {
  633. type: 'string',
  634. required: true,
  635. trigger: ['blur', 'change']
  636. },
  637. [`productList.${index}.warehouseId`]: {
  638. type: 'string',
  639. required: true,
  640. trigger: ['blur', 'change']
  641. }
  642. }
  643. }, {})
  644. }
  645. },
  646. methods: {
  647. goToScanCodeList() {
  648. uni.navigateTo({
  649. url: '/pages/warehouse/enterHouse/components/scanCodeList'
  650. })
  651. },
  652. goToRequisition() {
  653. uni.navigateTo({
  654. url: '/pages/warehouse/components/requisitionList?type=' + 1
  655. })
  656. },
  657. // 入库
  658. submit() {
  659. if (this.productList.length <= 0) {
  660. uni.showToast({
  661. icon: 'none',
  662. title: '请添加产品!'
  663. })
  664. return
  665. }
  666. let boolen = this.productList.every(item => item.isSave)
  667. if (!boolen) {
  668. uni.showToast({
  669. icon: 'none',
  670. title: '请先保存所有产品信息!'
  671. })
  672. return
  673. }
  674. uni.showLoading({
  675. title: '保存中...'
  676. })
  677. this.formData.outInDetailList = this.productList
  678. let obj = uni.$u.deepClone(this.formData)
  679. // 处理物品类型assetType
  680. obj.extInfo.assetType = obj.extInfo.assetType.join(',')
  681. // 处理仓库id
  682. let warehouseId = []
  683. let warehouseName = []
  684. let warehouseIds = this.productList.map(item => item.warehouseIds).flat()
  685. let warehouseNames = this.productList.map(item => item.warehouseNames).flat()
  686. warehouseIds.forEach((item, index) => {
  687. if (!warehouseId.includes(item)) {
  688. warehouseId.push(item)
  689. warehouseName.push(warehouseNames[index])
  690. }
  691. })
  692. obj.warehouseIds = warehouseId
  693. obj.warehouseNames = warehouseName
  694. // 是否需要审核(0审核 1跳过审核)
  695. if (obj.bizType == '12') {
  696. obj.isSkip = 1
  697. } else {
  698. obj.isSkip = 0
  699. }
  700. // obj.isSkip = 1;
  701. console.log(obj)
  702. storage(obj)
  703. .then(async res => {
  704. console.log('入库成功', res)
  705. if (res.code == 0) {
  706. try {
  707. // 委外入库(非采购)
  708. if (obj.bizType == '12') {
  709. await qualityInspectionTwo({
  710. outInId: res.data[0]
  711. })
  712. } else {
  713. await submitTwo({
  714. outInId: res.data[0]
  715. })
  716. }
  717. uni.hideLoading()
  718. uni.showToast({
  719. icon: 'none',
  720. title: '入库成功',
  721. duration: 1500
  722. })
  723. uni.navigateBack({
  724. delta: 1
  725. })
  726. } catch (error) {
  727. uni.hideLoading()
  728. console.log('提交流程失败', error)
  729. }
  730. }
  731. })
  732. .catch(err => {
  733. console.log('入库失败', err)
  734. uni.hideLoading()
  735. uni.showToast({
  736. icon: 'none',
  737. title: '入库失败',
  738. duration: 2000
  739. })
  740. })
  741. },
  742. // 重量限制
  743. weightInput(value, row, productIndex) {
  744. const newValue = value.replace(/[^\d.]/g, '') // 保留数字和小数点
  745. const decimalCount = (newValue.match(/\./g) || []).length // 计算小数点的个数
  746. if (row.weight < 0) {
  747. row.weight = 0
  748. } else if (row.weight > 9999) {
  749. row.weight = 9999
  750. } else {
  751. if (decimalCount > 1) {
  752. // 如果小数点个数大于1,移除多余的小数点
  753. const lastIndex = newValue.lastIndexOf('.')
  754. row.weight = newValue.slice(0, lastIndex) + newValue.slice(lastIndex + 1)
  755. } else if (decimalCount === 1) {
  756. // 如果小数点个数等于1,允许小数点的输入
  757. row.weight = newValue
  758. } else {
  759. row.weight = newValue === '' ? 0 : parseFloat(newValue) // 如果输入为空,则设为0
  760. }
  761. }
  762. this.packingWeightCahnge(productIndex)
  763. },
  764. // 包装重量修改
  765. packingWeightCahnge(productIndex) {
  766. // 修改物品重量
  767. let totalWeight = this.productList[productIndex].outInDetailRecordRequestList.reduce((accumulator,
  768. currentValue) => {
  769. return Number(accumulator) + Number(currentValue.weight)
  770. }, 0)
  771. this.$set(this.productList[productIndex], 'weight', totalWeight)
  772. },
  773. scrolltolower() {
  774. console.log('滑动了~~~')
  775. },
  776. typeTimeClick(index, idx) {
  777. console.log('index-----', index)
  778. console.log('idx----', idx)
  779. this.currentProductIndex = index
  780. this.currentPackingIndex = idx > -1 ? idx : -1
  781. this.typeTimeShow = true
  782. },
  783. statusClick(index, idx) {
  784. this.currentProductIndex = index
  785. this.currentPackingIndex = idx > -1 ? idx : -1
  786. this.statusShow = true
  787. },
  788. selectStautsInfo(e) {
  789. this.productList[this.currentProductIndex].outInDetailRecordRequestList[this.currentPackingIndex].status =
  790. e.value[0]?.value
  791. this.statusShow = false
  792. },
  793. typeTimeConfirm() {
  794. this.typeTimeShow = false
  795. this.$nextTick(() => {
  796. console.log(this.currentPackingIndex)
  797. if (this.currentPackingIndex > -1) {
  798. // 单独
  799. this.productList[this.currentProductIndex].outInDetailRecordRequestList[this
  800. .currentPackingIndex][this.curDateType] = this.formatter(this.currentTypeTime)
  801. } else {
  802. // 批量
  803. this.productList[this.currentProductIndex].outInDetailRecordRequestList = this.productList[
  804. this.currentProductIndex].outInDetailRecordRequestList.map(item => {
  805. console.log(this.currentTypeTime)
  806. console.log(this.formatter(this.currentTypeTime))
  807. return {
  808. ...item,
  809. [this.curDateType]: this.formatter(this.currentTypeTime)
  810. }
  811. })
  812. }
  813. })
  814. },
  815. // 物品保存验证表单(单独)
  816. validateFormIndividually(index) {
  817. return new Promise(async resolve => {
  818. console.log('index----------------', index)
  819. let fileds = [`productList.${index}.batchNo`, `productList.${index}.packingQuantity`,
  820. `productList.${index}.packingUnit`, `productList.${index}.warehouseId`
  821. ]
  822. Promise.all(
  823. fileds.map(
  824. item =>
  825. new Promise(async (res, rej) => {
  826. this.$refs.lisrFormRef.validateField(item, err => {
  827. console.log('err--', err)
  828. if (err?.length) {
  829. rej(err)
  830. } else {
  831. res(true)
  832. }
  833. })
  834. })
  835. )
  836. )
  837. .then(() => {
  838. resolve()
  839. })
  840. .catch(err => {
  841. uni.showToast({
  842. icon: 'none',
  843. title: '请填入必填项!'
  844. })
  845. })
  846. })
  847. },
  848. // 产品编辑
  849. listEdit(index) {
  850. this.currentProductIndex = index
  851. this.productList[index].isSave = false
  852. this.productList[index].outInDetailRecordRequestList = []
  853. },
  854. listSave(row, index) {
  855. console.log('index------', index)
  856. this.validateFormIndividually(index).then(async () => {
  857. console.log('通过了!!!')
  858. // 判断包装单位和计量单位是否为不拆物料层规格
  859. let packingBoolen = !!this.getDict(row.packingUnit).dictValue
  860. let measureBoolen = !!this.getDict(row.measureUnit).dictValue
  861. let packingNum = 0
  862. // 处理包装单位为KG类的情况
  863. if (packingBoolen) {
  864. let filterArr = row.packingSpecificationOption.filter(item => {
  865. return item.packageUnit == row.packingUnit && item.packageUnit != item
  866. .conversionUnit
  867. })
  868. packingNum = Math.ceil(row.packingQuantity / filterArr[0].packageCell)
  869. }
  870. // 处理包装单位不为KG类,计量单位为KG类的情况
  871. let measureNum = row.packingQuantity
  872. if (measureBoolen) {
  873. let splitIndex = row.packingSpecificationOption.findIndex(item => item
  874. .conversionUnit == row.packingUnit && item.packageUnit != item.conversionUnit)
  875. for (; splitIndex > 1; splitIndex--) {
  876. measureNum = measureNum * row.packingSpecificationOption[splitIndex].packageCell
  877. }
  878. }
  879. // 获取包装编码列表
  880. const {
  881. data
  882. } = await getAssetNum([{
  883. assetCode: row.categoryCode + row.index,
  884. batchNum: row.batchNo,
  885. num: packingBoolen ? packingNum : row.isUnpack ? (measureBoolen ?
  886. measureNum : row.measureQuantity) : row.packingQuantity
  887. }])
  888. this.generateWrappers(row, index, data)
  889. this.$set(this.productList[index], 'isSave', true)
  890. })
  891. },
  892. // 获取当前时间函数
  893. getNowDate() {
  894. let date = new Date(),
  895. obj = {
  896. year: date.getFullYear(), //获取完整的年份(4位)
  897. month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
  898. strDate: date.getDate(), // 获取当前日(1-31)
  899. hour: date.getHours(), //获取当前小时(0 ~ 23)
  900. minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
  901. second: date.getSeconds() //获取当前秒数(0 ~ 59)
  902. }
  903. Object.keys(obj).forEach(key => {
  904. if (obj[key] < 10) obj[key] = `0${obj[key]}`
  905. })
  906. return obj
  907. },
  908. // 生成包装
  909. generateWrappers(row, productIndex, packingCodeList) {
  910. console.log('是否拆包----', row.isUnpack)
  911. console.log('包装规格----', row.packingSpecificationOption)
  912. console.log('计量单位----', row.measureUnit)
  913. console.log('包装数量----', row.packingQuantity)
  914. console.log('包装编码----', packingCodeList)
  915. let obj = this.getNowDate()
  916. let productionDate = ''
  917. let purchaseDate = ''
  918. if (this.formData.bizType == '1') {
  919. // 生产入库
  920. productionDate = `${obj.year}-${obj.month}-${obj.strDate} ${obj.hour}:${obj.minute}:${obj.second}`
  921. this.curDateType = 'productionDate'
  922. } else if (this.formData.bizType == '2') {
  923. // 采购入库
  924. purchaseDate = `${obj.year}-${obj.month}-${obj.strDate} ${obj.hour}:${obj.minute}:${obj.second}`
  925. this.curDateType = 'purchaseDate'
  926. }
  927. // 判断包装单位和计量单位是否为不拆物料层规格
  928. let packingBoolen = !!this.getDict(row.packingUnit).dictValue
  929. let measureBoolen = !!this.getDict(row.measureUnit).dictValue
  930. let num = row.packingQuantity
  931. let filterArr = []
  932. // 处理包装单位为KG类的情况
  933. if (packingBoolen) {
  934. filterArr = row.packingSpecificationOption.filter(item => {
  935. return item.packageUnit == row.packingUnit && item.packageUnit != item.conversionUnit
  936. })
  937. num = Math.ceil(row.packingQuantity / filterArr[0].packageCell)
  938. } else {
  939. if (row.isUnpack) {
  940. if (measureBoolen) {
  941. // 处理包装单位不为KG类,计量单位为KG类的情况
  942. let splitIndex = row.packingSpecificationOption.findIndex(item => item.conversionUnit == row
  943. .packingUnit && item.packageUnit != item.conversionUnit)
  944. for (; splitIndex > 1; splitIndex--) {
  945. // num = this.$math.format(num * row.packingSpecificationOption[splitIndex].packageCell, 14)
  946. num = num * row.packingSpecificationOption[splitIndex].packageCell
  947. }
  948. } else {
  949. console.log(row.packingSpecificationOption)
  950. let splitIndex = row.packingSpecificationOption.findIndex(item => item.conversionUnit == row
  951. .packingUnit && item.packageUnit != item.conversionUnit)
  952. console.log(splitIndex)
  953. for (; splitIndex > 0; splitIndex--) {
  954. console.log(splitIndex)
  955. // num = this.$math.format(num * row.packingSpecificationOption[splitIndex].packageCell, 14)
  956. num = num * row.packingSpecificationOption[splitIndex].packageCell
  957. }
  958. }
  959. } else {
  960. num = row.packingQuantity
  961. }
  962. }
  963. for (let index = 0; index < num; index++) {
  964. let measureQuantity = 1
  965. // 处理包装单位为KG类,计算每桶KG值
  966. if (packingBoolen) {
  967. // console.log(this.$math.format(filterArr[0].packageCell * (index + 1), 14))
  968. console.log(filterArr[0].packageCell * (index + 1))
  969. console.log(row.packingQuantity)
  970. // measureQuantity =
  971. // Number(row.packingQuantity) > this.$math.format(filterArr[0].packageCell * (index + 1), 14)
  972. // ? filterArr[0].packageCell
  973. // : Number(row.packingQuantity) - this.$math.format(filterArr[0].packageCell * index, 14)
  974. measureQuantity = Number(row.packingQuantity) > filterArr[0].packageCell * (index + 1) ? filterArr[
  975. 0].packageCell : Number(row.packingQuantity) - filterArr[0].packageCell * index
  976. } else {
  977. if (!row.isUnpack) {
  978. if (measureBoolen) {
  979. // 处理包装单位不为KG类,计量单位为KG类的情况
  980. let splitIndex = row.packingSpecificationOption.findIndex(item => item.conversionUnit ==
  981. row.packingUnit && item.packageUnit != item.conversionUnit)
  982. for (; splitIndex > 0; splitIndex--) {
  983. // measureQuantity = this.$math.format(measureQuantity * row.packingSpecificationOption[splitIndex].packageCell, 14)
  984. measureQuantity = measureQuantity * row.packingSpecificationOption[splitIndex]
  985. .packageCell
  986. }
  987. } else {
  988. let splitIndex = row.packingSpecificationOption.findIndex(item => item.conversionUnit ==
  989. row.packingUnit && item.packageUnit != item.conversionUnit)
  990. for (; splitIndex > 0; splitIndex--) {
  991. console.log(splitIndex)
  992. // measureQuantity = this.$math.format(measureQuantity * row.packingSpecificationOption[splitIndex].packageCell, 14)
  993. measureQuantity = measureQuantity * row.packingSpecificationOption[splitIndex]
  994. .packageCell
  995. }
  996. }
  997. }
  998. }
  999. let item = {
  1000. index: row.index + '-' + index, // 包装索引
  1001. warehouseId: row.warehouseIds[0], // 仓库id
  1002. warehouseName: row.warehouseNames[0], // 仓库名称
  1003. categoryName: row.categoryName, // 产品名称
  1004. categoryCode: row.categoryCode, // 产品编码
  1005. categoryModel: row.categoryModel, // 物品型号
  1006. specification: row.specification, // 规格
  1007. brandNum: row.brandNum, // 牌号
  1008. parentIndex: row.index, // 产品索引
  1009. batchNo: row.batchNo, // 批次号
  1010. packageNo: packingCodeList[index].onlyCode, // 包装编码
  1011. packingQuantity: 1, // 包装数量
  1012. packingUnit: row.isUnpack ?
  1013. packingBoolen ?
  1014. filterArr[0].conversionUnit :
  1015. measureBoolen ?
  1016. row.packingSpecificationOption[1].conversionUnit :
  1017. row.measureUnit : packingBoolen ?
  1018. filterArr[0].conversionUnit : row.packingUnit,
  1019. measureQuantity: row.isUnpack ? (packingBoolen ? measureQuantity : measureBoolen ? row
  1020. .packingSpecificationOption[1].packageCell : measureQuantity) : measureQuantity, // 计量数量
  1021. measureUnit: row.isUnpack ? (measureBoolen ? row.packingSpecificationOption[1].packageUnit :
  1022. row.measureUnit) : row.measureUnit, // 计量单位
  1023. weight: 0, // 重量
  1024. packingSpecificationOption: row.packingSpecificationOption, // 包装规格
  1025. weightUnit: row.weightUnit, // 重量单位
  1026. netWeight: row.netWeight, // 净重
  1027. barcodes: '', // 发货条码
  1028. clientCode: '', // 客户代号
  1029. materielDesignation: '', // 物料代号
  1030. engrave: '', // 刻码
  1031. isUnpack: row.isUnpack, // 是否允许拆包
  1032. productionDate: productionDate, // 生产日期
  1033. purchaseDate: purchaseDate, // 采购时间
  1034. result: 1, // 结果(1合格 2不合格)
  1035. status: 1 // 状态(0=未质检 1已质检)
  1036. }
  1037. let outBoolen = !!this.getDict(item.measureUnit).dictValue
  1038. console.log('this.dictCodeList-------', this.dictCodeList)
  1039. console.log('item.measureUnit-------', item)
  1040. console.log('!!this.getDict(item.measureUnit).dictValue--------', this.getDict(item.measureUnit))
  1041. if (outBoolen) {
  1042. // 计量单位为KG类,直接替换
  1043. item.weight = item.measureQuantity
  1044. } else {
  1045. // 计量单位为不为KG类,重新统计计算
  1046. let inBoolen = !!this.getDict(item.packingSpecificationOption[0].packageUnit).dictValue
  1047. let startIndex = item.packingSpecificationOption.findIndex(ite => {
  1048. return item.measureUnit == ite.packingUnit && ite.packingUnit != ite.conversionUnit
  1049. })
  1050. console.log(startIndex)
  1051. let endIndex = item.packingSpecificationOption.findIndex(ite => item.packingUnit == ite
  1052. .conversionUnit)
  1053. console.log(endIndex)
  1054. let total = item.packingQuantity
  1055. for (; startIndex < endIndex; endIndex--) {
  1056. // total = this.$math.format(item.packingSpecificationOption[endIndex].packageCell * total, 14)
  1057. total = item.packingSpecificationOption[endIndex].packageCell * total
  1058. }
  1059. if (inBoolen) {
  1060. // 第二层为KG类
  1061. item.weight = total
  1062. } else {
  1063. // 第二层不为KG类
  1064. // item.weight = this.$math.format(total * item.netWeight, 14)
  1065. item.weight = total * item.netWeight
  1066. }
  1067. }
  1068. row.outInDetailRecordRequestList.push(item)
  1069. }
  1070. // // 单独点击保存并插入对应位置(包装)
  1071. // if (productIndex == 0) {
  1072. // this.packingList.splice(productIndex, 0, ...packingList)
  1073. // } else {
  1074. // let packingIndex = this.packingList.findLastIndex(item => item.parentIndex == this.productList[productIndex - 1].index)
  1075. // this.packingList.splice(packingIndex + 1, 0, ...packingList)
  1076. // }
  1077. },
  1078. async requireDictCode() {
  1079. // 不拆物料层规格列表
  1080. const res = await getByCode('material_layer')
  1081. this.dictCodeList = res.map(item => {
  1082. const arr = Object.entries(item)
  1083. return {
  1084. dictCode: arr[0][0],
  1085. dictValue: arr[0][1]
  1086. }
  1087. })
  1088. },
  1089. getDict(dictCode) {
  1090. // 不拆物料层规格列表
  1091. if (this.dictCodeList.length > 0) {
  1092. return this.dictCodeList.find(item => item.dictCode == dictCode) || {}
  1093. } else {
  1094. return {}
  1095. }
  1096. },
  1097. async computeNum(row, index, isClear) {
  1098. console.log(row)
  1099. console.log(row.packingQuantity)
  1100. console.log(row.packingUnit)
  1101. // 清空仓库(包装数量输入)
  1102. if (isClear) {
  1103. // this.$set(this.productList[index], 'warehouseId', '')
  1104. // this.$set(this.productList[index], 'warehouseName', '')
  1105. if (row.packingQuantity < 1) {
  1106. this.$set(this.productList[index], 'packingQuantity', 1)
  1107. } else if (row.packingQuantity > 9999) {
  1108. this.$set(this.productList[index], 'packingQuantity', 9999)
  1109. } else {
  1110. this.$set(this.productList[index], 'packingQuantity', row.packingQuantity.replace(
  1111. /[^\d\.{2,}]/g, ''))
  1112. }
  1113. }
  1114. if (row.packingQuantity && row.packingUnit) {
  1115. let startIndex = row.packingSpecificationOption.findIndex(ite => {
  1116. return row.measuringUnit == ite.packingUnit && ite.packingUnit != ite.conversionUnit
  1117. })
  1118. console.log(startIndex)
  1119. let endIndex = row.packingSpecificationOption.findIndex(ite => row.packingUnit == ite
  1120. .conversionUnit)
  1121. console.log(endIndex)
  1122. let total = row.packingQuantity
  1123. for (; startIndex < endIndex; endIndex--) {
  1124. total = row.packingSpecificationOption[endIndex].packageCell * total
  1125. }
  1126. row.measureQuantity = total
  1127. // 判断包装单位和计量单位是否为不拆物料层规格
  1128. console.log(this.getDict(row.packingUnit))
  1129. let packingBoolen = !!this.getDict(row.packingUnit).dictValue
  1130. let measureBoolen = !!this.getDict(row.measureUnit).dictValue
  1131. if (packingBoolen || measureBoolen) {
  1132. row.weight = total
  1133. } else {
  1134. row.weight = total * row.netWeight
  1135. }
  1136. }
  1137. },
  1138. //获取仓库
  1139. async getwarehouseList() {
  1140. let res = await getWarehouseList()
  1141. this.warehouseListOption = [res.data]
  1142. },
  1143. showWarehousePicker(index) {
  1144. this.currentProductIndex = index
  1145. this.warehouseShow = true
  1146. },
  1147. showPackingUnitPicker(data, index) {
  1148. this.currentProductIndex = index
  1149. this.currentPackingSpecificationOption = [data.packingSpecificationOption]
  1150. this.packingUnitsShow = true
  1151. },
  1152. showSupplierPicker(data, index) {
  1153. this.currentProductIndex = index
  1154. this.currentSupplierListOption = [data.supplierListOptions]
  1155. this.suppliersShow = true
  1156. },
  1157. selectPackingUnitInfo(e) {
  1158. this.productList[this.currentProductIndex].packingUnit = e.value[0]?.conversionUnit
  1159. this.computeNum(this.productList[this.currentProductIndex], this.currentProductIndex)
  1160. this.packingUnitsShow = false
  1161. },
  1162. selectSuppliersInfo(e) {
  1163. this.productList[this.currentProductIndex].supplierName = e.value[0]?.name
  1164. this.productList[this.currentProductIndex].supplierId = e.value[0]?.id
  1165. this.suppliersShow = false
  1166. },
  1167. selectWarehouseInfo(e) {
  1168. this.productList[this.currentProductIndex].warehouseName = e.value[0]?.name
  1169. this.productList[this.currentProductIndex].warehouseId = e.value[0]?.id
  1170. this.productList[this.currentProductIndex].warehouseNames = [e.value[0]?.name]
  1171. this.productList[this.currentProductIndex].warehouseIds = [e.value[0]?.id]
  1172. this.warehouseShow = false
  1173. },
  1174. selectTimeTypeInfo(e) {
  1175. this.curDateType = e.value[0]?.prop
  1176. this.timeTypeShow = false
  1177. },
  1178. sceneStateFilter(bizType) {
  1179. if (bizType) {
  1180. return this.sceneState.filter(item => item.value == bizType)[0].text
  1181. }
  1182. },
  1183. formatter(dataTime) {
  1184. return dayjs(dataTime).format('YYYY-MM-DD HH:mm:ss')
  1185. },
  1186. timeConfirm() {
  1187. this.timeShow = false
  1188. this.$nextTick(() => {
  1189. console.log(this.storageTime)
  1190. console.log(this.formatter(this.storageTime))
  1191. this.formData.storageTime = this.formatter(this.storageTime)
  1192. console.log(this.formData)
  1193. })
  1194. },
  1195. timeCancel() {
  1196. this.timeShow = false
  1197. },
  1198. openPicker() {
  1199. this.$refs.treePicker._show()
  1200. },
  1201. // 获取物品列表
  1202. async getListItems() {
  1203. this.goodsLists = await getTreeByGroup({
  1204. type: 2
  1205. })
  1206. },
  1207. confirm(data, name, allList) {
  1208. console.log('name-------', name)
  1209. this.assetTypeName = name
  1210. this.formData.extInfo.assetType = allList.map(item => item.id)
  1211. },
  1212. handleScan() {
  1213. if (this.formData.bizType !== '' && this.formData.bizType != 5) {
  1214. uni.showModal({
  1215. title: '提示',
  1216. content: '仅退还入库支持扫码,是否清除已选明细并切换至退还入库?',
  1217. success: async res => {
  1218. if (res.confirm) {
  1219. this.productList = []
  1220. this.formData.bizType = 5
  1221. this.getData()
  1222. }
  1223. }
  1224. })
  1225. return
  1226. }
  1227. this.getData()
  1228. },
  1229. // goScan () {
  1230. // uni.navigateTo({
  1231. // url: '/pages/ScanCode/ScanCode'
  1232. // })
  1233. // },
  1234. // 根据条码请求设备数据 @_@
  1235. getData() {
  1236. let par = {
  1237. barType: this.qrContent.split('@_@')[1] || 0,
  1238. qrContent: this.qrContent
  1239. }
  1240. // uni.showLoading({
  1241. // title: '加载中',
  1242. // mask: true
  1243. // })
  1244. // postJ(this.apiUrl + '/scan/getAssetInfo', par)
  1245. // .then(res => {
  1246. // let data = res.data
  1247. // console.log(data, 'qrContent')
  1248. // if (data.assetType === undefined) {
  1249. // uni.showToast({
  1250. // title: '请扫码物品码',
  1251. // icon: 'none'
  1252. // })
  1253. // return
  1254. // } else if (data.source == 2) {
  1255. // uni.showModal({
  1256. // title: '提示',
  1257. // content: '当前物品已在库',
  1258. // success: async res => {}
  1259. // })
  1260. // return
  1261. // } else if (this.warehousingName && this.formData.assetType != data.assetType) {
  1262. // uni.showToast({
  1263. // title: `当前物品不属于${this.warehousingName}分类`,
  1264. // icon: 'none'
  1265. // })
  1266. // return
  1267. // }
  1268. // this.setScanMaterial(data)
  1269. // })
  1270. // .finally(() => {
  1271. // uni.hideLoading()
  1272. // })
  1273. },
  1274. async setScanMaterial(data) {
  1275. this.formData.assetType = data.assetType
  1276. this.formData.bizType = 5
  1277. const curMap = {
  1278. assetId: 'id',
  1279. assetCode: 'informationCode', //编码
  1280. assetName: 'informationName', //名称
  1281. materialId: 'id',
  1282. materialName: 'informationName',
  1283. batchNo: '', //批次号
  1284. unit: 'measuringUnit', //单位
  1285. minPackUnit: 'packingUnit' //最小包装单位
  1286. }
  1287. let obj = {}
  1288. for (const key in curMap) {
  1289. obj[key] = (curMap[key] && data.information[curMap[key]]) || ''
  1290. }
  1291. let detailObj = uni.$u.deepClone(obj)
  1292. detailObj.onlyCode = data.assetCode
  1293. obj = {
  1294. ...data.information,
  1295. ...obj,
  1296. ...{
  1297. cargoSpaceCode: '', //货位编码
  1298. cargoSpaceId: '', //货位id
  1299. shelfId: '', //货架id
  1300. shelfCode: '', //货架名称
  1301. areaId: '', //库区id
  1302. areaName: '', //库区名称
  1303. warehouseId: '', //仓库id
  1304. warehouseName: '', //仓库名称
  1305. measurementUnit: '',
  1306. bizStatus: 1,
  1307. contentImage: []
  1308. }
  1309. }
  1310. let warehouseLedgerDetails = [detailObj]
  1311. this.productList.push(obj)
  1312. this.$set(this.productList[this.productList.length - 1], 'warehouseLedgerDetails',
  1313. warehouseLedgerDetails)
  1314. this.$set(this.productList[this.productList.length - 1], 'selfWarehouseLedgerDetails', uni.$u
  1315. .deepClone(warehouseLedgerDetails))
  1316. this.handleBatchSetting(obj, this.productList.length - 1, true)
  1317. },
  1318. calcSum(a, b, c, row) {
  1319. if ((Number.isNaN(+a) && a !== '') || (Number.isNaN(+b) && b !== '') || (Number.isNaN(+c) && c !== '')) {
  1320. return ''
  1321. }
  1322. return a * b * c + {
  1323. yuan: '元',
  1324. wanyuan: '万元'
  1325. } [row.univalenceUnit]
  1326. },
  1327. handleBatchSetting(item, index, isScan = false) {
  1328. this.settingIndex = index
  1329. uni.setStorageSync('inputData', item)
  1330. uni.setStorageSync('productList', this.productList || [])
  1331. uni.navigateTo({
  1332. url: '/pages/warehouse/enterHouse/batchNumEdit?bizType=' + this.formData.bizType +
  1333. '&assetType=' + this.formData.assetType + '&index=' + index + '&isScan=' + isScan
  1334. })
  1335. },
  1336. chooseFile(file) {
  1337. console.log(file)
  1338. this.$refs.lFile.upload({
  1339. //替换为你的上传接口地址
  1340. url: this.apiUrl + '/data/doc/add',
  1341. // 服务端接收附件的key
  1342. name: 'file',
  1343. //根据你接口需求自定义 (优先不传content-type,安卓端无法收到参数再传)
  1344. header: {
  1345. Authorization: 'bearer eyJhbGciO',
  1346. uid: '27682',
  1347. client: 'app'
  1348. }
  1349. // 限制选择附件的大小上限,默认10M
  1350. // maxSize: 20,
  1351. // 若需要在body单独添加附件名或附件大小如下方式传入组件:
  1352. // addName: '后端要的附件名称字段key,此处请勿写name的同值如(file),会覆盖name',
  1353. // addSize: '后端要的附件大小字段key'
  1354. // body参数直接写key,value,如:
  1355. // date: '2020-1-1',
  1356. // key2: 'value2',
  1357. })
  1358. },
  1359. // 抬头下拉信息保存
  1360. handlePicker(e, list, idKey, nameKey) {
  1361. console.log('e?.detail--------------', e)
  1362. if (idKey) {
  1363. this.formData[idKey] = list[e?.detail.value]?.value
  1364. }
  1365. if (nameKey) {
  1366. this.formData[nameKey] = list[e?.detail.value]?.text
  1367. }
  1368. this.$nextTick(() => {
  1369. if (idKey === 'assetType' || idKey === 'bizType') {
  1370. this.$refs.formRef.validateField(idKey)
  1371. }
  1372. console.log('this.formData.bizType---', this.formData.bizType)
  1373. })
  1374. },
  1375. // 抬头下拉信息保存
  1376. handleDictPicker(e, list, idKey, nameKey) {
  1377. if (idKey) {
  1378. this.formData[idKey] = list[e?.detail.value]?.dictCode
  1379. }
  1380. if (nameKey) {
  1381. this.formData[nameKey] = list[e?.detail.value]?.dictValue
  1382. }
  1383. this.$nextTick(() => {
  1384. if (idKey === 'assetType' || idKey === 'bizType') {
  1385. this.$refs.formRef.validateField(idKey)
  1386. }
  1387. })
  1388. },
  1389. // 明细下拉信息保存
  1390. handleListPicker(e, list, item, idKey, nameKey) {
  1391. if (idKey) {
  1392. item[idKey] = list[e.detail.value].id
  1393. }
  1394. if (nameKey) {
  1395. item[nameKey] = list[e.detail.value].name
  1396. }
  1397. },
  1398. //获取仓库信息
  1399. handleWarehouseChoose(item) {
  1400. this.$refs.warehouseChooseRef.openDefault(item, res => {
  1401. Object.assign(item, res)
  1402. })
  1403. },
  1404. //状态
  1405. getstatus(e) {
  1406. this.formData.houseType = this.statusList[e.detail.value].name
  1407. },
  1408. //上传附件
  1409. getUpFlie(res) {
  1410. console.log(res)
  1411. let arr = []
  1412. res.forEach(item => {
  1413. let obj = {
  1414. accessUrl: item.accessUrl,
  1415. docId: item.docId,
  1416. name: item.name,
  1417. size: item.size,
  1418. url: item.url,
  1419. type: 1
  1420. }
  1421. // obj.type.id = item.type.id;
  1422. // obj.type.value = item.type.name;
  1423. arr.push(obj)
  1424. })
  1425. this.formData.attaments = arr
  1426. },
  1427. //选择入库类别跳转
  1428. selectType() {
  1429. if (!this.formData.extInfo.assetType) {
  1430. uni.showToast({
  1431. title: '请选择物品类型',
  1432. icon: 'none'
  1433. })
  1434. return
  1435. }
  1436. if (!this.formData.bizType) {
  1437. uni.showToast({
  1438. title: '请选择入库场景',
  1439. icon: 'none'
  1440. })
  1441. return
  1442. }
  1443. uni.navigateTo({
  1444. url: '/pages/warehouse/enterHouse/selectEnterType?assetType=' + this.formData.extInfo.assetType
  1445. })
  1446. },
  1447. //删除
  1448. getDelete(index) {
  1449. uni.showModal({
  1450. title: '提示',
  1451. content: '是否删除当前物品',
  1452. success: res => {
  1453. if (res.confirm) {
  1454. this.productList.splice(index, 1)
  1455. }
  1456. }
  1457. })
  1458. },
  1459. deletePacking(index, idx) {
  1460. uni.showModal({
  1461. title: '提示',
  1462. content: '是否删除当前包装',
  1463. success: res => {
  1464. if (res.confirm) {
  1465. this.productList[index].outInDetailRecordRequestList.splice(idx, 1)
  1466. this.productList[index].packingQuantity = this.productList[index].packingQuantity -
  1467. 1
  1468. }
  1469. }
  1470. })
  1471. },
  1472. // 入库操作
  1473. // listEdit(row) {
  1474. // this.$set(row, 'isSave', false)
  1475. // },
  1476. // listSave(row, index) {
  1477. // const fileds = [`productList.${index}.cargoSpaceCode`, `productList.${index}.batchNum`]
  1478. // if (this.formData.bizType != 5) {
  1479. // fileds.push(...[`productList.${index}.outInNum`, `productList.${index}.measurementUnit`])
  1480. // } else if (this.productList.some(i => !i.selfWarehouseLedgerDetails?.length)) {
  1481. // uni.showToast({
  1482. // title: '请选择资产编号!',
  1483. // icon: 'none'
  1484. // })
  1485. // return
  1486. // }
  1487. // Promise.all(
  1488. // fileds.map(
  1489. // item =>
  1490. // new Promise(async (resolve, rej) => {
  1491. // this.$refs.lisrFormRef.validateField(item, err => {
  1492. // if (err?.length) {
  1493. // rej(err)
  1494. // } else {
  1495. // resolve()
  1496. // }
  1497. // })
  1498. // })
  1499. // )
  1500. // )
  1501. // .then(res => {
  1502. // this.$set(row, 'isSave', true)
  1503. // if (this.formData.bizType != 5) {
  1504. // this.createMaterialCode(row)
  1505. // } else {
  1506. // // 退还
  1507. // this.createMaterialCodeReturn(row)
  1508. // }
  1509. // })
  1510. // .catch(err => {
  1511. // uni.showToast({
  1512. // icon: 'error',
  1513. // title: '请填入必填项!'
  1514. // })
  1515. // })
  1516. // },
  1517. //入库明细删除
  1518. listDel(row, index) {
  1519. this.productList.splice(index, 1)
  1520. },
  1521. // 入库明细生成条码信息
  1522. async createMaterialCode(row) {
  1523. return
  1524. // 添加相同物品重新更新明细 原料编码
  1525. const list = this.productList.filter(i => i.assetCode === row.assetCode && i.batchNum === row
  1526. .batchNum && i.isSave)
  1527. const num = list.reduce((num, pre) => {
  1528. num += row.isUnpack ? pre.outInNum * pre.measurementUnit : pre.outInNum
  1529. return num
  1530. }, 0)
  1531. const res = await postJ(this.apiUrl + '/outInWarehouse/getAssetNum', {
  1532. batchNum: row.batchNum,
  1533. assetCode: row.assetCode,
  1534. num
  1535. })
  1536. if (res?.success) {
  1537. list.forEach(item => {
  1538. if (item.warehouseLedgerDetails?.length) {
  1539. item.warehouseLedgerDetails.forEach(i => {
  1540. i.onlyCode = res.data.shift().onlyCode
  1541. })
  1542. } else {
  1543. this.$set(
  1544. item,
  1545. 'warehouseLedgerDetails',
  1546. Array.from(new Array(item.isUnpack ? item.outInNum * item.measurementUnit :
  1547. +item.outInNum), (val, idx) => {
  1548. return {
  1549. ...item,
  1550. onlyCode: res.data.shift().onlyCode,
  1551. bizStatus: 1,
  1552. contentImage: []
  1553. }
  1554. })
  1555. )
  1556. }
  1557. })
  1558. }
  1559. // 添加相同物品,重复批次号 重新更新明细 包装编码
  1560. const batchList = this.productList.filter(i => i.batchNum === row.batchNum && i.isSave)
  1561. if (batchList.length) {
  1562. const num = batchList.reduce((num, pre) => {
  1563. num += +pre.outInNum
  1564. return num
  1565. }, 0)
  1566. const res1 = await postJ(this.apiUrl + '/outInWarehouse/getAssetNum', {
  1567. batchNum: row.batchNum,
  1568. num
  1569. })
  1570. if (res1?.success) {
  1571. batchList.forEach(item => {
  1572. let num = res1.data.shift()?.num
  1573. let measurementUnit = item.measurementUnit
  1574. if (item.warehouseLedgerDetails?.length) {
  1575. item.warehouseLedgerDetails.forEach((i, index) => {
  1576. this.$set(i, 'num', num)
  1577. if (!item.isUnpack) {
  1578. if (index < item.warehouseLedgerDetails.length - 1) {
  1579. num = res1.data.shift()?.num
  1580. }
  1581. } else {
  1582. // 拆包的包装编码一致
  1583. measurementUnit--
  1584. if (measurementUnit === 0 && index < item
  1585. .warehouseLedgerDetails.length - 1) {
  1586. measurementUnit = item.measurementUnit
  1587. num = res1.data.shift()?.num
  1588. }
  1589. }
  1590. })
  1591. }
  1592. })
  1593. }
  1594. }
  1595. },
  1596. // 入库明细生成条码信息 退还
  1597. async createMaterialCodeReturn(row) {
  1598. return
  1599. // 添加相同物品重新更新明细 原料编码
  1600. const list = this.productList.filter(i => i.batchNum === row.batchNum && i.isSave)
  1601. // 退还
  1602. const res = await postJ(this.apiUrl + '/outInWarehouse/getAssetNum', {
  1603. batchNum: row.batchNum,
  1604. num: list.reduce((num, pre) => {
  1605. num += pre.selfWarehouseLedgerDetails.length
  1606. return num
  1607. }, 0)
  1608. })
  1609. if (res?.success) {
  1610. list.forEach(item => {
  1611. const num = res.data.shift().num
  1612. if (item.warehouseLedgerDetails?.length) {
  1613. item.warehouseLedgerDetails.forEach(i => {
  1614. i.num = num
  1615. if (!item.isUnpack) {
  1616. // 拆包的包装编码一致
  1617. num = res.data.shift()?.num
  1618. }
  1619. })
  1620. } else {
  1621. this.$set(
  1622. item,
  1623. 'warehouseLedgerDetails',
  1624. item.selfWarehouseLedgerDetails.map((val, idx) => {
  1625. let obj = {
  1626. ...val,
  1627. bizStatus: 1,
  1628. batchNum: item.batchNum,
  1629. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  1630. cargoSpaceId: item.cargoSpaceId, //货位id
  1631. shelfId: item.shelfId, //货架id
  1632. shelfCode: item.shelfCode, //货架名称
  1633. areaId: item.areaId, //库区id
  1634. areaName: item.areaName, //库区名称
  1635. warehouseId: item.warehouseId, //仓库id
  1636. warehouseName: item.warehouseName, //仓库名称
  1637. num
  1638. }
  1639. if (!item.isUnpack) {
  1640. // 拆包的包装编码一致
  1641. num = res.data.shift()?.num
  1642. }
  1643. return obj
  1644. })
  1645. )
  1646. }
  1647. })
  1648. }
  1649. },
  1650. //确定提交
  1651. getsure() {
  1652. return
  1653. this.$refs.formRef.validate().then(res => {
  1654. if (!this.productList?.length) {
  1655. uni.showToast({
  1656. icon: 'error',
  1657. title: '请添加明细!'
  1658. })
  1659. return
  1660. } else if (this.productList.some(item => !item.warehouseLedgerDetails?.length)) {
  1661. uni.showToast({
  1662. icon: 'error',
  1663. title: '请完善明细信息!'
  1664. })
  1665. return
  1666. }
  1667. const params = {
  1668. outInWarehouse: {
  1669. ...this.formData,
  1670. bizStatus: 1
  1671. },
  1672. warehouseLedgerInfos: this.productList
  1673. }
  1674. postJ(this.apiUrl + '/outInWarehouse/add', params).then(res => {
  1675. if (res?.success) {
  1676. uni.showToast({
  1677. icon: 'success',
  1678. title: '保存成功'
  1679. })
  1680. setTimeout(() => {
  1681. uni.navigateBack({
  1682. delta: 1
  1683. })
  1684. }, 1500)
  1685. }
  1686. })
  1687. })
  1688. },
  1689. // 部门确认
  1690. deptConfirm(data, name) {
  1691. this.formData.deptName = name
  1692. this.formData.deptCode = data[0]
  1693. },
  1694. // 部门确认
  1695. verifyDeptConfirm(data, name) {
  1696. this.formData.verifyDeptCode = data[0]
  1697. this.formData.verifyDeptName = name
  1698. this.formData.verifyId = ''
  1699. this.formData.verifyName = ''
  1700. this.getUser(data[0])
  1701. },
  1702. // 获取部门
  1703. getDept() {
  1704. return
  1705. get(this.apiUrl + '/main/org/dept/effectiveTree').then(res => {
  1706. if (res?.success) {
  1707. this.deptList = res.data
  1708. }
  1709. })
  1710. },
  1711. // 获取供应商
  1712. getSupplier() {
  1713. // post(this.apiUrl + `/main/supplier/list?page=1&size=999`, {
  1714. // page: 1,
  1715. // size: 999
  1716. // }).then(res => {
  1717. // if (res?.success) {
  1718. // this.supplierList = res.data.items
  1719. // }
  1720. // })
  1721. },
  1722. // 获取人员
  1723. getUser(deptCode) {
  1724. // post(this.apiUrl + '/main/user/list', {
  1725. // deptCode,
  1726. // page: 1,
  1727. // size: 9999
  1728. // }).then(res => {
  1729. // if (res?.success) {
  1730. // this.userList = res.data.items.map(item => {
  1731. // item.name = item.trueName
  1732. // item.id = item.userId
  1733. // return item
  1734. // })
  1735. // }
  1736. // })
  1737. }
  1738. }
  1739. }
  1740. </script>
  1741. <style lang="scss" scoped>
  1742. .mainBox {
  1743. padding-bottom: 120rpx;
  1744. /deep/.required-form .u-form-item__body__left__content__label::before {
  1745. content: '*';
  1746. color: red;
  1747. }
  1748. }
  1749. .required-form-text {
  1750. /deep/ .u-form-item__body__right {
  1751. overflow: hidden;
  1752. .u-form-item__body__right__content {
  1753. width: 100%;
  1754. display: inline-block !important;
  1755. width: 100%;
  1756. }
  1757. }
  1758. }
  1759. .picList {
  1760. display: flex;
  1761. align-items: center;
  1762. justify-items: flex-start;
  1763. flex-wrap: wrap;
  1764. }
  1765. /deep/.baseForm {
  1766. .u-form-item__body {
  1767. padding: 4px !important;
  1768. }
  1769. .assetType_box {
  1770. padding: 12rpx 18rpx;
  1771. width: 100%;
  1772. overflow: hidden;
  1773. white-space: nowrap;
  1774. text-overflow: ellipsis;
  1775. font-size: 30rpx;
  1776. }
  1777. }
  1778. /deep/.picList .u-image {
  1779. margin-right: 10rpx;
  1780. margin-bottom: 10rpx;
  1781. }
  1782. /deep/.cLine .u-line:nth-child(1) {
  1783. border-bottom: none !important;
  1784. }
  1785. .detail-box {
  1786. position: relative;
  1787. display: flex;
  1788. justify-content: space-between;
  1789. align-items: center;
  1790. /deep/uni-button {
  1791. margin: 0 !important;
  1792. width: 180rpx;
  1793. }
  1794. .selectEnterType {
  1795. margin-left: 10rpx !important;
  1796. }
  1797. }
  1798. .footBox {
  1799. position: fixed;
  1800. left: 0px;
  1801. bottom: 0px;
  1802. height: 100rpx;
  1803. width: 100%;
  1804. display: flex;
  1805. align-items: center;
  1806. justify-content: space-between;
  1807. view {
  1808. width: 100%;
  1809. height: 100%;
  1810. text-align: center;
  1811. color: #fff;
  1812. display: flex;
  1813. align-items: center;
  1814. justify-content: center;
  1815. }
  1816. .reg {
  1817. background: $u-success-dark;
  1818. }
  1819. .add {
  1820. background: $uni-color-primary;
  1821. }
  1822. .uni-icons {
  1823. margin-right: 8rpx !important;
  1824. }
  1825. }
  1826. .listBox {
  1827. padding: 20rpx 10rpx;
  1828. border-bottom: 1px #f2f2f2 solid;
  1829. position: relative;
  1830. &.code {
  1831. .label {
  1832. width: 120rpx !important;
  1833. }
  1834. }
  1835. .listTit {
  1836. width: 100%;
  1837. display: flex;
  1838. justify-content: space-between;
  1839. align-items: center;
  1840. /deep/uni-button {
  1841. margin-right: 20rpx;
  1842. width: 100rpx;
  1843. &.assets {
  1844. width: 180rpx;
  1845. }
  1846. }
  1847. .name {
  1848. width: 50%;
  1849. margin-left: 10px;
  1850. overflow: hidden;
  1851. white-space: nowrap;
  1852. -o-text-overflow: ellipsis;
  1853. text-overflow: ellipsis;
  1854. font-size: 24rpx;
  1855. }
  1856. .btn {
  1857. display: flex;
  1858. justify-content: flex-end;
  1859. }
  1860. .weight {
  1861. width: 30%;
  1862. font-size: 24rpx;
  1863. margin-left: auto;
  1864. margin-right: 60rpx;
  1865. position: relative;
  1866. display: flex;
  1867. input {
  1868. margin-right: 10rpx;
  1869. border: 1px solid black;
  1870. width: 40%;
  1871. height: 20rpx;
  1872. }
  1873. }
  1874. .weight::after {
  1875. position: absolute;
  1876. right: -30rpx;
  1877. top: 50%;
  1878. content: '';
  1879. background: #eee;
  1880. width: 1px;
  1881. height: 28rpx;
  1882. margin-top: -14rpx;
  1883. }
  1884. }
  1885. .z_list {
  1886. height: 100% !important;
  1887. max-height: 500rpx;
  1888. .material {
  1889. margin-top: 10rpx;
  1890. .left {
  1891. width: 40rpx;
  1892. }
  1893. .zdy_check {
  1894. width: 30rpx;
  1895. height: 30rpx;
  1896. border: 2rpx solid #c8c9cc;
  1897. border-radius: 4rpx;
  1898. }
  1899. .check_active {
  1900. background: $theme-color;
  1901. border: 2rpx solid $theme-color;
  1902. /deep/ .u-icon__icon {
  1903. color: #fff !important;
  1904. }
  1905. }
  1906. .content_table {
  1907. width: 670rpx;
  1908. border: 2rpx solid $border-color;
  1909. .item {
  1910. display: flex;
  1911. border-bottom: 2rpx solid $border-color;
  1912. .lable {
  1913. width: 200rpx;
  1914. text-align: center;
  1915. background-color: #f7f9fa;
  1916. font-size: 26rpx;
  1917. border-right: 2rpx solid $border-color;
  1918. flex-shrink: 0;
  1919. }
  1920. .ww80 {
  1921. width: 80rpx;
  1922. }
  1923. .content {
  1924. width: 500rpx;
  1925. min-height: 64rpx;
  1926. font-size: 28rpx;
  1927. line-height: 28rpx;
  1928. font-style: normal;
  1929. font-weight: 400;
  1930. padding: 18rpx 8rpx;
  1931. box-sizing: border-box;
  1932. word-wrap: break-word;
  1933. flex-grow: 1 !important;
  1934. }
  1935. .input_box {
  1936. padding: 0 !important;
  1937. }
  1938. .content_num {
  1939. display: flex;
  1940. align-items: center;
  1941. padding: 0 4rpx;
  1942. /deep/ .uni-input-input {
  1943. width: 200rpx;
  1944. border: 2rpx solid #f0f8f2;
  1945. background: #f0f8f2;
  1946. color: $theme-color;
  1947. }
  1948. .unit {
  1949. padding: 0 4rpx;
  1950. font-size: 24rpx;
  1951. color: #404446;
  1952. }
  1953. }
  1954. .ww400 {
  1955. /deep/ .uni-input-input {
  1956. width: 400rpx;
  1957. }
  1958. }
  1959. .pd4 {
  1960. padding: 4rpx 8rpx;
  1961. }
  1962. &:last-child {
  1963. border-bottom: none;
  1964. }
  1965. }
  1966. .ww55 {
  1967. width: 55%;
  1968. }
  1969. .ww45 {
  1970. width: 45%;
  1971. }
  1972. .ww50 {
  1973. width: 50%;
  1974. }
  1975. .ww30 {
  1976. width: 30%;
  1977. }
  1978. .ww70 {
  1979. width: 70%;
  1980. }
  1981. .ww80 {
  1982. width: 80%;
  1983. }
  1984. .ww20 {
  1985. width: 20%;
  1986. }
  1987. .check {
  1988. width: 30rpx;
  1989. height: 30rpx;
  1990. }
  1991. .tag_box {
  1992. padding: 2rpx 10rpx;
  1993. margin-right: 12rpx;
  1994. background: #e6a23c;
  1995. font-size: 22rpx;
  1996. color: #fff;
  1997. border-radius: 4rpx;
  1998. }
  1999. }
  2000. }
  2001. }
  2002. .more {
  2003. position: absolute;
  2004. bottom: 26rpx;
  2005. right: 30rpx;
  2006. font-size: 28rpx;
  2007. color: #666;
  2008. }
  2009. }
  2010. .listCont {
  2011. display: flex;
  2012. align-items: center;
  2013. flex-wrap: wrap;
  2014. margin-top: 20rpx;
  2015. margin-left: 10rpx;
  2016. &.save {
  2017. .u-input {
  2018. border: none;
  2019. }
  2020. }
  2021. .u-input {
  2022. border: 1px solid rgb(229, 229, 229);
  2023. height: 15rpx !important;
  2024. }
  2025. .item {
  2026. width: 47%;
  2027. font-size: 28rpx;
  2028. margin-bottom: 10rpx;
  2029. margin-right: 3%;
  2030. // line-height: 45rpx;
  2031. // overflow: hidden;
  2032. // white-space: nowrap;
  2033. // text-overflow: ellipsis;
  2034. // -o-text-overflow: ellipsis;
  2035. // color: #000;
  2036. // display: flex;
  2037. /deep/.u-form-item__body {
  2038. padding: 0 !important;
  2039. }
  2040. /deep/.u-input__content__field-wrapper__field,
  2041. /deep/.u-form-item {
  2042. font-size: 28rpx !important;
  2043. }
  2044. text.label {
  2045. width: 120rpx;
  2046. display: inline-block;
  2047. text-align: right;
  2048. margin-right: 20rpx;
  2049. margin-bottom: 20rpx;
  2050. }
  2051. /deep/.uni-date__x-input {
  2052. height: 40rpx;
  2053. font-size: 28rpx;
  2054. }
  2055. /deep/.uni-date {
  2056. width: 48%;
  2057. display: inline-block;
  2058. .uni-icons {
  2059. display: none !important;
  2060. }
  2061. .uni-date-x {
  2062. padding: 0 !important;
  2063. }
  2064. }
  2065. }
  2066. .item text {
  2067. color: #666;
  2068. }
  2069. }
  2070. .selectTime {
  2071. display: flex;
  2072. justify-content: flex-end;
  2073. align-items: center;
  2074. margin-bottom: 10rpx;
  2075. .title {
  2076. flex: 1;
  2077. font-size: 30rpx;
  2078. }
  2079. .timeBox {
  2080. display: flex;
  2081. width: 500rpx;
  2082. .firstBtn {
  2083. margin-right: 10rpx;
  2084. }
  2085. }
  2086. }
  2087. .listBox:last-child {
  2088. border: none !important;
  2089. }
  2090. .textBox {
  2091. border: 1px #f2f2f2 solid;
  2092. height: 160px;
  2093. display: block;
  2094. width: auto !important;
  2095. }
  2096. .saveBtn {
  2097. width: 50%;
  2098. margin: 40rpx auto;
  2099. }
  2100. .top-css {
  2101. border-bottom: 1px solid rgb(207, 204, 204);
  2102. }
  2103. </style>