list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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. <a-input id="storeTransferOutList-putPersonName" v-model.trim="queryParam.putPersonName" allowClear placeholder="请输入调往对象名称"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="调拨类型">
  20. <a-select id="storeTransferOutList-callOutType" v-model="queryParam.callOutType" placeholder="请选择调拨类型" allowClear >
  21. <a-select-option v-for="item in storeCallOutTypeList" :key="item.storeCallOutTypeSn" :value="item.storeCallOutTypeSn">{{ item.name }}</a-select-option>
  22. </a-select>
  23. </a-form-item>
  24. </a-col>
  25. <template v-if="advanced">
  26. <a-col :md="6" :sm="24">
  27. <a-form-item label="业务状态">
  28. <v-select
  29. v-model="queryParam.state"
  30. ref="state"
  31. id="storeTransferOutList-state"
  32. code="STORE_CALL_OUT_STATE"
  33. placeholder="请选择业务状态"
  34. allowClear
  35. ></v-select>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24">
  39. <a-form-item label="财务状态">
  40. <v-select
  41. v-model="queryParam.settleState"
  42. ref="settleState"
  43. id="storeTransferOutList-settleState"
  44. code="FINANCIAL_RECEIVE_STATUS"
  45. placeholder="请选择财务状态"
  46. allowClear
  47. ></v-select>
  48. </a-form-item>
  49. </a-col>
  50. </template>
  51. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  52. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="storeTransferOutList-refresh">查询</a-button>
  53. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
  54. <a @click="advanced=!advanced" style="margin-left: 8px">
  55. {{ advanced ? '收起' : '展开' }}
  56. <a-icon :type="advanced ? 'up' : 'down'"/>
  57. </a>
  58. </a-col>
  59. </a-row>
  60. </a-form>
  61. </div>
  62. <!-- 操作按钮 -->
  63. <div class="table-operator">
  64. <a-button id="storeTransferOutList-add" v-if="$hasPermissions('B_storeTransferOutNews')" type="primary" class="button-error" @click="openModal=true">新增</a-button>
  65. </div>
  66. <!-- 列表 -->
  67. <s-table
  68. class="sTable fixPagination"
  69. ref="table"
  70. :style="{ height: tableHeight+84.5+'px' }"
  71. size="small"
  72. :rowKey="(record) => record.id"
  73. :columns="columns"
  74. :data="loadData"
  75. :scroll="{ y: tableHeight }"
  76. :defaultLoadData="false"
  77. bordered>
  78. <!-- 店内调出单号 -->
  79. <template slot="storeCallOutNo" slot-scope="text, record">
  80. <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_storeCallOutDetail')" @click="handleDetail(record)">{{ record.storeCallOutNo }}</span>
  81. <span v-else>{{ record.storeCallOutNo }}</span>
  82. </template>
  83. <!-- 操作 -->
  84. <template slot="action" slot-scope="text, record">
  85. <a-button
  86. size="small"
  87. type="link"
  88. v-if="record.state == 'WAIT_AUDIT'&&$hasPermissions('B_storeCallOutAudit')"
  89. class="button-warning"
  90. @click="handleExamine(record)"
  91. id="storeTransferOutList-examine-btn">审核</a-button>
  92. <a-button
  93. size="small"
  94. type="link"
  95. v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT')) &&$hasPermissions('B_storeCallOutEdit')"
  96. class="button-info"
  97. @click="handleEdit(record)"
  98. id="storeTransferOutList-edit-btn">编辑</a-button>
  99. <a-button
  100. size="small"
  101. type="link"
  102. v-if="record.state == 'WAIT_OUT_WAREHOUSE'&&$hasPermissions('B_storeCallStockOut')"
  103. class="button-primary"
  104. @click="handleOut(record)"
  105. id="storeTransferOutList-out-btn">出库</a-button>
  106. <a-button
  107. size="small"
  108. type="link"
  109. v-if="((record.state == 'WAIT_SUBMIT') || (record.state == 'WAIT_AUDIT') || (record.state == 'WAIT_OUT_WAREHOUSE'))&&$hasPermissions('B_storeCallOutDel')"
  110. class="button-error"
  111. @click="handleDel(record)"
  112. id="storeTransferOutList-del-btn">删除</a-button>
  113. <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>
  114. </template>
  115. </s-table>
  116. </a-spin>
  117. <!-- 新增/编辑 -->
  118. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  119. </a-card>
  120. </template>
  121. <script>
  122. import { STable, VSelect } from '@/components'
  123. import rangeDate from '@/views/common/rangeDate.vue'
  124. import getDate from '@/libs/getDate.js'
  125. import basicInfoModal from './basicInfoModal.vue'
  126. import { storeCallOutList, storeCallOutAudit, storeCallOutDel, storeCallOutOut } from '@/api/storeCallOut'
  127. import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
  128. export default {
  129. components: { STable, VSelect, basicInfoModal, rangeDate },
  130. data () {
  131. return {
  132. spinning: false,
  133. advanced: true, // 高级搜索 展开/关闭
  134. tableHeight: 0,
  135. time: [
  136. getDate.getCurrMonthDays().starttime,
  137. getDate.getCurrMonthDays().endtime
  138. ],
  139. queryParam: { // 查询条件
  140. beginDate: getDate.getCurrMonthDays().starttime,
  141. endDate: getDate.getCurrMonthDays().endtime,
  142. putPersonName: undefined, // 调往对象
  143. callOutType: undefined, // 调拨类型
  144. state: undefined, // 业务状态
  145. settleState: undefined // 财务状态
  146. },
  147. disabled: false, // 查询、重置按钮是否可操作
  148. columns: [
  149. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  150. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  151. { title: '店内调出单号', scopedSlots: { customRender: 'storeCallOutNo' }, width: '14%', align: 'center' },
  152. { title: '调往对象名称', dataIndex: 'putPersonName', width: '14%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  153. { title: '调拨类型', dataIndex: 'callOutTypeName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  154. { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  155. { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  156. { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  157. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  158. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  159. { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  160. { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
  161. ],
  162. // 加载数据方法 必须为 Promise 对象
  163. loadData: parameter => {
  164. this.disabled = true
  165. this.spinning = true
  166. return storeCallOutList(Object.assign(parameter, this.queryParam)).then(res => {
  167. let data
  168. if (res.status == 200) {
  169. data = res.data
  170. const no = (data.pageNo - 1) * data.pageSize
  171. for (var i = 0; i < data.list.length; i++) {
  172. data.list[i].no = no + i + 1
  173. }
  174. this.disabled = false
  175. }
  176. this.spinning = false
  177. return data
  178. })
  179. },
  180. storeCallOutTypeList: [], // 调拨类型
  181. openModal: false, // 新增编辑 弹框
  182. itemId: '' // 当前品牌id
  183. }
  184. },
  185. methods: {
  186. // 时间 change
  187. dateChange (date) {
  188. this.queryParam.beginDate = date[0]
  189. this.queryParam.endDate = date[1]
  190. },
  191. // 重置
  192. resetSearchForm () {
  193. this.resetData()
  194. this.$refs.table.refresh(true)
  195. },
  196. // 重置数据
  197. resetData () {
  198. this.$refs.rangeDate.resetDate(this.time)
  199. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  200. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  201. this.queryParam.putPersonName = undefined
  202. this.queryParam.callOutType = undefined
  203. this.queryParam.state = undefined
  204. this.queryParam.settleState = undefined
  205. },
  206. // 基本信息 保存
  207. handleOk (data) {
  208. this.$router.push({ path: `/allocationManagement/storeTransferOut/add/${data.id}/${data.storeCallOutSn}` })
  209. },
  210. // 删除
  211. handleDel (row) {
  212. const _this = this
  213. this.$confirm({
  214. title: '提示',
  215. content: '删除后不可恢复,确定要进行删除吗?',
  216. centered: true,
  217. onOk () {
  218. _this.spinning = true
  219. storeCallOutDel({ id: row.id }).then(res => {
  220. if (res.status == 200) {
  221. _this.$message.success(res.message)
  222. _this.$refs.table.refresh()
  223. _this.spinning = false
  224. } else {
  225. _this.spinning = false
  226. }
  227. })
  228. }
  229. })
  230. },
  231. // 出库
  232. handleOut (row) {
  233. const _this = this
  234. this.$confirm({
  235. title: '提示',
  236. content: '确认要出库吗?',
  237. centered: true,
  238. onOk () {
  239. _this.spinning = true
  240. storeCallOutOut({ storeCallOutSn: row.storeCallOutSn }).then(res => {
  241. if (res.status == 200) {
  242. _this.$message.success(res.message)
  243. _this.$refs.table.refresh()
  244. _this.spinning = false
  245. } else {
  246. _this.spinning = false
  247. }
  248. })
  249. }
  250. })
  251. },
  252. // 审核
  253. handleExamine (row) {
  254. const _this = this
  255. this.$confirm({
  256. title: '提示',
  257. content: '确认要审核通过吗?',
  258. centered: true,
  259. onOk () {
  260. _this.spinning = true
  261. storeCallOutAudit({ id: row.id }).then(res => {
  262. if (res.status == 200) {
  263. _this.$message.success(res.message)
  264. _this.$refs.table.refresh()
  265. _this.spinning = false
  266. } else {
  267. _this.spinning = false
  268. }
  269. })
  270. }
  271. })
  272. },
  273. // 详情
  274. handleDetail (row) {
  275. this.$router.push({ path: `/allocationManagement/storeTransferOut/detail/${row.storeCallOutSn}` })
  276. },
  277. // 新增/编辑
  278. handleEdit (row) {
  279. this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${row.id}/${row.storeCallOutSn}` })
  280. },
  281. // 调拨类型
  282. getStoreCallOutTypeAllList () {
  283. storeCallOutTypeAllList().then(res => {
  284. if (res.status == 200) {
  285. this.storeCallOutTypeList = res.data
  286. } else {
  287. this.storeCallOutTypeList = []
  288. }
  289. })
  290. },
  291. pageInit () {
  292. const _this = this
  293. this.$nextTick(() => { // 页面渲染完成后的回调
  294. _this.setTableH()
  295. })
  296. this.openModal = false
  297. this.getStoreCallOutTypeAllList()
  298. },
  299. setTableH () {
  300. const tableSearchH = this.$refs.tableSearch.offsetHeight
  301. this.tableHeight = window.innerHeight - tableSearchH - 235
  302. }
  303. },
  304. watch: {
  305. advanced (newValue, oldValue) {
  306. const _this = this
  307. setTimeout(() => {
  308. _this.setTableH()
  309. }, 400)
  310. },
  311. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  312. this.setTableH()
  313. }
  314. },
  315. mounted () {
  316. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  317. this.pageInit()
  318. this.resetSearchForm()
  319. }
  320. },
  321. activated () {
  322. // 如果是新页签打开,则重置当前页面
  323. if (this.$store.state.app.isNewTab) {
  324. this.resetData()
  325. if (this.$route.query.pageParams) {
  326. this.queryParam.state = this.$route.query.pageParams.state
  327. }
  328. this.pageInit()
  329. this.$refs.table.refresh(true)
  330. }
  331. // 仅刷新列表,不重置页面
  332. if (this.$store.state.app.updateList) {
  333. this.pageInit()
  334. this.$refs.table.refresh()
  335. }
  336. },
  337. beforeRouteEnter (to, from, next) {
  338. next(vm => {})
  339. }
  340. }
  341. </script>