AllocationOutModal.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. </j-editable-table>
  108. <a-row class="form-row" :gutter="24">
  109. <a-col :lg="24" :md="24" :sm="24">
  110. <a-form-item :labelCol="labelCol" :wrapperCol="{ xs: { span: 24 }, sm: { span: 24 } }" label="">
  111. <a-textarea :rows="1" placeholder="请输入备注" v-decorator="['remark']" style="margin-top: 8px" />
  112. </a-form-item>
  113. </a-col>
  114. </a-row>
  115. <a-row class="form-row" :gutter="24">
  116. <a-col :lg="6" :md="12" :sm="24">
  117. <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件">
  118. <j-upload v-model="fileList" bizPath="bill"></j-upload>
  119. </a-form-item>
  120. </a-col>
  121. </a-row>
  122. <a-row class="form-row" :gutter="24">
  123. <a-col :lg="6" :md="12" :sm="24">
  124. <a-form-item
  125. :labelCol="labelCol"
  126. :wrapperCol="wrapperCol"
  127. label="凭证图片"
  128. data-step="11"
  129. data-title="附件"
  130. data-intro="可以上传与单据相关的图片、文档,支持多个文件"
  131. >
  132. <j-image-upload v-model="imageList" bizPath="material" text="上传图片" isMultiple></j-image-upload>
  133. </a-form-item>
  134. </a-col>
  135. </a-row>
  136. </a-form>
  137. </a-spin>
  138. <depot-modal ref="depotModalForm" @ok="depotModalFormOk"></depot-modal>
  139. <batch-set-depot ref="batchSetDepotModalForm" @ok="batchSetDepotModalFormOk"></batch-set-depot>
  140. <workflow-iframe ref="modalWorkflow" @ok="workflowModalFormOk"></workflow-iframe>
  141. <bill-print-iframe ref="modalPrint"></bill-print-iframe>
  142. </j-modal>
  143. </template>
  144. <script>
  145. import pick from 'lodash.pick'
  146. import DepotModal from '../../system/modules/DepotModal'
  147. import BatchSetDepot from '../dialog/BatchSetDepot'
  148. import WorkflowIframe from '@/components/tools/WorkflowIframe'
  149. import BillPrintIframe from '../dialog/BillPrintIframe'
  150. import { FormTypes } from '@/utils/JEditableTableUtil'
  151. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  152. import { BillModalMixin } from '../mixins/BillModalMixin'
  153. import { getMpListShort } from '@/utils/util'
  154. import JUpload from '@/components/jeecg/JUpload'
  155. import JImageUpload from '@/components/jeecg/JImageUpload.vue'
  156. import JDate from '@/components/jeecg/JDate'
  157. import Vue from 'vue'
  158. export default {
  159. name: 'AllocationOutModal',
  160. mixins: [JEditableTableMixin, BillModalMixin],
  161. components: {
  162. DepotModal,
  163. BatchSetDepot,
  164. WorkflowIframe,
  165. BillPrintIframe,
  166. JUpload,
  167. JDate,
  168. },
  169. data() {
  170. return {
  171. title: '操作',
  172. width: '1600px',
  173. moreStatus: false,
  174. // 新增时子表默认添加几行空数据
  175. addDefaultRowNum: 1,
  176. visible: false,
  177. operTimeStr: '',
  178. prefixNo: 'DBCK',
  179. fileList: [],
  180. imageList: [],
  181. model: {},
  182. labelCol: {
  183. xs: { span: 24 },
  184. sm: { span: 8 },
  185. },
  186. wrapperCol: {
  187. xs: { span: 24 },
  188. sm: { span: 16 },
  189. },
  190. refKeys: ['materialDataTable'],
  191. activeKey: 'materialDataTable',
  192. materialTable: {
  193. loading: false,
  194. dataSource: [],
  195. columns: [
  196. {
  197. title: '批次号',
  198. key: 'batchNumber',
  199. width: '12%',
  200. type: FormTypes.popupJsh,
  201. kind: 'material',
  202. multi: true,
  203. validateRules: [{ required: true, message: '${title}不能为空' }],
  204. },
  205. { title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
  206. { title: '规格', key: 'standard', width: '9%', type: FormTypes.normal },
  207. { title: '生产日期', key: 'productionDate', width: '9%', type: FormTypes.normal },
  208. { title: '保质期', key: 'expiryNum', width: '6%', type: FormTypes.normal },
  209. { title: '商品条码', key: 'barCode', width: '6%', type: FormTypes.normal },
  210. { title: '仓库名', key: 'depotName', width: '6%', type: FormTypes.normal },
  211. { title: '仓库货架', key: 'position', width: '6%', type: FormTypes.normal },
  212. { title: '包装规格', key: 'unitName', width: '6%', type: FormTypes.normal },
  213. { title: '型号', key: 'model', width: '9%', type: FormTypes.normal },
  214. { title: '颜色', key: 'color', width: '5%', type: FormTypes.normal },
  215. { title: '品牌', key: 'brand', width: '6%', type: FormTypes.normal },
  216. { title: '制造商', key: 'mfrs', width: '6%', type: FormTypes.normal },
  217. { title: '扩展信息', key: 'materialOther', width: '5%', type: FormTypes.normal },
  218. { title: '库存', key: 'stock', width: '5%', type: FormTypes.normal },
  219. {
  220. title: '调入仓库',
  221. key: 'anotherDepotId',
  222. width: '8%',
  223. type: FormTypes.select,
  224. placeholder: '请选择${title}',
  225. options: [],
  226. allowSearch: true,
  227. },
  228. {
  229. title: '单位',
  230. key: 'unit',
  231. width: '6%',
  232. type: FormTypes.slot,
  233. options: [],
  234. allowClear: false,
  235. slotName: 'unit',
  236. },
  237. { title: '单位id', key: 'unitId', width: '4%', type: FormTypes.hidden },
  238. { title: '单位列表', key: 'unitList', width: '5%', type: FormTypes.hidden },
  239. { title: '多属性', key: 'sku', width: '9%', type: FormTypes.normal },
  240. {
  241. title: '数量',
  242. key: 'operNumber',
  243. width: '5%',
  244. type: FormTypes.inputNumber,
  245. statistics: true,
  246. validateRules: [{ required: true, message: '${title}不能为空' }],
  247. },
  248. { title: '单价', key: 'unitPrice', width: '5%', type: FormTypes.inputNumber },
  249. { title: '金额', key: 'allPrice', width: '5%', type: FormTypes.inputNumber, statistics: true },
  250. {
  251. title: '实际出库数量',
  252. key: 'actualQuantityInStorage',
  253. width: '9%',
  254. type: FormTypes.inputNumber,
  255. validateRules: [{ required: true, message: '实际入库数量不能为空' }],
  256. },
  257. { title: '出库差异', key: 'warehousingVariance', width: '9%', type: FormTypes.input },
  258. { title: '出库差异原因', key: 'reasonOfDifference', width: '9%', type: FormTypes.input },
  259. {
  260. title: '出库人',
  261. key: 'warehousingUser',
  262. width: '9%',
  263. type: FormTypes.input,
  264. validateRules: [{ required: true, message: '出库人不能为空' }],
  265. },
  266. { title: '出库时间', key: 'warehousingTime', width: '9%', type: FormTypes.date },
  267. { title: '备注', key: 'remark', width: '5%', type: FormTypes.input },
  268. ],
  269. },
  270. confirmLoading: false,
  271. validatorRules: {
  272. operTime: {
  273. rules: [{ required: true, message: '请输入单据日期!' }],
  274. },
  275. type: {
  276. rules: [{ required: true, message: '请选择类型!' }],
  277. },
  278. },
  279. url: {
  280. add: '/depotHead/addDepotHeadAndDetail',
  281. edit: '/depotHead/updateDepotHeadAndDetail',
  282. detailList: '/depotItem/getDetailList',
  283. },
  284. unitList: [],
  285. }
  286. },
  287. created() {},
  288. methods: {
  289. //调用完edit()方法之后会自动调用此方法
  290. editAfter() {
  291. this.billStatus = '0'
  292. this.currentSelectDepotId = ''
  293. this.changeColumnHide()
  294. this.changeFormTypes(this.materialTable.columns, 'snList', 0)
  295. // this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0)
  296. this.changeFormTypes(this.materialTable.columns, 'expirationDate', 0)
  297. if (this.action === 'add') {
  298. this.addInit(this.prefixNo)
  299. this.fileList = []
  300. this.imageList = []
  301. } else {
  302. this.model.operTime = this.model.operTimeStr
  303. this.fileList = this.model.fileName
  304. this.imageList = this.model.voucherPicture
  305. this.$nextTick(() => {
  306. this.form.setFieldsValue(
  307. pick(
  308. this.model,
  309. 'organId',
  310. 'operTime',
  311. 'number',
  312. 'remark',
  313. 'discount',
  314. 'discountMoney',
  315. 'discountLastMoney',
  316. 'otherMoney',
  317. 'accountId',
  318. 'changeAmount'
  319. )
  320. )
  321. })
  322. // 加载子表数据
  323. let params = {
  324. headerId: this.model.id,
  325. mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
  326. linkType: 'basic',
  327. }
  328. let url = this.readOnly ? this.url.detailList : this.url.detailList
  329. this.requestSubTableData(url, params, this.materialTable)
  330. }
  331. //复制新增单据-初始化单号和日期
  332. if (this.action === 'copyAdd') {
  333. this.model.id = ''
  334. this.model.tenantId = ''
  335. this.copyAddInit(this.prefixNo)
  336. }
  337. this.initSystemConfig()
  338. this.initDepot()
  339. this.initPlatform()
  340. this.initQuickBtn()
  341. },
  342. //提交单据时整理成formData
  343. classifyIntoFormData(allValues) {
  344. let totalPrice = 0
  345. let billMain = Object.assign(this.model, allValues.formValue)
  346. let detailArr = allValues.tablesValue[0].values
  347. billMain.type = '出库'
  348. billMain.subType = '调拨'
  349. for (let item of detailArr) {
  350. totalPrice += item.allPrice - 0
  351. }
  352. billMain.totalPrice = totalPrice
  353. if (this.fileList && this.fileList.length > 0) {
  354. billMain.fileName = this.fileList
  355. } else {
  356. billMain.fileName = ''
  357. }
  358. if (this.imageList && this.imageList.length > 0) {
  359. billMain.voucherPicture = this.imageList
  360. } else {
  361. billMain.voucherPicture = ''
  362. }
  363. if (this.model.id) {
  364. billMain.id = this.model.id
  365. }
  366. billMain.status = this.billStatus
  367. return {
  368. info: JSON.stringify(billMain),
  369. rows: JSON.stringify(detailArr),
  370. }
  371. },
  372. getUnitInfo(val) {
  373. this.unitList = val
  374. },
  375. },
  376. }
  377. </script>
  378. <style scoped></style>