addStock.vue 66 KB

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