addStock.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="新增出库单" @clickLeft="back">
  4. <!--右菜单-->
  5. <template slot="float">
  6. <!-- <view class="nav-icon-caozuo rightNav" @click="getsure">
  7. <u-button type="success" size="small" class="u-reset-button" text="确定"></u-button>
  8. </view> -->
  9. </template>
  10. </uni-nav-bar>
  11. <u-form labelPosition="left" :model="formData" :rules="rules" ref="formRef" labelWidth="200" labelAlign="right"
  12. class="baseForm">
  13. <u-form-item label="物品类型" class="required-form" borderBottom prop="assetType">
  14. <view :style="{ color: assetTypeName ? 'black' : '#c0c4cc' }" class="assetType_box" @click="openPicker">
  15. {{ assetTypeName ? assetTypeName : '请选择产品类型' }}
  16. </view>
  17. </u-form-item>
  18. <u-form-item label="来源单据" prop="documentSource" borderBottom>
  19. <u-input type="text" placeholder="请输入" v-model="formData.sourceBizNo" @click.native="goToRequisition" />
  20. </u-form-item>
  21. <u-form-item label="出库场景" class="required-form" prop="bizType" borderBottom>
  22. <uni-data-select v-model="formData.bizType" :localdata="outputSceneState"
  23. @change="changeType"></uni-data-select>
  24. </u-form-item>
  25. <u-form-item label="出库时间" prop="storageTime" borderBottom>
  26. <view class="assetType_box" @click="timeShow = true">{{ storageTime ? formatter(storageTime) : '请选择' }}
  27. </view>
  28. </u-form-item>
  29. <u-form-item label="出库登记人" prop="createUserName" borderBottom>
  30. <u-input disableColor="#ffffff" v-model="formData.extInfo.createUserName" placeholder="请选择" disabled
  31. type="text" />
  32. </u-form-item>
  33. <u-form-item class="required-form" label="领料部门" prop="deliveryName" borderBottom>
  34. <view :style="{ color: formData.extInfo.verifyDeptName ? 'black' : '#c0c4cc' }" class="assetType_box"
  35. @click="openDepartmentPicker">
  36. {{ formData.extInfo.verifyDeptName ? formData.extInfo.verifyDeptName : '请选择领料部门' }}
  37. </view>
  38. </u-form-item>
  39. <u-form-item class="required-form" label="领料人" prop="deliveryPhone" borderBottom>
  40. <view :style="{ color: formData.fromUser ? 'black' : '#c0c4cc' }" class="assetType_box"
  41. @click="openUserPicker">
  42. {{ formData.fromUser ? formData.fromUser : '请选择领料人' }}
  43. </view>
  44. </u-form-item>
  45. <u-form-item label="备注" prop="remark" borderBottom>
  46. <u-input disableColor="#ffffff" v-model="formData.remark" placeholder="请输入内容" type="text" />
  47. </u-form-item>
  48. </u-form>
  49. <uni-collapse ref="collapse" v-model="collapseOpen">
  50. <uni-collapse-item :typeOpen="1" title="" name="collapse1" :open="true" :key="detailOpen"
  51. :show-animation="true">
  52. <template v-slot:title>
  53. <view class="detail-box">
  54. <view data-v-41027c34="" class="uni-collapse-item__title-wrap">
  55. <view data-v-41027c34=""
  56. class="uni-collapse-item__title-box uni-collapse-item__title-box-base">
  57. <text data-v-41027c34="" class="tag tag-base"><text></text></text>
  58. <text data-v-41027c34="" class="uni-collapse-item__title-text"><text>出库明细</text></text>
  59. </view>
  60. </view>
  61. <u-button type="primary" size="small" text="扫码添加" @click.native.stop="selectType2"></u-button>
  62. <u-button type="success" size="small" class="selectEnterType" text="手动添加"
  63. @click.native.stop="selectType"></u-button>
  64. </view>
  65. </template>
  66. <u-form labelPosition="left" :model="{ productList: productList }" ref="lisrFormRef" labelWidth="150"
  67. :rules="listRules" errorType="none" labelAlign="right" :labelStyle="{
  68. fontSize: '28rpx'
  69. }">
  70. <view class="listContent">
  71. <view class="listBox" v-for="(item, index) in productList" :key="index">
  72. <view class="main" :class="{ save: item.isSave }">
  73. <view class="row">
  74. <view class="row-item">
  75. <text class="t1">物品名称</text>
  76. <text class="t2">{{ item.categoryName }}</text>
  77. </view>
  78. </view>
  79. <view class="row">
  80. <view class="row-item">
  81. <text class="t1">物品编码</text>
  82. <text class="t2">{{ item.categoryCode }}</text>
  83. </view>
  84. </view>
  85. <view class="row">
  86. <view class="row-item" style="display: flex;width: 100%;">
  87. <text class="t1">包装规格</text>
  88. <view style="display: flex;"><u-tag style="display: flex;margin-right: 10px;"
  89. v-for="ite in item.packingSpecificationLabel" :text="ite"></u-tag>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="row">
  94. <view class="row-item">
  95. <text class="t1">批次号</text>
  96. <text class="t2">{{ item.batchNo }}</text>
  97. </view>
  98. <view class="row-item">
  99. <text class="t1">是否拆包</text>
  100. <text class="t2">{{ item.isUnpack ? '是' : '否' }}</text>
  101. </view>
  102. </view>
  103. <view class="row">
  104. <view class="row-item">
  105. <text class="t1">数量</text>
  106. <text class="t2">{{ item.packingQuantity }}</text>
  107. </view>
  108. <view class="row-item">
  109. <text class="t1">包装单位</text>
  110. <text class="t2">{{ item.packingUnit }}</text>
  111. </view>
  112. </view>
  113. <view class="row">
  114. <view class="row-item">
  115. <text class="t1">供应商</text>
  116. <text class="t2">{{ item.supplierName }}</text>
  117. </view>
  118. </view>
  119. <view class="row">
  120. <view class="row-item">
  121. <text class="t1">计量数量</text>
  122. <text class="t2">{{ item.measureQuantity }}</text>
  123. </view>
  124. <view class="row-item">
  125. <text class="t1">计量单位</text>
  126. <text class="t2">{{ item.measureUnit }}</text>
  127. </view>
  128. </view>
  129. <view class="row">
  130. <view class="row-item">
  131. <text class="t1">重量</text>
  132. <text class="t2">{{ item.weight }}</text>
  133. </view>
  134. <view class="row-item">
  135. <text class="t1">重量单位</text>
  136. <text class="t2">{{ item.weightUnit }}</text>
  137. </view>
  138. </view>
  139. <view class="row">
  140. <view class="row-item">
  141. <text class="t1">仓库</text>
  142. <text class="t2">{{ item.warehouseName }}</text>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="main">
  147. <view class="selectTime">
  148. <view class="title">包装列表</view>
  149. </view>
  150. <u-list @scrolltolower="scrolltolower" class="z_list" style="height: 100% !important">
  151. <view class="material rx-ss" v-for="(ite, idx) in item.outInDetailRecordRequestList"
  152. :key="idx">
  153. <view class="content_table">
  154. <view class="item">
  155. <view class="lable rx-cc">序号</view>
  156. <view class="content">{{ idx + 1 }}</view>
  157. </view>
  158. <view class="item">
  159. <view class="lable rx-cc">包装编码</view>
  160. <view class="content">{{ ite.packageNo }}</view>
  161. </view>
  162. <view class="item">
  163. <view class="lable rx-cc">包装数量({{ ite.packingUnit }})</view>
  164. <view class="content">{{ ite.packingQuantity }}</view>
  165. </view>
  166. <view class="item">
  167. <view class="lable rx-cc">计量数量({{ ite.measureUnit }})</view>
  168. <view class="content">{{ ite.measureQuantity }}</view>
  169. </view>
  170. <view class="item">
  171. <view class="lable rx-cc">物料代号</view>
  172. <view class="content">{{ ite.materielDesignation }}</view>
  173. </view>
  174. <view class="item">
  175. <view class="lable rx-cc">客户代号</view>
  176. <view class="content">{{ ite.clientCode }}</view>
  177. </view>
  178. <view class="item">
  179. <view class="lable rx-cc">刻码</view>
  180. <view class="content">{{ ite.engrave }}</view>
  181. </view>
  182. <view class="item">
  183. <view class="lable rx-cc">重量({{ ite.weightUnit }})</view>
  184. <view class="content">
  185. {{ ite.weight }}
  186. </view>
  187. </view>
  188. <view class="item">
  189. <view class="lable rx-cc">质检状态</view>
  190. <view class="content">
  191. {{ qualityResults[ite.status] }}
  192. </view>
  193. </view>
  194. <view class="item">
  195. <view class="lable rx-cc">采购日期</view>
  196. <view class="content">
  197. {{ ite.purchaseDate }}
  198. </view>
  199. </view>
  200. <view class="item">
  201. <view class="lable rx-cc">生产日期</view>
  202. <view class="content">
  203. {{ ite.productionDate }}
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. </u-list>
  209. </view>
  210. </view>
  211. </view>
  212. </u-form>
  213. </uni-collapse-item>
  214. </uni-collapse>
  215. <view class="footBox">
  216. <view class="reg" @click="submit">
  217. <uni-icons custom-prefix="iconfont" size="20" color="#fff"></uni-icons>
  218. 提交
  219. </view>
  220. </view>
  221. <!-- 选择出库场景 -->
  222. <ba-tree-picker ref="treePicker" :multiple="true" @select-change="confirm" title="选择物品类型"
  223. :localdata="goodsLists" valueKey="id" textKey="name" childrenKey="child" />
  224. <!-- 选择物品类型 -->
  225. <ba-tree-picker ref="treePicker" :multiple="true" @select-change="confirm" title="选择物品类型"
  226. :localdata="goodsLists" valueKey="id" textKey="name" childrenKey="child" />
  227. <!-- 选择领料部门 -->
  228. <ba-tree-picker ref="departmentPicker" :multiple="false" @select-change="departmentConfirm" title="选择领料部门"
  229. :localdata="departmentOption" valueKey="id" textKey="name" childrenKey="children" />
  230. <!-- 选择领料人 -->
  231. <ba-tree-picker ref="userPicker" :multiple="false" @select-change="userConfirm" title="选择领料人"
  232. :localdata="userOption" valueKey="id" textKey="name" childrenKey="children" />
  233. <!-- 选择入库时间 -->
  234. <u-datetime-picker @confirm="timeConfirm" @cancel="timeCancel" :show="timeShow" v-model="storageTime"
  235. mode="datetime"></u-datetime-picker>
  236. </view>
  237. </template>
  238. <script>
  239. // import ScanCode from '@/components/ScanCode.vue'
  240. import {
  241. toTreeData
  242. } from '@/utils/utils.js'
  243. import {
  244. getTreeByGroup,
  245. submitInsideTwo,
  246. outStorage
  247. } from '@/api/warehouseManagement'
  248. import {
  249. listOrganizations,
  250. getUserPage
  251. } from '@/api/common'
  252. import {
  253. getByCode
  254. } from '@/api/pda/common'
  255. import dayjs from 'dayjs'
  256. import {
  257. outputSceneState
  258. } from '../common'
  259. import {
  260. post,
  261. postJ,
  262. get,
  263. getJ
  264. } from '@/utils/api.js'
  265. import WarehouseChoose from '@/components/WarehouseChoose'
  266. import {
  267. warehousingType,
  268. inputStatus,
  269. emergencyState,
  270. warehousingMaterialListTable,
  271. getDictName,
  272. materialType
  273. } from '../enum.js'
  274. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  275. // import addDetails from '@/components/addDetails'
  276. import UploadFileNew from '@/components/UploadFileNew'
  277. // import dictMixins from '@/mixins/dictMixins.js'
  278. export default {
  279. components: {
  280. WarehouseChoose,
  281. baTreePicker,
  282. UploadFileNew
  283. },
  284. data() {
  285. return {
  286. dimension: '3',
  287. userOption: [], // 用户列表
  288. departmentOption: [], // 部门列表
  289. goodsLists: [], // 物品类型
  290. assetTypeName: '', // 物品类型名称
  291. timeShow: false,
  292. packingSpecificationOption: [], // 包装规格
  293. currentPackingSpecificationOption: [], // 当前包装规格
  294. currentSupplierListOption: [], // 当前供货商
  295. warehouseListOption: [], // 仓库列表
  296. currentTypeTime: Number(new Date()), // 当前时间类型的时间
  297. storageTime: '', // 入库时间
  298. currentProductIndex: null, // 当前产品索引
  299. currentPackingIndex: null, // 当前包装索引
  300. packingUnitsShow: false,
  301. typeTimeShow: false,
  302. suppliersShow: false,
  303. warehouseShow: false,
  304. timeTypeShow: false,
  305. statusShow: false,
  306. dictCodeList: [], // 字典列表
  307. curDateType: 'purchaseDate',
  308. qualityResultsOption: [
  309. [{
  310. label: '合格',
  311. value: 1
  312. },
  313. {
  314. label: '不合格',
  315. value: 2
  316. }
  317. ]
  318. ], // 质检状态 0未检 1已检
  319. qualityResults: {
  320. 1: '合格',
  321. 2: '不合格'
  322. }, // 质检结果 1合格 2不合格
  323. curDateTypeLabel: {
  324. purchaseDate: '采购日期',
  325. productionDate: '生产日期'
  326. },
  327. timeTypeOption: [
  328. [{
  329. name: '采购日期',
  330. prop: 'purchaseDate'
  331. },
  332. {
  333. name: '生产日期',
  334. prop: 'productionDate'
  335. }
  336. ]
  337. ], // 时间类型
  338. collapseOpen: 'collapse1',
  339. emergencyState,
  340. warehousingType,
  341. materialType,
  342. outputSceneState,
  343. inputStatus,
  344. getDictName,
  345. detailOpen: false,
  346. codeOpen: false,
  347. deptList: [], //部门
  348. supplierList: [], //供应商
  349. formData: {
  350. type: 1, // 入库
  351. bizType: '', // 入库场景
  352. storageTime: '', // 入库时间
  353. extInfo: {}, // 扩展信息
  354. sourceBizNo: '', // 来源单据编号
  355. fromUser: '', // 送货人
  356. remark: '' // 备注
  357. },
  358. statusList: [{
  359. id: 1,
  360. name: '紧急'
  361. },
  362. {
  363. id: 2,
  364. name: '中等'
  365. },
  366. {
  367. id: 1,
  368. name: '普通'
  369. }
  370. ], //紧急状态
  371. pickerIndex: 0,
  372. productList: [],
  373. userList: [],
  374. rules: {
  375. assetType: {
  376. type: 'number',
  377. required: true,
  378. message: '请选择入库产品类型',
  379. trigger: ['blur', 'change']
  380. },
  381. bizType: {
  382. type: 'number',
  383. required: true,
  384. message: '请选择入库场景',
  385. trigger: ['blur', 'change']
  386. }
  387. // contentImage: {
  388. // type: 'array',
  389. // required: true,
  390. // message: '请上传附件',
  391. // trigger: ['blur', 'change']
  392. // }
  393. },
  394. settingIndex: 0
  395. }
  396. },
  397. onShow() {
  398. this.collapseOpen = 'collapse1'
  399. },
  400. beforeDestroy() {
  401. uni.$off('setSelectList')
  402. uni.$off('setCategory')
  403. uni.$off('requisitionSelectC')
  404. },
  405. onLoad() {
  406. this.getListItems() // 物品类型
  407. this.initDeptData() // 部门列表
  408. this.storageTime = Number(new Date())
  409. this.formData.storageTime = this.formatter(this.storageTime)
  410. const userInfo = uni.getStorageSync('userInfo')
  411. this.formData.extInfo.createUserName = userInfo.name
  412. this.formData.createUserId = userInfo.userId
  413. uni.$on('setCategory', data => {
  414. this.formData.extInfo.assetType = data
  415. let filterArray = this.formData.extInfo.assetType.map(item => {
  416. return this.goodsLists.find(ite => ite.id == item).name
  417. })
  418. this.assetTypeName = Array.from(new Set(filterArray)).join('/')
  419. })
  420. uni.$on('setSelectList', async (data, dimension) => {
  421. this.dimension = dimension;
  422. if (data?.length) {
  423. console.log('data------------', data)
  424. this.formData.sourceBizNo = ''
  425. this.productList = data.map(item => {
  426. return {
  427. ...item,
  428. packingSpecificationLabel: item.extField.packingSpecification ? item
  429. .extField.packingSpecification.split(',') : []
  430. }
  431. })
  432. this.formData.outInDetailList = data
  433. setTimeout(() => {
  434. this.detailOpen = !this.detailOpen
  435. this.$refs.collapse && this.$refs.collapse.resize()
  436. }, 0)
  437. }
  438. })
  439. uni.$on('requisitionSelectC', async (data, query) => {
  440. console.log(data, 'data')
  441. console.log(query, 'queryqueryqueryqueryqueryqueryqueryqueryquery')
  442. this.formData.sourceBizNo = query.sourceBizNo
  443. this.formData.bizType = parseInt(query.bizType)
  444. this.formData.extInfo.assetType = query.assetType.split(',')
  445. let filterArray = this.formData.extInfo.assetType.map(item => {
  446. return this.goodsLists.find(ite => ite.id == item).name
  447. })
  448. this.assetTypeName = Array.from(new Set(filterArray)).join('/')
  449. this.formData.outInDetailList = data
  450. this.productList = data.map(productItem => {
  451. return {
  452. ...productItem,
  453. packingSpecificationLabel: productItem.extField.packingSpecification.split(
  454. ','),
  455. outInDetailRecordRequestList: productItem.outInDetailRecordRequestList.map(
  456. packingItem => {
  457. return {
  458. ...packingItem,
  459. categoryName: productItem.categoryName,
  460. categoryCode: productItem.categoryCode,
  461. materialDetailList: packingItem.materialDetailList.map(
  462. materialItem => {
  463. return {
  464. ...materialItem,
  465. categoryName: productItem.categoryName,
  466. categoryCode: productItem.categoryCode
  467. }
  468. })
  469. }
  470. })
  471. }
  472. })
  473. setTimeout(() => {
  474. this.detailOpen = !this.detailOpen
  475. this.$refs.collapse && this.$refs.collapse.resize()
  476. }, 0)
  477. })
  478. // 明细信息填写
  479. uni.$on('batchNumBack', productList => {
  480. if (productList?.length) {
  481. this.productList = productList
  482. }
  483. })
  484. },
  485. mounted() {
  486. // this.getAddDetails();
  487. },
  488. computed: {
  489. listRules() {
  490. return this.productList.reduce((cur, pre, index) => {
  491. return {
  492. ...cur,
  493. [`productList.${index}.batchNo`]: {
  494. type: 'string',
  495. required: true,
  496. trigger: ['blur', 'change']
  497. },
  498. [`productList.${index}.packingQuantity`]: {
  499. type: 'number',
  500. required: true,
  501. trigger: ['blur', 'change']
  502. },
  503. [`productList.${index}.packingUnit`]: {
  504. type: 'string',
  505. required: true,
  506. trigger: ['blur', 'change']
  507. },
  508. [`productList.${index}.warehouseId`]: {
  509. type: 'string',
  510. required: true,
  511. trigger: ['blur', 'change']
  512. }
  513. }
  514. }, {})
  515. }
  516. },
  517. methods: {
  518. formatter(dataTime) {
  519. return dayjs(dataTime).format('YYYY-MM-DD HH:mm:ss')
  520. },
  521. timeConfirm() {
  522. this.timeShow = false
  523. this.$nextTick(() => {
  524. console.log(this.storageTime)
  525. console.log(this.formatter(this.storageTime))
  526. this.formData.storageTime = this.formatter(this.storageTime)
  527. console.log(this.formData)
  528. })
  529. },
  530. timeCancel() {
  531. this.timeShow = false
  532. },
  533. changeType(e) {
  534. this.formData.bizType = e
  535. },
  536. goToRequisition() {
  537. uni.navigateTo({
  538. url: '/pages/warehouse/components/requisitionList?type=' + 2
  539. })
  540. },
  541. scrolltolower() {
  542. console.log('滑动了~~~')
  543. },
  544. async submit() {
  545. if (this.productList.length <= 0) {
  546. uni.showToast({
  547. title: '请添加出库明细',
  548. icon: 'none'
  549. })
  550. return
  551. }
  552. if (!this.formData.extInfo.verifyDeptName) {
  553. uni.showToast({
  554. title: '请选择领料部门',
  555. icon: 'none'
  556. })
  557. return
  558. }
  559. if (!this.formData.fromUser) {
  560. uni.showToast({
  561. title: '请选择领料人',
  562. icon: 'none'
  563. })
  564. return
  565. }
  566. console.log(this.formData)
  567. let obj = uni.$u.deepClone({
  568. ...this.formData,
  569. type: 2
  570. })
  571. obj.extInfo.sourceBizNo = obj.sourceBizNo
  572. obj.fromType = obj.type
  573. this.saveLoading = true
  574. // 处理物品类型assetType
  575. obj.extInfo.assetType = obj.extInfo.assetType.join(',')
  576. // 处理仓库id
  577. let warehouseId = []
  578. let warehouseName = []
  579. let warehouseIds = this.productList.map(item => item.warehouseId).flat()
  580. let warehouseNames = this.productList.map(item => item.warehouseName).flat()
  581. warehouseIds.forEach((item, index) => {
  582. if (!warehouseId.includes(item)) {
  583. warehouseId.push(item)
  584. warehouseName.push(warehouseNames[index])
  585. }
  586. })
  587. obj.warehouseIds = warehouseId
  588. obj.warehouseNames = warehouseName
  589. console.log('2222', obj)
  590. uni.showLoading({
  591. title: '保存中...'
  592. })
  593. try {
  594. const res = await outStorage(obj)
  595. if (res.code == 0) {
  596. await submitInsideTwo({
  597. outInIds: res.data
  598. })
  599. uni.hideLoading()
  600. uni.showToast({
  601. icon: 'none',
  602. title: '出库成功',
  603. duration: 1500
  604. })
  605. setTimeout(() => {
  606. uni.navigateBack({
  607. delta: 1
  608. })
  609. }, 1500)
  610. }
  611. } catch (error) {
  612. console.log('出库失败', err)
  613. uni.hideLoading()
  614. uni.showToast({
  615. icon: 'none',
  616. title: '出库失败',
  617. duration: 2000
  618. })
  619. }
  620. },
  621. // 部门列表
  622. async initDeptData() {
  623. let deptTreeList = await listOrganizations()
  624. this.departmentOption = toTreeData({
  625. data: deptTreeList,
  626. idField: 'id',
  627. parentIdField: 'parentId'
  628. })
  629. },
  630. async getStaffList(id) {
  631. uni.showLoading({
  632. title: '加载中',
  633. mask: true
  634. })
  635. let res = await getUserPage({
  636. groupId: id,
  637. size: 9999,
  638. page: 1
  639. })
  640. uni.hideLoading()
  641. this.userOption = res.list
  642. },
  643. // 打开领料部门选择器
  644. openDepartmentPicker() {
  645. this.$refs.departmentPicker._show()
  646. },
  647. // 打开领料人选择器
  648. openUserPicker() {
  649. this.$refs.userPicker._show()
  650. },
  651. sceneStateFilter(bizType) {
  652. if (bizType) {
  653. return this.outputSceneState.filter(item => item.value == bizType)[0].text
  654. }
  655. },
  656. formatter(dataTime) {
  657. return dayjs(dataTime).format('YYYY-MM-DD HH:mm:ss')
  658. },
  659. openPicker() {
  660. this.$refs.treePicker._show()
  661. },
  662. // 获取物品列表
  663. getListItems() {
  664. getTreeByGroup({
  665. type: 2
  666. }).then(res => {
  667. this.goodsLists = res
  668. })
  669. },
  670. selectType2() {
  671. if (!this.formData.bizType) {
  672. uni.showToast({
  673. title: '请选择出库场景',
  674. icon: 'none'
  675. })
  676. return
  677. }
  678. uni.navigateTo({
  679. url: '/pages/warehouse/outHouse/QRCode'
  680. })
  681. },
  682. selectType() {
  683. console.log(this.formData);
  684. if (!this.formData.extInfo.assetType) {
  685. uni.showToast({
  686. title: '请选择物品类型',
  687. icon: 'none'
  688. })
  689. return
  690. }
  691. if (!this.formData.bizType) {
  692. uni.showToast({
  693. title: '请选择出库场景',
  694. icon: 'none'
  695. })
  696. return
  697. }
  698. // const storageKey = Date.now() + ''
  699. // uni.setStorageSync(storageKey, this.warehousingMaterialList)
  700. uni.navigateTo({
  701. url: '/pages/warehouse/outHouse/selectOutType?assetType=' + this.formData.extInfo.assetType
  702. })
  703. },
  704. userConfirm(data, name) {
  705. this.formData.fromId = data[0]
  706. this.formData.fromUser = name
  707. },
  708. departmentConfirm(data, name, allList) {
  709. this.formData.extInfo.verifyDeptCode = data[0]
  710. this.formData.extInfo.verifyDeptName = name
  711. this.formData.fromId = ''
  712. this.formData.fromUser = ''
  713. this.getStaffList(data[0])
  714. },
  715. confirm(data, name, allList) {
  716. this.assetTypeName = name
  717. this.formData.extInfo.assetType = allList.map(item => item.id)
  718. },
  719. // 抬头下拉信息保存
  720. handlePicker(e, list, idKey, nameKey) {
  721. if (idKey) {
  722. this.formData[idKey] = list[e?.detail.value]?.value
  723. }
  724. if (nameKey) {
  725. this.formData[nameKey] = list[e?.detail.value]?.text
  726. }
  727. this.$nextTick(() => {
  728. if (idKey === 'assetType' || idKey === 'bizType') {
  729. this.$refs.formRef.validateField(idKey)
  730. }
  731. })
  732. },
  733. // 部门确认
  734. deptConfirm(data, name) {
  735. this.formData.deptName = name
  736. this.formData.deptCode = data[0]
  737. },
  738. // 部门确认
  739. verifyDeptConfirm(data, name) {
  740. this.formData.verifyDeptCode = data[0]
  741. this.formData.verifyDeptName = name
  742. this.formData.verifyId = ''
  743. this.formData.verifyName = ''
  744. this.getUser(data[0])
  745. }
  746. }
  747. }
  748. </script>
  749. <style lang="scss" scoped>
  750. .mainBox {
  751. padding-bottom: 120rpx;
  752. /deep/.required-form .u-form-item__body__left__content__label::before {
  753. content: '*';
  754. color: red;
  755. }
  756. }
  757. /deep/.baseForm {
  758. .u-form-item__body {
  759. padding: 4px !important;
  760. }
  761. .assetType_box {
  762. padding: 12rpx 18rpx;
  763. width: 100%;
  764. overflow: hidden;
  765. white-space: nowrap;
  766. text-overflow: ellipsis;
  767. font-size: 30rpx;
  768. }
  769. }
  770. .detail-box {
  771. position: relative;
  772. display: flex;
  773. justify-content: space-between;
  774. align-items: center;
  775. /deep/uni-button {
  776. margin: 0 !important;
  777. width: 180rpx;
  778. }
  779. .selectEnterType {
  780. margin-left: 10rpx !important;
  781. }
  782. }
  783. .footBox {
  784. position: fixed;
  785. left: 0px;
  786. bottom: 0px;
  787. height: 100rpx;
  788. width: 100%;
  789. display: flex;
  790. align-items: center;
  791. justify-content: space-between;
  792. view {
  793. width: 100%;
  794. height: 100%;
  795. text-align: center;
  796. color: #fff;
  797. display: flex;
  798. align-items: center;
  799. justify-content: center;
  800. }
  801. .reg {
  802. background: $u-success-dark;
  803. }
  804. .add {
  805. background: $uni-color-primary;
  806. }
  807. .uni-icons {
  808. margin-right: 8rpx !important;
  809. }
  810. }
  811. .main {
  812. padding: 0 30rpx;
  813. .row {
  814. display: flex;
  815. align-items: center;
  816. justify-content: space-between;
  817. padding: 20rpx 0;
  818. border-bottom: 1px dashed #dedede;
  819. .row-item {
  820. .t1 {
  821. font-weight: bold;
  822. font-size: 28rpx;
  823. color: #333333;
  824. margin-right: 20rpx;
  825. }
  826. .t2 {
  827. font-size: 28rpx;
  828. color: #333333;
  829. }
  830. }
  831. }
  832. .ckmx {
  833. color: #70b603;
  834. font-size: 28rpx;
  835. font-weight: bold;
  836. padding: 20rpx;
  837. display: flex;
  838. justify-content: flex-end;
  839. }
  840. }
  841. .listBox {
  842. padding: 20rpx 10rpx;
  843. border-bottom: 1px #f2f2f2 solid;
  844. position: relative;
  845. &.code {
  846. .label {
  847. width: 120rpx !important;
  848. }
  849. }
  850. .listTit {
  851. width: 100%;
  852. display: flex;
  853. justify-content: space-between;
  854. align-items: center;
  855. /deep/uni-button {
  856. margin-right: 20rpx;
  857. width: 100rpx;
  858. &.assets {
  859. width: 180rpx;
  860. }
  861. }
  862. .name {
  863. width: 50%;
  864. margin-left: 10px;
  865. overflow: hidden;
  866. white-space: nowrap;
  867. -o-text-overflow: ellipsis;
  868. text-overflow: ellipsis;
  869. font-size: 24rpx;
  870. }
  871. .btn {
  872. display: flex;
  873. justify-content: flex-end;
  874. }
  875. .weight {
  876. width: 30%;
  877. font-size: 24rpx;
  878. margin-left: auto;
  879. margin-right: 60rpx;
  880. position: relative;
  881. display: flex;
  882. input {
  883. margin-right: 10rpx;
  884. border: 1px solid black;
  885. width: 40%;
  886. height: 20rpx;
  887. }
  888. }
  889. .weight::after {
  890. position: absolute;
  891. right: -30rpx;
  892. top: 50%;
  893. content: '';
  894. background: #eee;
  895. width: 1px;
  896. height: 28rpx;
  897. margin-top: -14rpx;
  898. }
  899. }
  900. .z_list {
  901. height: 100% !important;
  902. max-height: 500rpx;
  903. .material {
  904. margin-top: 10rpx;
  905. .left {
  906. width: 40rpx;
  907. }
  908. .zdy_check {
  909. width: 30rpx;
  910. height: 30rpx;
  911. border: 2rpx solid #c8c9cc;
  912. border-radius: 4rpx;
  913. }
  914. .check_active {
  915. background: $theme-color;
  916. border: 2rpx solid $theme-color;
  917. /deep/ .u-icon__icon {
  918. color: #fff !important;
  919. }
  920. }
  921. .content_table {
  922. width: 670rpx;
  923. border: 2rpx solid $border-color;
  924. .item {
  925. display: flex;
  926. border-bottom: 2rpx solid $border-color;
  927. .lable {
  928. width: 200rpx;
  929. text-align: center;
  930. background-color: #f7f9fa;
  931. font-size: 26rpx;
  932. border-right: 2rpx solid $border-color;
  933. flex-shrink: 0;
  934. }
  935. .ww80 {
  936. width: 80rpx;
  937. }
  938. .content {
  939. width: 500rpx;
  940. min-height: 64rpx;
  941. font-size: 28rpx;
  942. line-height: 28rpx;
  943. font-style: normal;
  944. font-weight: 400;
  945. padding: 18rpx 8rpx;
  946. box-sizing: border-box;
  947. word-wrap: break-word;
  948. flex-grow: 1 !important;
  949. }
  950. .input_box {
  951. padding: 0 !important;
  952. }
  953. .content_num {
  954. display: flex;
  955. align-items: center;
  956. padding: 0 4rpx;
  957. /deep/ .uni-input-input {
  958. width: 200rpx;
  959. border: 2rpx solid #f0f8f2;
  960. background: #f0f8f2;
  961. color: $theme-color;
  962. }
  963. .unit {
  964. padding: 0 4rpx;
  965. font-size: 24rpx;
  966. color: #404446;
  967. }
  968. }
  969. .ww400 {
  970. /deep/ .uni-input-input {
  971. width: 400rpx;
  972. }
  973. }
  974. .pd4 {
  975. padding: 4rpx 8rpx;
  976. }
  977. &:last-child {
  978. border-bottom: none;
  979. }
  980. }
  981. .ww55 {
  982. width: 55%;
  983. }
  984. .ww45 {
  985. width: 45%;
  986. }
  987. .ww50 {
  988. width: 50%;
  989. }
  990. .ww30 {
  991. width: 30%;
  992. }
  993. .ww70 {
  994. width: 70%;
  995. }
  996. .ww80 {
  997. width: 80%;
  998. }
  999. .ww20 {
  1000. width: 20%;
  1001. }
  1002. .check {
  1003. width: 30rpx;
  1004. height: 30rpx;
  1005. }
  1006. .tag_box {
  1007. padding: 2rpx 10rpx;
  1008. margin-right: 12rpx;
  1009. background: #e6a23c;
  1010. font-size: 22rpx;
  1011. color: #fff;
  1012. border-radius: 4rpx;
  1013. }
  1014. }
  1015. }
  1016. }
  1017. .more {
  1018. position: absolute;
  1019. bottom: 26rpx;
  1020. right: 30rpx;
  1021. font-size: 28rpx;
  1022. color: #666;
  1023. }
  1024. }
  1025. .selectTime {
  1026. display: flex;
  1027. justify-content: flex-end;
  1028. align-items: center;
  1029. margin-top: 10px;
  1030. .title {
  1031. flex: 1;
  1032. font-size: 28rpx;
  1033. font-weight: bold;
  1034. }
  1035. .timeBox {
  1036. display: flex;
  1037. width: 500rpx;
  1038. .firstBtn {
  1039. margin-right: 10rpx;
  1040. }
  1041. }
  1042. }
  1043. .listBox:last-child {
  1044. border: none !important;
  1045. }
  1046. .textBox {
  1047. border: 1px #f2f2f2 solid;
  1048. height: 160px;
  1049. display: block;
  1050. width: auto !important;
  1051. }
  1052. .saveBtn {
  1053. width: 50%;
  1054. margin: 40rpx auto;
  1055. }
  1056. .top-css {
  1057. border-bottom: 1px solid rgb(207, 204, 204);
  1058. }
  1059. </style>