AllocationOutModal.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. :keyboard="false"
  8. :forceRender="true"
  9. v-bind:prefixNo="prefixNo"
  10. fullscreen
  11. switchFullscreen
  12. @cancel="handleCancel"
  13. :id="prefixNo"
  14. style="top: 20px; height: 95%"
  15. >
  16. <template slot="footer">
  17. <a-button @click="handleCancel">取消</a-button>
  18. <a-button v-if="billPrintFlag && isShowPrintBtn" @click="handlePrint('调拨出库')">三联打印预览</a-button>
  19. <a-button v-if="checkFlag && isCanCheck" :loading="confirmLoading" @click="handleOkAndCheck">保存并审核</a-button>
  20. <a-button type="primary" :loading="confirmLoading" @click="handleOk">保存(Ctrl+S)</a-button>
  21. <!--发起多级审核-->
  22. <a-button v-if="!checkFlag" @click="handleWorkflow()" type="primary">提交流程</a-button>
  23. </template>
  24. <a-spin :spinning="confirmLoading">
  25. <a-form :form="form">
  26. <a-row class="form-row" :gutter="24">
  27. <a-col :lg="6" :md="12" :sm="24">
  28. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="单据日期">
  29. <j-date v-decorator="['operTime', validatorRules.operTime]" :show-time="true" />
  30. </a-form-item>
  31. </a-col>
  32. <a-col :lg="6" :md="12" :sm="24">
  33. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="单据编号">
  34. <a-input placeholder="请输入单据编号" v-decorator.trim="['number']" />
  35. </a-form-item>
  36. </a-col>
  37. <a-col :lg="6" :md="12" :sm="24"></a-col>
  38. <a-col :lg="6" :md="12" :sm="24"></a-col>
  39. </a-row>
  40. <j-editable-table
  41. id="billModal"
  42. :ref="refKeys[0]"
  43. :loading="materialTable.loading"
  44. :columns="materialTable.columns"
  45. :dataSource="materialTable.dataSource"
  46. :minWidth="minWidth"
  47. :maxHeight="300"
  48. :rowNumber="false"
  49. :rowSelection="true"
  50. :actionButton="true"
  51. :dragSortAndNumber="true"
  52. @valueChange="onValueChange"
  53. @added="onAdded"
  54. @deleted="onDeleted"
  55. @focusChange="getUnitInfo"
  56. >
  57. <template #buttonAfter>
  58. <a-row
  59. :gutter="24"
  60. style="float: left"
  61. data-step="4"
  62. data-title="扫码录入"
  63. data-intro="此功能支持扫码枪扫描商品条码进行录入"
  64. >
  65. <a-col v-if="scanStatus" :md="6" :sm="24">
  66. <a-button @click="scanEnter">扫码录入</a-button>
  67. </a-col>
  68. <a-col v-if="!scanStatus" :md="16" :sm="24" style="padding: 0 6px 0 12px">
  69. <a-input
  70. placeholder="请扫描商品条码并回车"
  71. v-model="scanBarCode"
  72. @pressEnter="scanPressEnter"
  73. ref="scanBarCode"
  74. />
  75. </a-col>
  76. <a-col v-if="!scanStatus" :md="6" :sm="24" style="padding: 0px">
  77. <a-button @click="stopScan">收起扫码</a-button>
  78. </a-col>
  79. </a-row>
  80. </template>
  81. <template #depotBatchSet>
  82. <a-icon type="down" @click="handleBatchSetDepot" />
  83. </template>
  84. <template #depotAdd>
  85. <a-divider v-if="quickBtn.depot" style="margin: 4px 0" />
  86. <div v-if="quickBtn.depot" style="padding: 4px 8px; cursor: pointer" @click="addDepot">
  87. <a-icon type="plus" /> 新增仓库
  88. </div>
  89. </template>
  90. <template #unit="{ handleChange, handleFocus, value }">
  91. <a-select
  92. placeholder="请选择"
  93. v-decorator="['unit']"
  94. :dropdownMatchSelectWidth="false"
  95. showSearch
  96. :allowClear="false"
  97. optionFilterProp="children"
  98. :value="value"
  99. @change="($event) => handleChange($event)"
  100. @focus="($event) => handleFocus($event)"
  101. >
  102. <a-select-option v-for="(item, index) in unitList" :key="index" :value="item.name">
  103. {{ item.name }}
  104. </a-select-option>
  105. </a-select>
  106. </template>
  107. <template #warehousingUser="{ handleChange, value }">
  108. <a-select
  109. placeholder="请选择"
  110. v-decorator="['warehousingUser']"
  111. :dropdownMatchSelectWidth="false"
  112. showSearch
  113. :allowClear="false"
  114. optionFilterProp="children"
  115. :value="value"
  116. :options="currentUserList"
  117. @change="($event) => handleChange($event)"
  118. >
  119. </a-select>
  120. </template>
  121. </j-editable-table>
  122. <a-row class="form-row" :gutter="24">
  123. <a-col :lg="24" :md="24" :sm="24">
  124. <a-form-item :labelCol="labelCol" :wrapperCol="{ xs: { span: 24 }, sm: { span: 24 } }" label="">
  125. <a-textarea :rows="1" placeholder="请输入备注" v-decorator="['remark']" style="margin-top: 8px" />
  126. </a-form-item>
  127. </a-col>
  128. </a-row>
  129. <a-row class="form-row" :gutter="24">
  130. <a-col :lg="6" :md="12" :sm="24">
  131. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件">
  132. <j-upload v-model="fileList" bizPath="bill"></j-upload>
  133. </a-form-item>
  134. </a-col>
  135. </a-row>
  136. <a-row class="form-row" :gutter="24">
  137. <a-col :lg="6" :md="12" :sm="24">
  138. <a-form-item
  139. :labelCol="labelCol"
  140. :wrapperCol="wrapperCol"
  141. label="凭证图片"
  142. data-step="11"
  143. data-title="附件"
  144. data-intro="可以上传与单据相关的图片、文档,支持多个文件"
  145. >
  146. <j-image-upload v-model="imageList" bizPath="material" text="上传图片" isMultiple></j-image-upload>
  147. </a-form-item>
  148. </a-col>
  149. </a-row>
  150. </a-form>
  151. </a-spin>
  152. <depot-modal ref="depotModalForm" @ok="depotModalFormOk"></depot-modal>
  153. <batch-set-depot ref="batchSetDepotModalForm" @ok="batchSetDepotModalFormOk"></batch-set-depot>
  154. <workflow-iframe ref="modalWorkflow" @ok="workflowModalFormOk"></workflow-iframe>
  155. <bill-print-iframe ref="modalPrint"></bill-print-iframe>
  156. </j-modal>
  157. </template>
  158. <script>
  159. import pick from 'lodash.pick'
  160. import DepotModal from '../../system/modules/DepotModal'
  161. import BatchSetDepot from '../dialog/BatchSetDepot'
  162. import WorkflowIframe from '@/components/tools/WorkflowIframe'
  163. import BillPrintIframe from '../dialog/BillPrintIframe'
  164. import { FormTypes } from '@/utils/JEditableTableUtil'
  165. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  166. import { BillModalMixin } from '../mixins/BillModalMixin'
  167. import { getMpListShort } from '@/utils/util'
  168. import JUpload from '@/components/jeecg/JUpload'
  169. import JImageUpload from '@/components/jeecg/JImageUpload.vue'
  170. import JDate from '@/components/jeecg/JDate'
  171. import Vue from 'vue'
  172. export default {
  173. name: 'AllocationOutModal',
  174. mixins: [JEditableTableMixin, BillModalMixin],
  175. components: {
  176. DepotModal,
  177. BatchSetDepot,
  178. WorkflowIframe,
  179. BillPrintIframe,
  180. JUpload,
  181. JDate,
  182. },
  183. data() {
  184. return {
  185. title: '操作',
  186. width: '1600px',
  187. moreStatus: false,
  188. // 新增时子表默认添加几行空数据
  189. addDefaultRowNum: 1,
  190. visible: false,
  191. operTimeStr: '',
  192. prefixNo: 'DBCK',
  193. fileList: [],
  194. imageList: [],
  195. model: {},
  196. labelCol: {
  197. xs: { span: 24 },
  198. sm: { span: 8 },
  199. },
  200. wrapperCol: {
  201. xs: { span: 24 },
  202. sm: { span: 16 },
  203. },
  204. refKeys: ['materialDataTable'],
  205. activeKey: 'materialDataTable',
  206. materialTable: {
  207. loading: false,
  208. dataSource: [],
  209. columns: [
  210. {
  211. title: '批次号',
  212. key: 'batchNumber',
  213. width: '12%',
  214. type: FormTypes.popupJsh,
  215. kind: 'material',
  216. multi: true,
  217. validateRules: [{ required: true, message: '${title}不能为空' }],
  218. },
  219. { title: '名称', key: 'name', width: '9%', type: FormTypes.normal },
  220. { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
  221. { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal, disabled: true },
  222. { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
  223. { title: '商品条码', key: 'barCode', width: '9%', type: FormTypes.normal },
  224. { title: '仓库名', key: 'depotId', width: '9%', type: FormTypes.select, disabled: true },
  225. { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
  226. { title: '包装规格', key: 'unitName', width: '7%', type: FormTypes.normal },
  227. { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
  228. { title: '颜色', key: 'color', width: '9%', type: FormTypes.normal },
  229. { title: '品牌', key: 'brand', width: '9%', type: FormTypes.normal },
  230. { title: '制造商', key: 'mfrs', width: '6%', type: FormTypes.normal },
  231. { title: '扩展信息', key: 'materialOther', width: '5%', type: FormTypes.normal },
  232. { title: '库存', key: 'inventory', width: '5%', type: FormTypes.normal },
  233. {
  234. title: '调入仓库',
  235. key: 'anotherDepotId',
  236. width: '8%',
  237. type: FormTypes.select,
  238. placeholder: '请选择${title}',
  239. options: [],
  240. allowSearch: true,
  241. },
  242. {
  243. title: '单位',
  244. key: 'unit',
  245. width: '6%',
  246. type: FormTypes.slot,
  247. options: [],
  248. allowClear: false,
  249. slotName: 'unit',
  250. },
  251. { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
  252. { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
  253. { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
  254. {
  255. title: '数量',
  256. key: 'operNumber',
  257. width: '5%',
  258. type: FormTypes.inputNumber,
  259. statistics: true,
  260. validateRules: [{ required: true, message: '${title}不能为空' }],
  261. },
  262. { title: '单价', key: 'unitPrice', width: '5%', type: FormTypes.inputNumber },
  263. { title: '金额', key: 'allPrice', width: '5%', type: FormTypes.inputNumber, statistics: true },
  264. {
  265. title: '实际出库数量',
  266. key: 'actualQuantityInStorage',
  267. width: '9%',
  268. type: FormTypes.inputNumber,
  269. validateRules: [{ required: true, message: '实际入库数量不能为空' }],
  270. },
  271. { title: '出库差异', key: 'warehousingVariance', width: '9%', type: FormTypes.input },
  272. { title: '出库差异原因', key: 'reasonOfDifference', width: '9%', type: FormTypes.input },
  273. {
  274. title: '出库人',
  275. key: 'warehousingUser',
  276. width: '9%',
  277. type: FormTypes.slot,
  278. slotName: 'warehousingUser',
  279. validateRules: [{ required: true, message: '出库人不能为空' }],
  280. },
  281. { title: '出库时间', key: 'warehousingTime', width: '9%', type: FormTypes.date },
  282. { title: '备注', key: 'remark', width: '5%', type: FormTypes.input },
  283. ],
  284. },
  285. confirmLoading: false,
  286. validatorRules: {
  287. operTime: {
  288. rules: [{ required: true, message: '请输入单据日期!' }],
  289. },
  290. type: {
  291. rules: [{ required: true, message: '请选择类型!' }],
  292. },
  293. },
  294. url: {
  295. add: '/depotHead/addDepotHeadAndDetail',
  296. edit: '/depotHead/updateDepotHeadAndDetail',
  297. detailList: '/depotItem/getDetailList',
  298. },
  299. unitList: [],
  300. }
  301. },
  302. created() {},
  303. methods: {
  304. //调用完edit()方法之后会自动调用此方法
  305. editAfter() {
  306. this.billStatus = '0'
  307. this.changeColumnHide()
  308. this.changeFormTypes(this.materialTable.columns, 'snList', 0)
  309. // this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0)
  310. this.changeFormTypes(this.materialTable.columns, 'expirationDate', 0)
  311. if (this.action === 'add') {
  312. this.addInit(this.prefixNo)
  313. this.fileList = []
  314. this.imageList = []
  315. } else {
  316. this.model.operTime = this.model.operTimeStr
  317. this.fileList = this.model.fileName
  318. this.imageList = this.model.voucherPicture
  319. this.$nextTick(() => {
  320. this.form.setFieldsValue(
  321. pick(
  322. this.model,
  323. 'organId',
  324. 'operTime',
  325. 'number',
  326. 'remark',
  327. 'discount',
  328. 'discountMoney',
  329. 'discountLastMoney',
  330. 'otherMoney',
  331. 'accountId',
  332. 'changeAmount'
  333. )
  334. )
  335. })
  336. // 加载子表数据
  337. let params = {
  338. headerId: this.model.id,
  339. mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
  340. linkType: 'basic',
  341. }
  342. let url = this.readOnly ? this.url.detailList : this.url.detailList
  343. this.requestSubTableData(url, params, this.materialTable)
  344. }
  345. //复制新增单据-初始化单号和日期
  346. if (this.action === 'copyAdd') {
  347. this.model.id = ''
  348. this.model.tenantId = ''
  349. this.copyAddInit(this.prefixNo)
  350. }
  351. this.initSystemConfig()
  352. this.initDepot()
  353. this.initPlatform()
  354. this.initQuickBtn()
  355. },
  356. //提交单据时整理成formData
  357. classifyIntoFormData(allValues) {
  358. let totalPrice = 0
  359. let billMain = Object.assign(this.model, allValues.formValue)
  360. let detailArr = allValues.tablesValue[0].values
  361. billMain.type = '出库'
  362. billMain.subType = '调拨'
  363. for (let item of detailArr) {
  364. totalPrice += item.allPrice - 0
  365. }
  366. billMain.totalPrice = totalPrice
  367. if (this.fileList && this.fileList.length > 0) {
  368. billMain.fileName = this.fileList
  369. } else {
  370. billMain.fileName = ''
  371. }
  372. if (this.imageList && this.imageList.length > 0) {
  373. billMain.voucherPicture = this.imageList
  374. } else {
  375. billMain.voucherPicture = ''
  376. }
  377. if (this.model.id) {
  378. billMain.id = this.model.id
  379. }
  380. billMain.status = this.billStatus
  381. return {
  382. info: JSON.stringify(billMain),
  383. rows: JSON.stringify(detailArr),
  384. }
  385. },
  386. getUnitInfo(val) {
  387. this.unitList = val
  388. },
  389. },
  390. }
  391. </script>
  392. <style scoped></style>