add_old.vue 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <el-form
  5. :model="formData"
  6. ref="formName"
  7. label-width="110px"
  8. :rules="rules"
  9. >
  10. <el-row :gutter="20">
  11. <!-- <el-col :span="8">
  12. <el-form-item label="出库单号" prop="bizNum">
  13. <el-input :value="formData.bizNum" disabled /></el-form-item
  14. ></el-col> -->
  15. <el-col :span="8">
  16. <el-form-item label="出库场景" prop="bizType">
  17. <el-select
  18. filterable
  19. placeholder="请选择"
  20. v-model="formData.bizType"
  21. clearable
  22. @change="handleBizSceneChange"
  23. :disabled="
  24. !!(warehousingMaterialList && warehousingMaterialList.length)
  25. "
  26. >
  27. <el-option
  28. v-for="item in outputSceneState"
  29. :key="item.code"
  30. :value="item.code + ''"
  31. :label="item.label"
  32. ></el-option>
  33. </el-select> </el-form-item
  34. ></el-col>
  35. <el-col :span="8">
  36. <el-form-item
  37. :label="
  38. formData.bizType == 3
  39. ? '销售发货单'
  40. : formData.bizType == 4
  41. ? '领料单'
  42. : formData.bizType == 1
  43. ? '采购退货单'
  44. : '来源单据'
  45. "
  46. prop="sourceBizNo"
  47. v-if="formData.extInfo.assetType == 7 && formData.bizType == 4"
  48. >
  49. <el-select
  50. filterable
  51. v-model="formData.sourceBizNo"
  52. :disabled="
  53. !!(formData.sourceBizNo && warehousingMaterialList.length)
  54. "
  55. clearable
  56. placeholder="请输入"
  57. @change="handleDocumentSourceChange"
  58. >
  59. <el-option
  60. v-for="item in options"
  61. :key="item"
  62. :label="item"
  63. :value="item"
  64. >
  65. </el-option> </el-select
  66. ></el-form-item>
  67. <el-form-item
  68. :label="
  69. formData.bizType == 3
  70. ? '销售发货单'
  71. : formData.bizType == 4
  72. ? '领料单'
  73. : formData.bizType == 1
  74. ? '采购退货单'
  75. : '来源单据'
  76. "
  77. v-else
  78. prop="sourceBizNo"
  79. >
  80. <el-input
  81. @input="$forceUpdate()"
  82. placeholder="请输入"
  83. @change="handleDocumentSourceChange"
  84. v-model="formData.sourceBizNo"
  85. @click.native="
  86. formData.bizType == 4
  87. ? handlePickorder()
  88. : formData.bizType == 3
  89. ? handleEom()
  90. : null
  91. "
  92. >
  93. <el-button
  94. v-if="formData.bizType == 4 || formData.bizType == 3"
  95. slot="append"
  96. icon="el-icon-circle-close"
  97. @click.stop="onClear"
  98. ></el-button>
  99. </el-input>
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="8">
  103. <el-form-item label="出库物品类型" prop="extInfo.assetType">
  104. <!-- <DictSelection
  105. dictName="类型用途"
  106. :disabled="
  107. !!(warehousingMaterialList && warehousingMaterialList.length)
  108. "
  109. clearable
  110. v-model="formData.extInfo.assetType"
  111. @itemChange="handleChange"
  112. /> -->
  113. <!-- <el-select
  114. :disabled="
  115. !!(warehousingMaterialList && warehousingMaterialList.length)
  116. "
  117. clearable
  118. v-model="formData.extInfo.assetType"
  119. @change="handleChanges"
  120. >
  121. <el-option
  122. v-for="(item, index) in codeList"
  123. :key="index"
  124. :label="item.dictValue"
  125. :value="item.dictCode"
  126. ></el-option>
  127. </el-select> -->
  128. <selectTree
  129. ref="trees"
  130. class="form-ipt"
  131. :isBindPlan="
  132. !!(warehousingMaterialList && warehousingMaterialList.length)
  133. "
  134. size="medium"
  135. style="width: 100%"
  136. clearable
  137. :options="codeList"
  138. :props="{
  139. value: 'id',
  140. label: 'name',
  141. children: 'children'
  142. }"
  143. @getValue="codeListValue"
  144. :isAll="false"
  145. />
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="8" v-if="formData.bizType == 3">
  149. <el-form-item label="客户名称">
  150. <el-input
  151. placeholder="客户名称"
  152. disabled
  153. v-model="formData.clientName"
  154. clearable /></el-form-item
  155. ></el-col>
  156. <el-col :span="8" v-if="formData.bizType == 3">
  157. <el-form-item label="客户联系人">
  158. <el-input
  159. placeholder="客户联系人"
  160. disabled
  161. v-model="formData.clientUser"
  162. clearable /></el-form-item
  163. ></el-col>
  164. <el-col :span="8" v-if="formData.bizType == 3">
  165. <el-form-item label="客户电话">
  166. <el-input
  167. placeholder="客户电话"
  168. disabled
  169. v-model="formData.clientPhone"
  170. clearable /></el-form-item
  171. ></el-col>
  172. <el-col :span="8">
  173. <el-form-item label="权属部门" prop="deptName">
  174. <el-input
  175. placeholder="权属部门"
  176. disabled
  177. v-model="formData.extInfo.deptName"
  178. clearable
  179. />
  180. </el-form-item>
  181. <!-- <selectTree
  182. ref="tree"
  183. style="width: 100%"
  184. size="medium"
  185. :initStr="formData.deptName"
  186. clearable
  187. :options="treeList"
  188. :props="{
  189. value: 'code',
  190. label: 'name',
  191. children: 'children'
  192. }"
  193. @getValue="deptClick"
  194. /> -->
  195. </el-col>
  196. <el-col :span="8">
  197. <el-form-item label="出库登记人">
  198. <el-input
  199. placeholder="登记人"
  200. disabled
  201. v-model="formData.extInfo.createUserName"
  202. clearable /></el-form-item
  203. ></el-col>
  204. <!-- <el-col :span="8">
  205. <el-form-item label="出库时间" prop="outInTime">
  206. <el-date-picker
  207. v-model="formData.outInTime"
  208. clearable
  209. type="datetime"
  210. value-format="yyyy-MM-dd HH:mm:ss"
  211. placeholder="选择日期"
  212. >
  213. </el-date-picker></el-form-item
  214. ></el-col> -->
  215. <el-col :span="8">
  216. <el-form-item label="领料人部门" prop="verifyDeptName">
  217. <selectTree
  218. ref="tree"
  219. class="form-ipt"
  220. size="medium"
  221. style="width: 100%"
  222. clearable
  223. :options="treeList"
  224. :props="{
  225. value: 'code',
  226. label: 'name',
  227. children: 'children'
  228. }"
  229. @getValue="auditorDeptClick"
  230. />
  231. </el-form-item>
  232. </el-col>
  233. <el-col :span="8">
  234. <el-form-item label="领料人" prop="fromUser">
  235. <el-select
  236. v-model="formData.fromUser"
  237. filterable
  238. placeholder="请选择领料人"
  239. >
  240. <el-option
  241. v-for="item in llrLsit"
  242. :key="item.id"
  243. :label="item.name"
  244. :value="item.id"
  245. @click.native="
  246. () => (formData.extInfo.fromUserPhone = item.phone)
  247. "
  248. >
  249. </el-option>
  250. </el-select> </el-form-item
  251. ></el-col>
  252. <el-col :span="8">
  253. <el-form-item label="领料人联系方式" prop="fromUserPhone">
  254. <el-input
  255. placeholder="请输入"
  256. disabled
  257. v-model="formData.extInfo.fromUserPhone"
  258. clearable /></el-form-item
  259. ></el-col>
  260. <!-- <el-col :span="8">
  261. <el-form-item label="紧急状态" prop="urgent">
  262. <el-select
  263. filterable
  264. placeholder="请选择"
  265. v-model="formData.extInfo.urgent"
  266. clearable
  267. >
  268. <el-option
  269. v-for="item in emergencyState"
  270. :key="item.code"
  271. :value="item.code"
  272. :label="item.label"
  273. ></el-option>
  274. </el-select> </el-form-item
  275. ></el-col> -->
  276. <!-- <el-col :span="8">
  277. <el-form-item label="审核人" prop="verifyId">
  278. <el-select
  279. filterable
  280. class="form-ipt"
  281. style="width: 100%"
  282. v-model="formData.verifyId"
  283. placeholder="请选择"
  284. >
  285. <el-option
  286. v-for="item in staffList"
  287. :key="item.id"
  288. :label="item.name"
  289. :value="item.id"
  290. @click.native="() => (formData.verifyName = item.name)"
  291. >
  292. </el-option>
  293. </el-select>
  294. </el-form-item>
  295. </el-col> -->
  296. <!-- <el-col :span="24">
  297. <el-form-item label="附件" prop="contentImage">
  298. <selectUpload @getImgs="upload" :initData="uploadList" />
  299. </el-form-item>
  300. </el-col> -->
  301. <el-col :span="24">
  302. <el-form-item label="备注" prop="remark">
  303. <el-input
  304. v-model="formData.remark"
  305. clearable
  306. type="textarea"
  307. placeholder="请详细说明"
  308. :rows="4"
  309. ></el-input>
  310. </el-form-item>
  311. </el-col>
  312. </el-row>
  313. </el-form>
  314. <div class="material">
  315. <div style="width: 100%; text-align: right"
  316. ><el-button type="primary" @click="addStock">添加</el-button></div
  317. >
  318. <div v-if="dimension != 4">
  319. <div class="flex">
  320. <div><span class="red">*</span>物品清单</div>
  321. <div>
  322. <!-- <el-button type="primary" @click="addStock">添加</el-button> -->
  323. </div>
  324. </div>
  325. <div class="mt10 form-table">
  326. <el-form
  327. ref="warehousingMaterialListRef"
  328. :model="{ warehousingMaterialList: warehousingMaterialList }"
  329. :show-message="false"
  330. >
  331. <el-table
  332. ref="warehousingMaterialListTable"
  333. :data="warehousingMaterialList"
  334. tooltip-effect="dark"
  335. style="width: 100%"
  336. :max-height="300"
  337. stripe
  338. :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
  339. >
  340. <el-table-column label="序号" type="index" width="50">
  341. </el-table-column>
  342. <el-table-column
  343. label="编码"
  344. prop="assetCode"
  345. width="150"
  346. :show-overflow-tooltip="true"
  347. ></el-table-column>
  348. <el-table-column
  349. label="名称"
  350. width="200"
  351. prop="assetName"
  352. :show-overflow-tooltip="true"
  353. ></el-table-column>
  354. <el-table-column
  355. v-for="(item, index) in tableHeader"
  356. :key="index"
  357. align="center"
  358. :label="item.label"
  359. :width="item.width"
  360. :prop="item.prop"
  361. :show-overflow-tooltip="true"
  362. >
  363. <template slot-scope="{ row }">
  364. <template v-if="item.formatter">{{
  365. item.formatter(row)
  366. }}</template>
  367. <template v-else>{{ row[item.prop] }}</template>
  368. </template>
  369. </el-table-column>
  370. <el-table-column
  371. label="批次号"
  372. prop="batchNo"
  373. ></el-table-column>
  374. <el-table-column label="最小包装单元" width="120">
  375. <template slot-scope="{ row }">
  376. {{ row.minPackingCount }}{{ row.measuringUnit }}/{{
  377. row.minUnit
  378. }}
  379. </template>
  380. </el-table-column>
  381. <el-table-column label="包装数量" prop="availableCountBase">
  382. <template slot-scope="{ row }">
  383. {{ row.packingCountBase }}{{ row.minUnit }}
  384. </template>
  385. </el-table-column>
  386. <el-table-column
  387. label="计量数量"
  388. prop="availableCountBase"
  389. ></el-table-column>
  390. <el-table-column
  391. label="计量单位"
  392. prop="measuringUnit"
  393. ></el-table-column>
  394. <el-table-column label="重量" prop="weight"></el-table-column>
  395. <el-table-column
  396. label="重量单位"
  397. prop="weightUnit"
  398. ></el-table-column>
  399. <el-table-column
  400. label="仓库"
  401. width="300"
  402. prop="pathName"
  403. :show-overflow-tooltip="true"
  404. ></el-table-column>
  405. <!-- <el-table-column
  406. label="出库数量"
  407. prop=""
  408. align="center"
  409. width="350px"
  410. >
  411. <template slot-scope="{ row, $index }">
  412. <el-row :gutter="4">
  413. <el-col :span="9" v-if="!row.isUnpack">
  414. <el-input type="text" disabled :value="row.outInNum">
  415. <template slot="append">
  416. {{ row.minPackUnit }}
  417. </template>
  418. </el-input>
  419. </el-col>
  420. <el-col :span="6">
  421. <el-button type="text" @click="handleSetting(row, $index)"
  422. >出库明细选择</el-button
  423. ></el-col
  424. >
  425. </el-row>
  426. </template>
  427. </el-table-column> -->
  428. <el-table-column fixed="right" label="操作" width="200">
  429. <template slot-scope="{ row, $index }">
  430. <el-button type="text" @click="listDel(row, $index)"
  431. >删除</el-button
  432. >
  433. </template>
  434. </el-table-column>
  435. </el-table>
  436. </el-form>
  437. </div>
  438. <div class="flex" style="margin-top: 20px">
  439. <div><span class="red">*</span>包装清单</div>
  440. </div>
  441. <div class="mt10 form-table">
  442. <BatchDetail
  443. :assetType="formData.extInfo.assetType"
  444. :data="batchDetailsVOList"
  445. />
  446. </div>
  447. </div>
  448. <!-- <div class="flex" style="margin-top: 20px">
  449. <div><span class="red">*</span>包装清单</div>
  450. </div>
  451. <div class="mt10 form-table">
  452. <BatchDetail
  453. :assetType="formData.extInfo.assetType"
  454. :codeObj="{ name: '包装编码', prop: 'code' }"
  455. :nameObj="{ name: '名称', prop: 'name' }"
  456. />
  457. </div> -->
  458. <div class="mt20">
  459. <el-tabs v-model="activeName" type="card">
  460. <el-tab-pane :label="`${title}明细`" name="a">
  461. <el-table
  462. ref="multipleTable"
  463. :data="materialCodeReqList"
  464. tooltip-effect="dark"
  465. style="width: 100%"
  466. :max-height="300"
  467. stripe
  468. :header-cell-style="rowClass"
  469. >
  470. <el-table-column label="序号" type="index" width="50">
  471. </el-table-column>
  472. <el-table-column
  473. :label="`编码`"
  474. min-width="100"
  475. prop="assetCode"
  476. :show-overflow-tooltip="true"
  477. ></el-table-column>
  478. <el-table-column
  479. label="名称"
  480. prop="name"
  481. width="200"
  482. :show-overflow-tooltip="true"
  483. >
  484. </el-table-column>
  485. <el-table-column label="批次号" prop="batchNo">
  486. </el-table-column>
  487. <el-table-column
  488. v-if="dimension == 4"
  489. label="包装编码"
  490. min-width="100"
  491. prop="onlyCode"
  492. :show-overflow-tooltip="true"
  493. ></el-table-column>
  494. <el-table-column
  495. v-for="(item, index) in tableHeader"
  496. :key="index"
  497. align="center"
  498. :label="item.label"
  499. :width="item.width"
  500. :prop="item.prop"
  501. :show-overflow-tooltip="true"
  502. >
  503. <template slot-scope="{ row }">
  504. <template v-if="item.formatter">{{
  505. item.formatter(row)
  506. }}</template>
  507. <template v-else>{{ row[item.prop] }}</template>
  508. </template>
  509. </el-table-column>
  510. <el-table-column
  511. label="物料编码"
  512. width="250"
  513. prop="no"
  514. :show-overflow-tooltip="true"
  515. ></el-table-column>
  516. <!-- <el-table-column label="生产日期" width="200">
  517. <template slot-scope="{ row }">
  518. <span v-if="row.dateType === 2">
  519. {{ row.produceTime }}
  520. </span>
  521. </template>
  522. </el-table-column>
  523. <el-table-column label="采购日期" width="200">
  524. <template slot-scope="{ row }">
  525. <span v-if="row.dateType === 1">
  526. {{ row.procureTime }}
  527. </span>
  528. </template>
  529. </el-table-column> -->
  530. <el-table-column label="计量数量" prop="">
  531. <template slot-scope="{ row }">1</template>
  532. </el-table-column>
  533. <el-table-column
  534. label="计量单位"
  535. prop="measuringUnit"
  536. ></el-table-column>
  537. <el-table-column label="物料代号" prop="materielCode">
  538. </el-table-column>
  539. <el-table-column
  540. label="客户代号"
  541. prop="clientCode"
  542. ></el-table-column>
  543. <el-table-column label="刻码" prop="engrave"></el-table-column>
  544. <el-table-column label="重量" prop="weight"></el-table-column>
  545. <el-table-column
  546. label="重量单位"
  547. prop="weightUnit"
  548. ></el-table-column>
  549. <!-- <el-table-column
  550. label="货位"
  551. prop="pathName"
  552. show-overflow-tooltip
  553. >
  554. </el-table-column>
  555. <el-table-column label="转消耗" prop="">
  556. <template slot-scope="{ row }">
  557. <el-checkbox v-model="row.isTransferAsset"></el-checkbox>
  558. </template>
  559. </el-table-column> -->
  560. </el-table>
  561. </el-tab-pane>
  562. </el-tabs>
  563. </div>
  564. </div>
  565. <div class="center mt20">
  566. <el-button type="primary" @click="handleNewSave" :loading="saveLoading"
  567. >保存</el-button
  568. >
  569. <el-button @click="$router.go(-1)">返回</el-button>
  570. </div>
  571. </el-card>
  572. <AssetsDialog
  573. ref="assetsDialogRef"
  574. :title="title"
  575. :warehousingMaterialList="selectionList"
  576. :assetType="formData.extInfo.assetType"
  577. @detailData="detailData"
  578. />
  579. <!-- @selectTableData="onSelectTableData" -->
  580. <!-- 选桶号 -->
  581. <detailSelect
  582. ref="detailSelectRef"
  583. :title="title"
  584. :tableHeader="tableHeader"
  585. />
  586. <!-- 转资产 -->
  587. <!-- <TurnToAsset ref="turnToAssetRef" /> -->
  588. <!-- 选择仓库 -->
  589. <WareHouseDailog ref="wareHouseDailogRef"></WareHouseDailog>
  590. <!-- 选领料单 -->
  591. <pickOrder ref="pickOrderRef" @success="pickOrderRow" />
  592. <!-- 销售订单 -->
  593. <eom ref="eomRef" @success="eomSuccess" />
  594. </div>
  595. </template>
  596. <script>
  597. import outin from '@/api/warehouseManagement/outin';
  598. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  599. import {
  600. getTreeByPid,
  601. getTreeByGroup,
  602. getProductList
  603. } from '@/api/classifyManage';
  604. import selectUpload from '@/components/selectUpload';
  605. import upload from '@/components/uploadImg';
  606. import pickOrder from './components/pickOrder.vue';
  607. import {
  608. warehousingType,
  609. outputSceneState,
  610. emergencyState,
  611. materialType
  612. } from '@/utils/dict/index';
  613. import selectTree from '@/components/selectTree';
  614. import AssetsDialog from '../components/AssetsDialog.vue';
  615. import outputType from '../components/outputType.vue';
  616. // import TurnToAsset from '../components/TurnToAsset/index.vue'
  617. import WareHouseDailog from '../components/WareHouseDailog.vue';
  618. // import supplier from '@/api/main/supplier';
  619. // import org from '@/api/main/org';
  620. // import user from '@/api/main/user';
  621. import { tableHeader } from '../common';
  622. import detailSelect from './components/detailSelect';
  623. import eom from './components/eom.vue';
  624. import BatchDetail from './components/batchDetail.vue';
  625. import { watch } from 'ele-admin/lib/ele-pro-table';
  626. export default {
  627. components: {
  628. BatchDetail,
  629. pickOrder,
  630. selectUpload,
  631. selectTree,
  632. AssetsDialog,
  633. WareHouseDailog,
  634. upload,
  635. detailSelect,
  636. // TurnToAsset,
  637. outputType,
  638. eom
  639. },
  640. data() {
  641. return {
  642. dimension: '3',
  643. llList: [],
  644. codeList: [],
  645. materialType,
  646. warehousingType,
  647. outputSceneState,
  648. emergencyState,
  649. saveLoading: false,
  650. title: '',
  651. tableData2: [],
  652. uploadList: [],
  653. fromUserList: [], //人员数组
  654. warehousingMaterialList: [],
  655. activeName: 'a',
  656. treeList: [],
  657. staffList: [],
  658. formData: {
  659. extInfo: {
  660. assetType: '', //物品类型
  661. deptCode: '', //部门code
  662. deptName: '', //部门名称
  663. verifyDeptCode: '', //审核部门编码
  664. verifyDeptName: '', //审核部门名称
  665. deliveryName: '', //送货人名称
  666. fromUserPhone: '', //送货人电话
  667. sourceBizNo: '', //销售订单
  668. urgent: '', //紧急状态
  669. supplierId: '', //供应商ID
  670. supplierName: '', //供应商名称
  671. createUserName: '', //创建人名字
  672. contentImage: [] //图片数组
  673. },
  674. fromUser: '', //送货人
  675. bizType: '', //物品类型
  676. verifyId: '', //审核人Id
  677. verifyName: '', //审核人名称
  678. createUserId: '',
  679. remark: ''
  680. },
  681. rules: {
  682. // 'extInfo.assetType': {
  683. // required: true,
  684. // message: '请选择出库产品类型',
  685. // trigger: 'change'
  686. // },
  687. bizType: {
  688. required: true,
  689. message: '请选择出库场景',
  690. trigger: 'change'
  691. },
  692. fromUser: {
  693. required: true,
  694. message: '请选择领料人',
  695. trigger: 'change'
  696. }
  697. // verifyDeptName: {
  698. // required: true,
  699. // message: '请选择领料部门',
  700. // trigger: 'blur'
  701. // }
  702. },
  703. llrLsit: [],
  704. options: [],
  705. loading: false,
  706. onSelectTableDataVal: [],
  707. batchDetailsVOList: [],
  708. materialCodeReqList: [],
  709. selectionList: [],
  710. // shouldTriggerPickorder: true,
  711. materialObj: {},
  712. wlParams: {}
  713. };
  714. },
  715. computed: {
  716. tableHeader() {
  717. return tableHeader(this.formData.extInfo.assetType);
  718. }
  719. // 条码信息
  720. // materialCodeReqList() {
  721. // return this.warehousingMaterialList
  722. // .map((i) => i.warehouseLedgerDetails || [])
  723. // .flat();
  724. // }
  725. },
  726. created() {
  727. this.initData();
  728. },
  729. methods: {
  730. detailData(data, dimension) {
  731. this.dimension = dimension;
  732. console.log('总数居', data);
  733. this.onSelectTableDataVal = data.realTimeInventoryVOList;
  734. this.warehousingMaterialList = data.realTimeInventoryVOList.map(
  735. (next) => {
  736. delete next.updateTime;
  737. delete next.createTime;
  738. return {
  739. ...next,
  740. realInventoryAmount: 0,
  741. assetType: this.formData.extInfo.assetType,
  742. outInNum: '',
  743. assetCode: next.code,
  744. assetName: next.name,
  745. bizStatus: 2,
  746. contactCode: next.contactCode
  747. };
  748. }
  749. );
  750. // this.batchDetailsVOList = data.batchDetailsVOList;
  751. if (dimension == 4) {
  752. this.materialCodeReqList = data.wlList;
  753. this.selectionList = data.wlList;
  754. let params = {
  755. realTimeInventoryNewPOList: data.realTimeInventoryVOList
  756. };
  757. for (const item of params.realTimeInventoryNewPOList) {
  758. item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
  759. for (const detail of item.inventoryDetailsNewPOList) {
  760. detail.outInMaterialDetailsAddPOList = [];
  761. for (const wlItem of data.wlList) {
  762. if (detail.id === wlItem.recordId) {
  763. detail.outInMaterialDetailsAddPOList.push({
  764. ...wlItem
  765. });
  766. }
  767. }
  768. }
  769. }
  770. this.wlParams = params;
  771. this.materialObj = data;
  772. } else if (dimension == 3) {
  773. //包装维度出库
  774. const list = data.realTimeInventoryVOList;
  775. //获取包装维度
  776. let packArr = [];
  777. for (const item of list) {
  778. if (item.inventoryDetailsVOList.length != 0) {
  779. for (const iterator of item.inventoryDetailsVOList) {
  780. packArr.push({ ...iterator, batchNo: iterator.batchNum });
  781. }
  782. }
  783. }
  784. this.batchDetailsVOList = packArr.map((item) => {
  785. return {
  786. ...item,
  787. packingCountBase:
  788. dimension == 4 || dimension == 3 ? 1 : item.packingCountBase
  789. // weight: 0
  790. };
  791. });
  792. //物料维度数据
  793. let meteArr = [];
  794. for (const item of packArr) {
  795. if (item.materialDetailsVOList.length != 0) {
  796. for (const iterator of item.materialDetailsVOList) {
  797. meteArr.push({
  798. ...iterator
  799. });
  800. }
  801. }
  802. }
  803. this.materialCodeReqList = meteArr;
  804. //再次打开选择上
  805. this.selectionList = list;
  806. //send数据
  807. this.wlParams = { realTimeInventoryNewPOList: list };
  808. this.wlParams.realTimeInventoryNewPOList.forEach((item) => {
  809. item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
  810. item.inventoryDetailsNewPOList.forEach((ite) => {
  811. // ite.weight = 0;
  812. ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList;
  813. });
  814. });
  815. } else {
  816. // else if (dimension == 2) {
  817. // this.batchDetailsVOList = data.wlList;
  818. // this.selectionList = data.wlList;
  819. // }
  820. //物品维度出库
  821. console.log(data);
  822. const list = data.realTimeInventoryVOList;
  823. //获取包装维度
  824. let packArr = [];
  825. for (const item of list) {
  826. if (item.inventoryDetailsVOList.length != 0) {
  827. for (const iterator of item.inventoryDetailsVOList) {
  828. packArr.push({ ...iterator, batchNo: iterator.batchNum });
  829. }
  830. }
  831. }
  832. this.batchDetailsVOList = packArr.map((item) => {
  833. return {
  834. ...item,
  835. packingCountBase: dimension == 3 ? 1 : item.packingCountBase
  836. // weight: 0
  837. };
  838. });
  839. //物料维度数据
  840. let meteArr = [];
  841. for (const item of packArr) {
  842. if (item.materialDetailsVOList.length != 0) {
  843. for (const iterator of item.materialDetailsVOList) {
  844. meteArr.push({
  845. ...iterator
  846. });
  847. }
  848. }
  849. }
  850. this.materialCodeReqList = meteArr;
  851. //再次打开选择上
  852. this.selectionList = list;
  853. //send数据
  854. this.wlParams = { realTimeInventoryNewPOList: list };
  855. this.wlParams.realTimeInventoryNewPOList.forEach((item) => {
  856. item.inventoryDetailsNewPOList = item.inventoryDetailsVOList;
  857. item.inventoryDetailsNewPOList.forEach((ite) => {
  858. // ite.weight = 0;
  859. ite.outInMaterialDetailsAddPOList = ite.materialDetailsVOList;
  860. });
  861. });
  862. }
  863. },
  864. handleNewSave() {
  865. this.$refs.formName.validate(async (valid) => {
  866. if (valid) {
  867. if (!this.warehousingMaterialList?.length) {
  868. return this.$message.error('请添加出库明细!');
  869. }
  870. let obj = { ...this.formData, type: 2 };
  871. obj.extInfo.sourceBizNo = obj.sourceBizNo;
  872. // obj.fromId=
  873. obj.fromType = obj.type;
  874. this.saveLoading = true;
  875. obj = { ...obj, ...this.wlParams };
  876. if (this.dimension == 4) {
  877. obj.num = this.materialObj.wlList.length;
  878. } else {
  879. obj.num = this.materialCodeReqList.length;
  880. }
  881. console.log('2222', obj);
  882. try {
  883. const res = await outin.saveNew(obj);
  884. if (res.code == 0) {
  885. await await outin.outApprove({ outInId: res.data });
  886. this.$message.success('保存成功!');
  887. }
  888. this.$router.push('/warehouseManagement/outgoingManagement');
  889. if (res?.success) {
  890. this.$message.success('保存成功!');
  891. this.$router.go(-1);
  892. }
  893. this.saveLoading = false;
  894. } catch (error) {
  895. this.saveLoading = false;
  896. }
  897. }
  898. });
  899. },
  900. onClear() {
  901. this.formData.sourceBizNo = '';
  902. this.warehousingMaterialList = [];
  903. this.$refs.trees.valueTitle = '';
  904. this.formData.clientName = '';
  905. this.formData.clientUser = '';
  906. this.formData.clientPhone = '';
  907. this.title = '';
  908. this.$forceUpdate();
  909. },
  910. async eomSuccess(row) {
  911. console.log(row);
  912. this.formData.extInfo.assetType = 9;
  913. this.$refs.trees.valueTitle = '产品';
  914. this.title = '产品';
  915. this.formData.sourceBizNo = row.orderNo;
  916. this.formData.sid = row.id;
  917. this.formData.fromId = row.id;
  918. this.formData.clientName = row.contactName;
  919. this.formData.clientUser = row.linkName;
  920. this.formData.clientPhone = row.linkPhone;
  921. console.log('==sasa', row.tableData);
  922. this.onSelectTableData(await this.serachMainCode(row.tableData), 1);
  923. this.$forceUpdate();
  924. },
  925. async serachMainCode(arr) {
  926. let newArr = [];
  927. // 使用 Promise.all 来等待所有异步操作完成
  928. await Promise.all(
  929. arr.map(async (item) => {
  930. const data = await getProductList({
  931. pageNum: 1,
  932. size: 10,
  933. categoryLevelId: item.productCategoryId,
  934. code: item.code
  935. });
  936. newArr.push(data.list); // 将结果存储到 newArr 中
  937. })
  938. );
  939. let re = [];
  940. for (const item of newArr) {
  941. for (const it of item) {
  942. re.push(it);
  943. }
  944. }
  945. return re.map((item) => {
  946. return {
  947. ...item,
  948. minUnit: item.packingUnit,
  949. assetCode: item.code,
  950. assetName: item.name
  951. };
  952. });
  953. },
  954. async pickOrderRow(row) {
  955. this.formData.sid = row.id;
  956. row.tableData = [];
  957. this.formData.sourceBizNo = row.code;
  958. for (const key in row.orderInfoList) {
  959. if (row.orderInfoList[key].bomDetailDTOS.length != 0) {
  960. for (const i in row.orderInfoList[key].bomDetailDTOS) {
  961. row.tableData.push({
  962. ...row.orderInfoList[key].bomDetailDTOS[i],
  963. code: row.orderInfoList[key].bomDetailDTOS[i].categoryCode,
  964. name: row.orderInfoList[key].bomDetailDTOS[i].categoryName,
  965. modelType: row.orderInfoList[key].bomDetailDTOS[i].model,
  966. id: row.orderInfoList[key].bomDetailDTOS[i].categoryId
  967. });
  968. }
  969. }
  970. if (row.orderInfoList[key].instanceList.length != 0) {
  971. for (const j in row.orderInfoList[key].instanceList) {
  972. row.tableData.push({
  973. ...row.orderInfoList[key].instanceList[j],
  974. code: row.orderInfoList[key].instanceList[j].categoryCode,
  975. name: row.orderInfoList[key].instanceList[j].categoryName,
  976. modelType: row.orderInfoList[key].instanceList[j].model,
  977. id: row.orderInfoList[key].instanceList[j].instanceId
  978. });
  979. }
  980. }
  981. }
  982. const uniqueItems = [];
  983. const uniqueIds = new Set();
  984. row.tableData.forEach((item) => {
  985. if (!uniqueIds.has(item.code)) {
  986. uniqueIds.add(item.code);
  987. uniqueItems.push(item);
  988. }
  989. });
  990. row.tableData = uniqueItems;
  991. console.log(row);
  992. this.onSelectTableData(await this.serachMainCode(row.tableData), 1);
  993. this.selectTop(row);
  994. this.$forceUpdate();
  995. },
  996. async selectTop(row) {
  997. let list = row.tableData;
  998. let arr = [];
  999. for (const it of list) {
  1000. arr.push({
  1001. categoryLevelId: it.rootCategoryLevelId,
  1002. code: it.code,
  1003. count: it.demandQuantity
  1004. });
  1005. }
  1006. const data = await outin.getDetailByCode(arr);
  1007. console.log('===', data);
  1008. },
  1009. handleEom() {
  1010. this.$refs.eomRef.open();
  1011. },
  1012. handlePickorder() {
  1013. this.$refs.pickOrderRef.open();
  1014. },
  1015. async handleDocumentSourceChange() {
  1016. // this.formData.sourceBizNo = '';
  1017. if (!this.formData.sourceBizNo) {
  1018. if (this.formData.bizType == 4) {
  1019. this.warehousingMaterialList = [];
  1020. }
  1021. return;
  1022. }
  1023. if (
  1024. !(this.formData.extInfo.assetType == 7 && this.formData.bizType == 4)
  1025. ) {
  1026. return;
  1027. }
  1028. const loading = this.$loading({ fullscreen: true });
  1029. const res = await getSparePartsInfo({
  1030. code: this.formData.sourceBizNo
  1031. });
  1032. if (res?.success && res.data.length) {
  1033. const curMap = {
  1034. assetId: 'classificationId',
  1035. assetCode: 'informationCode', //编码
  1036. assetName: 'informationName', //名称
  1037. materialId: 'classificationId',
  1038. materialName: 'informationName',
  1039. batchNo: '', //批次号
  1040. unit: 'measuringUnit', //单位
  1041. minPackUnit: 'packingUnit' //最小包装单位
  1042. };
  1043. res.data.forEach((item) => {
  1044. let obj = {};
  1045. for (const key in curMap) {
  1046. obj[key] = curMap[key] ? item[curMap[key]] : '';
  1047. }
  1048. obj.curId =
  1049. obj.assetCode +
  1050. (obj.measurementUnit || '') +
  1051. (obj.minPackUnit || '') +
  1052. (obj.unit || '');
  1053. console.log(obj.curId);
  1054. const index = this.warehousingMaterialList.findIndex(
  1055. (i) => i.curId === obj.curId
  1056. );
  1057. if (index === -1) {
  1058. Object.assign(obj, item);
  1059. obj.sparePartsNum = item.num;
  1060. this.warehousingMaterialList.push(obj);
  1061. } else {
  1062. this.warehousingMaterialList[index].sparePartsNum = item.num;
  1063. }
  1064. });
  1065. }
  1066. loading.close();
  1067. },
  1068. // 备品备件来源单号
  1069. async remoteMethod(code) {
  1070. // if (code !== '') {
  1071. // this.loading = true
  1072. const res = await getDocumentSource({ code });
  1073. if (res?.success) {
  1074. this.options = res.data;
  1075. }
  1076. // this.loading = false
  1077. // } else {
  1078. // this.options = []
  1079. // }
  1080. },
  1081. rowClass({ row, column, rowIndex, columnIndex }) {
  1082. if (rowIndex === 1) {
  1083. return {
  1084. display: 'none',
  1085. background: '#EEEEEE',
  1086. border: 'none'
  1087. };
  1088. }
  1089. return { background: '#EEEEEE', border: 'none' };
  1090. },
  1091. // 部门 点击事件
  1092. async auditorDeptClick(data) {
  1093. console.log(data);
  1094. this.formData.extInfo.verifyDeptCode = data?.id;
  1095. this.formData.extInfo.verifyDeptName = data?.name;
  1096. this.formData.verifyId = '';
  1097. this.formData.verifyName = '';
  1098. this.$refs.formName.validateField('verifyDeptName');
  1099. if (data) {
  1100. this.getStaffList(data);
  1101. }
  1102. },
  1103. async getStaffList(data) {
  1104. let res = await warehouseDefinition.getUserPage({
  1105. groupId: data.id,
  1106. size: 9999,
  1107. page: 1
  1108. });
  1109. this.llrLsit = res.list;
  1110. },
  1111. // // 转资产
  1112. // turnToAssets (row) {
  1113. // this.$refs.turnToAssetRef
  1114. // .open(row.transferCurVal)
  1115. // .then(({ code, name }) => {
  1116. // row.transferType = name
  1117. // row.materialId = code
  1118. // row.materialName = name.split('/').pop()
  1119. // row.transferType = name
  1120. // this.$set(row, 'transferCurVal', code)
  1121. // })
  1122. // },
  1123. handleSetting(row) {
  1124. row.bizTypes = this.formData.bizType;
  1125. row.type = this.formData.bizType == 3 ? 1 : 0;
  1126. this.$refs.detailSelectRef
  1127. .open(row, row.warehouseLedgerDetails || [])
  1128. .then((res) => {
  1129. console.log(res);
  1130. console.log(row);
  1131. this.$set(
  1132. row,
  1133. 'warehouseLedgerDetails',
  1134. (res || []).map((item) => {
  1135. delete item.updateTime;
  1136. delete item.createTime;
  1137. this.$set(item, 'isTransferAsset', false);
  1138. item.isUnpack = row.isUnpack;
  1139. return item;
  1140. })
  1141. );
  1142. this.$set(row, 'outInNum', res.length);
  1143. this.$set(row, 'minPackUnit', res[0].minPackUnit);
  1144. this.$set(
  1145. row,
  1146. 'selfSum',
  1147. row.warehouseLedgerDetails.reduce((sum, pre) => {
  1148. if (row.isUnpack) {
  1149. return ++sum;
  1150. }
  1151. return sum + pre.measurementUnit;
  1152. }, 0)
  1153. );
  1154. });
  1155. },
  1156. // 仓库编辑
  1157. handleWareHouse(row) {
  1158. this.$refs.wareHouseDailogRef.open(row);
  1159. },
  1160. // 出库操作
  1161. listEdit(row) {
  1162. this.$set(row, 'isSave', false);
  1163. },
  1164. //出库明细删除
  1165. listDel(row, index) {
  1166. this.warehousingMaterialList.splice(index, 1);
  1167. if (this.warehousingMaterialList.length == 0) {
  1168. this.formData.sourceBizNo = '';
  1169. this.formData.extInfo.clientName = '';
  1170. this.formData.extInfo.clientUser = '';
  1171. this.formData.extInfo.clientUserPhone = '';
  1172. }
  1173. // 从 this.batchDetailsVOList 中删除满足条件的对象
  1174. this.removeItemsFromArray(
  1175. this.batchDetailsVOList,
  1176. (item) => item.code.substr(0, 12) === row.code
  1177. );
  1178. // 从 this.materialCodeReqList 中删除满足条件的对象
  1179. this.removeItemsFromArray(
  1180. this.materialCodeReqList,
  1181. (item) => item.assetCode === row.code
  1182. );
  1183. },
  1184. // 删除数组中满足条件的对象
  1185. removeItemsFromArray(arr, condition) {
  1186. for (let i = arr.length - 1; i >= 0; i--) {
  1187. if (condition(arr[i])) {
  1188. arr.splice(i, 1);
  1189. }
  1190. }
  1191. },
  1192. // 出库明细生成条码信息
  1193. async createMaterialCode(row) {
  1194. let arr = [];
  1195. const res = await getAssetNum({
  1196. assetCode: row.assetCode,
  1197. num: row.outInNum || 1
  1198. });
  1199. if (res?.success) {
  1200. delete row.createTime;
  1201. arr = Array.from(new Array(res.data.length), (val, idx) => ({
  1202. ...row,
  1203. num: res.data[idx],
  1204. bizStatus: 2,
  1205. isTransferAsset: false
  1206. }));
  1207. }
  1208. return arr;
  1209. },
  1210. handleSave() {
  1211. this.$refs.formName.validate(async (valid) => {
  1212. if (valid) {
  1213. if (!this.warehousingMaterialList?.length) {
  1214. return this.$message.error('请添加出库明细!');
  1215. } else if (
  1216. this.warehousingMaterialList.some(
  1217. (item) => !item.warehouseLedgerDetails?.length
  1218. )
  1219. ) {
  1220. return this.$message.error('请完善出库明细数据!');
  1221. }
  1222. console.log('qqqq===>', this.warehousingMaterialList);
  1223. let arr = this.warehousingMaterialList.map((item) => {
  1224. return {
  1225. batchNo: item.batchNo,
  1226. categoryId: item.id,
  1227. count: item.outInNum,
  1228. num: item.outInNum,
  1229. minPackingCount: item.selfSum,
  1230. packingCount: item.outInNum,
  1231. outInDetailRecordAddPOList: item.warehouseLedgerDetails,
  1232. ...item
  1233. // position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
  1234. // // pathIds: item.categoryLevelPathId.toString(),
  1235. // pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
  1236. // totalMoney:
  1237. // item.outInNum * item.minPackingCount * item.univalence
  1238. };
  1239. });
  1240. arr.forEach((item) => {
  1241. item.warehouseId =
  1242. item.warehouseLedgerDetails[0].pathIds.split(',')[0];
  1243. delete item.id;
  1244. delete item.warehouseLedgerDetails;
  1245. if (item.outInDetailRecordAddPOList.length > 0) {
  1246. let list = item.outInDetailRecordAddPOList.map((it) => {
  1247. return {
  1248. positionId: it.positionId,
  1249. code: it.sourceBizNo,
  1250. dateType: it.dateType,
  1251. dateValue: it.dateValue,
  1252. minUnit: it.minUnit,
  1253. batchNo: it.sourceBatchNo,
  1254. position: it.pathName,
  1255. // minPositionId: it.cargoSpaceId,
  1256. minPositionId: it.minPositionId,
  1257. name: it.name,
  1258. pathIds: it.pathIds,
  1259. unit: it.unit,
  1260. packageNo: it.packageNo,
  1261. minPackingCount: it.minPackingCount,
  1262. procureTime: it.procureTime,
  1263. produceTime: it.produceTime
  1264. // num: it.minPackingCount
  1265. };
  1266. });
  1267. item.outInDetailRecordAddPOList = list;
  1268. }
  1269. });
  1270. let obj = { ...this.formData, type: 2 };
  1271. for (const key in arr) {
  1272. arr[key].count = arr[key].outInNum;
  1273. }
  1274. obj.outInDetailAddPOList = arr;
  1275. obj.extInfo.sourceBizNo = obj.sourceBizNo;
  1276. obj.fromType = obj.type;
  1277. this.saveLoading = true;
  1278. // console.log('明细', this.warehousingMaterialList);
  1279. // const categoryLevelId = this.$refs.assetsDialogRef.materialType;
  1280. // let newObj = {
  1281. // inOutAddPO: {
  1282. // ...this.formData,
  1283. // ...this.formData.extInfo,
  1284. // bizStatus: 2
  1285. // },
  1286. // warehouseLedgerInfos: this.handelArr(
  1287. // this.warehousingMaterialList,
  1288. // categoryLevelId
  1289. // )
  1290. // };
  1291. // delete newObj.inOutAddPO.extInfo;
  1292. console.log('2222', obj);
  1293. const res = await outin.save(obj);
  1294. if (res.code == 0) {
  1295. this.$message.success('保存成功!');
  1296. }
  1297. this.saveLoading = false;
  1298. this.$router.push('/warehouseManagement/outgoingManagement');
  1299. if (res?.success) {
  1300. this.$message.success('保存成功!');
  1301. this.$router.go(-1);
  1302. }
  1303. }
  1304. });
  1305. },
  1306. handelArr(arr, id) {
  1307. for (const key in arr) {
  1308. arr[key].inLedgerId = arr[key].id;
  1309. arr[key].categoryLevelId = id;
  1310. for (const k in arr[key].warehouseLedgerDetails) {
  1311. arr[key].warehouseLedgerDetails[k].ledgerDetailId =
  1312. arr[key].warehouseLedgerDetails[k].id;
  1313. arr[key].warehouseLedgerDetails[k].inDetailId = arr[key].inLedgerId;
  1314. arr[key].warehouseLedgerDetails[k].isTransferAsset = arr[key]
  1315. .warehouseLedgerDetails[k].isTransferAsset
  1316. ? 1
  1317. : 0;
  1318. arr[key].warehouseLedgerDetails[k].bizStatus = 2;
  1319. }
  1320. }
  1321. return arr;
  1322. // let newArr = arr.map((item) => {
  1323. // return { ...item, ledgerId: item.id };
  1324. // });
  1325. // newArr.map((item) => {
  1326. // item.warehouseLedgerDetails.map((ite) => {
  1327. // return { ...ite, ledgerDetailId: ite.id, ledgerId: item.id };
  1328. // });
  1329. // });
  1330. // return newArr;
  1331. },
  1332. //添加明细
  1333. onSelectTableData(val, e) {
  1334. // if (e == 1) {
  1335. // this.llList = val;
  1336. // } else {
  1337. // this.llList = [];
  1338. // }
  1339. // .concat(this.llList)
  1340. // if (this.warehousingMaterialList.length != 0) {
  1341. // val = this.warehousingMaterialList.concat(val);
  1342. // }
  1343. this.onSelectTableDataVal = val;
  1344. this.warehousingMaterialList = val.map((next) => {
  1345. delete next.updateTime;
  1346. delete next.createTime;
  1347. return {
  1348. ...next,
  1349. realInventoryAmount: 0,
  1350. // cargoSpaceCode: '', //货位编码
  1351. // cargoSpaceId: '', //货位id
  1352. // shelfId: '', //货架id
  1353. // shelfCode: '', //货架名称
  1354. // areaId: '', //库区id
  1355. // areaName: '', //库区名称
  1356. // warehouseId: '', //仓库id
  1357. // warehouseName: '', //仓库名称
  1358. assetType: this.formData.extInfo.assetType,
  1359. outInNum: '',
  1360. assetCode: next.code,
  1361. assetName: next.name,
  1362. bizStatus: 2,
  1363. contactCode: next.contactCode
  1364. };
  1365. });
  1366. console.log('sasasasa===>>>', this.warehousingMaterialList);
  1367. },
  1368. codeListValue(val) {
  1369. console.log(val);
  1370. this.formData.extInfo.assetType = val.id;
  1371. this.$forceUpdate();
  1372. this.title = val?.name;
  1373. this.selectEquiType = val?.id;
  1374. console.log(this.title);
  1375. },
  1376. async initData() {
  1377. const { data } = await getTreeByGroup({ type: 2 });
  1378. this.codeList = data;
  1379. const res = await warehouseDefinition.tree();
  1380. this.treeList = this.$util.toTreeData({
  1381. data: res,
  1382. idField: 'id',
  1383. parentIdField: 'parentId'
  1384. });
  1385. let res22 = await warehouseDefinition.getUserPage({
  1386. size: -1,
  1387. page: 1
  1388. });
  1389. this.fromUserList = res22.list;
  1390. // const res111 = await warehouseDefinition.list();
  1391. // this.warehouseList = res111.list;
  1392. console.log('res=====', res);
  1393. const info = JSON.parse(localStorage.getItem('info'));
  1394. console.log('info=====', info);
  1395. let obj = res.find(
  1396. (item) => item.id === info.deptId[info.deptId.length - 1]
  1397. );
  1398. console.log('obj=====', obj);
  1399. this.formData.extInfo.deptName = obj?.name;
  1400. this.formData.extInfo.deptCode = obj?.id;
  1401. this.formData.extInfo.createUserName = info.name;
  1402. this.formData.createUserId = info.userId;
  1403. },
  1404. addStock() {
  1405. if (!this.title) return this.$message.error('请选择出库产品类型');
  1406. if (!this.formData.bizType && this.formData.bizType !== 0)
  1407. return this.$message.error('请选择出库场景');
  1408. // if (this.formData.bizType == 4&& !this.formData.sourceBizNo) {
  1409. // return this.$message.error('请选择来源单据');
  1410. // }
  1411. this.$refs.assetsDialogRef.open();
  1412. },
  1413. handleChange(data) {
  1414. this.title = data?.dictValue;
  1415. if (this.formData.bizType == 4) {
  1416. this.formData.sourceBizNo = '';
  1417. }
  1418. },
  1419. handleChanges(code) {
  1420. const data = this.codeList.find((item) => item.dictCode == code);
  1421. this.title = data?.dictValue;
  1422. this.selectEquiType = data?.dictCode;
  1423. if (this.formData.bizType == 4) {
  1424. this.formData.sourceBizNo = '';
  1425. }
  1426. },
  1427. handleBizSceneChange() {
  1428. if (this.formData.extInfo.assetType == 7) {
  1429. this.formData.extInfo.sourceBizNo = '';
  1430. }
  1431. this.formData.sourceBizNo = '';
  1432. },
  1433. getSupplier() {
  1434. return new Promise((resolve, reject) => {
  1435. supplier.list({ page: 1, size: 999 }).then((res) => {
  1436. if (res.success) {
  1437. resolve(res);
  1438. }
  1439. });
  1440. });
  1441. },
  1442. upload(data) {
  1443. this.formData.contentImage = data;
  1444. this.$refs.formName.validateField('contentImage');
  1445. },
  1446. deptClick(data) {
  1447. this.formData.deptName = data?.name;
  1448. this.formData.deptCode = data?.code;
  1449. }
  1450. },
  1451. watch: {
  1452. // 解决右侧悬浮操作栏不对称问题
  1453. warehousingMaterialList: {
  1454. handler() {
  1455. this.$nextTick(() => {
  1456. this.$refs.warehousingMaterialListTable.doLayout();
  1457. });
  1458. },
  1459. deep: true
  1460. }
  1461. }
  1462. };
  1463. </script>
  1464. <style lang="scss" scoped>
  1465. ::v-deep.form-table {
  1466. .el-form-item {
  1467. margin-bottom: 0;
  1468. }
  1469. .el-input__inner {
  1470. padding: 0 10px;
  1471. }
  1472. }
  1473. .p20 {
  1474. padding: 20px;
  1475. }
  1476. .el-select,
  1477. .el-date-editor {
  1478. width: 100%;
  1479. }
  1480. .el-form-item {
  1481. margin-bottom: 22px;
  1482. }
  1483. .material {
  1484. margin-top: 20px;
  1485. .flex {
  1486. display: flex;
  1487. justify-content: space-between;
  1488. font-size: 14px;
  1489. align-items: center;
  1490. .red {
  1491. color: #ff4949;
  1492. }
  1493. }
  1494. }
  1495. .mt10 {
  1496. margin-top: 10px;
  1497. }
  1498. .mt20 {
  1499. margin-top: 20px;
  1500. }
  1501. .center {
  1502. text-align: center;
  1503. }
  1504. </style>