list.vue 19 KB

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