edit.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. <template>
  2. <div class="chainTransferOutEdit-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="chainTransferOutEdit-back" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="chainTransferOutEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span style="margin: 0 15px;color: #666;">调往对象:{{ (basicInfoData&&basicInfoData.putTenantName) || '--' }}</span>
  9. </template>
  10. <!-- 操作区,位于 title 行的行尾 -->
  11. <template slot="extra" v-if="$hasPermissions('B_allocLinkageOutPrint')">
  12. <a-radio-group key="3" v-model="printerType">
  13. <a-radio value="NEEDLE">针式</a-radio>
  14. <a-radio value="INK">喷墨</a-radio>
  15. </a-radio-group>
  16. <a-button key="2" id="chainTransferOutEdit-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
  17. <a-button key="1" type="primary" id="chainTransferOutEdit-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
  18. </template>
  19. </a-page-header>
  20. <!-- 选择产品 -->
  21. <a-card size="small" :bordered="false" class="chainTransferOutEdit-cont">
  22. <a-collapse :activeKey="['1']">
  23. <a-collapse-panel key="1" header="选择产品">
  24. <!-- 筛选条件 -->
  25. <div class="table-page-search-wrapper">
  26. <a-form layout="inline" @keyup.enter.native="getProductList(1)">
  27. <a-row :gutter="15">
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="产品编码" prop="productCode">
  30. <a-input id="chainTransferOutEdit-productCode" v-model="queryParam.productCode" placeholder="请输入产品编码" allowClear />
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="产品名称" prop="productName">
  35. <a-input id="chainTransferOutEdit-productName" v-model="queryParam.productName" placeholder="请输入产品名称" allowClear />
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24">
  39. <a-form-item label="原厂编码" prop="productOrigCode">
  40. <a-input id="chainTransferOutEdit-productOrigCode" v-model="queryParam.productOrigCode" placeholder="请输入原厂编码" allowClear />
  41. </a-form-item>
  42. </a-col>
  43. <template v-if="advanced">
  44. <a-col :md="6" :sm="24">
  45. <a-form-item label="产品品牌">
  46. <a-select
  47. placeholder="请选择"
  48. id="chainTransferOutEdit-brandSn"
  49. allowClear
  50. v-model="queryParam.brandSn"
  51. :showSearch="true"
  52. option-filter-prop="children"
  53. :filter-option="filterOption">
  54. <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
  55. </a-select>
  56. </a-form-item>
  57. </a-col>
  58. <a-col :md="6" :sm="24">
  59. <a-form-item label="产品分类">
  60. <a-cascader
  61. @change="changeProductType"
  62. change-on-select
  63. v-model="productType"
  64. expand-trigger="hover"
  65. :options="productTypeList"
  66. :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
  67. id="chainTransferOutEdit-productType"
  68. placeholder="请选择产品分类"
  69. allowClear />
  70. </a-form-item>
  71. </a-col>
  72. <a-col :md="6" :sm="24">
  73. <a-form-item label="仓库">
  74. <a-select id="chainTransferOutEdit-warehouseSn" allowClear placeholder="请选择仓库" v-model="queryParam.warehouseSn" >
  75. <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
  76. </a-select>
  77. </a-form-item>
  78. </a-col>
  79. </template>
  80. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  81. <a-button type="primary" @click="getProductList(1)" :disabled="disabled" id="chainTransferOutEdit-refresh">查询</a-button>
  82. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutEdit-reset">重置</a-button>
  83. <a @click="advanced=!advanced" style="margin-left: 8px">
  84. {{ advanced ? '收起' : '展开' }}
  85. <a-icon :type="advanced ? 'up' : 'down'"/>
  86. </a>
  87. </a-col>
  88. </a-row>
  89. </a-form>
  90. </div>
  91. <!-- 列表 -->
  92. <a-table
  93. class="sTable"
  94. ref="table"
  95. size="small"
  96. :rowKey="(record) => record.stockSn+record.productSn+record.warehouseSn+record.warehouseLocationSn"
  97. :columns="columns"
  98. :customRow="handleClickRow"
  99. :dataSource="loadData"
  100. :loading="loading"
  101. :scroll="{ x: 1680, y: 300 }"
  102. bordered>
  103. <!-- 调出数量 -->
  104. <template slot="outQty" slot-scope="text, record">
  105. <a-input-number
  106. id="chainTransferOutEdit-outQty"
  107. v-model="record.outQty"
  108. :precision="0"
  109. :min="1"
  110. :max="record.currentQty"
  111. placeholder="请输入"
  112. style="width: 100%;" />
  113. </template>
  114. <!-- 操作 -->
  115. <template slot="action" slot-scope="text, record">
  116. <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="chainTransferOutEdit-add-btn">添加</a-button>
  117. </template>
  118. </a-table>
  119. </a-collapse-panel>
  120. </a-collapse>
  121. </a-card>
  122. <!-- 已选产品 -->
  123. <a-card size="small" :bordered="false" class="chainTransferOutEdit-cont">
  124. <a-collapse :activeKey="['1']">
  125. <a-collapse-panel key="1" header="已选产品">
  126. <!-- 总计 -->
  127. <a-alert type="info" showIcon style="margin-bottom:10px">
  128. <div slot="message">
  129. 总款数 <strong>{{ (productTotal&&(productTotal.productTotalCategory || productTotal.productTotalCategory==0)) ? productTotal.productTotalCategory : '--' }}</strong> ,
  130. 总数量 <strong>{{ (productTotal&&(productTotal.productTotalQty || productTotal.productTotalQty==0)) ? productTotal.productTotalQty : '--' }}</strong> ,
  131. 总成本 <strong>{{ (productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0)) ? '¥'+productTotal.productTotalCost : '--' }}</strong>
  132. </div>
  133. </a-alert>
  134. <!-- 筛选条件 -->
  135. <a-row :gutter="15" justify="space-between">
  136. <a-col :span="17">
  137. <div class="table-page-search-wrapper">
  138. <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
  139. <a-row :gutter="15">
  140. <a-col :md="9" :sm="24">
  141. <a-form-item label="产品编码" prop="productCode">
  142. <a-input id="chainTransferOutEdit-productCode" v-model="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
  143. </a-form-item>
  144. </a-col>
  145. <a-col :md="9" :sm="24">
  146. <a-form-item label="产品名称" prop="productName">
  147. <a-input id="chainTransferOutEdit-productName" v-model="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
  148. </a-form-item>
  149. </a-col>
  150. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  151. <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="chainTransferOutList-refresh">查询</a-button>
  152. <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="chainTransferOutList-reset">重置</a-button>
  153. </a-col>
  154. </a-row>
  155. </a-form>
  156. </div>
  157. </a-col>
  158. <a-col :span="7" style="text-align: right;">
  159. <!-- <a-button size="small" style="margin-left: 8px" id="chainTransferOutEdit-import-btn">导入明细</a-button> -->
  160. <a-button size="small" type="danger" style="margin-left: 8px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button>
  161. </a-col>
  162. </a-row>
  163. <!-- 列表 -->
  164. <s-table
  165. class="sTable"
  166. ref="chooseTable"
  167. size="small"
  168. :rowKey="(record) => record.id"
  169. :columns="chooseColumns"
  170. :data="chooseLoadData"
  171. :scroll="{ x: 1695, y: 300 }"
  172. bordered>
  173. <!-- 操作 -->
  174. <template slot="action" slot-scope="text, record">
  175. <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="chainTransferOutEdit-del-btn">删除</a-button>
  176. </template>
  177. </s-table>
  178. </a-collapse-panel>
  179. </a-collapse>
  180. </a-card>
  181. <a-affix :offset-bottom="0">
  182. <div style="text-align: center;width: 100%;background-color: #fff;padding: 12px 0;box-shadow: 0 0 20px #dcdee2;">
  183. <a-button
  184. type="primary"
  185. id="chainTransferOutEdit-submit"
  186. size="large"
  187. class="button-primary"
  188. @click="handleSubmit"
  189. style="padding: 0 60px;">提交</a-button>
  190. </div>
  191. </a-affix>
  192. </a-spin>
  193. <!-- 打印 -->
  194. <div id="print"></div>
  195. </div>
  196. </template>
  197. <script>
  198. import { STable, VSelect } from '@/components'
  199. import { getOperationalPrecision } from '@/libs/tools.js'
  200. import { allocLinkageOutDetailSn, allocLinkageOutDetailList, allocLinkageOutDetailSave, allocLinkageOutDetailDel, allocLinkageOutDetailCount, allocLinkageOutSubmit, allocLinkageOutDetailDelAll, allocLinkageOutDetailPrint } from '@/api/allocLinkageOut'
  201. import { productQuery } from '@/api/allocWarehouse'
  202. import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
  203. import { dealerProductTypeList } from '@/api/dealerProductType'
  204. import { warehouseAllList } from '@/api/warehouse'
  205. export default {
  206. components: { STable, VSelect },
  207. data () {
  208. return {
  209. spinning: false,
  210. queryParam: {
  211. productCode: '',
  212. productName: '',
  213. productOrigCode: '',
  214. warehouseSn: undefined,
  215. brandSn: undefined,
  216. productTypeSn1: undefined,
  217. productTypeSn2: undefined,
  218. productTypeSn3: undefined
  219. },
  220. productBrandList: [], // 产品品牌 下拉数据
  221. productTypeList: [], // 产品分类 下拉数据
  222. productType: [],
  223. warehouseList: [], // 仓库 下拉数据
  224. disabled: false, // 查询、重置按钮是否可操作
  225. loading: false, // 表格加载中
  226. chooseDisabled: false,
  227. advanced: false, // 高级搜索 展开/关闭
  228. // 表头
  229. columns: [
  230. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  231. { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  232. { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  233. { title: '原厂编码', dataIndex: 'productOrigCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  234. { title: '品牌', dataIndex: 'brandName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  235. { title: '仓库', dataIndex: 'warehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  236. { title: '仓位', dataIndex: 'warehouseLocationName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  237. { title: '成本价(¥)', dataIndex: 'putCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  238. { title: '库存数量', dataIndex: 'currentQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  239. { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  240. { title: '调出数量', scopedSlots: { customRender: 'outQty' }, width: 140, align: 'center', fixed: 'right' },
  241. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  242. ],
  243. loadData: [],
  244. pageNo: 1, // 分页页码
  245. pageSize: 10, // 分页 每页多少条
  246. paginationProps: {
  247. showSizeChanger: true, // 是否可以改变 pageSize
  248. total: 0, // 分页总条数
  249. current: 1,
  250. onShowSizeChange: (current, pageSize) => this.changePageSize(current, pageSize),
  251. onChange: (current) => this.changePage(current)
  252. },
  253. chooseQueryParam: {
  254. productCode: '',
  255. productName: ''
  256. },
  257. // 表头
  258. chooseColumns: [
  259. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  260. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  261. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  262. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  263. { title: '品牌', dataIndex: 'dealerProductEntity.productBrandName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  264. { title: '仓库', dataIndex: 'warehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  265. { title: '仓位', dataIndex: 'warehouseLocationName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  266. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  267. { title: '成本价', dataIndex: 'outCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  268. { title: '调出数量', dataIndex: 'outQty', width: 140, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  269. { title: '成本小计', dataIndex: 'costSubtotal', width: 115, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  270. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  271. ],
  272. // 加载数据方法 必须为 Promise 对象
  273. chooseLoadData: parameter => {
  274. this.chooseDisabled = true
  275. const params = Object.assign(parameter, this.chooseQueryParam, { allocationLinkageOutSn: this.$route.params.sn })
  276. return allocLinkageOutDetailList(params).then(res => {
  277. const data = res.data
  278. const no = (data.pageNo - 1) * data.pageSize
  279. for (var i = 0; i < data.list.length; i++) {
  280. data.list[i].no = no + i + 1
  281. // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
  282. data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
  283. }
  284. this.chooseDisabled = false
  285. this.getDetailCount(params)
  286. this.localDataSource = data.list
  287. return data
  288. })
  289. },
  290. basicInfoData: null, // 基本信息
  291. productTotal: null, // 合计
  292. localDataSource: [],
  293. printerType: 'NEEDLE' // 打印机类型
  294. }
  295. },
  296. methods: {
  297. // 重置
  298. resetSearchForm () {
  299. this.queryParam.productCode = ''
  300. this.queryParam.productName = ''
  301. this.queryParam.productOrigCode = ''
  302. this.queryParam.warehouseSn = undefined
  303. this.queryParam.brandSn = undefined
  304. this.queryParam.productTypeSn1 = undefined
  305. this.queryParam.productTypeSn2 = undefined
  306. this.queryParam.productTypeSn3 = undefined
  307. this.productType = []
  308. this.getProductList(1)
  309. },
  310. // 已选产品 重置
  311. chooseResetSearchForm () {
  312. this.chooseQueryParam.productCode = ''
  313. this.chooseQueryParam.productName = ''
  314. this.$refs.chooseTable.refresh(true)
  315. },
  316. // 双击快速添加
  317. handleClickRow (record) {
  318. return {
  319. on: {
  320. dblclick: (event) => {
  321. this.handleAdd(record)
  322. }
  323. }
  324. }
  325. },
  326. // 基本信息
  327. getDetail () {
  328. allocLinkageOutDetailSn({ sn: this.$route.params.sn }).then(res => {
  329. if (res.status == 200) {
  330. this.basicInfoData = res.data
  331. this.getProductList(1)
  332. this.getProductBrand()
  333. this.getProductType()
  334. } else {
  335. this.basicInfoData = null
  336. }
  337. })
  338. },
  339. // 添加/编辑
  340. handleAdd (row, isEdit) {
  341. if (!isEdit && !row.outQty) {
  342. this.$message.warning('请输入调出数量后再添加!')
  343. return
  344. }
  345. const params = {
  346. id: isEdit ? row.id : undefined,
  347. allocationLinkageOutSn: this.$route.params.sn,
  348. outCost: isEdit ? row.outCost : row.putCost,
  349. outQty: row.outQty,
  350. productSn: row.productSn,
  351. productProduceDate: row.productProduceDate,
  352. productExpiryDate: row.productExpiryDate,
  353. warehouseSn: row.warehouseSn,
  354. warehouseLocationSn: row.warehouseLocationSn
  355. }
  356. this.spinning = true
  357. allocLinkageOutDetailSave(params).then(res => {
  358. if (res.status == 200) {
  359. this.$message.success(res.message)
  360. this.getProductList()
  361. this.$refs.chooseTable.refresh()
  362. this.spinning = false
  363. } else {
  364. this.spinning = false
  365. }
  366. })
  367. },
  368. // 删除
  369. handleDel (row, isAll) {
  370. const _this = this
  371. const content = isAll ? '删除后不可恢复,确定要进行整单删除吗?' : '删除后不可恢复,确定要进行删除吗?'
  372. this.$confirm({
  373. title: '提示',
  374. content: content,
  375. centered: true,
  376. onOk () {
  377. if (isAll) { // 整单删除
  378. _this.spinning = true
  379. allocLinkageOutDetailDelAll({ sn: _this.$route.params.sn }).then(res => {
  380. if (res.status == 200) {
  381. _this.$message.success(res.message)
  382. _this.getProductList()
  383. _this.$refs.chooseTable.refresh()
  384. _this.spinning = false
  385. } else {
  386. _this.spinning = false
  387. }
  388. })
  389. } else { // 单个删除
  390. _this.spinning = true
  391. allocLinkageOutDetailDel({ id: row.id }).then(res => {
  392. if (res.status == 200) {
  393. _this.$message.success(res.message)
  394. _this.getProductList()
  395. _this.$refs.chooseTable.refresh()
  396. _this.spinning = false
  397. } else {
  398. _this.spinning = false
  399. }
  400. })
  401. }
  402. }
  403. })
  404. },
  405. // 提交
  406. handleSubmit () {
  407. const _this = this
  408. _this.spinning = true
  409. allocLinkageOutSubmit({ sn: this.$route.params.sn }).then(res => {
  410. if (res.status == 200) {
  411. this.$message.success(res.message)
  412. setTimeout(() => {
  413. _this.handleBack()
  414. _this.spinning = false
  415. }, 1000)
  416. } else {
  417. _this.spinning = false
  418. }
  419. })
  420. },
  421. // 导入明细
  422. handleImport () {
  423. console.log(333)
  424. },
  425. // 返回列表
  426. handleBack () {
  427. this.$router.push({ path: '/allocationManagement/chainTransferOut/list', query: { closeLastOldTab: true } })
  428. },
  429. filterOption (input, option) {
  430. return (
  431. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  432. )
  433. },
  434. // 产品列表数据
  435. getProductList (pageNo) {
  436. this.disabled = true
  437. this.loading = true
  438. this.pageNo = pageNo || this.pageNo
  439. // 箭冠品牌 sysFlag传1,非箭冠品牌传0。与新增时所选调出产品类型有关
  440. this.queryParam.sysFlag = this.basicInfoData.allocationType == 'JIANGUAN' ? '1' : '0'
  441. const params = Object.assign({ pageNo: this.pageNo, pageSize: this.pageSize }, this.queryParam)
  442. productQuery(params).then(res => {
  443. this.loading = false
  444. if (res.status == 200) {
  445. const data = res.data
  446. this.paginationProps.total = Number(res.data.count) || 0
  447. this.paginationProps.current = data.pageNo
  448. const no = (data.pageNo - 1) * data.pageSize
  449. for (var i = 0; i < data.list.length; i++) {
  450. data.list[i].no = no + i + 1
  451. }
  452. this.loadData = data.list
  453. this.disabled = false
  454. } else {
  455. this.paginationProps.total = 0
  456. this.paginationProps.current = 1
  457. this.loadData = []
  458. }
  459. })
  460. },
  461. // 合计
  462. getDetailCount (params) {
  463. allocLinkageOutDetailCount(params).then(res => {
  464. if (res.status == 200) {
  465. this.productTotal = res.data
  466. } else {
  467. this.productTotal = null
  468. }
  469. })
  470. },
  471. // 产品分类 change
  472. changeProductType (val, opt) {
  473. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  474. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  475. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  476. },
  477. // 产品品牌 列表
  478. getProductBrand () {
  479. // sysFlag为1查询箭冠产品,为0查询非箭冠产品
  480. dealerProductBrandQuery({ sysFlag: this.basicInfoData.allocationType == 'JIANGUAN' ? '1' : '0' }).then(res => {
  481. if (res.status == 200) {
  482. this.productBrandList = res.data
  483. } else {
  484. this.productBrandList = []
  485. }
  486. })
  487. },
  488. // 产品分类 列表
  489. getProductType () {
  490. dealerProductTypeList({ sysFlag: this.basicInfoData.allocationType == 'JIANGUAN' ? '1' : '0' }).then(res => {
  491. if (res.status == 200) {
  492. this.productTypeList = res.data
  493. } else {
  494. this.productTypeList = []
  495. }
  496. })
  497. },
  498. // 仓库下拉数据
  499. getWarehouseList (type) {
  500. warehouseAllList({}).then(res => {
  501. if (res.status == 200) {
  502. this.warehouseList = res.data
  503. } else {
  504. this.warehouseList = []
  505. }
  506. })
  507. },
  508. // 打印预览/快捷打印
  509. handlePrint (type) {
  510. const _this = this
  511. _this.spinning = true
  512. allocLinkageOutDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
  513. _this.spinning = false
  514. if (res.type == 'application/json') {
  515. var reader = new FileReader()
  516. reader.addEventListener('loadend', function () {
  517. const obj = JSON.parse(reader.result)
  518. _this.$notification.error({
  519. message: '提示',
  520. description: obj.message
  521. })
  522. })
  523. reader.readAsText(res)
  524. } else {
  525. this.print(res, type)
  526. }
  527. })
  528. },
  529. print (data, type) {
  530. if (!data) {
  531. return
  532. }
  533. const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
  534. document.getElementById('print').innerHTML = '<iframe id="printf" name="printf" src="' + url + '" hidden></iframe>'
  535. if (type == 'preview') { // 预览
  536. window.open(url)
  537. } else if (type == 'print') { // 打印
  538. window.frames['printf'].focus()
  539. window.frames['printf'].print()
  540. }
  541. }
  542. },
  543. beforeRouteEnter (to, from, next) {
  544. next(vm => {
  545. vm.getDetail()
  546. vm.getWarehouseList()
  547. })
  548. }
  549. }
  550. </script>
  551. <style lang="less">
  552. .chainTransferOutEdit-wrap{
  553. .chainTransferOutEdit-back{
  554. margin-bottom: 15px;
  555. }
  556. .chainTransferOutEdit-cont{
  557. margin-bottom: 15px;
  558. .sub-title{
  559. font-size: 12px;
  560. color: #808695;
  561. margin-left: 10px;
  562. }
  563. .tag-txt{
  564. font-size: 12px;
  565. color: #ed1c24;
  566. }
  567. .edit-circle-btn{
  568. margin-left: 15px;
  569. i{
  570. vertical-align: text-bottom;
  571. }
  572. }
  573. .import-btn{
  574. margin-left: 15px;
  575. }
  576. }
  577. }
  578. </style>