list.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <a-card size="small" :bordered="false" class="chainTransferOutList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="创建时间">
  10. <rangeDate id="chainTransferOutList-time" ref="rangeDate" :value="time" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="审核时间">
  15. <rangeDate id="chainTransferOutList-auditTime" ref="auditRangeDate" v-model="auditTime" @change="auditDateChange" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="连锁调出单号">
  20. <a-input id="chainTransferOutList-allocationLinkageOutNo" v-model.trim="queryParam.allocationLinkageOutNo" allowClear placeholder="请输入连锁调出单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="业务状态">
  25. <v-select
  26. v-model="queryParam.state"
  27. ref="state"
  28. id="chainTransferOutList-state"
  29. code="ALLOCATION_LINKAGE_OUT_STATUS"
  30. @change="setIsHomeNav($route.name, null)"
  31. placeholder="请选择业务状态"
  32. allowClear></v-select>
  33. </a-form-item>
  34. </a-col>
  35. <template v-if="advanced">
  36. <a-col :md="6" :sm="24">
  37. <a-form-item label="出库时间">
  38. <rangeDate id="chainTransferOutList-outWareTime" ref="outWareRangeDate" v-model="outWareTime" @change="outWareDateChange" />
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="6" :sm="24">
  42. <a-form-item label="调往对象">
  43. <getTenantList id="chainTransferOutList-putTenantSn" type="out" placeholder="请选择调往对象" v-model="queryParam.putTenantSn"></getTenantList>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :md="6" :sm="24">
  47. <a-form-item label="调出产品类型">
  48. <v-select
  49. v-model="queryParam.allocationType"
  50. ref="allocationType"
  51. id="chainTransferOutList-allocationType"
  52. code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
  53. placeholder="请选择调出产品类型"
  54. allowClear></v-select>
  55. </a-form-item>
  56. </a-col>
  57. <a-col :md="6" :sm="24">
  58. <a-form-item label="财务状态">
  59. <v-select
  60. v-model="queryParam.settleState"
  61. ref="settleState"
  62. id="chainTransferOutList-settleState"
  63. code="FINANCIAL_STATUS"
  64. placeholder="请选择财务状态"
  65. allowClear></v-select>
  66. </a-form-item>
  67. </a-col>
  68. </template>
  69. <a-col :md="24" :sm="24" style="margin-bottom: 10px;text-align: center;">
  70. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferOutList-refresh">查询</a-button>
  71. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="chainTransferOutList-reset">重置</a-button>
  72. <a-button
  73. type="primary"
  74. class="button-warning"
  75. v-if="$hasPermissions('B_allocLinkageOutExport')"
  76. @click="handleExport"
  77. :disabled="disabled"
  78. :loading="exportLoading"
  79. id="chainTransferOutList-export">导出</a-button>
  80. <a @click="advanced=!advanced" style="margin-left: 8px" id="chainTransferOutList-advanced">
  81. {{ advanced ? '收起' : '展开' }}
  82. <a-icon :type="advanced ? 'up' : 'down'"/>
  83. </a>
  84. </a-col>
  85. </a-row>
  86. </a-form>
  87. </div>
  88. <!-- 操作按钮 -->
  89. <div class="table-operator">
  90. <a-button id="chainTransferOutList-add" v-if="$hasPermissions('B_allocLinkageOutNew')" type="primary" class="button-error" @click="openModal=true">新增</a-button>
  91. </div>
  92. <!-- 统计 -->
  93. <a-alert type="info" style="margin-bottom:10px">
  94. <div slot="message">
  95. 总款数: <strong>{{ countData&&(countData.productTotalCategory || countData.productTotalCategory==0) ? countData.productTotalCategory : '--' }}</strong> ,
  96. 总数量: <strong>{{ countData&&(countData.productTotalQty || countData.productTotalQty==0) ? countData.productTotalQty : '--' }}</strong>
  97. <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
  98. ,总成本: <strong>{{ countData&&(countData.productTotalCost || countData.productTotalCost==0) ? toThousands(countData.productTotalCost,2) : '--' }}</strong>
  99. </div>
  100. </div>
  101. </a-alert>
  102. <!-- 列表 -->
  103. <s-table
  104. class="sTable fixPagination"
  105. ref="table"
  106. :style="{ height: tableHeight+84.5+'px' }"
  107. size="small"
  108. :rowKey="(record) => record.id"
  109. :columns="columns"
  110. :data="loadData"
  111. :scroll="{ y: tableHeight }"
  112. :defaultLoadData="false"
  113. bordered>
  114. <!-- 连锁调出单号 -->
  115. <template slot="allocationLinkageOutNo" slot-scope="text, record">
  116. <span class="table-td-link" v-if="$hasPermissions('B_allocLinkageOutDetail')" @click="handleDetail(record)">{{ record.allocationLinkageOutNo }}</span>
  117. <span v-else>{{ record.allocationLinkageOutNo }}</span>
  118. </template>
  119. <!-- 审核 -->
  120. <template slot="audit" slot-scope="text, record">
  121. <stateIcon :title="record.stateDictValue" :state="record.state == 'FINISH'||record.state == 'WAIT_OUT_WAREHOUSE'?'1':'2'"></stateIcon>
  122. </template>
  123. <!-- 结算 -->
  124. <template slot="financial" slot-scope="text, record">
  125. <stateIcon :title="record.settleStateDictValue" :state="record.settleState == 'FINISH'?'1':'2'"></stateIcon>
  126. </template>
  127. <!-- 出库 -->
  128. <template slot="waitOut" slot-scope="text, record">
  129. <stateIcon :state="record.state == 'FINISH'?'1':'2'"></stateIcon>
  130. </template>
  131. <!-- 操作 -->
  132. <template slot="action" slot-scope="text, record">
  133. <a-button
  134. size="small"
  135. type="link"
  136. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkageOutAudit')"
  137. class="button-primary"
  138. @click="handleExamine(record)"
  139. :id="'chainTransferOutList-examine-'+record.id">审核</a-button>
  140. <a-button
  141. size="small"
  142. type="link"
  143. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT') &&$hasPermissions('B_allocLinkageOutEdit')"
  144. class="button-primary"
  145. @click="handleEdit(record)"
  146. :id="'chainTransferOutList-edit-'+record.id">编辑</a-button>
  147. <a-button
  148. size="small"
  149. type="link"
  150. v-if="record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_allocLinkageOutStock')"
  151. class="button-primary"
  152. @click="handleOut(record)"
  153. :id="'chainTransferOutList-out-'+record.id">出库</a-button>
  154. <a-button
  155. size="small"
  156. type="link"
  157. v-if="(record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT' || record.state == 'WAIT_OUT_WAREHOUSE') &&$hasPermissions('B_allocLinkageOutDel')"
  158. class="button-error"
  159. @click="handleDel(record)"
  160. :id="'chainTransferOutList-del-'+record.id">删除</a-button>
  161. <span v-if="(record.state != 'WAIT_SUBMIT' && record.state != 'WAIT_AUDIT' && record.state != 'WAIT_OUT_WAREHOUSE')|| (!(record.state == 'WAIT_AUDIT'&&$hasPermissions('B_allocLinkageOutAudit')) && !((record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT') &&$hasPermissions('B_allocLinkageOutEdit')) && !(record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_allocLinkageOutStock')))">--</span>
  162. </template>
  163. </s-table>
  164. </a-spin>
  165. <!-- 新增/编辑 -->
  166. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  167. </a-card>
  168. </template>
  169. <script>
  170. import { commonMixin } from '@/utils/mixin'
  171. import { STable, VSelect } from '@/components'
  172. import rangeDate from '@/views/common/rangeDate.vue'
  173. import basicInfoModal from './basicInfoModal.vue'
  174. import stateIcon from '@/views/common/stateIcon'
  175. import getDate from '@/libs/getDate.js'
  176. import getTenantList from '@/views/common/getTenantList.js'
  177. import { downloadExcel } from '@/libs/JGPrint.js'
  178. import { allocLinkageOutList, allocLinkageAudit, allocLinkageOutDel, allocLinkageOutStock, allocLinkageOutQueryCount, allocLinkageOutExport } from '@/api/allocLinkageOut'
  179. export default {
  180. name: 'AllocLinkageOutList',
  181. components: { STable, VSelect, basicInfoModal, rangeDate, stateIcon, getTenantList },
  182. mixins: [commonMixin],
  183. data () {
  184. return {
  185. spinning: false,
  186. exportLoading: false,
  187. tableHeight: 0, // 表格高度
  188. advanced: true, // 高级搜索 展开/关闭
  189. time: [ // 时间默认值
  190. getDate.getCurrMonthDays().starttime,
  191. getDate.getCurrMonthDays().endtime
  192. ],
  193. auditTime: [], // 审核时间
  194. outWareTime: [], // 出库时间
  195. queryParam: { // 查询条件
  196. beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
  197. endDate: getDate.getCurrMonthDays().endtime, // 结束时间
  198. auditBeginDate: '', // 审核开始时间
  199. auditEndDate: '', // 审核结束时间
  200. outWarehouseBeginDate: '', // 出库开始时间
  201. outWarehouseEndDate: '', // 出库结束时间
  202. allocationLinkageOutNo: undefined, // 连锁调出单号
  203. putTenantSn: undefined, // 调往对象
  204. allocationType: undefined, // 调出产品类型
  205. state: undefined, // 业务状态
  206. settleState: undefined // 财务状态
  207. },
  208. disabled: false, // 查询、重置按钮是否可操作
  209. // 加载数据方法 必须为 Promise 对象
  210. loadData: parameter => {
  211. this.disabled = true
  212. this.spinning = true
  213. const params = Object.assign(parameter, this.queryParam)
  214. return allocLinkageOutList(params).then(res => {
  215. let data
  216. if (res.status == 200) {
  217. data = res.data
  218. this.getCount(params)
  219. const no = (data.pageNo - 1) * data.pageSize
  220. for (var i = 0; i < data.list.length; i++) {
  221. data.list[i].no = no + i + 1
  222. }
  223. this.disabled = false
  224. }
  225. this.spinning = false
  226. return data
  227. })
  228. },
  229. openModal: false, // 新增编辑 弹框
  230. itemId: '', // 当前品牌id
  231. countData: null // 统计
  232. }
  233. },
  234. computed: {
  235. columns () {
  236. const _this = this
  237. const arr = [
  238. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  239. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  240. { title: '连锁调出单号', scopedSlots: { customRender: 'allocationLinkageOutNo' }, width: '16%', align: 'center' },
  241. { title: '调往对象', dataIndex: 'putTenantName', width: '17%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  242. { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  243. { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  244. // { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  245. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  246. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  247. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  248. // { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  249. { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
  250. { title: '出库', scopedSlots: { customRender: 'waitOut' }, width: '3%', align: 'center' },
  251. { title: '收款', scopedSlots: { customRender: 'financial' }, width: '3%', align: 'center' },
  252. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  253. ]
  254. // 成本价权限
  255. if (this.$hasPermissions('M_ShowAllCost')) {
  256. arr.splice(6, 0, { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
  257. }
  258. return arr
  259. }
  260. },
  261. methods: {
  262. // 详情
  263. handleDetail (row) {
  264. this.$router.push({ name: 'chainTransferOutDetail', params: { sn: row.allocationLinkageOutSn } })
  265. },
  266. // 新增/编辑
  267. handleEdit (row) {
  268. this.$router.push({ name: 'chainTransferOutEdit', params: { id: row.id, sn: row.allocationLinkageOutSn } })
  269. },
  270. // 统计
  271. getCount (params) {
  272. allocLinkageOutQueryCount(params).then(res => {
  273. if (res.status == 200) {
  274. this.countData = res.data
  275. } else {
  276. this.countData = null
  277. }
  278. })
  279. },
  280. // 选择时间 change
  281. dateChange (date) {
  282. this.queryParam.beginDate = date[0]
  283. this.queryParam.endDate = date[1]
  284. },
  285. // 审核时间
  286. auditDateChange (date) {
  287. this.queryParam.auditBeginDate = date[0]
  288. this.queryParam.auditEndDate = date[1]
  289. },
  290. // 出库时间
  291. outWareDateChange (date) {
  292. this.queryParam.outWarehouseBeginDate = date[0]
  293. this.queryParam.outWarehouseEndDate = date[1]
  294. },
  295. // 导出
  296. handleExport () {
  297. const _this = this
  298. const params = this.queryParam
  299. params.showCost = _this.$hasPermissions('M_ShowAllCost') ? 1 : 0
  300. _this.exportLoading = true
  301. _this.spinning = true
  302. allocLinkageOutExport(params).then(res => {
  303. this.exportLoading = false
  304. _this.spinning = false
  305. if (res.type == 'application/json') {
  306. var reader = new FileReader()
  307. reader.addEventListener('loadend', function () {
  308. const obj = JSON.parse(reader.result)
  309. _this.$notification.error({
  310. message: '提示',
  311. description: obj.message
  312. })
  313. })
  314. reader.readAsText(res)
  315. } else {
  316. downloadExcel(res, '连锁调出列表')
  317. }
  318. })
  319. },
  320. // 重置
  321. resetSearchForm () {
  322. this.resetData()
  323. this.$refs.table.refresh(true)
  324. },
  325. // 重置数据
  326. resetData (flag) {
  327. this.$refs.rangeDate.resetDate(flag ? '' : this.time)
  328. this.queryParam.beginDate = flag ? '' : getDate.getCurrMonthDays().starttime
  329. this.queryParam.endDate = flag ? '' : getDate.getCurrMonthDays().endtime
  330. this.$refs.auditRangeDate.resetDate('')
  331. this.queryParam.auditBeginDate = ''
  332. this.queryParam.auditEndDate = ''
  333. this.$refs.outWareRangeDate.resetDate('')
  334. this.queryParam.outWarehouseBeginDate = ''
  335. this.queryParam.outWarehouseEndDate = ''
  336. this.queryParam.allocationLinkageOutNo = undefined
  337. this.queryParam.putTenantSn = undefined
  338. this.queryParam.allocationType = undefined
  339. this.queryParam.state = undefined
  340. this.queryParam.settleState = undefined
  341. if (!flag) {
  342. this.setIsHomeNav(this.$route.name, null)
  343. }
  344. },
  345. // 基本信息 保存
  346. handleOk (data) {
  347. this.resetData()
  348. this.$router.push({ name: 'chainTransferOutAdd', params: { id: data.id, sn: data.allocationLinkageOutSn } })
  349. },
  350. // 删除
  351. handleDel (row) {
  352. const _this = this
  353. this.$confirm({
  354. title: '提示',
  355. content: '删除后不可恢复,确定要进行删除吗?',
  356. centered: true,
  357. onOk () {
  358. _this.spinning = true
  359. allocLinkageOutDel({ sn: row.allocationLinkageOutSn }).then(res => {
  360. if (res.status == 200) {
  361. _this.$message.success(res.message)
  362. _this.$refs.table.refresh()
  363. _this.spinning = false
  364. } else {
  365. _this.spinning = false
  366. }
  367. })
  368. }
  369. })
  370. },
  371. // 出库
  372. handleOut (row) {
  373. const _this = this
  374. this.$confirm({
  375. title: '提示',
  376. content: '确认要出库吗?',
  377. centered: true,
  378. onOk () {
  379. _this.spinning = true
  380. allocLinkageOutStock({ sn: row.allocationLinkageOutSn }).then(res => {
  381. if (res.status == 200) {
  382. _this.$message.success(res.message)
  383. _this.$refs.table.refresh()
  384. _this.spinning = false
  385. } else {
  386. _this.spinning = false
  387. }
  388. })
  389. }
  390. })
  391. },
  392. // 审核
  393. handleExamine (row) {
  394. const _this = this
  395. this.$confirm({
  396. title: '提示',
  397. content: '确认要审核通过吗?',
  398. centered: true,
  399. onOk () {
  400. _this.spinning = true
  401. allocLinkageAudit({ sn: row.allocationLinkageOutSn }).then(res => {
  402. if (res.status == 200) {
  403. _this.$message.success(res.message)
  404. _this.$refs.table.refresh()
  405. _this.spinning = false
  406. } else {
  407. _this.spinning = false
  408. }
  409. })
  410. }
  411. })
  412. },
  413. // 初始化页面
  414. pageInit () {
  415. const _this = this
  416. this.$nextTick(() => { // 页面渲染完成后的回调
  417. _this.setTableH()
  418. })
  419. this.openModal = false
  420. // 是否打开的页签
  421. const a = this.$store.state.app.isNewTab
  422. // 是否要刷新列表
  423. const b = this.$store.state.app.updateList
  424. // 是否从首页点击进入
  425. const isHomeNav = this.getIsHomeNav()[this.$route.name]
  426. // 从首页进入,判断式新建还式待办查询
  427. if (isHomeNav) {
  428. // 新增
  429. if (isHomeNav.type == 'new') {
  430. this.resetSearchForm()
  431. this.openModal = true
  432. }
  433. // 待办
  434. if (isHomeNav.type == 'todo') {
  435. this.resetData(true)
  436. this.$refs.rangeDate.resetDate([isHomeNav.pageParams.beginDate, isHomeNav.pageParams.endDate])
  437. this.queryParam = Object.assign(this.queryParam, isHomeNav.pageParams)
  438. this.$refs.table.refresh(true)
  439. }
  440. } else {
  441. // 如果是新页签打开,则重置当前页面
  442. if (a && !b) {
  443. this.resetSearchForm()
  444. }
  445. // 仅刷新列表,不重置页面
  446. if (b || a == b) {
  447. this.$refs.table.refresh()
  448. }
  449. }
  450. },
  451. // 表格高度计算
  452. setTableH () {
  453. const tableSearchH = this.$refs.tableSearch.offsetHeight
  454. this.tableHeight = window.innerHeight - tableSearchH - 273
  455. }
  456. },
  457. watch: {
  458. advanced (newValue, oldValue) {
  459. const _this = this
  460. this.$nextTick(() => { // 页面渲染完成后的回调
  461. _this.setTableH()
  462. })
  463. },
  464. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  465. this.setTableH()
  466. }
  467. },
  468. activated () {
  469. this.pageInit()
  470. },
  471. beforeRouteEnter (to, from, next) {
  472. next(vm => {})
  473. }
  474. }
  475. </script>