list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <a-card size="small" :bordered="false" class="warehousingConfirmationList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div 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. <a-input id="warehousingConfirmationList-stockPutNo" v-model.trim="queryParam.stockPutNo" allowClear placeholder="请输入入库单号"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="单据状态">
  15. <v-select
  16. v-model="queryParam.auditState"
  17. ref="auditState"
  18. id="warehousingConfirmationList-auditState"
  19. code="PUT_CONFIRM_STATE"
  20. placeholder="请选择单据状态"
  21. allowClear></v-select>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="warehousingConfirmationList-refresh">查询</a-button>
  26. <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="warehousingConfirmationList-reset">重置</a-button>
  27. </a-col>
  28. </a-row>
  29. </a-form>
  30. </div>
  31. <!-- 列表 -->
  32. <div v-if="$hasPermissions('B_warehousingConfirmationpl')" style="margin-bottom: 15px">
  33. <a-button type="primary" id="warehousingConfirmationList-export" :loading="loading" @click="handleBatchAudit">批量确认</a-button>
  34. <span style="margin-left: 8px">
  35. <template v-if="hasSelected">{{ `已选 ${selectedRowKeys.length} 项` }}</template>
  36. </span>
  37. </div>
  38. <s-table
  39. class="sTable"
  40. ref="table"
  41. size="small"
  42. :row-selection="rowSelection"
  43. :rowKey="(record) => record.stockPutSn"
  44. :columns="columns"
  45. :data="loadData"
  46. :scroll="{ x: 1530, y: tableHeight }"
  47. bordered>
  48. <!-- 入库单号 -->
  49. <template slot="stockPutNo" slot-scope="text, record">
  50. <span :class="$hasPermissions('B_warehousingConfirmationDetail')?'active':'common'" @click="handleDetail(record)">{{ record.stockPutNo }}</span>
  51. </template>
  52. <!-- 操作 -->
  53. <template slot="action" slot-scope="text, record">
  54. <a-button
  55. size="small"
  56. type="link"
  57. v-if="record.auditState=='WAIT' && $hasPermissions('B_warehousingConfirmationAlone')"
  58. class="button-warning"
  59. @click="handleAudit(record)"
  60. id="warehousingConfirmationList-audit-btn">入库确认</a-button>
  61. <span v-else>--</span>
  62. </template>
  63. </s-table>
  64. </a-spin>
  65. <!-- 查看 -->
  66. <confirmation-detail-modal :openModal="openModal" :itemSn="itemSn" :nowData="nowData" @close="closeModal" />
  67. <!-- 入库确认 -->
  68. <a-modal
  69. centered
  70. class="confirmation-modal"
  71. :footer="null"
  72. :maskClosable="false"
  73. v-model="confirmationModal"
  74. @cancle="confirmationModal=false"
  75. :width="416">
  76. <div class="confirmation-main">
  77. <a-icon type="question-circle" style="color: #faad14;font-size: 22px;margin-right: 16px;" />
  78. <div class="confirmation-cont">
  79. <p class="confirmation-tit">提示</p>
  80. <p class="confirmation-txt">请点击下方按钮确认操作?</p>
  81. </div>
  82. </div>
  83. <div class="btn-box">
  84. <a-button type="primary" class="button-error" @click="handleConfirmationFail">不通过</a-button>
  85. <a-button type="primary" class="button-info" @click="handleConfirmationOk">通过</a-button>
  86. </div>
  87. </a-modal>
  88. </a-card>
  89. </template>
  90. <script>
  91. import { STable, VSelect } from '@/components'
  92. import confirmationDetailModal from './detailModal.vue'
  93. import { stockPutList, stockPutConfirm } from '@/api/stockPut'
  94. export default {
  95. components: { STable, VSelect, confirmationDetailModal },
  96. data () {
  97. return {
  98. spinning: false,
  99. queryParam: { // 查询条件
  100. stockPutNo: '', // 入库单号
  101. auditState: undefined // 状态
  102. },
  103. tableHeight: 0,
  104. disabled: false, // 查询、重置按钮是否可操作
  105. columns: [
  106. { title: '入库时间', dataIndex: 'putTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  107. { title: '入库单号', scopedSlots: { customRender: 'stockPutNo' }, width: 220, align: 'center' },
  108. { title: '商户名称', dataIndex: 'providerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  109. { title: '入库数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  110. { title: '入库成本', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  111. { title: '入库类型', dataIndex: 'putBizTypeDictValue', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  112. { title: '单据状态', dataIndex: 'auditStateDictValue', width: 110, align: 'center', customRender: function (text) { return text || '--' } },
  113. { title: '财务审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  114. { title: '备注', dataIndex: 'remark', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  115. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
  116. ],
  117. selectedRowKeys: [], // Check here to configure the default column
  118. loading: false,
  119. // 加载数据方法 必须为 Promise 对象
  120. loadData: parameter => {
  121. this.disabled = true
  122. if (this.tableHeight == 0) {
  123. this.tableHeight = window.innerHeight - 370
  124. }
  125. return stockPutList(Object.assign(parameter, this.queryParam, { confirm: true })).then(res => {
  126. const data = res.data
  127. this.disabled = false
  128. return data
  129. })
  130. },
  131. openModal: false,
  132. itemSn: '',
  133. nowData: null,
  134. confirmationModal: false,
  135. confirmationInfo: null,
  136. isBatch: false
  137. }
  138. },
  139. computed: {
  140. hasSelected () {
  141. return this.selectedRowKeys.length > 0
  142. },
  143. rowSelection () {
  144. if (this.$hasPermissions('B_warehousingConfirmationpl')) {
  145. return {
  146. selectedRowKeys: this.selectedRowKeys,
  147. onChange: (selectedRowKeys, selectedRows) => {
  148. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  149. this.onSelectChange(selectedRowKeys)
  150. },
  151. getCheckboxProps: record => ({
  152. props: {
  153. disabled: record.auditState != 'WAIT'
  154. }
  155. })
  156. }
  157. } else {
  158. return null
  159. }
  160. }
  161. },
  162. methods: {
  163. // 重置
  164. resetSearchForm () {
  165. this.queryParam.stockPutNo = ''
  166. this.queryParam.auditState = undefined
  167. this.$refs.table.refresh(true)
  168. },
  169. // 详情
  170. handleDetail (row) {
  171. if (this.$hasPermissions('B_warehousingConfirmationDetail')) {
  172. this.itemSn = row.stockPutSn
  173. this.nowData = row
  174. this.openModal = true
  175. }
  176. },
  177. closeModal () {
  178. this.itemSn = ''
  179. this.nowData = null
  180. this.openModal = false
  181. },
  182. // 通过
  183. handleConfirmationOk () {
  184. if (this.isBatch) { // 批量
  185. this.auditOrder(this.selectedRowKeys, true)
  186. } else {
  187. this.auditOrder([this.confirmationInfo.stockPutSn], true)
  188. }
  189. },
  190. // 不通过
  191. handleConfirmationFail () {
  192. if (this.isBatch) { // 批量
  193. this.auditOrder(this.selectedRowKeys, false)
  194. } else {
  195. this.auditOrder([this.confirmationInfo.stockPutSn], false)
  196. }
  197. },
  198. // 单个审核
  199. handleAudit (row) {
  200. this.confirmationInfo = row
  201. this.isBatch = false
  202. this.confirmationModal = true
  203. },
  204. auditOrder (snList, flag) {
  205. const _this = this
  206. if (this.isBatch) {
  207. _this.loading = true
  208. }
  209. _this.spinning = true
  210. stockPutConfirm({ stockPutSnList: snList, confirm: flag }).then(res => {
  211. if (this.isBatch) {
  212. _this.loading = false
  213. }
  214. if (res.status == 200) {
  215. if (this.isBatch) {
  216. _this.selectedRowKeys = []
  217. _this.selectedRows = []
  218. }
  219. _this.$message.success(res.message)
  220. _this.$refs.table.refresh()
  221. _this.confirmationModal = false
  222. _this.spinning = false
  223. } else {
  224. _this.confirmationModal = false
  225. _this.spinning = false
  226. }
  227. })
  228. },
  229. // 批量审核
  230. handleBatchAudit () {
  231. const _this = this
  232. if (_this.selectedRowKeys.length < 1) {
  233. _this.$message.warning('请在列表勾选后再进行批量操作!')
  234. return
  235. }
  236. this.isBatch = true
  237. this.confirmationModal = true
  238. },
  239. onSelectChange (selectedRowKeys) {
  240. console.log('selectedRowKeys changed: ', selectedRowKeys)
  241. this.selectedRowKeys = selectedRowKeys
  242. }
  243. }
  244. }
  245. </script>
  246. <style lang="less">
  247. .warehousingConfirmationList-wrap{
  248. .sTable{
  249. margin-top: 20px;
  250. }
  251. }
  252. .active{
  253. color: #ed1c24;
  254. cursor: pointer;
  255. }
  256. .common{
  257. color: rgba(0, 0, 0, 0.65);
  258. }
  259. .confirmation-modal{
  260. .ant-modal-body{
  261. padding: 32px 32px 24px;
  262. }
  263. .confirmation-main{
  264. display: flex;
  265. .confirmation-cont{
  266. .confirmation-tit{
  267. color: rgba(0, 0, 0, 0.85);
  268. font-weight: 500;
  269. font-size: 16px;
  270. line-height: 1.4;
  271. margin: 0;
  272. }
  273. .confirmation-txt{
  274. margin: 8px 0 0;
  275. color: rgba(0, 0, 0, 0.65);
  276. font-size: 14px;
  277. line-height: 1.5;
  278. }
  279. }
  280. }
  281. .btn-box{
  282. text-align: right;
  283. margin-top: 24px;
  284. }
  285. }
  286. </style>