list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <a-card size="small" :bordered="false" class="storeTransferOutList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="6" :sm="24">
  8. <a-form-item label="创建时间">
  9. <a-range-picker
  10. style="width:100%"
  11. id="storeTransferOutList-createDate"
  12. :disabledDate="disabledDate"
  13. v-model="createDate"
  14. :format="dateFormat"
  15. :placeholder="['开始时间', '结束时间']" />
  16. </a-form-item>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-item label="调往对象名称">
  21. <a-input id="storeTransferOutList-putPersonName" v-model.trim="queryParam.putPersonName" allowClear placeholder="请输入调往对象名称"/>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="调拨类型">
  26. <a-select id="storeTransferOutList-callOutType" v-model="queryParam.callOutType" placeholder="请选择调拨类型" allowClear >
  27. <a-select-option v-for="item in storeCallOutTypeList" :key="item.storeCallOutTypeSn" :value="item.storeCallOutTypeSn">{{ item.name }}</a-select-option>
  28. </a-select>
  29. </a-form-item>
  30. </a-col>
  31. <template v-if="advanced">
  32. <a-col :md="6" :sm="24">
  33. <a-form-item label="业务状态">
  34. <v-select
  35. v-model="queryParam.state"
  36. ref="state"
  37. id="storeTransferOutList-state"
  38. code="STORE_CALL_OUT_STATE"
  39. placeholder="请选择业务状态"
  40. allowClear
  41. ></v-select>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="6" :sm="24">
  45. <a-form-item label="财务状态">
  46. <v-select
  47. v-model="queryParam.settleState"
  48. ref="settleState"
  49. id="storeTransferOutList-settleState"
  50. code="FINANCIAL_STATUS"
  51. placeholder="请选择财务状态"
  52. allowClear
  53. ></v-select>
  54. </a-form-item>
  55. </a-col>
  56. </template>
  57. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  58. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="storeTransferOutList-refresh">查询</a-button>
  59. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
  60. <a @click="advanced=!advanced" style="margin-left: 8px">
  61. {{ advanced ? '收起' : '展开' }}
  62. <a-icon :type="advanced ? 'up' : 'down'"/>
  63. </a>
  64. </a-col>
  65. </a-row>
  66. </a-form>
  67. </div>
  68. <!-- 操作按钮 -->
  69. <div class="table-operator">
  70. <a-button id="storeTransferOutList-add" type="primary" class="button-error" @click="openModal=true">新增</a-button>
  71. </div>
  72. <!-- 列表 -->
  73. <s-table
  74. class="sTable"
  75. ref="table"
  76. size="default"
  77. :rowKey="(record) => record.id"
  78. :columns="columns"
  79. :data="loadData"
  80. :scroll="{ x: 1500, y: tableHeight }"
  81. bordered>
  82. <!-- 店内调出单号 -->
  83. <template slot="storeCallOutNo" slot-scope="text, record">
  84. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.storeCallOutNo }}</span>
  85. </template>
  86. <!-- 操作 -->
  87. <template slot="action" slot-scope="text, record">
  88. <a-button
  89. size="small"
  90. type="link"
  91. v-if="record.state == 'WAIT_AUDIT'"
  92. class="button-success"
  93. @click="handleExamine(record)"
  94. id="storeTransferOutList-examine-btn">审核</a-button>
  95. <a-button
  96. size="small"
  97. type="link"
  98. v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
  99. class="button-info"
  100. @click="handleEdit(record)"
  101. id="storeTransferOutList-edit-btn">编辑</a-button>
  102. <a-button
  103. size="small"
  104. type="link"
  105. v-if="record.state == 'WAIT_OUT_WAREHOUSE'"
  106. class="button-warning"
  107. @click="handleOut(record)"
  108. id="storeTransferOutList-out-btn">出库</a-button>
  109. <a-button
  110. size="small"
  111. type="link"
  112. v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
  113. class="button-error"
  114. @click="handleDel(record)"
  115. id="storeTransferOutList-del-btn">删除</a-button>
  116. </template>
  117. </s-table>
  118. <!-- 新增/编辑 -->
  119. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  120. </a-card>
  121. </template>
  122. <script>
  123. import moment from 'moment'
  124. import { STable, VSelect } from '@/components'
  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 },
  130. data () {
  131. return {
  132. advanced: false, // 高级搜索 展开/关闭
  133. tableHeight: 0,
  134. createDate: [], // 创建时间
  135. queryParam: { // 查询条件
  136. putPersonName: undefined, // 调往对象
  137. callOutType: undefined, // 调拨类型
  138. state: undefined, // 业务状态
  139. settleState: undefined // 财务状态
  140. },
  141. disabled: false, // 查询、重置按钮是否可操作
  142. dateFormat: 'YYYY-MM-DD',
  143. columns: [
  144. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  145. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
  146. { title: '店内调出单号', scopedSlots: { customRender: 'storeCallOutNo' }, width: 200, align: 'center' },
  147. { title: '调往对象名称', dataIndex: 'putPersonName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  148. { title: '调拨类型', dataIndex: 'callOutTypeName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  149. { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  150. { title: '总数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  151. { title: '总成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  152. { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  153. { title: '业务状态', dataIndex: 'stateDictValue', width: 110, align: 'center' },
  154. { title: '财务状态', dataIndex: 'settleStateDictValue', width: 110, align: 'center' },
  155. { title: '操作', scopedSlots: { customRender: 'action' }, width: 250, align: 'center', fixed: 'right' }
  156. ],
  157. // 加载数据方法 必须为 Promise 对象
  158. loadData: parameter => {
  159. this.disabled = true
  160. if (this.tableHeight == 0) {
  161. this.tableHeight = window.innerHeight - 220
  162. }
  163. // 创建时间
  164. if (this.createDate && this.createDate.length > 0) {
  165. this.queryParam.beginDate = moment(this.createDate[0]).format(this.dateFormat)
  166. this.queryParam.endDate = moment(this.createDate[1]).format(this.dateFormat)
  167. } else {
  168. this.queryParam.beginDate = undefined
  169. this.queryParam.endDate = undefined
  170. }
  171. return storeCallOutList(Object.assign(parameter, this.queryParam)).then(res => {
  172. const 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. return data
  179. })
  180. },
  181. storeCallOutTypeList: [], // 调拨类型
  182. openModal: false, // 新增编辑 弹框
  183. itemId: '' // 当前品牌id
  184. }
  185. },
  186. methods: {
  187. // 不可选日期
  188. disabledDate (date, dateStrings) {
  189. return date && date.valueOf() > Date.now()
  190. },
  191. // 重置
  192. resetSearchForm () {
  193. this.queryParam.putPersonName = undefined
  194. this.queryParam.callOutType = undefined
  195. this.queryParam.state = undefined
  196. this.createDate = undefined
  197. this.$refs.table.refresh(true)
  198. },
  199. // 基本信息 保存
  200. handleOk (data) {
  201. this.$router.push({ path: `/allocationManagement/storeTransferOut/add/${data.id}/${data.storeCallOutSn}` })
  202. },
  203. // 删除
  204. handleDel (row) {
  205. const _this = this
  206. this.$confirm({
  207. title: '提示',
  208. content: '删除后不可恢复,确定要进行删除吗?',
  209. centered: true,
  210. onOk () {
  211. storeCallOutDel({ id: row.id }).then(res => {
  212. if (res.status == 200) {
  213. _this.$message.success(res.message)
  214. _this.$refs.table.refresh()
  215. }
  216. })
  217. }
  218. })
  219. },
  220. // 出库
  221. handleOut (row) {
  222. const _this = this
  223. this.$confirm({
  224. title: '提示',
  225. content: '确认要进行出库操作吗?',
  226. centered: true,
  227. onOk () {
  228. storeCallOutOut({ storeCallOutSn: row.storeCallOutSn }).then(res => {
  229. if (res.status == 200) {
  230. _this.$message.success(res.message)
  231. _this.$refs.table.refresh()
  232. }
  233. })
  234. }
  235. })
  236. },
  237. // 审核
  238. handleExamine (row) {
  239. const _this = this
  240. this.$confirm({
  241. title: '提示',
  242. content: '确认要审核通过吗?',
  243. centered: true,
  244. onOk () {
  245. storeCallOutAudit({ id: row.id }).then(res => {
  246. if (res.status == 200) {
  247. _this.$message.success(res.message)
  248. _this.$refs.table.refresh()
  249. }
  250. })
  251. }
  252. })
  253. },
  254. // 详情
  255. handleDetail (row) {
  256. this.$router.push({ path: `/allocationManagement/storeTransferOut/detail/${row.storeCallOutSn}` })
  257. },
  258. // 新增/编辑
  259. handleEdit (row) {
  260. this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${row.id}/${row.storeCallOutSn}` })
  261. },
  262. // 调拨类型
  263. getStoreCallOutTypeAllList () {
  264. storeCallOutTypeAllList().then(res => {
  265. if (res.status == 200) {
  266. this.storeCallOutTypeList = res.data
  267. } else {
  268. this.storeCallOutTypeList = []
  269. }
  270. })
  271. }
  272. },
  273. beforeRouteEnter (to, from, next) {
  274. next(vm => {
  275. vm.openModal = false
  276. vm.getStoreCallOutTypeAllList()
  277. })
  278. }
  279. }
  280. </script>