list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <div class="allocateBillList-wrap">
  3. <div style="background-color: #fff;margin-bottom: 5px;">
  4. <a-tabs v-model="currentTab" @change="changeTab">
  5. <a-tab-pane :key="1" tab="全部">
  6. </a-tab-pane>
  7. <a-tab-pane :key="2" tab="待打印">
  8. </a-tab-pane>
  9. </a-tabs>
  10. </div>
  11. <a-card size="small" :bordered="false">
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <!-- 搜索条件 -->
  14. <div ref="tableSearch" class="table-page-search-wrapper">
  15. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  16. <a-row :gutter="15">
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="创建时间">
  19. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  20. </a-form-item>
  21. </a-col>
  22. <a-col :md="6" :sm="24">
  23. <a-form-item label="调往对象">
  24. <a-input id="allocateBillList-targetName" v-model.trim="queryParam.targetName" allowClear placeholder="请输入调往对象"/>
  25. </a-form-item>
  26. </a-col>
  27. <template v-if="advanced">
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="收货客户名称">
  30. <dealerSubareaScopeList ref="receiverSn" defValKey="buyerSn" @change="custChange" v-model="queryParam.receiverSn" />
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="4" :sm="24">
  34. <a-form-item label="业务状态">
  35. <v-select
  36. v-model="queryParam.state"
  37. ref="state"
  38. id="allocateBillList-state"
  39. code="ALLOCATE_STATUS"
  40. placeholder="请选择业务状态"
  41. allowClear
  42. ></v-select>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="4" :sm="24">
  46. <a-form-item label="调拨单号">
  47. <a-input id="allocateBillList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="4" :sm="24" v-if="currentTab == 1">
  51. <a-form-item label="打印状态">
  52. <v-select
  53. v-model="queryParam.printState"
  54. ref="printState"
  55. id="allocateBillList-printState"
  56. code="PRINT_STATUS"
  57. placeholder="请选择打印状态"
  58. allowClear
  59. ></v-select>
  60. </a-form-item>
  61. </a-col>
  62. <a-col :md="3" :sm="24">
  63. <a-form-item label="所在区域">
  64. <subarea id="allocateBillList-subarea" v-model="queryParam.subareaSn"></subarea>
  65. </a-form-item>
  66. </a-col>
  67. <a-col :md="3" :sm="24">
  68. <a-row>
  69. <a-form-item label="地区">
  70. <a-col span="24">
  71. <a-form-item style="margin: 0;">
  72. <Area id="allocateBillList-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  73. </a-form-item>
  74. </a-col>
  75. </a-form-item>
  76. </a-row>
  77. </a-col>
  78. </template>
  79. <a-col :md="6" :sm="24">
  80. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="allocateBillList-refresh">查询</a-button>
  81. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocateBillList-reset">重置</a-button>
  82. <a @click="advanced=!advanced" style="margin-left: 5px">
  83. {{ advanced ? '收起' : '展开' }}
  84. <a-icon :type="advanced ? 'up' : 'down'"/>
  85. </a>
  86. </a-col>
  87. </a-row>
  88. </a-form>
  89. </div>
  90. <!-- 列表 -->
  91. <s-table
  92. class="sTable fixPagination"
  93. ref="table"
  94. :style="{ height: tableHeight+84.5+'px' }"
  95. size="small"
  96. :rowKey="(record) => record.id"
  97. :columns="columns"
  98. :data="loadData"
  99. :defaultLoadData="false"
  100. :scroll="{ y: tableHeight }"
  101. bordered>
  102. <!-- 单号 -->
  103. <template slot="allocateNo" slot-scope="text, record">
  104. <span v-if="$hasPermissions('M_tfoPrint_detail')" class="link-bule" @click="handleDetail(record)">{{ record.allocateNo }}</span>
  105. <span v-else>{{ record.allocateNo }}</span>
  106. </template>
  107. <div slot="costTitle">
  108. <a-tooltip placement="top">
  109. <template slot="title">
  110. 当调拨对象是经销商时,如果收货客户名称不为空,则按照收货客户的价格级别计算得到。
  111. </template>
  112. <span style="margin-right: 5px;">实际总售价</span> <a-icon type="question-circle" />
  113. </a-tooltip>
  114. </div>
  115. <!-- 操作 -->
  116. <template slot="action" slot-scope="text, record">
  117. <a-button
  118. size="small"
  119. type="link"
  120. v-if="record.printState == 'NO_PRINT'&&$hasPermissions('B_transferOut_type_print')"
  121. class="button-warning"
  122. @click="handlePrint(record)"
  123. id="allocateBillList-printState">调拨分类打印</a-button>
  124. <a-button
  125. size="small"
  126. type="link"
  127. v-else-if="record.printState == 'PRINT'&&$hasPermissions('B_tfoPrint_record')"
  128. class="button-success"
  129. @click="handlePrintRecord(record)"
  130. id="allocateBillList-printRecord">打印记录</a-button>
  131. <span v-else>--</span>
  132. </template>
  133. </s-table>
  134. </a-spin>
  135. </a-card>
  136. <!-- 打印导出 -->
  137. <print-modal
  138. v-drag
  139. :openModal="openModal"
  140. :itemData="itemData"
  141. nowType="dbflPrint"
  142. @ok="handleOk"
  143. @close="openModal=false" />
  144. <!-- 打印记录 -->
  145. <recordModal v-drag ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
  146. </div>
  147. </template>
  148. <script>
  149. import { commonMixin } from '@/utils/mixin'
  150. import moment from 'moment'
  151. import getDate from '@/libs/getDate.js'
  152. import { STable, VSelect } from '@/components'
  153. import subarea from '@/views/common/subarea.js'
  154. import Area from '@/views/common/area.js'
  155. import rangeDate from '@/views/common/rangeDate.vue'
  156. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  157. import printModal from '@/views/allocationManagement/transferOut/printModal.vue'
  158. import recordModal from './recordModal.vue'
  159. import { allocateBillList, allocateBillDetailPrint } from '@/api/allocateBill'
  160. import { printFun } from '@/libs/JGPrint.js'
  161. export default {
  162. name: 'TransfersPrintList',
  163. mixins: [commonMixin],
  164. components: { STable, VSelect, rangeDate, dealerSubareaScopeList, printModal, recordModal, subarea, Area },
  165. data () {
  166. return {
  167. spinning: false,
  168. advanced: true, // 高级搜索 展开/关闭
  169. tableHeight: 0,
  170. itemData: null,
  171. showRecordModal: false,
  172. time: [
  173. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  174. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  175. ],
  176. queryParam: { // 查询条件
  177. beginDate: getDate.getThreeMonthDays().starttime,
  178. endDate: getDate.getCurrMonthDays().endtime,
  179. targetName: '', // 调往对象
  180. state: undefined, // 业务状态
  181. allocateNo: '', // 调拨单号
  182. receiverSn: undefined,
  183. checkStatus: undefined,
  184. printState: 'NO_PRINT',
  185. subareaSn: undefined,
  186. shippingAddrProvinceSn: undefined
  187. },
  188. currentTab: 2,
  189. disabled: false, // 查询、重置按钮是否可操作
  190. exportLoading: false,
  191. // 加载数据方法 必须为 Promise 对象
  192. loadData: parameter => {
  193. this.disabled = true
  194. this.spinning = true
  195. return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
  196. let data
  197. if (res.status == 200) {
  198. data = res.data
  199. const no = (data.pageNo - 1) * data.pageSize
  200. for (var i = 0; i < data.list.length; i++) {
  201. data.list[i].no = no + i + 1
  202. }
  203. this.disabled = false
  204. }
  205. this.spinning = false
  206. return data
  207. })
  208. },
  209. visibleAudit: false,
  210. auditInfo: null,
  211. spinningAudit: false,
  212. openModal: false // 打印弹框
  213. }
  214. },
  215. computed: {
  216. columns () {
  217. const arr = [
  218. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  219. { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  220. { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, align: 'center', width: '10%' },
  221. { title: '调往对象', dataIndex: 'targetName', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  222. { title: '发货编号', dataIndex: 'sendNo', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  223. { title: '收货客户名称', dataIndex: 'receiverName', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  224. { title: '总数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  225. // { slots: { title: 'costTitle' }, dataIndex: 'receiveTotalAmount', width: '90px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  226. // { title: '易损件售价', dataIndex: 'receiveYsjTotalAmount', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  227. // { title: '电池售价', dataIndex: 'receiveDcTotalAmount', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  228. // { title: '机油售价', dataIndex: 'receiveJyTotalAmount', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  229. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  230. { title: '打印状态', dataIndex: 'printStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  231. { title: '允许打印时间', dataIndex: 'allowPrintTime', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  232. { title: '打印次数', dataIndex: 'printCount', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  233. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  234. ]
  235. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  236. arr.splice(7, 0, { slots: { title: 'costTitle' }, dataIndex: 'receiveTotalAmount', width: '90px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  237. arr.splice(8, 0, { title: '易损件售价', dataIndex: 'receiveYsjTotalAmount', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  238. arr.splice(9, 0, { title: '电池售价', dataIndex: 'receiveDcTotalAmount', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  239. arr.splice(10, 0, { title: '机油售价', dataIndex: 'receiveJyTotalAmount', width: '70px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  240. }
  241. return arr
  242. }
  243. },
  244. methods: {
  245. custChange (val) {
  246. this.queryParam.receiverSn = val.key || ''
  247. },
  248. changeTab (v) {
  249. this.currentTab = v
  250. this.resetSearchForm()
  251. },
  252. // 创建时间 change
  253. dateChange (date) {
  254. this.queryParam.beginDate = date[0]
  255. this.queryParam.endDate = date[1]
  256. },
  257. // 重置
  258. resetSearchForm () {
  259. this.$refs.rangeDate.resetDate(this.time)
  260. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  261. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  262. this.queryParam.targetName = ''
  263. this.queryParam.state = undefined
  264. this.queryParam.allocateNo = ''
  265. this.queryParam.receiverName = ''
  266. this.queryParam.receiverSn = undefined
  267. this.queryParam.subareaSn = undefined
  268. this.queryParam.shippingAddrProvinceSn = undefined
  269. this.$refs.receiverSn.resetForm()
  270. this.queryParam.printState = this.currentTab == 2 ? 'NO_PRINT' : undefined
  271. this.$refs.table.refresh(true)
  272. },
  273. // 分类打印
  274. handlePrint (row) {
  275. this.itemData = row
  276. this.openModal = true
  277. },
  278. // 打印记录
  279. handlePrintRecord (row) {
  280. this.showRecordModal = true
  281. this.$refs.recordModal.setData(row, {
  282. billType: 'ALLOCATE',
  283. billSn: row.allocateSn
  284. })
  285. },
  286. // 确定打印
  287. handleOk (objs) {
  288. const _this = this
  289. const params = JSON.parse(JSON.stringify(objs))
  290. delete params.type
  291. _this.spinning = true
  292. printFun(
  293. allocateBillDetailPrint,
  294. params,
  295. objs.isPreview ? 'preview' : 'print',
  296. '调拨分类',
  297. (res) => {
  298. _this.spinning = false
  299. if (res.status == 200) {
  300. _this.$refs.table.refresh()
  301. }
  302. _this.$message.info(res.message)
  303. }, {
  304. billType: 'ALLOCATE',
  305. billSn: objs.allocateSn,
  306. billNo: objs.allocateNo,
  307. printType: '调拨分类打印'
  308. })
  309. },
  310. // 详情
  311. handleDetail (row) {
  312. if (this.$hasPermissions('M_tfoPrint_detail')) {
  313. this.$router.push({ path: `/allocationManagement/transferOut/detail/${row.allocateSn}` })
  314. }
  315. },
  316. pageInit () {
  317. const _this = this
  318. this.$nextTick(() => { // 页面渲染完成后的回调
  319. _this.setTableH()
  320. })
  321. this.openModal = false
  322. },
  323. setTableH () {
  324. const tableSearchH = this.$refs.tableSearch.offsetHeight
  325. this.tableHeight = window.innerHeight - tableSearchH - 240
  326. }
  327. },
  328. watch: {
  329. advanced (newValue, oldValue) {
  330. const _this = this
  331. this.$nextTick(() => { // 页面渲染完成后的回调
  332. _this.setTableH()
  333. })
  334. },
  335. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  336. this.setTableH()
  337. }
  338. },
  339. mounted () {
  340. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  341. this.pageInit()
  342. this.resetSearchForm()
  343. }
  344. },
  345. activated () {
  346. // 如果是新页签打开,则重置当前页面
  347. if (this.$store.state.app.isNewTab) {
  348. this.pageInit()
  349. this.resetSearchForm()
  350. }
  351. // 仅刷新列表,不重置页面
  352. if (this.$store.state.app.updateList) {
  353. this.pageInit()
  354. this.$refs.table.refresh()
  355. }
  356. },
  357. beforeRouteEnter (to, from, next) {
  358. next(vm => {})
  359. }
  360. }
  361. </script>
  362. <style lang="less">
  363. .allocateBillList-wrap{
  364. .ant-tabs-bar{
  365. margin: 0;
  366. }
  367. }
  368. </style>