list.vue 19 KB

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