list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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-primary"
  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-primary"
  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 { commonMixin } from '@/utils/mixin'
  123. import { STable, VSelect } from '@/components'
  124. import rangeDate from '@/views/common/rangeDate.vue'
  125. import getDate from '@/libs/getDate.js'
  126. import basicInfoModal from './basicInfoModal.vue'
  127. import { storeCallOutList, storeCallOutAudit, storeCallOutDel, storeCallOutOut } from '@/api/storeCallOut'
  128. import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
  129. export default {
  130. name: 'StoreCallOutList',
  131. components: { STable, VSelect, basicInfoModal, rangeDate },
  132. mixins: [commonMixin],
  133. data () {
  134. return {
  135. spinning: false,
  136. advanced: true, // 高级搜索 展开/关闭
  137. tableHeight: 0,
  138. time: [
  139. getDate.getCurrMonthDays().starttime,
  140. getDate.getCurrMonthDays().endtime
  141. ],
  142. queryParam: { // 查询条件
  143. beginDate: getDate.getCurrMonthDays().starttime,
  144. endDate: getDate.getCurrMonthDays().endtime,
  145. putPersonName: undefined, // 调往对象
  146. callOutType: undefined, // 调拨类型
  147. state: undefined, // 业务状态
  148. settleState: undefined // 财务状态
  149. },
  150. disabled: false, // 查询、重置按钮是否可操作
  151. columns: [
  152. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  153. { title: '创建时间', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  154. { title: '店内调出单号', scopedSlots: { customRender: 'storeCallOutNo' }, width: '14%', align: 'center' },
  155. { title: '调往对象名称', dataIndex: 'putPersonName', width: '14%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  156. { title: '调拨类型', dataIndex: 'callOutTypeName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  157. { title: '总款数', dataIndex: 'productTotalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  158. { title: '总数量', dataIndex: 'productTotalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  159. { title: '总成本', dataIndex: 'productTotalCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  160. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  161. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  162. { title: '财务状态', dataIndex: 'settleStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  163. { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
  164. ],
  165. // 加载数据方法 必须为 Promise 对象
  166. loadData: parameter => {
  167. this.disabled = true
  168. this.spinning = true
  169. return storeCallOutList(Object.assign(parameter, this.queryParam)).then(res => {
  170. let data
  171. if (res.status == 200) {
  172. data = res.data
  173. const no = (data.pageNo - 1) * data.pageSize
  174. for (var i = 0; i < data.list.length; i++) {
  175. data.list[i].no = no + i + 1
  176. }
  177. this.disabled = false
  178. }
  179. this.spinning = false
  180. return data
  181. })
  182. },
  183. storeCallOutTypeList: [], // 调拨类型
  184. openModal: false, // 新增编辑 弹框
  185. itemId: '' // 当前品牌id
  186. }
  187. },
  188. methods: {
  189. // 时间 change
  190. dateChange (date) {
  191. this.queryParam.beginDate = date[0]
  192. this.queryParam.endDate = date[1]
  193. },
  194. // 重置
  195. resetSearchForm () {
  196. this.resetData()
  197. this.$refs.table.refresh(true)
  198. },
  199. // 重置数据
  200. resetData () {
  201. this.$refs.rangeDate.resetDate(this.time)
  202. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  203. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  204. this.queryParam.putPersonName = undefined
  205. this.queryParam.callOutType = undefined
  206. this.queryParam.state = undefined
  207. this.queryParam.settleState = undefined
  208. },
  209. // 基本信息 保存
  210. handleOk (data) {
  211. this.$router.push({ path: `/allocationManagement/storeTransferOut/add/${data.id}/${data.storeCallOutSn}` })
  212. },
  213. // 删除
  214. handleDel (row) {
  215. const _this = this
  216. this.$confirm({
  217. title: '提示',
  218. content: '删除后不可恢复,确定要进行删除吗?',
  219. centered: true,
  220. onOk () {
  221. _this.spinning = true
  222. storeCallOutDel({ id: row.id }).then(res => {
  223. if (res.status == 200) {
  224. _this.$message.success(res.message)
  225. _this.$refs.table.refresh()
  226. _this.spinning = false
  227. } else {
  228. _this.spinning = false
  229. }
  230. })
  231. }
  232. })
  233. },
  234. // 出库
  235. handleOut (row) {
  236. const _this = this
  237. this.$confirm({
  238. title: '提示',
  239. content: '确认要出库吗?',
  240. centered: true,
  241. onOk () {
  242. _this.spinning = true
  243. storeCallOutOut({ storeCallOutSn: row.storeCallOutSn }).then(res => {
  244. if (res.status == 200) {
  245. _this.$message.success(res.message)
  246. _this.$refs.table.refresh()
  247. _this.spinning = false
  248. } else {
  249. _this.spinning = false
  250. }
  251. })
  252. }
  253. })
  254. },
  255. // 审核
  256. handleExamine (row) {
  257. const _this = this
  258. this.$confirm({
  259. title: '提示',
  260. content: '确认要审核通过吗?',
  261. centered: true,
  262. onOk () {
  263. _this.spinning = true
  264. storeCallOutAudit({ id: row.id }).then(res => {
  265. if (res.status == 200) {
  266. _this.$message.success(res.message)
  267. _this.$refs.table.refresh()
  268. _this.spinning = false
  269. } else {
  270. _this.spinning = false
  271. }
  272. })
  273. }
  274. })
  275. },
  276. // 详情
  277. handleDetail (row) {
  278. this.$router.push({ path: `/allocationManagement/storeTransferOut/detail/${row.storeCallOutSn}` })
  279. },
  280. // 新增/编辑
  281. handleEdit (row) {
  282. this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${row.id}/${row.storeCallOutSn}` })
  283. },
  284. // 调拨类型
  285. getStoreCallOutTypeAllList () {
  286. storeCallOutTypeAllList().then(res => {
  287. if (res.status == 200) {
  288. this.storeCallOutTypeList = res.data
  289. } else {
  290. this.storeCallOutTypeList = []
  291. }
  292. })
  293. },
  294. pageInit () {
  295. const _this = this
  296. this.$nextTick(() => { // 页面渲染完成后的回调
  297. _this.setTableH()
  298. })
  299. this.openModal = false
  300. this.getStoreCallOutTypeAllList()
  301. },
  302. setTableH () {
  303. const tableSearchH = this.$refs.tableSearch.offsetHeight
  304. this.tableHeight = window.innerHeight - tableSearchH - 235
  305. }
  306. },
  307. watch: {
  308. advanced (newValue, oldValue) {
  309. const _this = this
  310. this.$nextTick(() => { // 页面渲染完成后的回调
  311. _this.setTableH()
  312. })
  313. },
  314. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  315. this.setTableH()
  316. }
  317. },
  318. mounted () {
  319. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  320. this.pageInit()
  321. this.resetSearchForm()
  322. }
  323. },
  324. activated () {
  325. // 如果是新页签打开,则重置当前页面
  326. if (this.$store.state.app.isNewTab) {
  327. this.resetData()
  328. if (this.$route.query.pageParams) {
  329. this.queryParam.state = this.$route.query.pageParams.state
  330. }
  331. this.pageInit()
  332. this.$refs.table.refresh(true)
  333. }
  334. // 仅刷新列表,不重置页面
  335. if (this.$store.state.app.updateList) {
  336. this.pageInit()
  337. this.$refs.table.refresh()
  338. }
  339. },
  340. beforeRouteEnter (to, from, next) {
  341. next(vm => {})
  342. }
  343. }
  344. </script>