list.vue 20 KB

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