list.vue 20 KB

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