addStock.vue 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088
  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="selectType"></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. goToRequisition() {
  596. uni.navigateTo({
  597. url: '/pages/warehouse/components/requisitionList?type=' + 1
  598. })
  599. },
  600. // 入库
  601. submit() {
  602. if (this.productList.length <= 0) {
  603. uni.showToast({
  604. icon: 'none',
  605. title: '请添加产品!'
  606. })
  607. return
  608. }
  609. let boolen = this.productList.every(item => item.isSave)
  610. if (!boolen) {
  611. uni.showToast({
  612. icon: 'none',
  613. title: '请先保存所有产品信息!'
  614. })
  615. return
  616. }
  617. uni.showLoading({
  618. title: '保存中...'
  619. })
  620. this.formData.outInDetailList = this.productList
  621. let obj = uni.$u.deepClone(this.formData)
  622. // 处理物品类型assetType
  623. obj.extInfo.assetType = obj.extInfo.assetType.join(',')
  624. // 处理仓库id
  625. let warehouseId = []
  626. let warehouseName = []
  627. let warehouseIds = this.productList.map(item => item.warehouseIds).flat()
  628. let warehouseNames = this.productList.map(item => item.warehouseNames).flat()
  629. warehouseIds.forEach((item, index) => {
  630. if (!warehouseId.includes(item)) {
  631. warehouseId.push(item)
  632. warehouseName.push(warehouseNames[index])
  633. }
  634. })
  635. obj.warehouseIds = warehouseId
  636. obj.warehouseNames = warehouseName
  637. // 是否需要审核(0审核 1跳过审核)
  638. if (obj.bizType == '12') {
  639. obj.isSkip = 1
  640. } else {
  641. obj.isSkip = 0
  642. }
  643. // obj.isSkip = 1;
  644. console.log(obj)
  645. storage(obj)
  646. .then(async res => {
  647. console.log('入库成功', res)
  648. if (res.code == 0) {
  649. try {
  650. // 委外入库(非采购)
  651. if (obj.bizType == '12') {
  652. await qualityInspectionTwo({
  653. outInId: res.data[0]
  654. })
  655. } else {
  656. await submitTwo({ outInId: res.data[0] })
  657. }
  658. uni.hideLoading()
  659. uni.showToast({
  660. icon: 'none',
  661. title: '入库成功',
  662. duration: 1500
  663. })
  664. uni.navigateBack({
  665. delta: 1
  666. })
  667. } catch (error) {
  668. uni.hideLoading()
  669. console.log('提交流程失败', error)
  670. }
  671. }
  672. })
  673. .catch(err => {
  674. console.log('入库失败', err)
  675. uni.hideLoading()
  676. uni.showToast({
  677. icon: 'none',
  678. title: '入库失败',
  679. duration: 2000
  680. })
  681. })
  682. },
  683. // 重量限制
  684. weightInput(value, row, productIndex) {
  685. const newValue = value.replace(/[^\d.]/g, '') // 保留数字和小数点
  686. const decimalCount = (newValue.match(/\./g) || []).length // 计算小数点的个数
  687. if (row.weight < 0) {
  688. row.weight = 0
  689. } else if (row.weight > 9999) {
  690. row.weight = 9999
  691. } else {
  692. if (decimalCount > 1) {
  693. // 如果小数点个数大于1,移除多余的小数点
  694. const lastIndex = newValue.lastIndexOf('.')
  695. row.weight = newValue.slice(0, lastIndex) + newValue.slice(lastIndex + 1)
  696. } else if (decimalCount === 1) {
  697. // 如果小数点个数等于1,允许小数点的输入
  698. row.weight = newValue
  699. } else {
  700. row.weight = newValue === '' ? 0 : parseFloat(newValue) // 如果输入为空,则设为0
  701. }
  702. }
  703. this.packingWeightCahnge(productIndex)
  704. },
  705. // 包装重量修改
  706. packingWeightCahnge(productIndex) {
  707. // 修改物品重量
  708. let totalWeight = this.productList[productIndex].outInDetailRecordRequestList.reduce((accumulator, currentValue) => {
  709. return Number(accumulator) + Number(currentValue.weight)
  710. }, 0)
  711. this.$set(this.productList[productIndex], 'weight', totalWeight)
  712. },
  713. scrolltolower() {
  714. console.log('滑动了~~~')
  715. },
  716. typeTimeClick(index, idx) {
  717. console.log('index-----', index)
  718. console.log('idx----', idx)
  719. this.currentProductIndex = index
  720. this.currentPackingIndex = idx > -1 ? idx : -1
  721. this.typeTimeShow = true
  722. },
  723. statusClick(index, idx) {
  724. this.currentProductIndex = index
  725. this.currentPackingIndex = idx > -1 ? idx : -1
  726. this.statusShow = true
  727. },
  728. selectStautsInfo(e) {
  729. this.productList[this.currentProductIndex].outInDetailRecordRequestList[this.currentPackingIndex].status = e.value[0]?.value
  730. this.statusShow = false
  731. },
  732. typeTimeConfirm() {
  733. this.typeTimeShow = false
  734. this.$nextTick(() => {
  735. console.log(this.currentPackingIndex)
  736. if (this.currentPackingIndex > -1) {
  737. // 单独
  738. this.productList[this.currentProductIndex].outInDetailRecordRequestList[this.currentPackingIndex][this.curDateType] = this.formatter(this.currentTypeTime)
  739. } else {
  740. // 批量
  741. this.productList[this.currentProductIndex].outInDetailRecordRequestList = this.productList[this.currentProductIndex].outInDetailRecordRequestList.map(item => {
  742. console.log(this.currentTypeTime)
  743. console.log(this.formatter(this.currentTypeTime))
  744. return {
  745. ...item,
  746. [this.curDateType]: this.formatter(this.currentTypeTime)
  747. }
  748. })
  749. }
  750. })
  751. },
  752. // 物品保存验证表单(单独)
  753. validateFormIndividually(index) {
  754. return new Promise(async resolve => {
  755. console.log('index----------------', index)
  756. let fileds = [`productList.${index}.batchNo`, `productList.${index}.packingQuantity`, `productList.${index}.packingUnit`, `productList.${index}.warehouseId`]
  757. Promise.all(
  758. fileds.map(
  759. item =>
  760. new Promise(async (res, rej) => {
  761. this.$refs.lisrFormRef.validateField(item, err => {
  762. console.log('err--', err)
  763. if (err?.length) {
  764. rej(err)
  765. } else {
  766. res(true)
  767. }
  768. })
  769. })
  770. )
  771. )
  772. .then(() => {
  773. resolve()
  774. })
  775. .catch(err => {
  776. uni.showToast({
  777. icon: 'none',
  778. title: '请填入必填项!'
  779. })
  780. })
  781. })
  782. },
  783. // 产品编辑
  784. listEdit(index) {
  785. this.currentProductIndex = index
  786. this.productList[index].isSave = false
  787. this.productList[index].outInDetailRecordRequestList = []
  788. },
  789. listSave(row, index) {
  790. console.log('index------', index)
  791. this.validateFormIndividually(index).then(async () => {
  792. console.log('通过了!!!')
  793. // 判断包装单位和计量单位是否为不拆物料层规格
  794. let packingBoolen = !!this.getDict(row.packingUnit).dictValue
  795. let measureBoolen = !!this.getDict(row.measureUnit).dictValue
  796. let packingNum = 0
  797. // 处理包装单位为KG类的情况
  798. if (packingBoolen) {
  799. let filterArr = row.packingSpecificationOption.filter(item => {
  800. return item.packageUnit == row.packingUnit && item.packageUnit != item.conversionUnit
  801. })
  802. packingNum = Math.ceil(row.packingQuantity / filterArr[0].packageCell)
  803. }
  804. // 处理包装单位不为KG类,计量单位为KG类的情况
  805. let measureNum = row.packingQuantity
  806. if (measureBoolen) {
  807. let splitIndex = row.packingSpecificationOption.findIndex(item => item.conversionUnit == row.packingUnit && item.packageUnit != item.conversionUnit)
  808. for (; splitIndex > 1; splitIndex--) {
  809. measureNum = measureNum * row.packingSpecificationOption[splitIndex].packageCell
  810. }
  811. }
  812. // 获取包装编码列表
  813. const { data } = await getAssetNum([
  814. {
  815. assetCode: row.categoryCode + row.index,
  816. batchNum: row.batchNo,
  817. num: packingBoolen ? packingNum : row.isUnpack ? (measureBoolen ? measureNum : row.measureQuantity) : row.packingQuantity
  818. }
  819. ])
  820. this.generateWrappers(row, index, data)
  821. this.$set(this.productList[index], 'isSave', true)
  822. })
  823. },
  824. // 获取当前时间函数
  825. getNowDate() {
  826. let date = new Date(),
  827. obj = {
  828. year: date.getFullYear(), //获取完整的年份(4位)
  829. month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
  830. strDate: date.getDate(), // 获取当前日(1-31)
  831. hour: date.getHours(), //获取当前小时(0 ~ 23)
  832. minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
  833. second: date.getSeconds() //获取当前秒数(0 ~ 59)
  834. }
  835. Object.keys(obj).forEach(key => {
  836. if (obj[key] < 10) obj[key] = `0${obj[key]}`
  837. })
  838. return obj
  839. },
  840. // 生成包装
  841. generateWrappers(row, productIndex, packingCodeList) {
  842. console.log('是否拆包----', row.isUnpack)
  843. console.log('包装规格----', row.packingSpecificationOption)
  844. console.log('计量单位----', row.measureUnit)
  845. console.log('包装数量----', row.packingQuantity)
  846. console.log('包装编码----', packingCodeList)
  847. let obj = this.getNowDate()
  848. let productionDate = ''
  849. let purchaseDate = ''
  850. if (this.formData.bizType == '1') {
  851. // 生产入库
  852. productionDate = `${obj.year}-${obj.month}-${obj.strDate} ${obj.hour}:${obj.minute}:${obj.second}`
  853. this.curDateType = 'productionDate'
  854. } else if (this.formData.bizType == '2') {
  855. // 采购入库
  856. purchaseDate = `${obj.year}-${obj.month}-${obj.strDate} ${obj.hour}:${obj.minute}:${obj.second}`
  857. this.curDateType = 'purchaseDate'
  858. }
  859. // 判断包装单位和计量单位是否为不拆物料层规格
  860. let packingBoolen = !!this.getDict(row.packingUnit).dictValue
  861. let measureBoolen = !!this.getDict(row.measureUnit).dictValue
  862. let num = row.packingQuantity
  863. let filterArr = []
  864. // 处理包装单位为KG类的情况
  865. if (packingBoolen) {
  866. filterArr = row.packingSpecificationOption.filter(item => {
  867. return item.packageUnit == row.packingUnit && item.packageUnit != item.conversionUnit
  868. })
  869. num = Math.ceil(row.packingQuantity / filterArr[0].packageCell)
  870. } else {
  871. if (row.isUnpack) {
  872. if (measureBoolen) {
  873. // 处理包装单位不为KG类,计量单位为KG类的情况
  874. let splitIndex = row.packingSpecificationOption.findIndex(item => item.conversionUnit == row.packingUnit && item.packageUnit != item.conversionUnit)
  875. for (; splitIndex > 1; splitIndex--) {
  876. // num = this.$math.format(num * row.packingSpecificationOption[splitIndex].packageCell, 14)
  877. num = num * row.packingSpecificationOption[splitIndex].packageCell
  878. }
  879. } else {
  880. console.log(row.packingSpecificationOption)
  881. let splitIndex = row.packingSpecificationOption.findIndex(item => item.conversionUnit == row.packingUnit && item.packageUnit != item.conversionUnit)
  882. console.log(splitIndex)
  883. for (; splitIndex > 0; splitIndex--) {
  884. console.log(splitIndex)
  885. // num = this.$math.format(num * row.packingSpecificationOption[splitIndex].packageCell, 14)
  886. num = num * row.packingSpecificationOption[splitIndex].packageCell
  887. }
  888. }
  889. } else {
  890. num = row.packingQuantity
  891. }
  892. }
  893. for (let index = 0; index < num; index++) {
  894. let measureQuantity = 1
  895. // 处理包装单位为KG类,计算每桶KG值
  896. if (packingBoolen) {
  897. // console.log(this.$math.format(filterArr[0].packageCell * (index + 1), 14))
  898. console.log(filterArr[0].packageCell * (index + 1))
  899. console.log(row.packingQuantity)
  900. // measureQuantity =
  901. // Number(row.packingQuantity) > this.$math.format(filterArr[0].packageCell * (index + 1), 14)
  902. // ? filterArr[0].packageCell
  903. // : Number(row.packingQuantity) - this.$math.format(filterArr[0].packageCell * index, 14)
  904. measureQuantity = Number(row.packingQuantity) > filterArr[0].packageCell * (index + 1) ? filterArr[0].packageCell : Number(row.packingQuantity) - filterArr[0].packageCell * index
  905. } else {
  906. if (!row.isUnpack) {
  907. if (measureBoolen) {
  908. // 处理包装单位不为KG类,计量单位为KG类的情况
  909. let splitIndex = row.packingSpecificationOption.findIndex(item => item.conversionUnit == row.packingUnit && item.packageUnit != item.conversionUnit)
  910. for (; splitIndex > 0; splitIndex--) {
  911. // measureQuantity = this.$math.format(measureQuantity * row.packingSpecificationOption[splitIndex].packageCell, 14)
  912. measureQuantity = measureQuantity * row.packingSpecificationOption[splitIndex].packageCell
  913. }
  914. } else {
  915. let splitIndex = row.packingSpecificationOption.findIndex(item => item.conversionUnit == row.packingUnit && item.packageUnit != item.conversionUnit)
  916. for (; splitIndex > 0; splitIndex--) {
  917. console.log(splitIndex)
  918. // measureQuantity = this.$math.format(measureQuantity * row.packingSpecificationOption[splitIndex].packageCell, 14)
  919. measureQuantity = measureQuantity * row.packingSpecificationOption[splitIndex].packageCell
  920. }
  921. }
  922. }
  923. }
  924. let item = {
  925. index: row.index + '-' + index, // 包装索引
  926. warehouseId: row.warehouseIds[0], // 仓库id
  927. warehouseName: row.warehouseNames[0], // 仓库名称
  928. categoryName: row.categoryName, // 产品名称
  929. categoryCode: row.categoryCode, // 产品编码
  930. categoryModel: row.categoryModel, // 物品型号
  931. specification: row.specification, // 规格
  932. brandNum: row.brandNum, // 牌号
  933. parentIndex: row.index, // 产品索引
  934. batchNo: row.batchNo, // 批次号
  935. packageNo: packingCodeList[index].onlyCode, // 包装编码
  936. packingQuantity: 1, // 包装数量
  937. packingUnit: row.isUnpack
  938. ? packingBoolen
  939. ? filterArr[0].conversionUnit
  940. : measureBoolen
  941. ? row.packingSpecificationOption[1].conversionUnit
  942. : row.measureUnit
  943. : packingBoolen
  944. ? filterArr[0].conversionUnit
  945. : row.packingUnit,
  946. measureQuantity: row.isUnpack ? (packingBoolen ? measureQuantity : measureBoolen ? row.packingSpecificationOption[1].packageCell : measureQuantity) : measureQuantity, // 计量数量
  947. measureUnit: row.isUnpack ? (measureBoolen ? row.packingSpecificationOption[1].packageUnit : row.measureUnit) : row.measureUnit, // 计量单位
  948. weight: 0, // 重量
  949. packingSpecificationOption: row.packingSpecificationOption, // 包装规格
  950. weightUnit: row.weightUnit, // 重量单位
  951. netWeight: row.netWeight, // 净重
  952. barcodes: '', // 发货条码
  953. clientCode: '', // 客户代号
  954. materielDesignation: '', // 物料代号
  955. engrave: '', // 刻码
  956. isUnpack: row.isUnpack, // 是否允许拆包
  957. productionDate: productionDate, // 生产日期
  958. purchaseDate: purchaseDate, // 采购时间
  959. result: 1, // 结果(1合格 2不合格)
  960. status: 1 // 状态(0=未质检 1已质检)
  961. }
  962. let outBoolen = !!this.getDict(item.measureUnit).dictValue
  963. console.log('this.dictCodeList-------', this.dictCodeList)
  964. console.log('item.measureUnit-------', item)
  965. console.log('!!this.getDict(item.measureUnit).dictValue--------', this.getDict(item.measureUnit))
  966. if (outBoolen) {
  967. // 计量单位为KG类,直接替换
  968. item.weight = item.measureQuantity
  969. } else {
  970. // 计量单位为不为KG类,重新统计计算
  971. let inBoolen = !!this.getDict(item.packingSpecificationOption[0].packageUnit).dictValue
  972. let startIndex = item.packingSpecificationOption.findIndex(ite => {
  973. return item.measureUnit == ite.packingUnit && ite.packingUnit != ite.conversionUnit
  974. })
  975. console.log(startIndex)
  976. let endIndex = item.packingSpecificationOption.findIndex(ite => item.packingUnit == ite.conversionUnit)
  977. console.log(endIndex)
  978. let total = item.packingQuantity
  979. for (; startIndex < endIndex; endIndex--) {
  980. // total = this.$math.format(item.packingSpecificationOption[endIndex].packageCell * total, 14)
  981. total = item.packingSpecificationOption[endIndex].packageCell * total
  982. }
  983. if (inBoolen) {
  984. // 第二层为KG类
  985. item.weight = total
  986. } else {
  987. // 第二层不为KG类
  988. // item.weight = this.$math.format(total * item.netWeight, 14)
  989. item.weight = total * item.netWeight
  990. }
  991. }
  992. row.outInDetailRecordRequestList.push(item)
  993. }
  994. // // 单独点击保存并插入对应位置(包装)
  995. // if (productIndex == 0) {
  996. // this.packingList.splice(productIndex, 0, ...packingList)
  997. // } else {
  998. // let packingIndex = this.packingList.findLastIndex(item => item.parentIndex == this.productList[productIndex - 1].index)
  999. // this.packingList.splice(packingIndex + 1, 0, ...packingList)
  1000. // }
  1001. },
  1002. async requireDictCode() {
  1003. // 不拆物料层规格列表
  1004. const res = await getByCode('material_layer')
  1005. this.dictCodeList = res.map(item => {
  1006. const arr = Object.entries(item)
  1007. return {
  1008. dictCode: arr[0][0],
  1009. dictValue: arr[0][1]
  1010. }
  1011. })
  1012. },
  1013. getDict(dictCode) {
  1014. // 不拆物料层规格列表
  1015. if (this.dictCodeList.length > 0) {
  1016. return this.dictCodeList.find(item => item.dictCode == dictCode) || {}
  1017. } else {
  1018. return {}
  1019. }
  1020. },
  1021. async computeNum(row, index, isClear) {
  1022. console.log(row)
  1023. console.log(row.packingQuantity)
  1024. console.log(row.packingUnit)
  1025. // 清空仓库(包装数量输入)
  1026. if (isClear) {
  1027. // this.$set(this.productList[index], 'warehouseId', '')
  1028. // this.$set(this.productList[index], 'warehouseName', '')
  1029. if (row.packingQuantity < 1) {
  1030. this.$set(this.productList[index], 'packingQuantity', 1)
  1031. } else if (row.packingQuantity > 9999) {
  1032. this.$set(this.productList[index], 'packingQuantity', 9999)
  1033. } else {
  1034. this.$set(this.productList[index], 'packingQuantity', row.packingQuantity.replace(/[^\d\.{2,}]/g, ''))
  1035. }
  1036. }
  1037. if (row.packingQuantity && row.packingUnit) {
  1038. let startIndex = row.packingSpecificationOption.findIndex(ite => {
  1039. return row.measuringUnit == ite.packingUnit && ite.packingUnit != ite.conversionUnit
  1040. })
  1041. console.log(startIndex)
  1042. let endIndex = row.packingSpecificationOption.findIndex(ite => row.packingUnit == ite.conversionUnit)
  1043. console.log(endIndex)
  1044. let total = row.packingQuantity
  1045. for (; startIndex < endIndex; endIndex--) {
  1046. total = row.packingSpecificationOption[endIndex].packageCell * total
  1047. }
  1048. row.measureQuantity = total
  1049. // 判断包装单位和计量单位是否为不拆物料层规格
  1050. console.log(this.getDict(row.packingUnit))
  1051. let packingBoolen = !!this.getDict(row.packingUnit).dictValue
  1052. let measureBoolen = !!this.getDict(row.measureUnit).dictValue
  1053. if (packingBoolen || measureBoolen) {
  1054. row.weight = total
  1055. } else {
  1056. row.weight = total * row.netWeight
  1057. }
  1058. }
  1059. },
  1060. //获取仓库
  1061. async getwarehouseList() {
  1062. let res = await getWarehouseList()
  1063. this.warehouseListOption = [res.data]
  1064. },
  1065. showWarehousePicker(index) {
  1066. this.currentProductIndex = index
  1067. this.warehouseShow = true
  1068. },
  1069. showPackingUnitPicker(data, index) {
  1070. this.currentProductIndex = index
  1071. this.currentPackingSpecificationOption = [data.packingSpecificationOption]
  1072. this.packingUnitsShow = true
  1073. },
  1074. showSupplierPicker(data, index) {
  1075. this.currentProductIndex = index
  1076. this.currentSupplierListOption = [data.supplierListOptions]
  1077. this.suppliersShow = true
  1078. },
  1079. selectPackingUnitInfo(e) {
  1080. this.productList[this.currentProductIndex].packingUnit = e.value[0]?.conversionUnit
  1081. this.computeNum(this.productList[this.currentProductIndex], this.currentProductIndex)
  1082. this.packingUnitsShow = false
  1083. },
  1084. selectSuppliersInfo(e) {
  1085. this.productList[this.currentProductIndex].supplierName = e.value[0]?.name
  1086. this.productList[this.currentProductIndex].supplierId = e.value[0]?.id
  1087. this.suppliersShow = false
  1088. },
  1089. selectWarehouseInfo(e) {
  1090. this.productList[this.currentProductIndex].warehouseName = e.value[0]?.name
  1091. this.productList[this.currentProductIndex].warehouseId = e.value[0]?.id
  1092. this.productList[this.currentProductIndex].warehouseNames = [e.value[0]?.name]
  1093. this.productList[this.currentProductIndex].warehouseIds = [e.value[0]?.id]
  1094. this.warehouseShow = false
  1095. },
  1096. selectTimeTypeInfo(e) {
  1097. this.curDateType = e.value[0]?.prop
  1098. this.timeTypeShow = false
  1099. },
  1100. sceneStateFilter(bizType) {
  1101. if (bizType) {
  1102. return this.sceneState.filter(item => item.value == bizType)[0].text
  1103. }
  1104. },
  1105. formatter(dataTime) {
  1106. return dayjs(dataTime).format('YYYY-MM-DD HH:mm:ss')
  1107. },
  1108. timeConfirm() {
  1109. this.timeShow = false
  1110. this.$nextTick(() => {
  1111. console.log(this.storageTime)
  1112. console.log(this.formatter(this.storageTime))
  1113. this.formData.storageTime = this.formatter(this.storageTime)
  1114. console.log(this.formData)
  1115. })
  1116. },
  1117. timeCancel() {
  1118. this.timeShow = false
  1119. },
  1120. openPicker() {
  1121. this.$refs.treePicker._show()
  1122. },
  1123. // 获取物品列表
  1124. async getListItems() {
  1125. this.goodsLists = await getTreeByGroup({ type: 2 })
  1126. },
  1127. confirm(data, name, allList) {
  1128. console.log('name-------', name)
  1129. this.assetTypeName = name
  1130. this.formData.extInfo.assetType = allList.map(item => item.id)
  1131. },
  1132. handleScan() {
  1133. if (this.formData.bizType !== '' && this.formData.bizType != 5) {
  1134. uni.showModal({
  1135. title: '提示',
  1136. content: '仅退还入库支持扫码,是否清除已选明细并切换至退还入库?',
  1137. success: async res => {
  1138. if (res.confirm) {
  1139. this.productList = []
  1140. this.formData.bizType = 5
  1141. this.getData()
  1142. }
  1143. }
  1144. })
  1145. return
  1146. }
  1147. this.getData()
  1148. },
  1149. // goScan () {
  1150. // uni.navigateTo({
  1151. // url: '/pages/ScanCode/ScanCode'
  1152. // })
  1153. // },
  1154. // 根据条码请求设备数据 @_@
  1155. getData() {
  1156. let par = {
  1157. barType: this.qrContent.split('@_@')[1] || 0,
  1158. qrContent: this.qrContent
  1159. }
  1160. // uni.showLoading({
  1161. // title: '加载中',
  1162. // mask: true
  1163. // })
  1164. // postJ(this.apiUrl + '/scan/getAssetInfo', par)
  1165. // .then(res => {
  1166. // let data = res.data
  1167. // console.log(data, 'qrContent')
  1168. // if (data.assetType === undefined) {
  1169. // uni.showToast({
  1170. // title: '请扫码物品码',
  1171. // icon: 'none'
  1172. // })
  1173. // return
  1174. // } else if (data.source == 2) {
  1175. // uni.showModal({
  1176. // title: '提示',
  1177. // content: '当前物品已在库',
  1178. // success: async res => {}
  1179. // })
  1180. // return
  1181. // } else if (this.warehousingName && this.formData.assetType != data.assetType) {
  1182. // uni.showToast({
  1183. // title: `当前物品不属于${this.warehousingName}分类`,
  1184. // icon: 'none'
  1185. // })
  1186. // return
  1187. // }
  1188. // this.setScanMaterial(data)
  1189. // })
  1190. // .finally(() => {
  1191. // uni.hideLoading()
  1192. // })
  1193. },
  1194. async setScanMaterial(data) {
  1195. this.formData.assetType = data.assetType
  1196. this.formData.bizType = 5
  1197. const curMap = {
  1198. assetId: 'id',
  1199. assetCode: 'informationCode', //编码
  1200. assetName: 'informationName', //名称
  1201. materialId: 'id',
  1202. materialName: 'informationName',
  1203. batchNo: '', //批次号
  1204. unit: 'measuringUnit', //单位
  1205. minPackUnit: 'packingUnit' //最小包装单位
  1206. }
  1207. let obj = {}
  1208. for (const key in curMap) {
  1209. obj[key] = (curMap[key] && data.information[curMap[key]]) || ''
  1210. }
  1211. let detailObj = uni.$u.deepClone(obj)
  1212. detailObj.onlyCode = data.assetCode
  1213. obj = {
  1214. ...data.information,
  1215. ...obj,
  1216. ...{
  1217. cargoSpaceCode: '', //货位编码
  1218. cargoSpaceId: '', //货位id
  1219. shelfId: '', //货架id
  1220. shelfCode: '', //货架名称
  1221. areaId: '', //库区id
  1222. areaName: '', //库区名称
  1223. warehouseId: '', //仓库id
  1224. warehouseName: '', //仓库名称
  1225. measurementUnit: '',
  1226. bizStatus: 1,
  1227. contentImage: []
  1228. }
  1229. }
  1230. let warehouseLedgerDetails = [detailObj]
  1231. this.productList.push(obj)
  1232. this.$set(this.productList[this.productList.length - 1], 'warehouseLedgerDetails', warehouseLedgerDetails)
  1233. this.$set(this.productList[this.productList.length - 1], 'selfWarehouseLedgerDetails', uni.$u.deepClone(warehouseLedgerDetails))
  1234. this.handleBatchSetting(obj, this.productList.length - 1, true)
  1235. },
  1236. calcSum(a, b, c, row) {
  1237. if ((Number.isNaN(+a) && a !== '') || (Number.isNaN(+b) && b !== '') || (Number.isNaN(+c) && c !== '')) {
  1238. return ''
  1239. }
  1240. return a * b * c + { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  1241. },
  1242. handleBatchSetting(item, index, isScan = false) {
  1243. this.settingIndex = index
  1244. uni.setStorageSync('inputData', item)
  1245. uni.setStorageSync('productList', this.productList || [])
  1246. uni.navigateTo({
  1247. url: '/pages/warehouse/enterHouse/batchNumEdit?bizType=' + this.formData.bizType + '&assetType=' + this.formData.assetType + '&index=' + index + '&isScan=' + isScan
  1248. })
  1249. },
  1250. chooseFile(file) {
  1251. console.log(file)
  1252. this.$refs.lFile.upload({
  1253. //替换为你的上传接口地址
  1254. url: this.apiUrl + '/data/doc/add',
  1255. // 服务端接收附件的key
  1256. name: 'file',
  1257. //根据你接口需求自定义 (优先不传content-type,安卓端无法收到参数再传)
  1258. header: {
  1259. Authorization: 'bearer eyJhbGciO',
  1260. uid: '27682',
  1261. client: 'app'
  1262. }
  1263. // 限制选择附件的大小上限,默认10M
  1264. // maxSize: 20,
  1265. // 若需要在body单独添加附件名或附件大小如下方式传入组件:
  1266. // addName: '后端要的附件名称字段key,此处请勿写name的同值如(file),会覆盖name',
  1267. // addSize: '后端要的附件大小字段key'
  1268. // body参数直接写key,value,如:
  1269. // date: '2020-1-1',
  1270. // key2: 'value2',
  1271. })
  1272. },
  1273. // 抬头下拉信息保存
  1274. handlePicker(e, list, idKey, nameKey) {
  1275. console.log('e?.detail--------------', e)
  1276. if (idKey) {
  1277. this.formData[idKey] = list[e?.detail.value]?.value
  1278. }
  1279. if (nameKey) {
  1280. this.formData[nameKey] = list[e?.detail.value]?.text
  1281. }
  1282. this.$nextTick(() => {
  1283. if (idKey === 'assetType' || idKey === 'bizType') {
  1284. this.$refs.formRef.validateField(idKey)
  1285. }
  1286. console.log('this.formData.bizType---', this.formData.bizType)
  1287. })
  1288. },
  1289. // 抬头下拉信息保存
  1290. handleDictPicker(e, list, idKey, nameKey) {
  1291. if (idKey) {
  1292. this.formData[idKey] = list[e?.detail.value]?.dictCode
  1293. }
  1294. if (nameKey) {
  1295. this.formData[nameKey] = list[e?.detail.value]?.dictValue
  1296. }
  1297. this.$nextTick(() => {
  1298. if (idKey === 'assetType' || idKey === 'bizType') {
  1299. this.$refs.formRef.validateField(idKey)
  1300. }
  1301. })
  1302. },
  1303. // 明细下拉信息保存
  1304. handleListPicker(e, list, item, idKey, nameKey) {
  1305. if (idKey) {
  1306. item[idKey] = list[e.detail.value].id
  1307. }
  1308. if (nameKey) {
  1309. item[nameKey] = list[e.detail.value].name
  1310. }
  1311. },
  1312. //获取仓库信息
  1313. handleWarehouseChoose(item) {
  1314. this.$refs.warehouseChooseRef.openDefault(item, res => {
  1315. Object.assign(item, res)
  1316. })
  1317. },
  1318. //状态
  1319. getstatus(e) {
  1320. this.formData.houseType = this.statusList[e.detail.value].name
  1321. },
  1322. //上传附件
  1323. getUpFlie(res) {
  1324. console.log(res)
  1325. let arr = []
  1326. res.forEach(item => {
  1327. let obj = {
  1328. accessUrl: item.accessUrl,
  1329. docId: item.docId,
  1330. name: item.name,
  1331. size: item.size,
  1332. url: item.url,
  1333. type: 1
  1334. }
  1335. // obj.type.id = item.type.id;
  1336. // obj.type.value = item.type.name;
  1337. arr.push(obj)
  1338. })
  1339. this.formData.attaments = arr
  1340. },
  1341. //选择入库类别跳转
  1342. selectType() {
  1343. if (!this.formData.extInfo.assetType) {
  1344. uni.showToast({
  1345. title: '请选择物品类型',
  1346. icon: 'none'
  1347. })
  1348. return
  1349. }
  1350. if (!this.formData.bizType) {
  1351. uni.showToast({
  1352. title: '请选择入库场景',
  1353. icon: 'none'
  1354. })
  1355. return
  1356. }
  1357. uni.navigateTo({
  1358. url: '/pages/warehouse/enterHouse/selectEnterType?assetType=' + this.formData.extInfo.assetType
  1359. })
  1360. },
  1361. //删除
  1362. getDelete(index) {
  1363. uni.showModal({
  1364. title: '提示',
  1365. content: '是否删除当前物品',
  1366. success: res => {
  1367. if (res.confirm) {
  1368. this.productList.splice(index, 1)
  1369. }
  1370. }
  1371. })
  1372. },
  1373. deletePacking(index, idx) {
  1374. uni.showModal({
  1375. title: '提示',
  1376. content: '是否删除当前包装',
  1377. success: res => {
  1378. if (res.confirm) {
  1379. this.productList[index].outInDetailRecordRequestList.splice(idx, 1)
  1380. this.productList[index].packingQuantity = this.productList[index].packingQuantity - 1
  1381. }
  1382. }
  1383. })
  1384. },
  1385. // 入库操作
  1386. // listEdit(row) {
  1387. // this.$set(row, 'isSave', false)
  1388. // },
  1389. // listSave(row, index) {
  1390. // const fileds = [`productList.${index}.cargoSpaceCode`, `productList.${index}.batchNum`]
  1391. // if (this.formData.bizType != 5) {
  1392. // fileds.push(...[`productList.${index}.outInNum`, `productList.${index}.measurementUnit`])
  1393. // } else if (this.productList.some(i => !i.selfWarehouseLedgerDetails?.length)) {
  1394. // uni.showToast({
  1395. // title: '请选择资产编号!',
  1396. // icon: 'none'
  1397. // })
  1398. // return
  1399. // }
  1400. // Promise.all(
  1401. // fileds.map(
  1402. // item =>
  1403. // new Promise(async (resolve, rej) => {
  1404. // this.$refs.lisrFormRef.validateField(item, err => {
  1405. // if (err?.length) {
  1406. // rej(err)
  1407. // } else {
  1408. // resolve()
  1409. // }
  1410. // })
  1411. // })
  1412. // )
  1413. // )
  1414. // .then(res => {
  1415. // this.$set(row, 'isSave', true)
  1416. // if (this.formData.bizType != 5) {
  1417. // this.createMaterialCode(row)
  1418. // } else {
  1419. // // 退还
  1420. // this.createMaterialCodeReturn(row)
  1421. // }
  1422. // })
  1423. // .catch(err => {
  1424. // uni.showToast({
  1425. // icon: 'error',
  1426. // title: '请填入必填项!'
  1427. // })
  1428. // })
  1429. // },
  1430. //入库明细删除
  1431. listDel(row, index) {
  1432. this.productList.splice(index, 1)
  1433. },
  1434. // 入库明细生成条码信息
  1435. async createMaterialCode(row) {
  1436. return
  1437. // 添加相同物品重新更新明细 原料编码
  1438. const list = this.productList.filter(i => i.assetCode === row.assetCode && i.batchNum === row.batchNum && i.isSave)
  1439. const num = list.reduce((num, pre) => {
  1440. num += row.isUnpack ? pre.outInNum * pre.measurementUnit : pre.outInNum
  1441. return num
  1442. }, 0)
  1443. const res = await postJ(this.apiUrl + '/outInWarehouse/getAssetNum', {
  1444. batchNum: row.batchNum,
  1445. assetCode: row.assetCode,
  1446. num
  1447. })
  1448. if (res?.success) {
  1449. list.forEach(item => {
  1450. if (item.warehouseLedgerDetails?.length) {
  1451. item.warehouseLedgerDetails.forEach(i => {
  1452. i.onlyCode = res.data.shift().onlyCode
  1453. })
  1454. } else {
  1455. this.$set(
  1456. item,
  1457. 'warehouseLedgerDetails',
  1458. Array.from(new Array(item.isUnpack ? item.outInNum * item.measurementUnit : +item.outInNum), (val, idx) => {
  1459. return {
  1460. ...item,
  1461. onlyCode: res.data.shift().onlyCode,
  1462. bizStatus: 1,
  1463. contentImage: []
  1464. }
  1465. })
  1466. )
  1467. }
  1468. })
  1469. }
  1470. // 添加相同物品,重复批次号 重新更新明细 包装编码
  1471. const batchList = this.productList.filter(i => i.batchNum === row.batchNum && i.isSave)
  1472. if (batchList.length) {
  1473. const num = batchList.reduce((num, pre) => {
  1474. num += +pre.outInNum
  1475. return num
  1476. }, 0)
  1477. const res1 = await postJ(this.apiUrl + '/outInWarehouse/getAssetNum', {
  1478. batchNum: row.batchNum,
  1479. num
  1480. })
  1481. if (res1?.success) {
  1482. batchList.forEach(item => {
  1483. let num = res1.data.shift()?.num
  1484. let measurementUnit = item.measurementUnit
  1485. if (item.warehouseLedgerDetails?.length) {
  1486. item.warehouseLedgerDetails.forEach((i, index) => {
  1487. this.$set(i, 'num', num)
  1488. if (!item.isUnpack) {
  1489. if (index < item.warehouseLedgerDetails.length - 1) {
  1490. num = res1.data.shift()?.num
  1491. }
  1492. } else {
  1493. // 拆包的包装编码一致
  1494. measurementUnit--
  1495. if (measurementUnit === 0 && index < item.warehouseLedgerDetails.length - 1) {
  1496. measurementUnit = item.measurementUnit
  1497. num = res1.data.shift()?.num
  1498. }
  1499. }
  1500. })
  1501. }
  1502. })
  1503. }
  1504. }
  1505. },
  1506. // 入库明细生成条码信息 退还
  1507. async createMaterialCodeReturn(row) {
  1508. return
  1509. // 添加相同物品重新更新明细 原料编码
  1510. const list = this.productList.filter(i => i.batchNum === row.batchNum && i.isSave)
  1511. // 退还
  1512. const res = await postJ(this.apiUrl + '/outInWarehouse/getAssetNum', {
  1513. batchNum: row.batchNum,
  1514. num: list.reduce((num, pre) => {
  1515. num += pre.selfWarehouseLedgerDetails.length
  1516. return num
  1517. }, 0)
  1518. })
  1519. if (res?.success) {
  1520. list.forEach(item => {
  1521. const num = res.data.shift().num
  1522. if (item.warehouseLedgerDetails?.length) {
  1523. item.warehouseLedgerDetails.forEach(i => {
  1524. i.num = num
  1525. if (!item.isUnpack) {
  1526. // 拆包的包装编码一致
  1527. num = res.data.shift()?.num
  1528. }
  1529. })
  1530. } else {
  1531. this.$set(
  1532. item,
  1533. 'warehouseLedgerDetails',
  1534. item.selfWarehouseLedgerDetails.map((val, idx) => {
  1535. let obj = {
  1536. ...val,
  1537. bizStatus: 1,
  1538. batchNum: item.batchNum,
  1539. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  1540. cargoSpaceId: item.cargoSpaceId, //货位id
  1541. shelfId: item.shelfId, //货架id
  1542. shelfCode: item.shelfCode, //货架名称
  1543. areaId: item.areaId, //库区id
  1544. areaName: item.areaName, //库区名称
  1545. warehouseId: item.warehouseId, //仓库id
  1546. warehouseName: item.warehouseName, //仓库名称
  1547. num
  1548. }
  1549. if (!item.isUnpack) {
  1550. // 拆包的包装编码一致
  1551. num = res.data.shift()?.num
  1552. }
  1553. return obj
  1554. })
  1555. )
  1556. }
  1557. })
  1558. }
  1559. },
  1560. //确定提交
  1561. getsure() {
  1562. return
  1563. this.$refs.formRef.validate().then(res => {
  1564. if (!this.productList?.length) {
  1565. uni.showToast({
  1566. icon: 'error',
  1567. title: '请添加明细!'
  1568. })
  1569. return
  1570. } else if (this.productList.some(item => !item.warehouseLedgerDetails?.length)) {
  1571. uni.showToast({
  1572. icon: 'error',
  1573. title: '请完善明细信息!'
  1574. })
  1575. return
  1576. }
  1577. const params = {
  1578. outInWarehouse: { ...this.formData, bizStatus: 1 },
  1579. warehouseLedgerInfos: this.productList
  1580. }
  1581. postJ(this.apiUrl + '/outInWarehouse/add', params).then(res => {
  1582. if (res?.success) {
  1583. uni.showToast({
  1584. icon: 'success',
  1585. title: '保存成功'
  1586. })
  1587. setTimeout(() => {
  1588. uni.navigateBack({
  1589. delta: 1
  1590. })
  1591. }, 1500)
  1592. }
  1593. })
  1594. })
  1595. },
  1596. // 部门确认
  1597. deptConfirm(data, name) {
  1598. this.formData.deptName = name
  1599. this.formData.deptCode = data[0]
  1600. },
  1601. // 部门确认
  1602. verifyDeptConfirm(data, name) {
  1603. this.formData.verifyDeptCode = data[0]
  1604. this.formData.verifyDeptName = name
  1605. this.formData.verifyId = ''
  1606. this.formData.verifyName = ''
  1607. this.getUser(data[0])
  1608. },
  1609. // 获取部门
  1610. getDept() {
  1611. return
  1612. get(this.apiUrl + '/main/org/dept/effectiveTree').then(res => {
  1613. if (res?.success) {
  1614. this.deptList = res.data
  1615. }
  1616. })
  1617. },
  1618. // 获取供应商
  1619. getSupplier() {
  1620. // post(this.apiUrl + `/main/supplier/list?page=1&size=999`, {
  1621. // page: 1,
  1622. // size: 999
  1623. // }).then(res => {
  1624. // if (res?.success) {
  1625. // this.supplierList = res.data.items
  1626. // }
  1627. // })
  1628. },
  1629. // 获取人员
  1630. getUser(deptCode) {
  1631. // post(this.apiUrl + '/main/user/list', {
  1632. // deptCode,
  1633. // page: 1,
  1634. // size: 9999
  1635. // }).then(res => {
  1636. // if (res?.success) {
  1637. // this.userList = res.data.items.map(item => {
  1638. // item.name = item.trueName
  1639. // item.id = item.userId
  1640. // return item
  1641. // })
  1642. // }
  1643. // })
  1644. }
  1645. }
  1646. }
  1647. </script>
  1648. <style lang="scss" scoped>
  1649. .mainBox {
  1650. padding-bottom: 120rpx;
  1651. /deep/.required-form .u-form-item__body__left__content__label::before {
  1652. content: '*';
  1653. color: red;
  1654. }
  1655. }
  1656. .required-form-text {
  1657. /deep/ .u-form-item__body__right {
  1658. overflow: hidden;
  1659. .u-form-item__body__right__content {
  1660. width: 100%;
  1661. display: inline-block !important;
  1662. width: 100%;
  1663. }
  1664. }
  1665. }
  1666. .picList {
  1667. display: flex;
  1668. align-items: center;
  1669. justify-items: flex-start;
  1670. flex-wrap: wrap;
  1671. }
  1672. /deep/.baseForm {
  1673. .u-form-item__body {
  1674. padding: 0px !important;
  1675. }
  1676. .assetType_box {
  1677. padding: 12rpx 18rpx;
  1678. width: 100%;
  1679. overflow: hidden;
  1680. white-space: nowrap;
  1681. text-overflow: ellipsis;
  1682. }
  1683. }
  1684. /deep/.picList .u-image {
  1685. margin-right: 10rpx;
  1686. margin-bottom: 10rpx;
  1687. }
  1688. /deep/.cLine .u-line:nth-child(1) {
  1689. border-bottom: none !important;
  1690. }
  1691. .detail-box {
  1692. position: relative;
  1693. display: flex;
  1694. justify-content: space-between;
  1695. align-items: center;
  1696. /deep/uni-button {
  1697. margin: 0 !important;
  1698. width: 180rpx;
  1699. }
  1700. .selectEnterType {
  1701. margin-left: 10rpx !important;
  1702. }
  1703. }
  1704. .footBox {
  1705. position: fixed;
  1706. left: 0px;
  1707. bottom: 0px;
  1708. height: 100rpx;
  1709. width: 100%;
  1710. display: flex;
  1711. align-items: center;
  1712. justify-content: space-between;
  1713. view {
  1714. width: 100%;
  1715. height: 100%;
  1716. text-align: center;
  1717. color: #fff;
  1718. display: flex;
  1719. align-items: center;
  1720. justify-content: center;
  1721. }
  1722. .reg {
  1723. background: $u-success-dark;
  1724. }
  1725. .add {
  1726. background: $uni-color-primary;
  1727. }
  1728. .uni-icons {
  1729. margin-right: 8rpx !important;
  1730. }
  1731. }
  1732. .listBox {
  1733. padding: 20rpx 10rpx;
  1734. border-bottom: 1px #f2f2f2 solid;
  1735. position: relative;
  1736. &.code {
  1737. .label {
  1738. width: 120rpx !important;
  1739. }
  1740. }
  1741. .listTit {
  1742. width: 100%;
  1743. display: flex;
  1744. justify-content: space-between;
  1745. align-items: center;
  1746. /deep/uni-button {
  1747. margin-right: 20rpx;
  1748. width: 100rpx;
  1749. &.assets {
  1750. width: 180rpx;
  1751. }
  1752. }
  1753. .name {
  1754. width: 50%;
  1755. margin-left: 10px;
  1756. overflow: hidden;
  1757. white-space: nowrap;
  1758. -o-text-overflow: ellipsis;
  1759. text-overflow: ellipsis;
  1760. font-size: 30rpx;
  1761. }
  1762. .btn {
  1763. display: flex;
  1764. justify-content: flex-end;
  1765. }
  1766. .weight {
  1767. width: 30%;
  1768. font-size: 30rpx;
  1769. margin-left: auto;
  1770. margin-right: 60rpx;
  1771. position: relative;
  1772. display: flex;
  1773. input {
  1774. margin-right: 10rpx;
  1775. border: 1px solid black;
  1776. width: 40%;
  1777. height: 20rpx;
  1778. }
  1779. }
  1780. .weight::after {
  1781. position: absolute;
  1782. right: -30rpx;
  1783. top: 50%;
  1784. content: '';
  1785. background: #eee;
  1786. width: 1px;
  1787. height: 28rpx;
  1788. margin-top: -14rpx;
  1789. }
  1790. }
  1791. .z_list {
  1792. height: 100% !important;
  1793. max-height: 500rpx;
  1794. .material {
  1795. margin-top: 10rpx;
  1796. .left {
  1797. width: 40rpx;
  1798. }
  1799. .zdy_check {
  1800. width: 30rpx;
  1801. height: 30rpx;
  1802. border: 2rpx solid #c8c9cc;
  1803. border-radius: 4rpx;
  1804. }
  1805. .check_active {
  1806. background: $theme-color;
  1807. border: 2rpx solid $theme-color;
  1808. /deep/ .u-icon__icon {
  1809. color: #fff !important;
  1810. }
  1811. }
  1812. .content_table {
  1813. width: 670rpx;
  1814. border: 2rpx solid $border-color;
  1815. .item {
  1816. display: flex;
  1817. border-bottom: 2rpx solid $border-color;
  1818. .lable {
  1819. width: 200rpx;
  1820. text-align: center;
  1821. background-color: #f7f9fa;
  1822. font-size: 26rpx;
  1823. border-right: 2rpx solid $border-color;
  1824. flex-shrink: 0;
  1825. }
  1826. .ww80 {
  1827. width: 80rpx;
  1828. }
  1829. .content {
  1830. width: 500rpx;
  1831. min-height: 64rpx;
  1832. font-size: 28rpx;
  1833. line-height: 28rpx;
  1834. font-style: normal;
  1835. font-weight: 400;
  1836. padding: 18rpx 8rpx;
  1837. box-sizing: border-box;
  1838. word-wrap: break-word;
  1839. flex-grow: 1 !important;
  1840. }
  1841. .input_box {
  1842. padding: 0 !important;
  1843. }
  1844. .content_num {
  1845. display: flex;
  1846. align-items: center;
  1847. padding: 0 4rpx;
  1848. /deep/ .uni-input-input {
  1849. width: 200rpx;
  1850. border: 2rpx solid #f0f8f2;
  1851. background: #f0f8f2;
  1852. color: $theme-color;
  1853. }
  1854. .unit {
  1855. padding: 0 4rpx;
  1856. font-size: 24rpx;
  1857. color: #404446;
  1858. }
  1859. }
  1860. .ww400 {
  1861. /deep/ .uni-input-input {
  1862. width: 400rpx;
  1863. }
  1864. }
  1865. .pd4 {
  1866. padding: 4rpx 8rpx;
  1867. }
  1868. &:last-child {
  1869. border-bottom: none;
  1870. }
  1871. }
  1872. .ww55 {
  1873. width: 55%;
  1874. }
  1875. .ww45 {
  1876. width: 45%;
  1877. }
  1878. .ww50 {
  1879. width: 50%;
  1880. }
  1881. .ww30 {
  1882. width: 30%;
  1883. }
  1884. .ww70 {
  1885. width: 70%;
  1886. }
  1887. .ww80 {
  1888. width: 80%;
  1889. }
  1890. .ww20 {
  1891. width: 20%;
  1892. }
  1893. .check {
  1894. width: 30rpx;
  1895. height: 30rpx;
  1896. }
  1897. .tag_box {
  1898. padding: 2rpx 10rpx;
  1899. margin-right: 12rpx;
  1900. background: #e6a23c;
  1901. font-size: 22rpx;
  1902. color: #fff;
  1903. border-radius: 4rpx;
  1904. }
  1905. }
  1906. }
  1907. }
  1908. .more {
  1909. position: absolute;
  1910. bottom: 26rpx;
  1911. right: 30rpx;
  1912. font-size: 28rpx;
  1913. color: #666;
  1914. }
  1915. }
  1916. .listCont {
  1917. display: flex;
  1918. align-items: center;
  1919. flex-wrap: wrap;
  1920. margin-top: 20rpx;
  1921. margin-left: 10rpx;
  1922. &.save {
  1923. .u-input {
  1924. border: none;
  1925. }
  1926. }
  1927. .u-input {
  1928. border: 1px solid rgb(229, 229, 229);
  1929. height: 15rpx !important;
  1930. }
  1931. .item {
  1932. width: 47%;
  1933. font-size: 28rpx;
  1934. margin-bottom: 10rpx;
  1935. margin-right: 3%;
  1936. // line-height: 45rpx;
  1937. // overflow: hidden;
  1938. // white-space: nowrap;
  1939. // text-overflow: ellipsis;
  1940. // -o-text-overflow: ellipsis;
  1941. // color: #000;
  1942. // display: flex;
  1943. /deep/.u-form-item__body {
  1944. padding: 0 !important;
  1945. }
  1946. /deep/.u-input__content__field-wrapper__field,
  1947. /deep/.u-form-item {
  1948. font-size: 28rpx !important;
  1949. }
  1950. text.label {
  1951. width: 120rpx;
  1952. display: inline-block;
  1953. text-align: right;
  1954. margin-right: 20rpx;
  1955. margin-bottom: 20rpx;
  1956. }
  1957. /deep/.uni-date__x-input {
  1958. height: 40rpx;
  1959. font-size: 28rpx;
  1960. }
  1961. /deep/.uni-date {
  1962. width: 48%;
  1963. display: inline-block;
  1964. .uni-icons {
  1965. display: none !important;
  1966. }
  1967. .uni-date-x {
  1968. padding: 0 !important;
  1969. }
  1970. }
  1971. }
  1972. .item text {
  1973. color: #666;
  1974. }
  1975. }
  1976. .selectTime {
  1977. display: flex;
  1978. justify-content: flex-end;
  1979. align-items: center;
  1980. margin-bottom: 10rpx;
  1981. .title {
  1982. flex: 1;
  1983. font-size: 30rpx;
  1984. }
  1985. .timeBox {
  1986. display: flex;
  1987. width: 500rpx;
  1988. .firstBtn {
  1989. margin-right: 10rpx;
  1990. }
  1991. }
  1992. }
  1993. .listBox:last-child {
  1994. border: none !important;
  1995. }
  1996. .textBox {
  1997. border: 1px #f2f2f2 solid;
  1998. height: 160px;
  1999. display: block;
  2000. width: auto !important;
  2001. }
  2002. .saveBtn {
  2003. width: 50%;
  2004. margin: 40rpx auto;
  2005. }
  2006. .top-css {
  2007. border-bottom: 1px solid rgb(207, 204, 204);
  2008. }
  2009. </style>