edit.vue 25 KB

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