add.vue 96 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <header-title title="基本信息"></header-title>
  5. <el-form
  6. :model="formData"
  7. ref="formName"
  8. label-width="110px"
  9. :rules="rules"
  10. >
  11. <el-row :gutter="20">
  12. <!-- <el-col :span="8">
  13. <el-form-item label="入库单号" prop="bizNum">
  14. <el-input :value="formData.bizNum" disabled /></el-form-item
  15. ></el-col> -->
  16. <!-- <el-col :span="8">
  17. <el-form-item label="仓库" prop="warehouseId">
  18. <el-select
  19. filterable
  20. v-model="formData.warehouseId"
  21. clearable
  22. :disabled="
  23. !!(warehousingMaterialList && warehousingMaterialList.length)
  24. "
  25. >
  26. <el-option
  27. v-for="(item, index) in warehouseList"
  28. :key="index"
  29. :label="item.name"
  30. :value="item.id"
  31. @click.native="warehouse = item"
  32. ></el-option>
  33. </el-select>
  34. </el-form-item>
  35. </el-col> -->
  36. <el-col :span="8">
  37. <el-form-item label="物品类型" prop="extInfo.assetType">
  38. <!-- <DictSelection
  39. dictName="类型用途"
  40. :disabled="
  41. !!(warehousingMaterialList && warehousingMaterialList.length)
  42. "
  43. clearable
  44. v-model="formData.extInfo.assetType"
  45. @itemChange="handleChange"
  46. /> -->
  47. <!-- <el-select
  48. :disabled="
  49. !!(warehousingMaterialList && warehousingMaterialList.length)
  50. "
  51. clearable
  52. v-model="formData.extInfo.assetType"
  53. @change="handleChanges"
  54. >
  55. <el-option
  56. v-for="(item, index) in codeList"
  57. :key="index"
  58. :label="item.dictValue"
  59. :value="item.dictCode"
  60. ></el-option>
  61. </el-select> -->
  62. <selectTree
  63. ref="tree"
  64. class="form-ipt"
  65. size="medium"
  66. style="width: 100%"
  67. clearable
  68. :options="codeList"
  69. :props="{
  70. value: 'id',
  71. label: 'name',
  72. children: 'children'
  73. }"
  74. @getValue="codeListValue"
  75. :isAll="false"
  76. />
  77. </el-form-item>
  78. </el-col>
  79. <el-col :span="8">
  80. <el-form-item label="入库类型" prop="bizType">
  81. <el-select
  82. @change="onClear"
  83. filterable
  84. placeholder="请选择"
  85. v-model="formData.bizType"
  86. clearable
  87. :disabled="
  88. !!(warehousingMaterialList && warehousingMaterialList.length)
  89. "
  90. >
  91. <el-option
  92. v-for="item in sceneState"
  93. :key="item.code"
  94. :value="item.code + ''"
  95. :label="item.label"
  96. ></el-option>
  97. </el-select> </el-form-item
  98. ></el-col>
  99. <el-col :span="8">
  100. <el-form-item
  101. v-if="formData.bizType == 2"
  102. label="采购收货单"
  103. prop="documentSource"
  104. >
  105. <el-input
  106. placeholder="请输入"
  107. v-model="formData.extInfo.documentSource"
  108. @click.native="handlePicker()"
  109. >
  110. <el-button
  111. slot="append"
  112. icon="el-icon-circle-close"
  113. @click.stop="onClear"
  114. ></el-button>
  115. </el-input>
  116. </el-form-item>
  117. <el-form-item
  118. v-if="formData.bizType == 1"
  119. label="生产工单"
  120. prop="documentSource"
  121. >
  122. <el-input
  123. placeholder="请输入"
  124. clearable
  125. v-model="formData.extInfo.documentSource"
  126. /></el-form-item>
  127. <el-form-item
  128. v-if="
  129. formData.bizType != 1 &&
  130. formData.bizType != 2 &&
  131. formData.bizType != 3
  132. "
  133. label="销售订单"
  134. prop="documentSource"
  135. >
  136. <el-input
  137. placeholder="请输入"
  138. clearable
  139. v-model="formData.extInfo.documentSource"
  140. /></el-form-item>
  141. <el-form-item
  142. v-if="formData.bizType == 3"
  143. label="出库单"
  144. prop="documentSource"
  145. >
  146. <el-input
  147. placeholder="请输入"
  148. clearable
  149. v-model="formData.extInfo.documentSource"
  150. /></el-form-item>
  151. </el-col>
  152. <el-col :span="8">
  153. <el-form-item label="权属部门" prop="deptName">
  154. <el-input
  155. placeholder="权属部门"
  156. disabled
  157. v-model="formData.extInfo.deptName"
  158. clearable
  159. />
  160. </el-form-item>
  161. </el-col>
  162. <el-col :span="8">
  163. <el-form-item label="入库登记人">
  164. <el-input
  165. placeholder="登记人"
  166. disabled
  167. v-model="formData.extInfo.createUserName"
  168. clearable /></el-form-item
  169. ></el-col>
  170. <!-- <el-col :span="8">
  171. <el-form-item label="入库时间" prop="outInTime">
  172. <el-date-picker
  173. v-model="formData.outInTime"
  174. clearable
  175. type="datetime"
  176. value-format="yyyy-MM-dd HH:mm:ss"
  177. placeholder="选择日期"
  178. >
  179. </el-date-picker></el-form-item
  180. ></el-col> -->
  181. <el-col :span="8" v-if="formData.bizType == 2">
  182. <el-form-item label="供应商" prop="supplierName">
  183. <!-- <DictSelection
  184. dictName="经销商列表"
  185. clearable
  186. v-model="formData.extInfo.supplierId"
  187. @itemChange="ChangeSupplier"
  188. /> -->
  189. <el-input
  190. placeholder="请输入"
  191. clearable
  192. v-model="formData.extInfo.supplierName"
  193. />
  194. </el-form-item>
  195. </el-col>
  196. <!-- <el-col :span="8" v-if="formData.bizType == 2">
  197. <el-form-item label="物料代号" prop="supplierCode">
  198. <el-input
  199. placeholder="请输入"
  200. v-model="formData.supplierCode"
  201. clearable /></el-form-item
  202. ></el-col> -->
  203. <!-- <el-col :span="8" v-if="formData.bizType == 2">
  204. <el-form-item label="客户" prop="clientName">
  205. <el-input
  206. placeholder="请输入"
  207. clearable
  208. v-model="formData.clientName"
  209. />
  210. </el-form-item>
  211. </el-col> -->
  212. <!-- <el-col :span="8" v-if="formData.bizType == 2">
  213. <el-form-item label="客户代号" prop="clientCode">
  214. <el-input
  215. placeholder="请输入"
  216. v-model="formData.clientCode"
  217. clearable /></el-form-item
  218. ></el-col> -->
  219. <!-- <el-col :span="8">
  220. <el-form-item label="送货人" prop="fromUser">
  221. <el-input
  222. placeholder="请输入"
  223. v-model="formData.fromUser"
  224. clearable /></el-form-item
  225. ></el-col> -->
  226. <el-col :span="8">
  227. <el-form-item label="送货人" prop="fromUser">
  228. <el-input
  229. placeholder="请输入"
  230. v-model="formData.fromUser"
  231. clearable
  232. />
  233. <!-- <el-select
  234. v-model="formData.fromUser"
  235. filterable
  236. placeholder="请选择送货人"
  237. >
  238. <el-option
  239. v-for="item in contactList"
  240. :key="item.id"
  241. :label="item.linkName"
  242. :value="item.id"
  243. @click.native="
  244. () => (formData.extInfo.deliveryPhone = item.mobilePhone)
  245. "
  246. >
  247. </el-option>
  248. </el-select> -->
  249. </el-form-item></el-col
  250. >
  251. <el-col :span="8">
  252. <el-form-item label="送货人联系方式" prop="deliveryPhone">
  253. <el-input
  254. placeholder="请输入"
  255. v-model="formData.extInfo.deliveryPhone"
  256. clearable /></el-form-item
  257. ></el-col>
  258. <!-- <el-col :span="8">
  259. <el-form-item label="紧急状态" prop="urgent">
  260. <el-select
  261. filterable
  262. placeholder="请选择"
  263. v-model="formData.extInfo.urgent"
  264. clearable
  265. >
  266. <el-option
  267. v-for="item in emergencyState"
  268. :key="item.code"
  269. :value="item.code"
  270. :label="item.label"
  271. ></el-option>
  272. </el-select> </el-form-item
  273. ></el-col> -->
  274. <!-- <el-col :span="8">
  275. <el-form-item label="审核人部门" prop="verifyDeptName">
  276. <selectTree
  277. ref="tree"
  278. class="form-ipt"
  279. size="medium"
  280. style="width: 100%"
  281. clearable
  282. :options="treeList"
  283. :props="{
  284. value: 'code',
  285. label: 'name',
  286. children: 'children'
  287. }"
  288. @getValue="auditorDeptClick"
  289. />
  290. </el-form-item>
  291. </el-col>
  292. <el-col :span="8">
  293. <el-form-item label="审核人" prop="verifyId">
  294. <el-select
  295. filterable
  296. class="form-ipt"
  297. style="width: 100%"
  298. v-model="formData.verifyId"
  299. placeholder="请选择"
  300. >
  301. <el-option
  302. v-for="item in staffList"
  303. :key="item.id"
  304. :label="item.name"
  305. :value="item.id"
  306. @click.native="changeVerfy(item)"
  307. >
  308. </el-option>
  309. </el-select>
  310. </el-form-item>
  311. </el-col> -->
  312. <!-- <el-col :span="24">
  313. <el-form-item label="附件" prop="contentImage">
  314. <selectUpload @getImgs="upload" :initData="uploadList" />
  315. </el-form-item>
  316. </el-col> -->
  317. <el-col :span="24">
  318. <el-form-item label="备注" prop="remark">
  319. <el-input
  320. v-model="formData.remark"
  321. clearable
  322. type="textarea"
  323. placeholder="请详细说明"
  324. :rows="4"
  325. ></el-input>
  326. </el-form-item>
  327. </el-col>
  328. </el-row>
  329. </el-form>
  330. <div class="material">
  331. <header-title title="产品信息">
  332. <el-button type="primary" @click="addStock">添加</el-button>
  333. </header-title>
  334. <div class="mt10 form-table">
  335. <el-form
  336. ref="warehousingMaterialListRef"
  337. :model="{ warehousingMaterialList: warehousingMaterialList }"
  338. :show-message="false"
  339. >
  340. <el-button
  341. v-if="warehousingMaterialList.length != 0"
  342. type="success"
  343. plain
  344. style="margin-bottom: 20px; float: right; margin-right: 20px"
  345. size="mini"
  346. @click="listSaveArrs"
  347. >批量保存</el-button
  348. >
  349. <el-table
  350. v-if="isWeight"
  351. :header-cell-style="rowClass"
  352. :max-height="300"
  353. ref="warehousingMaterialListTable"
  354. :key="formData.extInfo.assetType"
  355. :data="warehousingMaterialList"
  356. tooltip-effect="dark"
  357. style="width: 100%"
  358. stripe
  359. >
  360. <el-table-column
  361. label="序号"
  362. type="index"
  363. width="50"
  364. align="center"
  365. >
  366. </el-table-column>
  367. <el-table-column
  368. label="编码"
  369. prop="assetCode"
  370. align="center"
  371. width="130"
  372. :show-overflow-tooltip="true"
  373. ></el-table-column>
  374. <el-table-column
  375. label="名称"
  376. align="center"
  377. width="200"
  378. prop="assetName"
  379. :show-overflow-tooltip="true"
  380. ></el-table-column>
  381. <!-- <el-table-column
  382. label="客户编码"
  383. align="center"
  384. width="150"
  385. prop="customCode"
  386. v-if="formData.bizType == 1"
  387. >
  388. <template slot-scope="{ row, $index }">
  389. <template v-if="row.isSave">
  390. {{ row.customCode }}
  391. </template>
  392. <el-form-item
  393. v-else
  394. :prop="`warehousingMaterialList.${$index}.customCode`"
  395. required
  396. >
  397. <el-input v-model="row.customCode"> </el-input>
  398. </el-form-item>
  399. </template>
  400. </el-table-column>
  401. <el-table-column
  402. label="供应商编码"
  403. align="center"
  404. width="150"
  405. prop="customCode"
  406. v-if="formData.bizType == 2"
  407. >
  408. <template slot-scope="{ row, $index }">
  409. <template v-if="row.isSave">
  410. {{ row.supplierCode }}
  411. </template>
  412. <el-form-item
  413. v-else
  414. :prop="`warehousingMaterialList.${$index}.supplierCode`"
  415. required
  416. >
  417. <el-input v-model="row.supplierCode"> </el-input>
  418. </el-form-item>
  419. </template>
  420. </el-table-column> -->
  421. <el-table-column
  422. v-for="(item, index) in tableHeader"
  423. :key="index"
  424. align="center"
  425. :label="item.label"
  426. :width="item.width"
  427. :prop="item.prop"
  428. :show-overflow-tooltip="true"
  429. >
  430. <template slot-scope="{ row }">
  431. <template v-if="item.formatter">{{
  432. item.formatter(row)
  433. }}</template>
  434. <template v-else>{{ row[item.prop] }}</template>
  435. </template>
  436. </el-table-column>
  437. <el-table-column label="批号" width="100" prop="manualBatchNo">
  438. <template slot-scope="{ row, $index }">
  439. <template v-if="row.isSave">
  440. {{ row.manualBatchNo }}
  441. </template>
  442. <el-form-item v-else>
  443. <el-input
  444. :ref="'manualBatchNo' + $index"
  445. @keyup.native="
  446. moveFocus($event, $index, 'manualBatchNo', '产品', row)
  447. "
  448. v-model="row.manualBatchNo"
  449. >
  450. </el-input>
  451. </el-form-item>
  452. </template>
  453. </el-table-column>
  454. <el-table-column
  455. label="批次号"
  456. prop="batchNo"
  457. width="70"
  458. align="center"
  459. >
  460. <template slot-scope="{ row, $index }">
  461. <template v-if="row.isSave">
  462. {{ row.batchNo }}
  463. </template>
  464. <el-form-item
  465. v-else
  466. :prop="`warehousingMaterialList.${$index}.batchNo`"
  467. required
  468. >
  469. <!-- <el-input v-model="row.batchNo"></el-input> -->
  470. {{ row.batchNo }}
  471. </el-form-item>
  472. </template>
  473. </el-table-column>
  474. <el-table-column
  475. label="最小包装单元"
  476. align="center"
  477. prop="minPackingCount"
  478. width="100"
  479. >
  480. <el-table-column label="" prop="minPackingCount" width="100">
  481. <template slot-scope="{ row, $index }">
  482. <template v-if="row.isSave">
  483. {{ row.minPackingCount }}
  484. </template>
  485. <el-form-item
  486. v-else
  487. :prop="`warehousingMaterialList.${$index}.minPackingCount`"
  488. required
  489. >
  490. <el-input
  491. :ref="'minPackingCount' + $index"
  492. @keyup.native="
  493. moveFocus(
  494. $event,
  495. $index,
  496. 'minPackingCount',
  497. '产品',
  498. row
  499. )
  500. "
  501. type="number"
  502. v-model="row.minPackingCount"
  503. @input="minPackingCountChange(row, $event)"
  504. >
  505. </el-input>
  506. </el-form-item>
  507. </template>
  508. </el-table-column>
  509. <el-table-column label="" prop="minPackingCount">
  510. <template slot-scope="{ row, $index }">
  511. {{ handleRowUnit(row) }} /{{ row.minPackUnit }}
  512. </template>
  513. </el-table-column>
  514. </el-table-column>
  515. <el-table-column
  516. label="包装数量"
  517. prop="outInNum"
  518. width="150"
  519. align="center"
  520. >
  521. <template slot-scope="{ row, $index }">
  522. <template v-if="row.isSave || formData.bizType == 5">
  523. {{ row.outInNum }} {{ row.minPackUnit }}
  524. </template>
  525. <el-form-item
  526. v-else
  527. :prop="`warehousingMaterialList.${$index}.outInNum`"
  528. required
  529. >
  530. <el-input
  531. :ref="'outInNum' + $index"
  532. @keyup.native="
  533. moveFocus($event, $index, 'outInNum', '产品', row)
  534. "
  535. v-model="row.outInNum"
  536. @input="packNum(row, $event)"
  537. >
  538. <template slot="append">
  539. {{ row.minPackUnit ? row.minPackUnit : '/' }}
  540. </template>
  541. </el-input>
  542. </el-form-item>
  543. </template>
  544. </el-table-column>
  545. <el-table-column label="计量数量" prop="counts">
  546. <template slot-scope="{ row, $index }">
  547. {{ $math.format(row.minPackingCount * row.outInNum, 14) }}
  548. </template>
  549. </el-table-column>
  550. <el-table-column
  551. label="计量单位"
  552. prop="batchNo"
  553. width="100"
  554. align="center"
  555. >
  556. <!-- v-if="formData.extInfo.assetType == 1" -->
  557. <template slot-scope="{ row, $index }">
  558. <template>
  559. {{ row.measuringUnit }}
  560. </template>
  561. </template>
  562. </el-table-column>
  563. <!-- <el-table-column
  564. label="计量单位"
  565. prop="batchNo"
  566. width="100"
  567. align="center"
  568. v-if="formData.extInfo.assetType == 4"
  569. >
  570. <template slot-scope="{ row, $index }">
  571. <template>
  572. {{ row.measuringUnit }}
  573. </template>
  574. </template>
  575. </el-table-column> -->
  576. <!-- <el-table-column
  577. label="数量"
  578. prop="batchNo"
  579. width="150"
  580. align="center"
  581. v-if="formData.extInfo.assetType == 1"
  582. >
  583. <template slot-scope="{ row, $index }">
  584. <template> {{ row.outInNum }} </template>
  585. </template>
  586. </el-table-column>
  587. <el-table-column
  588. label="数量"
  589. prop="batchNo"
  590. width="150"
  591. align="center"
  592. v-if="formData.extInfo.assetType == 4"
  593. >
  594. <template slot-scope="{ row, $index }">
  595. <template>
  596. {{ row.minPackingCount * row.outInNum }}
  597. </template>
  598. </template>
  599. </el-table-column> -->
  600. <el-table-column
  601. label="重量"
  602. align="center"
  603. prop="contentImage"
  604. :show-overflow-tooltip="true"
  605. >
  606. <!-- v-if="formData.extInfo.assetType == 1" -->
  607. <template slot-scope="{ row, $index }">
  608. {{ row.weight }}
  609. <template slot="append">
  610. {{ handleRowUnit(row) }}
  611. <!-- {{
  612. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  613. }} -->
  614. </template>
  615. </template>
  616. </el-table-column>
  617. <!-- <el-table-column
  618. label="重量"
  619. align="center"
  620. prop="contentImage"
  621. :show-overflow-tooltip="true"
  622. v-if="formData.extInfo.assetType == 4"
  623. >
  624. <template slot-scope="{ row, $index }">
  625. {{
  626. deviceWeight(
  627. row.roughWeight,
  628. row.minPackingCount * row.outInNum
  629. )
  630. }}
  631. <template slot="append"> -->
  632. <!-- {{ handleRowUnit(row) }} -->
  633. <!-- {{
  634. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  635. }} -->
  636. <!-- </template>
  637. </template>
  638. </el-table-column> -->
  639. <el-table-column
  640. label="重量单位"
  641. align="center"
  642. prop="contentImage"
  643. :show-overflow-tooltip="true"
  644. >
  645. <template slot-scope="{ row, $index }">
  646. {{ row.weightUnit }}
  647. <template slot="append"> </template>
  648. </template>
  649. </el-table-column>
  650. <el-table-column
  651. label="单价"
  652. prop="univalence"
  653. width="150"
  654. align="center"
  655. >
  656. <template slot-scope="{ row, $index }">
  657. <!-- <template v-if="row.isSave || formData.bizType == 5">
  658. <template v-if="row.univalence || row.univalence === 0">
  659. {{ row.univalence
  660. }}{{
  661. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  662. }}
  663. </template>
  664. </template> -->
  665. <!-- v-else -->
  666. <el-form-item
  667. :prop="`warehousingMaterialList.${$index}.univalence`"
  668. >
  669. <el-input
  670. :ref="'univalence' + $index"
  671. @keyup.native="
  672. moveFocus($event, $index, 'univalence', '产品', row)
  673. "
  674. v-model="row.univalence"
  675. placeholder="非必填"
  676. @input="
  677. (value) =>
  678. (row.univalence = value.replace(/[^0-9.]+/g, ''))
  679. "
  680. >
  681. <template slot="append">
  682. 元/{{ handleRowUnit(row) }}
  683. <!-- {{
  684. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  685. }} -->
  686. </template>
  687. </el-input>
  688. </el-form-item>
  689. </template>
  690. </el-table-column>
  691. <el-table-column
  692. label="金额"
  693. align="center"
  694. prop="contentImage"
  695. :show-overflow-tooltip="true"
  696. >
  697. <template slot-scope="{ row, $index }">
  698. {{
  699. calcSumTotal(
  700. row.outInNum,
  701. row.minPackingCount,
  702. row.univalence,
  703. row
  704. )
  705. }}
  706. </template>
  707. </el-table-column>
  708. <el-table-column
  709. label="货位"
  710. prop="warehouseName"
  711. :show-overflow-tooltip="true"
  712. width="250"
  713. required
  714. >
  715. <template slot-scope="{ row, $index }">
  716. <el-form-item
  717. :prop="`warehousingMaterialList.${$index}.houseList`"
  718. :required="true"
  719. >
  720. <div @click="handleWareHouse(row, $index)">
  721. <div
  722. style="color: #ff4949"
  723. v-if="row.houseList.length == 0"
  724. >
  725. ---(必填)
  726. </div>
  727. <div v-else>
  728. <div
  729. class="fontOmitted"
  730. v-for="(item, index) in row.houseList"
  731. :key="index"
  732. >
  733. {{ item.warehouseName }}- {{ item.areaName }}-
  734. {{ item.shelfCode }}- {{ item.cargoSpaceCode
  735. }}<span style="color: #ff4949" v-if="item.num">
  736. - {{ item.num }}(数)</span
  737. >
  738. <br />
  739. </div>
  740. </div>
  741. </div>
  742. </el-form-item>
  743. </template>
  744. </el-table-column>
  745. <el-table-column
  746. label="质检单"
  747. v-if="formData.extInfo.assetType === 3"
  748. prop="contentImage"
  749. :show-overflow-tooltip="true"
  750. >
  751. <template slot-scope="{ row, $index }">
  752. <upload @on-success="(data) => (row.contentImage = [data])"
  753. ><template slot="placeholder">上传</template></upload
  754. >
  755. </template>
  756. </el-table-column>
  757. <el-table-column
  758. label="操作"
  759. width="200"
  760. fixed="right"
  761. align="center"
  762. >
  763. <template slot="header" slot-scope="scope"> 操作 </template>
  764. <template slot-scope="{ row, $index }">
  765. <el-button
  766. type="text"
  767. v-show="!row.isSave"
  768. @click="listSave(row, $index)"
  769. >保存</el-button
  770. >
  771. <el-button
  772. type="text"
  773. v-show="row.isSave"
  774. @click="listEdit(row, $index)"
  775. >编辑</el-button
  776. >
  777. <el-button
  778. type="text"
  779. v-if="formData.bizType == 5"
  780. v-show="!row.isSave"
  781. @click="chooseAssets(row, $index)"
  782. >选择资产编号</el-button
  783. >
  784. <el-button type="text" @click="listDel(row, $index)"
  785. >删除</el-button
  786. >
  787. </template>
  788. </el-table-column>
  789. </el-table>
  790. </el-form>
  791. </div>
  792. <div class="mt20">
  793. <header-title :title="`包装明细`">
  794. <div class="switch_right">
  795. <span v-if="materialCodeReqList.length != 0">
  796. 分拆<el-switch
  797. v-model="isSplit"
  798. active-color="#13ce66"
  799. inactive-color="#ff4949"
  800. @change="handleIsDetail"
  801. style="margin-left: 10px"
  802. >
  803. </el-switch>
  804. </span>
  805. <el-button
  806. style="margin-left: 20px"
  807. type="text"
  808. @click="dateSetting"
  809. v-if="!isSplit && formData.bizType != 5"
  810. >批量设置{{
  811. curDateType === 'manufactureTime' ? '生产日期' : '采购日期'
  812. }}</el-button
  813. >
  814. </div>
  815. </header-title>
  816. <el-button
  817. v-if="materialCodeReqList.length != 0"
  818. type="success"
  819. plain
  820. style="margin-bottom: 20px; float: right; margin-right: 20px"
  821. size="mini"
  822. @click="wrapListSave"
  823. >批量保存</el-button
  824. >
  825. <el-table
  826. v-if="showMaterialTable"
  827. ref="materialCodeReqListTable"
  828. :data="materialCodeReqList"
  829. tooltip-effect="dark"
  830. :key="formData.bizType"
  831. :header-cell-style="rowClass"
  832. style="width: 100%"
  833. stripe
  834. :max-height="300"
  835. @selection-change="handleSelectionChange"
  836. >
  837. <el-table-column
  838. v-if="formData.bizType != 5"
  839. type="selection"
  840. align="center"
  841. width="50"
  842. fixed="left"
  843. >
  844. </el-table-column>
  845. <el-table-column label="序号" type="index" width="50">
  846. </el-table-column>
  847. <el-table-column
  848. label="编码"
  849. prop="assetCode"
  850. width="130"
  851. :show-overflow-tooltip="true"
  852. ></el-table-column>
  853. <el-table-column
  854. label="名称"
  855. prop="assetName"
  856. width="150"
  857. :show-overflow-tooltip="true"
  858. ></el-table-column>
  859. <el-table-column
  860. label="批号"
  861. prop="manualBatchNo"
  862. width="100"
  863. ></el-table-column>
  864. <el-table-column
  865. label="批次号"
  866. prop="batchNo"
  867. width="70"
  868. ></el-table-column>
  869. <el-table-column
  870. :label="`包装编码`"
  871. prop="onlyCode"
  872. width="200"
  873. :show-overflow-tooltip="true"
  874. ></el-table-column>
  875. <el-table-column
  876. label="包装数量"
  877. prop="packingCount"
  878. width="80"
  879. ></el-table-column>
  880. <el-table-column
  881. label="包装单位"
  882. prop="packingUnit"
  883. ></el-table-column>
  884. <el-table-column
  885. label="计量数量"
  886. prop="minPackingCount"
  887. ></el-table-column>
  888. <el-table-column
  889. label="计量单位"
  890. prop="measuringUnit"
  891. ></el-table-column>
  892. <el-table-column label="物料代号" prop="materielCode" width="130">
  893. <template slot-scope="{ row, $index }">
  894. <el-input
  895. v-if="!row.isPack"
  896. :ref="'materielCode' + $index"
  897. @keyup.native="
  898. moveFocus($event, $index, 'materielCode', '包装', row)
  899. "
  900. v-model="row.materielCode"
  901. ></el-input>
  902. <span v-else>{{ row.materielCode }}</span>
  903. </template>
  904. </el-table-column>
  905. <el-table-column label="客户代号" prop="clientCode">
  906. <template slot-scope="{ row, $index }">
  907. <el-input
  908. v-if="!row.isPack"
  909. :ref="'clientCode' + $index"
  910. @keyup.native="
  911. moveFocus($event, $index, 'clientCode', '包装', row)
  912. "
  913. v-model="row.clientCode"
  914. ></el-input>
  915. <span v-else> {{ row.clientCode }}</span>
  916. </template>
  917. </el-table-column>
  918. <el-table-column label="刻码" prop="engrave">
  919. <template slot-scope="{ row, $index }">
  920. <el-input
  921. v-if="!row.isPack"
  922. :ref="'engrave' + $index"
  923. @keyup.native="
  924. moveFocus($event, $index, 'engrave', '包装', row)
  925. "
  926. v-model="row.engrave"
  927. ></el-input>
  928. <span v-else>{{ row.engrave }}</span>
  929. </template>
  930. </el-table-column>
  931. <el-table-column label="重量" prop="weight" width="100">
  932. <template slot-scope="{ row, $index }">
  933. <el-input
  934. v-if="!row.isPack && row.measuringUnit != row.weightUtil"
  935. :ref="'weight' + $index"
  936. @keyup.native="
  937. moveFocus($event, $index, 'weight', '包装', row)
  938. "
  939. v-model="row.weight"
  940. @input="weightInput($event, row)"
  941. ></el-input>
  942. <span v-else>{{ row.weight }}</span>
  943. </template>
  944. </el-table-column>
  945. <el-table-column label="重量单位" prop="weightUtil">
  946. <template slot-scope="{ row }">
  947. {{ row.weightUtil }}
  948. </template>
  949. </el-table-column>
  950. <el-table-column label="质检结果" prop="result" width="120">
  951. <template slot-scope="{ row }">
  952. <DictSelection
  953. v-if="!row.isPack"
  954. @updateVal="changeWrapStatus($event, row)"
  955. dictName="质检结果"
  956. clearable
  957. v-model="row.result"
  958. />
  959. <span v-else>{{ qualityResults[row.result] }}</span>
  960. </template>
  961. </el-table-column>
  962. <el-table-column label="质检状态" prop="status" width="120">
  963. <template slot-scope="{ row }">
  964. <!-- <DictSelection
  965. dictName="质检状态"
  966. clearable
  967. v-model="row.status"
  968. ></DictSelection> -->
  969. <span>{{ qualityStatus[row.status] }}</span>
  970. </template>
  971. </el-table-column>
  972. <el-table-column
  973. v-if="formData.bizType != 5"
  974. label="生产日期"
  975. prop=""
  976. width="220"
  977. >
  978. <template slot="header" slot-scope="scope">
  979. <el-select :disabled="isSplit" filterable v-model="curDateType">
  980. <el-option
  981. value="manufactureTime"
  982. label="生产日期"
  983. ></el-option>
  984. <el-option
  985. value="procurementTime"
  986. label="采购日期"
  987. ></el-option>
  988. </el-select>
  989. </template>
  990. <template slot-scope="{ row }">
  991. <template v-if="formData.bizType == 5">
  992. {{ row[curDateType] }}
  993. </template>
  994. <el-date-picker
  995. v-else
  996. :disabled="row.isPack"
  997. size="small"
  998. v-model="row[curDateType]"
  999. type="datetime"
  1000. value-format="yyyy-MM-dd HH:mm:ss"
  1001. placeholder="选择日期"
  1002. >
  1003. </el-date-picker>
  1004. </template>
  1005. </el-table-column>
  1006. <template v-else>
  1007. <el-table-column
  1008. label="生产日期"
  1009. prop="manufactureTime"
  1010. width="200"
  1011. ></el-table-column>
  1012. <el-table-column
  1013. label="采购日期"
  1014. prop="procurementTime"
  1015. width="200"
  1016. ></el-table-column>
  1017. </template>
  1018. <el-table-column
  1019. v-if="!isSplit"
  1020. label="操作"
  1021. width="80"
  1022. fixed="right"
  1023. >
  1024. <template slot-scope="{ row }">
  1025. <el-button type="text" @click="packCout(row)">
  1026. {{ !row.isPack ? '保存' : '编辑' }}
  1027. </el-button>
  1028. </template>
  1029. </el-table-column>
  1030. </el-table>
  1031. <!-- </el-tab-pane>
  1032. </el-tabs> -->
  1033. </div>
  1034. <div class="mt20" v-if="isSplit">
  1035. <header-title :title="`物料明细`"> </header-title>
  1036. <el-button
  1037. v-if="resultArray.length != 0"
  1038. type="success"
  1039. plain
  1040. style="margin-bottom: 20px; float: right; margin-right: 20px"
  1041. size="mini"
  1042. @click="materialListSave"
  1043. >批量保存</el-button
  1044. >
  1045. <el-table
  1046. ref="resultArrayTable"
  1047. :data="resultArray"
  1048. tooltip-effect="dark"
  1049. :key="formData.bizType"
  1050. :header-cell-style="rowClass"
  1051. style="width: 100%"
  1052. stripe
  1053. :max-height="300"
  1054. @selection-change="handleSelectionChange"
  1055. >
  1056. <el-table-column label="序号" type="index" width="50">
  1057. </el-table-column>
  1058. <el-table-column
  1059. label="编码"
  1060. width="150"
  1061. prop="assetCode"
  1062. :show-overflow-tooltip="true"
  1063. ></el-table-column>
  1064. <el-table-column
  1065. label="名称"
  1066. prop="assetName"
  1067. width="200"
  1068. :show-overflow-tooltip="true"
  1069. ></el-table-column>
  1070. <el-table-column
  1071. label="批号"
  1072. prop="manualBatchNo"
  1073. width="100"
  1074. ></el-table-column>
  1075. <el-table-column
  1076. label="批次号"
  1077. prop="batchNo"
  1078. width="80"
  1079. ></el-table-column>
  1080. <el-table-column
  1081. label="物料编码"
  1082. prop="no"
  1083. width="200"
  1084. :show-overflow-tooltip="true"
  1085. ></el-table-column>
  1086. <el-table-column
  1087. label="计量数量"
  1088. prop="minPackingCount"
  1089. width="90"
  1090. ></el-table-column>
  1091. <el-table-column
  1092. width="80"
  1093. label="计量单位"
  1094. prop="measuringUnit"
  1095. ></el-table-column>
  1096. <el-table-column label="物料代号" prop="materielCode" width="130">
  1097. <template slot-scope="{ row, $index }">
  1098. <el-input
  1099. v-if="!row.isPack"
  1100. :ref="'materielCode' + $index"
  1101. @keyup.native="
  1102. moveFocus($event, $index, 'materielCode', '物料', row)
  1103. "
  1104. v-model="row.materielCode"
  1105. ></el-input>
  1106. <span v-else>{{ row.materielCode }}</span>
  1107. </template>
  1108. </el-table-column>
  1109. <el-table-column label="客户代号" prop="clientCode">
  1110. <template slot-scope="{ row, $index }">
  1111. <el-input
  1112. v-if="!row.isPack"
  1113. :ref="'clientCode' + $index"
  1114. @keyup.native="
  1115. moveFocus($event, $index, 'clientCode', '物料', row)
  1116. "
  1117. v-model="row.clientCode"
  1118. ></el-input>
  1119. <span v-else>{{ row.clientCode }}</span>
  1120. </template>
  1121. </el-table-column>
  1122. <el-table-column label="刻码" prop="engrave">
  1123. <template slot-scope="{ row, $index }">
  1124. <el-input
  1125. v-if="!row.isPack"
  1126. :ref="'engrave' + $index"
  1127. @keyup.native="
  1128. moveFocus($event, $index, 'engrave', '物料', row)
  1129. "
  1130. v-model="row.engrave"
  1131. ></el-input>
  1132. <span v-else>{{ row.engrave }}</span>
  1133. </template>
  1134. </el-table-column>
  1135. <el-table-column label="重量" prop="weight" width="100">
  1136. <template slot-scope="{ row, $index }">
  1137. <el-input
  1138. v-if="!row.isPack && row.measuringUnit != row.weightUnit"
  1139. :ref="'weight' + $index"
  1140. @keyup.native="
  1141. moveFocus($event, $index, 'weight', '物料', row)
  1142. "
  1143. v-model="row.weight"
  1144. ></el-input>
  1145. <span v-else>{{ row.weight }}</span>
  1146. </template>
  1147. </el-table-column>
  1148. <el-table-column
  1149. label="重量单位"
  1150. prop="weightUnit"
  1151. width="100"
  1152. ></el-table-column>
  1153. <el-table-column label="质检结果" prop="result" width="120">
  1154. <template slot-scope="{ row }">
  1155. <DictSelection
  1156. v-if="!row.isPack"
  1157. @updateVal="changeWrapStatus($event, row)"
  1158. dictName="质检结果"
  1159. clearable
  1160. v-model="row.result"
  1161. />
  1162. <span v-else>{{ qualityResults[row.result] }}</span>
  1163. </template>
  1164. </el-table-column>
  1165. <el-table-column label="质检状态" prop="status" width="120">
  1166. <template slot-scope="{ row }">
  1167. <span>{{ qualityStatus[row.status] }}</span>
  1168. </template>
  1169. </el-table-column>
  1170. <el-table-column label="操作" width="80" fixed="right">
  1171. <template slot-scope="{ row }">
  1172. <el-button type="text" @click="materialBtn(row)">
  1173. {{ !row.isPack ? '保存' : '编辑' }}
  1174. </el-button>
  1175. </template>
  1176. </el-table-column>
  1177. </el-table>
  1178. </div>
  1179. </div>
  1180. <div class="center mt20">
  1181. <el-button type="primary" @click="handleSave" :loading="saveLoading"
  1182. >保存</el-button
  1183. >
  1184. <el-button @click="$router.go(-1)">返回</el-button>
  1185. </div>
  1186. </el-card>
  1187. <selectType
  1188. :visibleDialog.sync="visibleDialog"
  1189. :title="title"
  1190. :tableHeader="tableHeader"
  1191. :bizScene="formData.bizType"
  1192. :type="[selectEquiType]"
  1193. :loadTree.sync="loadTree"
  1194. @selectTableData="addProduct"
  1195. />
  1196. <WareHouseDailog
  1197. ref="wareHouseDailogRef"
  1198. @houseData="houseData"
  1199. ></WareHouseDailog>
  1200. <ReturnSelect
  1201. ref="returnSelectRef"
  1202. :tableHeader="tableHeader"
  1203. :curDateType="curDateType"
  1204. ></ReturnSelect>
  1205. <el-dialog :visible.sync="dateVisible" title="选择日期" width="400px">
  1206. <el-date-picker
  1207. size="small"
  1208. v-model="batchTime"
  1209. type="datetime"
  1210. style="width: 320px"
  1211. value-format="yyyy-MM-dd HH:mm:ss"
  1212. placeholder="选择日期"
  1213. >
  1214. </el-date-picker>
  1215. <div style="text-align: right; margin-top: 20px">
  1216. <el-button @click="dateVisible = false">取消</el-button>
  1217. <el-button type="primary" @click="dateConfirm" :disabled="!batchTime"
  1218. >确认</el-button
  1219. >
  1220. </div>
  1221. </el-dialog>
  1222. <!-- 销售订单 -->
  1223. <picker ref="pickerRef" @success="pickerSuccess" />
  1224. </div>
  1225. </template>
  1226. <script>
  1227. import { add, bignumber } from 'mathjs';
  1228. import picker from './components/picker.vue';
  1229. import outin from '@/api/warehouseManagement/outin';
  1230. import {
  1231. getTreeByPid,
  1232. getTreeByGroup,
  1233. getProductList
  1234. } from '@/api/classifyManage';
  1235. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  1236. import selectUpload from '@/components/selectUpload';
  1237. import upload from '@/components/uploadImg';
  1238. import {
  1239. warehousingType,
  1240. sceneState,
  1241. emergencyState,
  1242. materialType
  1243. } from '@/utils/dict/index';
  1244. // import { getInfo, warehousingAdd, getAssetNum } from '@/api/stockManagement';
  1245. import selectTree from '@/components/selectTree';
  1246. import selectType from '../components/selectType.vue';
  1247. import WareHouseDailog from '../components/WareHouseDailog.vue';
  1248. import ReturnSelect from './components/ReturnSelect.vue';
  1249. // import supplier from '@/api/main/supplier';
  1250. // import org from '@/api/main/org';
  1251. // import user from '@/api/main/user';
  1252. import { tableHeader } from '../common';
  1253. import { getCode } from '@/api/codeManagement/index.js';
  1254. import { number } from 'echarts/core';
  1255. import { purchaseorderGetById, contactlink, oneId } from '@/api/mes';
  1256. export default {
  1257. components: {
  1258. selectUpload,
  1259. selectTree,
  1260. selectType,
  1261. WareHouseDailog,
  1262. upload,
  1263. ReturnSelect,
  1264. picker
  1265. },
  1266. data() {
  1267. return {
  1268. showMaterialTable: true, // 缓存包装明细列表
  1269. isSplit: false, // 是否拆分到物料明细
  1270. qualityStatus: {
  1271. 0: '未检',
  1272. 1: '已检',
  1273. 2: '部分检'
  1274. }, // 质检状态 0未检 1已检
  1275. qualityResults: {
  1276. 0: '合格',
  1277. 1: '不合格',
  1278. 3: '让步接收'
  1279. }, // 质检结果 0合格 1不合格 3让步接收
  1280. isWeight: true,
  1281. resultArray: [],
  1282. contactList: [],
  1283. pickerRow: {},
  1284. fromUserList: [],
  1285. codeList: [],
  1286. materialType,
  1287. warehousingType,
  1288. sceneState,
  1289. emergencyState,
  1290. saveLoading: false,
  1291. visibleDialog: false,
  1292. curDateType: 'manufactureTime',
  1293. materialCodeReqListSelected: [],
  1294. // warehouseList: [], //仓库数组
  1295. // warehouse: {},
  1296. title: '',
  1297. tableData2: [],
  1298. uploadList: [],
  1299. supplierList: [],
  1300. warehousingMaterialList: [],
  1301. activeName: 'a',
  1302. loadTree: true,
  1303. selectEquiType: '',
  1304. batchTime: '',
  1305. dateVisible: false,
  1306. treeList: [],
  1307. staffList: [],
  1308. formData: {
  1309. extInfo: {
  1310. assetType: '', //物品类型
  1311. deptCode: '', //部门code
  1312. deptName: '', //部门名称
  1313. verifyDeptCode: '', //审核部门编码
  1314. verifyDeptName: '', //审核部门名称
  1315. deliveryName: '', //送货人名称
  1316. deliveryPhone: '', //送货人电话
  1317. documentSource: '', //销售订单
  1318. urgent: '', //紧急状态
  1319. supplierId: '', //供应商ID
  1320. supplierName: '', //供应商名称
  1321. createUserName: '', //创建人名字
  1322. contentImage: [] //图片数组
  1323. },
  1324. fromUser: '', //送货人
  1325. bizType: '', //物品类型
  1326. verifyId: '', //审核人Id
  1327. verifyName: '', //审核人名称
  1328. createUserId: '',
  1329. remark: ''
  1330. },
  1331. rules: {
  1332. 'extInfo.assetType': {
  1333. required: true,
  1334. message: '请选择物品类型',
  1335. trigger: 'change'
  1336. },
  1337. bizType: {
  1338. required: true,
  1339. message: '请选择入库场景',
  1340. trigger: 'change'
  1341. }
  1342. }
  1343. };
  1344. },
  1345. computed: {
  1346. // 条码信息
  1347. materialCodeReqList() {
  1348. return this.warehousingMaterialList
  1349. .map((i) => i.warehouseLedgerDetails || [])
  1350. .flat();
  1351. },
  1352. tableHeader() {
  1353. return tableHeader(this.selectEquiType);
  1354. }
  1355. },
  1356. created() {
  1357. if (this.$route.query.id) {
  1358. // this._getInfo()
  1359. } else {
  1360. let obj = localStorage.getItem('orgInfo')
  1361. ? JSON.parse(localStorage.getItem('orgInfo'))
  1362. : {};
  1363. this.formData.createUserName = obj.name;
  1364. this.formData.extInfo.deptName = obj.dept?.name;
  1365. this.formData.deptCode = obj.dept?.code;
  1366. }
  1367. this.initData();
  1368. },
  1369. methods: {
  1370. // 键盘移动
  1371. moveFocus(event, index, key, type, row) {
  1372. let keyfield = [];
  1373. let listLength = 0;
  1374. switch (type) {
  1375. case '产品':
  1376. listLength = this.warehousingMaterialList.length;
  1377. keyfield = [
  1378. 'manualBatchNo',
  1379. 'minPackingCount',
  1380. 'outInNum',
  1381. 'univalence'
  1382. ];
  1383. break;
  1384. case '包装':
  1385. listLength = this.materialCodeReqList.length;
  1386. if (row.measuringUnit != row.weightUtil) {
  1387. keyfield = ['materielCode', 'clientCode', 'engrave', 'weight'];
  1388. } else {
  1389. keyfield = ['materielCode', 'clientCode', 'engrave'];
  1390. }
  1391. break;
  1392. case '物料':
  1393. listLength = this.resultArray.length;
  1394. if (row.measuringUnit != row.weightUnit) {
  1395. keyfield = ['materielCode', 'clientCode', 'engrave', 'weight'];
  1396. } else {
  1397. keyfield = ['materielCode', 'clientCode', 'engrave'];
  1398. }
  1399. break;
  1400. }
  1401. if (event.keyCode === 13) {
  1402. // 回车
  1403. if (
  1404. index === listLength - 1 &&
  1405. key === keyfield[keyfield.length - 1]
  1406. ) {
  1407. // 最后一行最后一个
  1408. return;
  1409. }
  1410. this.$refs[key + index].blur();
  1411. if (key === keyfield[keyfield.length - 1]) {
  1412. // 当前行最后一个,跳转下一行第一个
  1413. this.$refs[keyfield[0] + (index + 1)].focus();
  1414. } else {
  1415. // 跳转下一个
  1416. const nextkeyindex = keyfield.findIndex((k) => k === key) + 1;
  1417. this.$nextTick(() => {
  1418. this.$refs[keyfield[nextkeyindex] + index].focus();
  1419. });
  1420. }
  1421. }
  1422. // 向上 =38
  1423. if (event.keyCode === 38) {
  1424. console.log('向上');
  1425. if (index === 0) {
  1426. // 第一行
  1427. console.log('第一行无法向上');
  1428. return;
  1429. }
  1430. this.$refs[key + index].blur();
  1431. this.$nextTick(() => {
  1432. this.$refs[key + (index - 1)].focus();
  1433. });
  1434. }
  1435. // 下 = 40
  1436. if (event.keyCode === 40) {
  1437. console.log('向下');
  1438. if (index === listLength - 1) {
  1439. // 最后一行
  1440. console.log('最后一行无法向下');
  1441. return;
  1442. }
  1443. this.$refs[key + index].blur();
  1444. this.$nextTick(() => {
  1445. this.$refs[key + (index + 1)].focus();
  1446. });
  1447. }
  1448. // 左 = 37
  1449. if (event.keyCode === 37) {
  1450. console.log('向左');
  1451. if (index === 0 && key === keyfield[0]) {
  1452. // 第一行第一个
  1453. console.log('第一行第一个无法向左');
  1454. return;
  1455. }
  1456. this.$refs[key + index].blur();
  1457. if (key === keyfield[0]) {
  1458. // 当前行第一个,跳转上一行最后一个
  1459. this.$refs[keyfield[keyfield.length - 1] + (index - 1)].focus();
  1460. } else {
  1461. // 跳转上一个
  1462. const prevkeyindex = keyfield.findIndex((k) => k === key) - 1;
  1463. this.$nextTick(() => {
  1464. this.$refs[keyfield[prevkeyindex] + index].focus();
  1465. });
  1466. }
  1467. }
  1468. // 右 = 39
  1469. if (event.keyCode === 39) {
  1470. console.log('向右');
  1471. if (
  1472. index === listLength - 1 &&
  1473. key === keyfield[keyfield.length - 1]
  1474. ) {
  1475. // 最后一行最后一个
  1476. console.log('最后一行最后一个无法向左');
  1477. return;
  1478. }
  1479. this.$refs[key + index].blur();
  1480. if (key === keyfield[keyfield.length - 1]) {
  1481. // 当前行最后一个,跳转下一行第一个
  1482. this.$refs[keyfield[0] + (index + 1)].focus();
  1483. } else {
  1484. // 跳转下一个
  1485. const nextkeyindex = keyfield.findIndex((k) => k === key) + 1;
  1486. this.$nextTick(() => {
  1487. this.$refs[keyfield[nextkeyindex] + index].focus();
  1488. });
  1489. }
  1490. }
  1491. },
  1492. // 包装维度最小包装单元改变——>总重量
  1493. minPackingCountChange(row, value) {
  1494. if (value >= 0) {
  1495. row.minPackingCount = value.replace(/^[0]+/, '');
  1496. } else {
  1497. row.minPackingCount = 0;
  1498. }
  1499. // row.minPackingCount = value.replace(/^(0+)|[^\d]+/g, '');
  1500. if (row.outInNum >= 0 && value >= 0) {
  1501. this.packNum(row, row.outInNum);
  1502. }
  1503. },
  1504. // 选择质检结果改变质检状态
  1505. changeWrapStatus(resultValue, row) {
  1506. switch (resultValue) {
  1507. case '':
  1508. // 清空质检状态
  1509. row.status = '0';
  1510. break;
  1511. default:
  1512. // 默认已检质检状态
  1513. row.status = '1';
  1514. break;
  1515. }
  1516. },
  1517. // 包装批量保存
  1518. wrapListSave() {
  1519. // 批量修改包装明细
  1520. this.isWeight = false;
  1521. this.bulkEditingWrap();
  1522. this.$nextTick(() => {
  1523. this.isWeight = true;
  1524. });
  1525. },
  1526. // 物料批量保存
  1527. materialListSave() {
  1528. this.resultArray.forEach((item) => {
  1529. if (!item.isPack) {
  1530. this.materialBtn(item);
  1531. }
  1532. });
  1533. },
  1534. weightInput(value, row) {
  1535. const newValue = value.replace(/[^\d.]/g, ''); // 保留数字和小数点
  1536. const decimalCount = (newValue.match(/\./g) || []).length; // 计算小数点的个数
  1537. if (decimalCount > 1) {
  1538. // 如果小数点个数大于1,移除多余的小数点
  1539. const lastIndex = newValue.lastIndexOf('.');
  1540. row.weight =
  1541. newValue.slice(0, lastIndex) + newValue.slice(lastIndex + 1);
  1542. } else if (decimalCount === 1) {
  1543. // 如果小数点个数等于1,允许小数点的输入
  1544. row.weight = newValue;
  1545. } else {
  1546. row.weight = newValue === '' ? 0 : parseFloat(newValue); // 如果输入为空,则设为0
  1547. }
  1548. },
  1549. handleIsDetail(event) {
  1550. this.isSplit = event;
  1551. const list = this.materialCodeReqList;
  1552. if (event) {
  1553. let resultArray = [];
  1554. list.forEach((item) => {
  1555. // 包装维度改成已保存状态
  1556. item.isPack = true;
  1557. // 拆分物料维度并生成列表
  1558. for (let i = 1; i <= Number(item.minPackingCount); i++) {
  1559. console.log(item.weight);
  1560. console.log(item.minPackingCount);
  1561. resultArray.push({
  1562. onlyCode: item.onlyCode,
  1563. no: item.onlyCode + i.toString().padStart(4, '0'),
  1564. assetCode: item.assetCode,
  1565. assetName: item.assetName,
  1566. manualBatchNo: item.manualBatchNo,
  1567. batchNo: item.batchNo,
  1568. minPackingCount: 1,
  1569. measuringUnit: item.measuringUnit,
  1570. materielCode: item.materielCode,
  1571. clientCode: item.clientCode,
  1572. weight: this.$math.format(
  1573. item.weight / Number(item.minPackingCount),
  1574. 14
  1575. ),
  1576. initWeight: this.$math.format(
  1577. item.weight / Number(item.minPackingCount),
  1578. 14
  1579. ),
  1580. weightUnit: item.weightUnit,
  1581. engrave: item.engrave,
  1582. result: item.result,
  1583. status: item.status,
  1584. isPack: false
  1585. });
  1586. }
  1587. });
  1588. this.resultArray = resultArray;
  1589. // 批量修改包装明细
  1590. this.isWeight = false;
  1591. this.bulkEditingWrap();
  1592. this.$nextTick(() => {
  1593. this.isWeight = true;
  1594. });
  1595. } else {
  1596. // 包装维度改成编辑状态
  1597. list.forEach((item) => {
  1598. item.isPack = false;
  1599. });
  1600. // 清空物料维度列表
  1601. this.resultArray = [];
  1602. }
  1603. },
  1604. //包装明细保存
  1605. packCout(row) {
  1606. //true保存==》反之
  1607. if (!row.isPack) {
  1608. row.isPack = true;
  1609. const code = row.assetCode;
  1610. const batchNo = row.batchNo;
  1611. //做防护,防止weight字符串类型
  1612. this.materialCodeReqList.forEach((ele) => {
  1613. ele.weight = Number(ele.weight);
  1614. });
  1615. // const count = this.materialCodeReqList.reduce(
  1616. // (acc, curr) => acc + curr.weight,
  1617. // 0
  1618. // );
  1619. // 修改产品信息重量(包装维度累计)
  1620. this.isWeight = false;
  1621. this.warehousingMaterialList.forEach((item) => {
  1622. if (item.assetCode == code && item.batchNo == batchNo) {
  1623. let arr = [];
  1624. for (const key in this.materialCodeReqList) {
  1625. if (
  1626. this.materialCodeReqList[key].assetCode == item.assetCode &&
  1627. this.materialCodeReqList[key].batchNo == item.batchNo
  1628. ) {
  1629. arr.push({ ...this.materialCodeReqList[key] });
  1630. }
  1631. }
  1632. const count = arr.reduce((acc, curr) => {
  1633. if (curr.isPack) {
  1634. this.$set(curr, 'initWeight', +curr.weight);
  1635. return Number(this.$math.format(+acc + +curr.weight, 14));
  1636. } else {
  1637. return Number(this.$math.format(+acc + +curr.initWeight, 14));
  1638. }
  1639. }, 0);
  1640. this.$set(item, 'weight', count);
  1641. }
  1642. });
  1643. this.$nextTick(() => {
  1644. this.isWeight = true;
  1645. });
  1646. } else {
  1647. row.isPack = false;
  1648. }
  1649. // setTimeout(() => {
  1650. // }, 100);
  1651. },
  1652. // 批量修改包装明细
  1653. bulkEditingWrap() {
  1654. // 批量修改包装明细列表状态(已保存)
  1655. this.materialCodeReqList.forEach((item) => {
  1656. item.isPack = true;
  1657. });
  1658. // 改变产品明细重量
  1659. this.warehousingMaterialList.forEach((outItem) => {
  1660. let arr = [];
  1661. this.materialCodeReqList.forEach((inneritem) => {
  1662. if (
  1663. inneritem.assetCode == outItem.assetCode &&
  1664. inneritem.batchNo == outItem.batchNo
  1665. ) {
  1666. arr.push(inneritem);
  1667. }
  1668. });
  1669. const count = arr.reduce((acc, curr) => {
  1670. if (curr.isPack) {
  1671. this.$set(curr, 'initWeight', +curr.weight);
  1672. return Number(this.$math.format(+acc + +curr.weight, 14));
  1673. } else {
  1674. return Number(this.$math.format(+acc + +curr.initWeight, 14));
  1675. }
  1676. }, 0);
  1677. this.$set(outItem, 'weight', count);
  1678. });
  1679. },
  1680. // 批量修改物料明细
  1681. bulkEditingMaterial() {
  1682. // 批量修改物料明细列表状态(已保存)
  1683. this.resultArray.forEach((item) => {
  1684. item.isPack = true;
  1685. });
  1686. // 改变包装明细重量
  1687. this.materialCodeReqList.forEach((outItem) => {
  1688. let arr = [];
  1689. this.resultArray.forEach((inneritem) => {
  1690. if (
  1691. inneritem.assetCode == outItem.assetCode &&
  1692. inneritem.batchNo == outItem.batchNo
  1693. ) {
  1694. arr.push(inneritem);
  1695. }
  1696. });
  1697. const count = arr.reduce((acc, curr) => {
  1698. if (curr.isPack) {
  1699. this.$set(curr, 'initWeight', +curr.weight);
  1700. return Number(this.$math.format(+acc + +curr.weight, 14));
  1701. } else {
  1702. return Number(this.$math.format(+acc + +curr.initWeight, 14));
  1703. }
  1704. }, 0);
  1705. this.$set(outItem, 'weight', count);
  1706. });
  1707. },
  1708. // 物料明细保存
  1709. materialBtn(row) {
  1710. console.log(row);
  1711. console.log(this.resultArray);
  1712. console.log(this.materialCodeReqList);
  1713. // true保存 false编辑
  1714. if (!row.isPack) {
  1715. row.isPack = true;
  1716. // 物料维度修改质检改变包装维度质检(结果和状态)
  1717. this.materialCodeReqList.forEach((outItem) => {
  1718. let arr = [];
  1719. this.resultArray.forEach((inneritem) => {
  1720. if (inneritem.onlyCode == outItem.onlyCode) {
  1721. arr.push(inneritem);
  1722. }
  1723. });
  1724. console.log(arr);
  1725. // 首先判断是未填/合格不合格
  1726. let boolen = arr.every((item) => {
  1727. return item.result === '' || item.result === undefined;
  1728. });
  1729. // 判断只要物料全部质检结果(未填)——>包装质检结果(未填) 状态(未检)
  1730. if (boolen) {
  1731. this.$set(outItem, 'result', '');
  1732. this.$set(outItem, 'status', '0');
  1733. } else {
  1734. // 判断只要物料有一个质检结果(不合格)——>包装质检结果(不合格) 状态(已检)
  1735. let boolen = arr.some((item) => {
  1736. return item.result === '1';
  1737. });
  1738. if (boolen) {
  1739. this.$set(outItem, 'result', '1');
  1740. this.$set(outItem, 'status', '1');
  1741. } else {
  1742. // 判断只要物料有一个质检结果(让步接收)——>包装质检结果(让步接收) 状态(已检)
  1743. let boolen = arr.some((item) => {
  1744. return item.result === '3';
  1745. });
  1746. if (boolen) {
  1747. // 让步接收 已检
  1748. this.$set(outItem, 'result', '3');
  1749. this.$set(outItem, 'status', '1');
  1750. } else {
  1751. // 判断只要物料有全部质检结果(合格)——>包装质检结果(合格) 状态(已检)
  1752. let boolen = arr.every((item) => {
  1753. return item.result === '0';
  1754. });
  1755. if (boolen) {
  1756. // 合格 已检
  1757. this.$set(outItem, 'result', '0');
  1758. this.$set(outItem, 'status', '1');
  1759. } else {
  1760. // 合格 部分检
  1761. this.$set(outItem, 'result', '0');
  1762. this.$set(outItem, 'status', '2');
  1763. }
  1764. }
  1765. }
  1766. }
  1767. // this.$set(outItem, 'result', boolen ? '1' : '0');
  1768. });
  1769. // 物料维度修改重量改变包装维度重量
  1770. let onlyCode = row.onlyCode;
  1771. this.materialCodeReqList.forEach((item) => {
  1772. if (item.onlyCode === onlyCode) {
  1773. let arr = [];
  1774. for (const key in this.resultArray) {
  1775. if (this.resultArray[key].onlyCode == item.onlyCode) {
  1776. arr.push(this.resultArray[key]);
  1777. }
  1778. }
  1779. const count = arr.reduce((acc, curr) => {
  1780. if (curr.isPack) {
  1781. this.$set(curr, 'initWeight', +curr.weight);
  1782. return Number(this.$math.format(+acc + +curr.weight, 14));
  1783. } else {
  1784. return Number(this.$math.format(+acc + +curr.initWeight, 14));
  1785. }
  1786. }, 0);
  1787. this.$set(item, 'weight', count);
  1788. }
  1789. });
  1790. // 包装维度修改重量改变产品信息
  1791. this.isWeight = false;
  1792. // 批量修改包装明细
  1793. this.bulkEditingWrap();
  1794. this.$nextTick(() => {
  1795. this.isWeight = true;
  1796. });
  1797. } else {
  1798. row.isPack = false;
  1799. }
  1800. },
  1801. packNum(row, value) {
  1802. const total = {
  1803. packingCount: Number(
  1804. row.minPackingCount > 0 ? row.minPackingCount : 0
  1805. ),
  1806. outInNum: Number(row.outInNum > 0 ? row.outInNum : 0)
  1807. };
  1808. if (row.measuringUnit == row.weightUnit) {
  1809. row.weight = Number(
  1810. this.$math.format(
  1811. total.packingCount * 1 * total.outInNum.toFixed(2),
  1812. 14
  1813. )
  1814. );
  1815. } else {
  1816. const totals = Number(
  1817. this.$math.format(total.packingCount * total.outInNum, 14)
  1818. );
  1819. row.weight = Number(
  1820. this.$math.format(
  1821. totals * (row.netWeight > 0 ? row.netWeight.toFixed(2) : 0),
  1822. 14
  1823. )
  1824. );
  1825. }
  1826. return (row.outInNum = value.replace(/^(0+)|[^\d]+/g, ''));
  1827. },
  1828. async searchContact(id) {
  1829. const data = await contactlink({ contactId: id });
  1830. this.contactList = data.data;
  1831. },
  1832. async pickerSuccess(row) {
  1833. this.pickerRow = row;
  1834. this.formData.extInfo.documentSource = row.orderNo;
  1835. this.formData.clientName = row.partaName;
  1836. this.formData.clientCode = row.partaId;
  1837. this.formData.extInfo.supplierName = row.partbName;
  1838. this.formData.extInfo.supplierId = row.partbId;
  1839. await this.searchContact(row.partbId);
  1840. const data = await oneId(row.id);
  1841. if (this.warehousingMaterialList.length == 0) {
  1842. console.log('data===', data);
  1843. let list = data.data.productList.map((item) => {
  1844. return {
  1845. ...item,
  1846. assetName: item.productName,
  1847. assetCode: item.productCode,
  1848. categoryId: item.productCategoryId,
  1849. minPackUnit: item.packingUnit
  1850. };
  1851. });
  1852. this.onSelectTableData(await this.serachMainCode(list));
  1853. }
  1854. },
  1855. async serachMainCode(arr) {
  1856. let newArr = [];
  1857. // 使用 Promise.all 来等待所有异步操作完成
  1858. await Promise.all(
  1859. arr.map(async (item) => {
  1860. const data = await getProductList({
  1861. pageNum: 1,
  1862. size: 10,
  1863. categoryLevelId: item.categoryLevelPathIdParent,
  1864. code: item.assetCode
  1865. });
  1866. newArr.push(data.list); // 将结果存储到 newArr 中
  1867. })
  1868. );
  1869. let re = [];
  1870. for (const item of newArr) {
  1871. for (const it of item) {
  1872. re.push(it);
  1873. }
  1874. }
  1875. return re.map((item) => {
  1876. return {
  1877. ...item,
  1878. minPackUnit: item.packingUnit,
  1879. assetCode: item.code,
  1880. assetName: item.name
  1881. };
  1882. });
  1883. },
  1884. onClear() {
  1885. this.formData.extInfo.documentSource = '';
  1886. this.pickerRow = {};
  1887. this.formData.clientName = '';
  1888. this.formData.clientCode = '';
  1889. this.formData.extInfo.supplierName = '';
  1890. this.formData.extInfo.supplierId = '';
  1891. this.$forceUpdate();
  1892. },
  1893. handlePicker() {
  1894. this.$refs.pickerRef.open();
  1895. },
  1896. codeListValue(val) {
  1897. this.formData.extInfo.assetType = val.id;
  1898. this.$forceUpdate();
  1899. this.title = val?.name;
  1900. this.selectEquiType = val?.id;
  1901. },
  1902. //计算生产设备重量
  1903. deviceWeight(row, num) {
  1904. if (row) {
  1905. return Number(row * num);
  1906. } else {
  1907. return row;
  1908. }
  1909. },
  1910. //计算金额
  1911. calcSumTotal(PackingCount, outInNum, univalence) {
  1912. //最小包装单元,包装数量,单价
  1913. const total = {
  1914. PackingCount: Number(PackingCount > 0 ? PackingCount : 0),
  1915. outInNum: Number(outInNum > 0 ? outInNum : 0),
  1916. univalence: Number(univalence > 0 ? univalence : 0)
  1917. };
  1918. return Number(
  1919. this.$math.format(
  1920. total.PackingCount * total.outInNum * total.univalence,
  1921. 14
  1922. )
  1923. );
  1924. },
  1925. handleRowUnit(row) {
  1926. return row.measuringUnit;
  1927. // if (this.formData.extInfo.assetType == 1) {
  1928. // return row.weightUnit;
  1929. // } else if (this.formData.extInfo.assetType == 4) {
  1930. // return row.measuringUnit;
  1931. // } else {
  1932. // return row.measuringUnit;
  1933. // }
  1934. },
  1935. changeVerfy(it) {
  1936. this.formData.verifyName = it.name;
  1937. },
  1938. //选择供应啥的操作
  1939. ChangeSupplier(data) {
  1940. this.formData.extInfo.supplierName = data.dictValue;
  1941. },
  1942. ChangeSuppliers(data) {
  1943. this.formData.clientName = data.dictValue;
  1944. },
  1945. rowClass({ row, column, rowIndex, columnIndex }) {
  1946. if (rowIndex === 1) {
  1947. return {
  1948. display: 'none',
  1949. background: '#EEEEEE',
  1950. border: 'none'
  1951. };
  1952. }
  1953. return { background: '#EEEEEE', border: 'none' };
  1954. },
  1955. calcSum(a, b, c, row) {
  1956. if (
  1957. (Number.isNaN(+a) && a !== '') ||
  1958. (Number.isNaN(+b) && b !== '') ||
  1959. (Number.isNaN(+c) && c !== '')
  1960. ) {
  1961. return '';
  1962. }
  1963. return a * b * c + { yuan: '元', wanyuan: '万元' }[row.univalenceUnit];
  1964. // return a * b * c;
  1965. },
  1966. // 部门 点击事件
  1967. async auditorDeptClick(data) {
  1968. this.formData.extInfo.verifyDeptCode = data?.id;
  1969. this.formData.extInfo.verifyDeptName = data?.name;
  1970. this.formData.verifyId = '';
  1971. this.formData.verifyName = '';
  1972. this.$refs.formName.validateField('verifyDeptName');
  1973. if (data) {
  1974. this.getStaffList(data);
  1975. }
  1976. },
  1977. async getStaffList(data) {
  1978. let res = await warehouseDefinition.getUserPage({
  1979. groupId: data.id,
  1980. size: 9999,
  1981. page: 1
  1982. });
  1983. this.staffList = res.list;
  1984. },
  1985. // 详情接口
  1986. // async _getInfo () {
  1987. // const res = await getInfo({ id: this.$route.query.id })
  1988. // if (res?.success) {
  1989. // this.warehousingMaterialList = res.data.warehouseLedgerInfos.map(i => {
  1990. // i.isSave = true
  1991. // return i
  1992. // })
  1993. // this.formData = res.data.outInWarehouse
  1994. // this.uploadList = this.formData.contentImage
  1995. // }
  1996. // },
  1997. chooseAssets(row, index) {
  1998. this.$refs.returnSelectRef.open(row, (res) => {
  1999. row.outInNum = res.length;
  2000. this.$set(
  2001. row,
  2002. 'selfWarehouseLedgerDetails',
  2003. res.map((i) => {
  2004. delete i.updateTime;
  2005. delete i.createTime;
  2006. return i;
  2007. })
  2008. );
  2009. });
  2010. },
  2011. // 仓库编辑
  2012. handleWareHouse(row, idx) {
  2013. this.$refs.wareHouseDailogRef.open(row, idx);
  2014. },
  2015. // 入库操作
  2016. listEdit(row) {
  2017. this.$set(row, 'isSave', false);
  2018. row.selfWarehouseLedgerDetails = row.warehouseLedgerDetails;
  2019. row.warehouseLedgerDetails = [];
  2020. // 重置重量
  2021. this.packNum(row, row.outInNum);
  2022. // 清空物料明细防止数据错乱
  2023. if (this.isSplit && this.resultArray?.length > 0) {
  2024. this.handleIsDetail(false);
  2025. }
  2026. },
  2027. listSave(row, index) {
  2028. if (this.isSplit && this.resultArray?.length > 0) {
  2029. this.handleIsDetail(false);
  2030. }
  2031. const fileds = [
  2032. // `warehousingMaterialList.${index}.cargoSpaceCode`,
  2033. `warehousingMaterialList.${index}.batchNo`,
  2034. `warehousingMaterialList.${index}.houseList`
  2035. ];
  2036. if (this.formData.bizType == 1) {
  2037. // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
  2038. } else if (this.formData.bizType == 2) {
  2039. // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
  2040. }
  2041. if (this.formData.bizType != 5) {
  2042. fileds.push(
  2043. ...[
  2044. `warehousingMaterialList.${index}.outInNum`,
  2045. `warehousingMaterialList.${index}.minPackingCount`
  2046. ]
  2047. );
  2048. } else if (
  2049. this.warehousingMaterialList.some(
  2050. (i) => !i.selfWarehouseLedgerDetails?.length
  2051. )
  2052. ) {
  2053. this.$message.error('请选择资产编号!');
  2054. return;
  2055. }
  2056. Promise.all(
  2057. fileds.map(
  2058. (item) =>
  2059. new Promise(async (resolve, rej) => {
  2060. this.$refs.warehousingMaterialListRef.validateField(
  2061. item,
  2062. (err) => {
  2063. if (err) {
  2064. rej(err);
  2065. } else {
  2066. resolve();
  2067. }
  2068. }
  2069. );
  2070. })
  2071. )
  2072. )
  2073. .then((res) => {
  2074. this.$set(row, 'isSave', true);
  2075. if (this.formData.bizType != 5) {
  2076. this.createMaterialCode(row);
  2077. } else {
  2078. // 退还
  2079. this.createMaterialCodeReturn(row);
  2080. }
  2081. })
  2082. .catch((err) => {
  2083. this.$message.error('请填入必填项!');
  2084. });
  2085. },
  2086. listSaveArrs() {
  2087. // 已经拆分(还原到未拆封编辑状态)
  2088. if (this.isSplit && this.resultArray.length > 0) {
  2089. this.handleIsDetail(false);
  2090. }
  2091. const rows = this.warehousingMaterialList;
  2092. const indexes = Array.from(
  2093. { length: this.warehousingMaterialList.length },
  2094. (_, index) => index
  2095. );
  2096. let showMessage = true;
  2097. rows.forEach((row, i) => {
  2098. const index = indexes[i];
  2099. const fileds = [
  2100. // `warehousingMaterialList.${index}.cargoSpaceCode`,
  2101. `warehousingMaterialList.${index}.batchNo`,
  2102. `warehousingMaterialList.${index}.houseList`
  2103. ];
  2104. if (this.formData.bizType == 1) {
  2105. // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
  2106. } else if (this.formData.bizType == 2) {
  2107. // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
  2108. }
  2109. if (this.formData.bizType != 5) {
  2110. fileds.push(
  2111. ...[
  2112. `warehousingMaterialList.${index}.outInNum`,
  2113. `warehousingMaterialList.${index}.minPackingCount`
  2114. ]
  2115. );
  2116. } else if (
  2117. this.warehousingMaterialList.some(
  2118. (i) => !i.selfWarehouseLedgerDetails?.length
  2119. )
  2120. ) {
  2121. this.$message.error('请选择资产编号!');
  2122. return;
  2123. }
  2124. Promise.all(
  2125. fileds.map(
  2126. (item) =>
  2127. new Promise(async (resolve, rej) => {
  2128. this.$refs.warehousingMaterialListRef.validateField(
  2129. item,
  2130. (err) => {
  2131. if (err) {
  2132. rej(err);
  2133. } else {
  2134. resolve();
  2135. }
  2136. }
  2137. );
  2138. })
  2139. )
  2140. )
  2141. .then((res) => {
  2142. this.$set(row, 'isSave', true);
  2143. if (this.formData.bizType != 5) {
  2144. this.createMaterialCode(row);
  2145. } else {
  2146. // 退还
  2147. this.createMaterialCodeReturn(row);
  2148. }
  2149. })
  2150. .catch((err) => {
  2151. if (showMessage) {
  2152. showMessage = false;
  2153. this.$message.error('请填入必填项!');
  2154. }
  2155. });
  2156. });
  2157. },
  2158. // listSaveArrs() {
  2159. // console.log(this.warehousingMaterialList);
  2160. // },
  2161. // 批量设置生产日期
  2162. handleSelectionChange(val) {
  2163. this.materialCodeReqListSelected = val;
  2164. },
  2165. dateSetting() {
  2166. if (!this.materialCodeReqListSelected.length) {
  2167. return this.$message.error(`请选择${this.title}明细!`);
  2168. }
  2169. this.dateVisible = true;
  2170. },
  2171. dateConfirm() {
  2172. this.materialCodeReqListSelected.forEach((item) => {
  2173. this.$set(item, this.curDateType, this.batchTime);
  2174. });
  2175. this.dateVisible = false;
  2176. },
  2177. //入库明细删除
  2178. listDel(row, index) {
  2179. this.warehousingMaterialList.splice(index, 1);
  2180. if (this.isSplit && this.resultArray?.length > 0) {
  2181. this.handleIsDetail(false);
  2182. }
  2183. },
  2184. // 入库明细生成条码信息
  2185. async createMaterialCode(row) {
  2186. // 添加相同物品、批次号重新更新明细 原料编码
  2187. const list = this.warehousingMaterialList.filter(
  2188. (i) =>
  2189. i.assetCode === row.assetCode &&
  2190. i.batchNo === row.batchNo &&
  2191. i.isSave
  2192. );
  2193. const num = list.reduce((num, pre) => {
  2194. num += row.isUnpack
  2195. ? Number(this.$math.format(pre.outInNum * pre.minPackingCount, 14))
  2196. : pre.outInNum - 0;
  2197. return num;
  2198. }, 0);
  2199. const nums = list.reduce((num, pre) => {
  2200. num += Number(
  2201. this.$math.format(pre.outInNum * pre.minPackingCount, 14)
  2202. );
  2203. return num;
  2204. }, 0);
  2205. const res = await outin.getAssetNum({
  2206. assetCode: row.assetCode,
  2207. batchNum: row.batchNo,
  2208. num: num
  2209. });
  2210. // row.measuringUnit == 'PCS' ? nums :
  2211. list.forEach((item) => {
  2212. if (item.warehouseLedgerDetails?.length) {
  2213. item.warehouseLedgerDetails.forEach((i) => {
  2214. i.onlyCode = res.shift().onlyCode;
  2215. });
  2216. } else {
  2217. this.$set(
  2218. item,
  2219. 'warehouseLedgerDetails',
  2220. Array.from(
  2221. new Array(
  2222. item.isUnpack
  2223. ? Number(
  2224. this.$math.format(
  2225. item.outInNum * item.minPackingCount,
  2226. 14
  2227. )
  2228. )
  2229. : // : item.measuringUnit == 'PCS'
  2230. // ? +item.outInNum * parseInt(item.minPackingCount)
  2231. +item.outInNum
  2232. ),
  2233. (val, idx) => {
  2234. return {
  2235. ...item,
  2236. onlyCode: res.shift().onlyCode,
  2237. bizStatus: 1,
  2238. contentImage: []
  2239. };
  2240. }
  2241. )
  2242. );
  2243. }
  2244. });
  2245. // 添加相同物品,重复批次号 重新更新明细 包装编码
  2246. const batchList = this.warehousingMaterialList.filter(
  2247. (i) => i.batchNo === row.batchNo && i.isSave
  2248. );
  2249. if (batchList.length) {
  2250. const num = batchList.reduce((num, pre) => {
  2251. num += +pre.outInNum;
  2252. return num;
  2253. }, 0);
  2254. const res1 = await outin.getAssetNum({
  2255. batchNum: row.batchNo,
  2256. num
  2257. });
  2258. if (res1) {
  2259. batchList.forEach((item) => {
  2260. let num = res1.shift()?.num;
  2261. let minPackingCount = item.minPackingCount;
  2262. if (item.warehouseLedgerDetails?.length) {
  2263. item.warehouseLedgerDetails.forEach((i, index) => {
  2264. this.$set(i, 'num', num);
  2265. console.log('i---', i);
  2266. console.log('row---', row);
  2267. if (row.code == i.code) {
  2268. if (item.measuringUnit == item.weightUnit) {
  2269. this.$set(i, 'weight', item.minPackingCount);
  2270. this.$set(i, 'initWeight', item.minPackingCount);
  2271. } else {
  2272. this.$set(
  2273. i,
  2274. 'weight',
  2275. Number(
  2276. this.$math.format(
  2277. 1 * item.minPackingCount * item.netWeight,
  2278. 14
  2279. )
  2280. )
  2281. );
  2282. this.$set(
  2283. i,
  2284. 'initWeight',
  2285. Number(
  2286. this.$math.format(
  2287. 1 * item.minPackingCount * item.netWeight,
  2288. 14
  2289. )
  2290. )
  2291. );
  2292. }
  2293. }
  2294. this.$set(i, 'weightUtil', item.weightUnit);
  2295. this.$set(i, 'packingCount', 1);
  2296. this.$set(i, 'packingUnit ', item.packingUnit);
  2297. this.$set(i, 'minPackingCount ', item.minPackingCount);
  2298. this.$set(i, 'measuringUnit', item.measuringUnit);
  2299. this.$set(i, 'isPack', false);
  2300. if (this.formData.extInfo.assetType == 1) {
  2301. this.$set(i, 'status', '0');
  2302. } else {
  2303. this.$set(i, 'result', '0');
  2304. this.$set(i, 'status', '1');
  2305. }
  2306. if (!item.isUnpack) {
  2307. if (index < item.warehouseLedgerDetails.length - 1) {
  2308. num = res1.shift()?.num;
  2309. }
  2310. } else {
  2311. // 拆包的包装编码一致
  2312. minPackingCount--;
  2313. if (
  2314. minPackingCount === 0 &&
  2315. index < item.warehouseLedgerDetails.length - 1
  2316. ) {
  2317. minPackingCount = item.minPackingCount;
  2318. num = res1.shift()?.num;
  2319. }
  2320. }
  2321. });
  2322. }
  2323. });
  2324. }
  2325. }
  2326. },
  2327. // 入库明细生成条码信息 退还
  2328. async createMaterialCodeReturn(row) {
  2329. // 添加相同物品重新更新明细 原料编码
  2330. const list = this.warehousingMaterialList.filter(
  2331. (i) => i.batchNo === row.batchNo && i.isSave
  2332. );
  2333. // 退还
  2334. const res = await getAssetNum({
  2335. batchNo: row.batchNo,
  2336. num: list.reduce((num, pre) => {
  2337. num += pre.selfWarehouseLedgerDetails.length;
  2338. return num;
  2339. }, 0)
  2340. });
  2341. if (res?.success) {
  2342. list.forEach((item) => {
  2343. let num = res.data.shift().num;
  2344. let minPackingCount = item.minPackingCount;
  2345. if (item.warehouseLedgerDetails?.length) {
  2346. item.warehouseLedgerDetails.forEach((i, index) => {
  2347. Object.assign(i, {
  2348. num,
  2349. manualBatchNo: item.manualBatchNo,
  2350. batchNo: item.batchNo,
  2351. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  2352. cargoSpaceId: item.cargoSpaceId, //货位id
  2353. shelfId: item.shelfId, //货架id
  2354. shelfCode: item.shelfCode, //货架名称
  2355. areaId: item.areaId, //库区id
  2356. areaName: item.areaName, //库区名称
  2357. warehouseId: item.warehouseId, //仓库id
  2358. warehouseName: item.warehouseName //仓库名称
  2359. });
  2360. if (!item.isUnpack) {
  2361. // 拆包的包装编码一致
  2362. if (index < item.warehouseLedgerDetails.length - 1) {
  2363. num = res.data.shift()?.num;
  2364. }
  2365. } else {
  2366. minPackingCount--;
  2367. if (
  2368. minPackingCount === 0 &&
  2369. index < item.warehouseLedgerDetails.length - 1
  2370. ) {
  2371. minPackingCount = item.minPackingCount;
  2372. num = res1.data.shift()?.num;
  2373. }
  2374. }
  2375. });
  2376. } else {
  2377. this.$set(
  2378. item,
  2379. 'warehouseLedgerDetails',
  2380. item.selfWarehouseLedgerDetails.map((val, idx) => {
  2381. let obj = {
  2382. ...val,
  2383. bizStatus: 1,
  2384. minPackingCount: item.minPackingCount,
  2385. batchNo: item.batchNo,
  2386. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  2387. cargoSpaceId: item.cargoSpaceId, //货位id
  2388. shelfId: item.shelfId, //货架id
  2389. shelfCode: item.shelfCode, //货架名称
  2390. areaId: item.areaId, //库区id
  2391. areaName: item.areaName, //库区名称
  2392. warehouseId: item.warehouseId, //仓库id
  2393. warehouseName: item.warehouseName, //仓库名称
  2394. materialId: item.materialId,
  2395. num
  2396. };
  2397. if (!item.isUnpack) {
  2398. // 拆包的包装编码一致
  2399. if (idx < item.warehouseLedgerDetails.length - 1) {
  2400. num = res.data.shift()?.num;
  2401. }
  2402. } else {
  2403. minPackingCount--;
  2404. if (
  2405. minPackingCount === 0 &&
  2406. idx < item.warehouseLedgerDetails.length - 1
  2407. ) {
  2408. minPackingCount = item.minPackingCount;
  2409. num = res1.data.shift()?.num;
  2410. }
  2411. }
  2412. return obj;
  2413. })
  2414. );
  2415. }
  2416. });
  2417. }
  2418. },
  2419. handleSave() {
  2420. this.$refs.formName.validate(async (valid) => {
  2421. if (valid) {
  2422. if (!this.warehousingMaterialList?.length) {
  2423. return this.$message.error('请添加入库明细!');
  2424. } else if (
  2425. this.warehousingMaterialList.some((item) => !item.isSave)
  2426. ) {
  2427. return this.$message.error('请保存入库明细!');
  2428. }
  2429. // 默认全部保存
  2430. if (this.resultArray?.length > 0) {
  2431. // 物料批量保存
  2432. this.materialListSave();
  2433. } else {
  2434. // 包装批量保存
  2435. this.wrapListSave();
  2436. }
  2437. this.formatWarehouseMaterialList();
  2438. let arr = this.warehousingMaterialList.map((item) => {
  2439. return {
  2440. netWeight: item.netWeight > 0 ? item.netWeight : 0,
  2441. num: item.num > 0 ? item.num : 0,
  2442. manualBatchNo: item.manualBatchNo,
  2443. batchNo: item.batchNo,
  2444. categoryId:
  2445. this.formData.bizType == 2
  2446. ? item.categoryId
  2447. ? item.categoryId
  2448. : item.id
  2449. : item.id,
  2450. count:
  2451. item.outInNum > 0 && item.minPackingCount > 0
  2452. ? this.$math.format(
  2453. parseInt(item.outInNum) *
  2454. parseInt(item.minPackingCount),
  2455. 14
  2456. )
  2457. : 0,
  2458. minPackingCount:
  2459. item.minPackingCount > 0 ? item.minPackingCount : 0,
  2460. packingCount: item.outInNum > 0 ? item.outInNum : 0,
  2461. price: item.univalence > 0 ? item.univalence : 0,
  2462. outInDetailRecordAddPOList: item.warehouseLedgerDetails,
  2463. position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
  2464. remark: '',
  2465. pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
  2466. pathName: `${item.warehouseName},${item.areaName},${item.shelfCode},${item.cargoSpaceCode}`,
  2467. totalMoney:
  2468. item.outInNum > 0 &&
  2469. item.minPackingCount > 0 &&
  2470. item.univalence > 0
  2471. ? this.$math.format(
  2472. item.outInNum * item.minPackingCount * item.univalence,
  2473. 14
  2474. )
  2475. : 0,
  2476. weightUnit: item.weightUnit,
  2477. customCode: item.customCode,
  2478. supplierCode: item.supplierCode,
  2479. weight: item.weight > 0 ? item.weight : 0
  2480. };
  2481. });
  2482. arr.forEach((item) => {
  2483. if (item.outInDetailRecordAddPOList.length > 0) {
  2484. let list = item.outInDetailRecordAddPOList.map((it) => {
  2485. return this.formatOutInDetailRecordAddPO(it, item);
  2486. });
  2487. item.outInDetailRecordAddPOList = list;
  2488. }
  2489. });
  2490. let obj = { ...this.formData, type: 1 };
  2491. obj.sourceBizNo = this.formData.extInfo.documentSource;
  2492. obj.outInDetailAddPOList = arr;
  2493. console.log('=====>', obj);
  2494. this.saveLoading = true;
  2495. try {
  2496. const res = await outin.save(obj);
  2497. if (res.code == 0) {
  2498. await outin.outApproves({ outInId: res.data[0] });
  2499. this.$message.success('保存成功!');
  2500. }
  2501. } catch (error) {
  2502. console.error('保存失败:', error);
  2503. }
  2504. this.saveLoading = false;
  2505. this.$router.push('/warehouseManagement/stockManagement');
  2506. }
  2507. });
  2508. },
  2509. formatWarehouseMaterialList() {
  2510. for (let key in this.warehousingMaterialList) {
  2511. for (let k in this.warehousingMaterialList[key].houseList) {
  2512. let house = this.warehousingMaterialList[key].houseList[k];
  2513. this.warehousingMaterialList[key].warehouseName =
  2514. house.warehouseName;
  2515. this.warehousingMaterialList[key].areaName = house.areaName;
  2516. this.warehousingMaterialList[key].shelfCode = house.shelfCode;
  2517. this.warehousingMaterialList[key].cargoSpaceCode =
  2518. house.cargoSpaceCode;
  2519. this.warehousingMaterialList[key].warehouseId = house.warehouseId;
  2520. this.warehousingMaterialList[key].areaId = house.areaId;
  2521. this.warehousingMaterialList[key].shelfId = house.shelfId;
  2522. this.warehousingMaterialList[key].cargoSpaceId = house.cargoSpaceId;
  2523. this.warehousingMaterialList[key].num = house.num;
  2524. }
  2525. }
  2526. },
  2527. formatOutInDetailRecordAddPO(it, item) {
  2528. return {
  2529. code: it.onlyCode,
  2530. dateType: this.curDateType === 'manufactureTime' ? 2 : 1,
  2531. dateValue: it[this.curDateType],
  2532. minUnit: it.minPackingCount,
  2533. minPackingCount: it.minPackingCount,
  2534. minPositionId: it.cargoSpaceId,
  2535. name: it.assetName,
  2536. pathIds: item.pathIds,
  2537. unit: it.unit,
  2538. packageNo: it.num,
  2539. clientCode: it.clientCode,
  2540. materielCode: it.materielCode,
  2541. weight: it.weight,
  2542. weightUtil: it.weightUtil,
  2543. engrave: it.engrave,
  2544. materialDetails: this.materialDetails(it.onlyCode),
  2545. packingCount: it.packingCount,
  2546. status: it.status,
  2547. result: it.result
  2548. };
  2549. },
  2550. materialDetails(onlyCode) {
  2551. return this.resultArray.filter((item) => item.onlyCode === onlyCode);
  2552. },
  2553. async getOrderCode() {
  2554. const data = await getCode('in_warehouse');
  2555. return data;
  2556. },
  2557. // 添加物品明细
  2558. addProduct(val) {
  2559. // 已经拆分(还原到未拆封编辑状态)
  2560. if (this.isSplit && this.resultArray.length > 0) {
  2561. this.handleIsDetail(false);
  2562. }
  2563. this.onSelectTableData(val);
  2564. },
  2565. //添加明细
  2566. async onSelectTableData(val) {
  2567. const res = await getCode('lot_number_code');
  2568. this.warehousingMaterialList.push(
  2569. ...val.map((next) => {
  2570. next.batchNo = res;
  2571. let cur = {};
  2572. next.realInventoryAmount = next.realInventoryAmount || 0;
  2573. cur = {
  2574. ...next,
  2575. cargoSpaceCode: '', //货位编码
  2576. cargoSpaceId: '', //货位id
  2577. shelfId: '', //货架id
  2578. shelfCode: '', //货架名称
  2579. areaId: '', //库区id
  2580. areaName: '', //库区名称
  2581. warehouseId: '', //仓库id
  2582. warehouseName: '', //仓库名称
  2583. assetType: this.formData.extInfo.assetType,
  2584. expirationDate: '',
  2585. outInNum: '',
  2586. minPackingCount: '',
  2587. bizStatus: 1,
  2588. contentImage: [],
  2589. warehouseLedgerDetails: [],
  2590. houseList: []
  2591. };
  2592. return cur;
  2593. })
  2594. );
  2595. },
  2596. async initData() {
  2597. const { data } = await getTreeByGroup({ type: 2 });
  2598. this.codeList = data;
  2599. // .map((item) => {
  2600. // return { dictCode: item.id, dictValue: item.name };
  2601. // });
  2602. const res = await warehouseDefinition.tree();
  2603. this.treeList = this.$util.toTreeData({
  2604. data: res,
  2605. idField: 'id',
  2606. parentIdField: 'parentId'
  2607. });
  2608. // const res111 = await warehouseDefinition.list();
  2609. // this.warehouseList = res111.list;
  2610. let res22 = await warehouseDefinition.getUserPage({
  2611. size: -1,
  2612. page: 1
  2613. });
  2614. this.fromUserList = res22.list;
  2615. const info = JSON.parse(localStorage.getItem('info'));
  2616. let obj = res.find(
  2617. (item) => item.id === info.deptId[info.deptId.length - 1]
  2618. );
  2619. if (!obj) return;
  2620. this.formData.extInfo.deptCode = obj.id;
  2621. this.formData.extInfo.deptName = obj.name;
  2622. this.formData.extInfo.createUserName = info.name;
  2623. this.formData.createUserId = info.id;
  2624. // this.treeList = res;
  2625. // this.formData.extInfo.deptCode =
  2626. // this.getTreeList().then((res) => {
  2627. // if (res?.success) {
  2628. // this.treeList = res.data;
  2629. // }
  2630. // });
  2631. // this.getSupplier().then((res) => {
  2632. // if (res?.success) {
  2633. // this.supplierList = res.data.items;
  2634. // }
  2635. // });
  2636. // this.getStaffList();
  2637. },
  2638. addStock() {
  2639. // this.$refs.wareHouseDailogRef.open({});
  2640. // return;
  2641. if (!this.title) return this.$message.error('请选择入库产品类型');
  2642. if (!this.formData.bizType)
  2643. return this.$message.error('请选择入库场景');
  2644. this.visibleDialog = true;
  2645. },
  2646. handleChange(data) {
  2647. this.title = data?.dictValue;
  2648. this.selectEquiType = data?.dictCode;
  2649. },
  2650. handleChanges(code) {
  2651. const data = this.codeList.find((item) => item.dictCode == code);
  2652. this.title = data?.dictValue;
  2653. this.selectEquiType = data?.dictCode;
  2654. },
  2655. getSupplier() {
  2656. return new Promise((resolve, reject) => {
  2657. supplier.list({ page: 1, size: 999 }).then((res) => {
  2658. if (res.success) {
  2659. resolve(res);
  2660. }
  2661. });
  2662. });
  2663. },
  2664. getTreeList() {
  2665. return new Promise((resolve, reject) => {
  2666. org.tree().then((res) => {
  2667. if (res.success) {
  2668. resolve(res);
  2669. }
  2670. });
  2671. });
  2672. },
  2673. upload(data) {
  2674. this.formData.contentImage = data;
  2675. this.$refs.formName.validateField('contentImage');
  2676. },
  2677. houseData(argum, idx) {
  2678. this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
  2679. }
  2680. },
  2681. watch: {
  2682. // 解决右侧悬浮操作栏不对称问题
  2683. warehousingMaterialList: {
  2684. handler() {
  2685. this.$nextTick(() => {
  2686. this.$refs.warehousingMaterialListTable?.doLayout();
  2687. });
  2688. },
  2689. deep: true
  2690. },
  2691. // 解决右侧悬浮操作栏不对称问题
  2692. materialCodeReqList: {
  2693. handler() {
  2694. this.$nextTick(() => {
  2695. this.$refs.materialCodeReqListTable?.doLayout();
  2696. });
  2697. },
  2698. deep: true
  2699. },
  2700. // 解决右侧悬浮操作栏不对称问题
  2701. resultArray: {
  2702. handler() {
  2703. this.$nextTick(() => {
  2704. this.$refs.resultArrayTable?.doLayout();
  2705. });
  2706. },
  2707. deep: true
  2708. }
  2709. }
  2710. };
  2711. </script>
  2712. <style lang="scss" scoped>
  2713. ::v-deep .el-row {
  2714. display: flex;
  2715. flex-wrap: wrap;
  2716. }
  2717. ::v-deep.form-table {
  2718. .el-form-item {
  2719. margin-bottom: 0;
  2720. }
  2721. .el-input__inner {
  2722. padding: 0 10px;
  2723. }
  2724. ::-webkit-scrollbar {
  2725. width: 8px;
  2726. height: 8px;
  2727. background-color: transparent;
  2728. }
  2729. }
  2730. .p20 {
  2731. padding: 20px;
  2732. }
  2733. .el-select,
  2734. .el-date-editor {
  2735. width: 100%;
  2736. }
  2737. .el-form-item {
  2738. margin-bottom: 22px;
  2739. }
  2740. .material {
  2741. margin-top: 20px;
  2742. .flex {
  2743. display: flex;
  2744. justify-content: space-between;
  2745. font-size: 14px;
  2746. align-items: center;
  2747. .red {
  2748. color: #ff4949;
  2749. }
  2750. }
  2751. }
  2752. .mt10 {
  2753. margin-top: 10px;
  2754. }
  2755. .mt20 {
  2756. margin-top: 20px;
  2757. }
  2758. .center {
  2759. text-align: center;
  2760. }
  2761. .switch_left li {
  2762. border-right: 1px solid rgba(222, 222, 222, 1);
  2763. border-left: 1px solid rgba(222, 222, 222, 1);
  2764. }
  2765. .fontOmitted {
  2766. text-overflow: ellipsis;
  2767. overflow: hidden;
  2768. word-break: break-all;
  2769. white-space: nowrap;
  2770. }
  2771. .table-fixed {
  2772. .el-table__fixed-right {
  2773. height: 100% !important;
  2774. }
  2775. .el-table__fixed-left {
  2776. height: 100% !important;
  2777. }
  2778. .el-table__fixed {
  2779. height: 100% !important;
  2780. }
  2781. }
  2782. </style>