addStock.vue 65 KB

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