list.vue 19 KB

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