list.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <a-card size="small" :bordered="false" class="urgentItemsOffsetList-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. <custList ref="custList" v-model="queryParam.buyerName"></custList>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="关联单号">
  20. <a-input id="urgentItemsOffsetList-bizBillNo" v-model.trim="queryParam.bizBillNo" allowClear placeholder="请输入销售单号"/>
  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="urgentItemsOffsetList-urgentBillNo" v-model.trim="queryParam.urgentBillNo" allowClear placeholder="请输入急件单号"/>
  27. </a-form-item>
  28. </a-col>
  29. <!-- <a-col :md="6" :sm="24">
  30. <a-form-item label="单据来源">
  31. <v-select
  32. v-model="queryParam.sourceType"
  33. ref="sourceType"
  34. id="urgentItemsOffsetList-sourceType"
  35. code="SALES_SOURCE"
  36. placeholder="请选择单据来源"
  37. allowClear></v-select>
  38. </a-form-item>
  39. </a-col> -->
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="状态">
  42. <v-select
  43. v-model="queryParam.status"
  44. ref="status"
  45. id="chainTransferInList-status"
  46. code="URGENT_STATUS"
  47. placeholder="请选择状态"
  48. allowClear></v-select>
  49. </a-form-item>
  50. </a-col>
  51. </template>
  52. <a-col :md="6" :sm="24">
  53. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="urgentItemsOffsetList-refresh">查询</a-button>
  54. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="urgentItemsOffsetList-reset">重置</a-button>
  55. <a @click="advanced=!advanced" style="margin-left: 8px">
  56. {{ advanced ? '收起' : '展开' }}
  57. <a-icon :type="advanced ? 'up' : 'down'"/>
  58. </a>
  59. </a-col>
  60. </a-row>
  61. </a-form>
  62. </div>
  63. <!-- 列表 -->
  64. <s-table
  65. class="sTable fixPagination"
  66. ref="table"
  67. :style="{ height: tableHeight+84.5+'px' }"
  68. size="small"
  69. :rowKey="(record) => record.id"
  70. :columns="columns"
  71. :data="loadData"
  72. :scroll="{ y: tableHeight }"
  73. :defaultLoadData="false"
  74. bordered>
  75. <!-- 单号 -->
  76. <template slot="urgentBillNo" slot-scope="text, record">
  77. <span class="table-td-link" v-if="$hasPermissions('M_urgentDetail')" @click="handleDetail(record)">{{ record.urgentBillNo }}</span>
  78. <span v-else>{{ record.urgentBillNo }}</span>
  79. </template>
  80. <!-- 状态 -->
  81. <template slot="status" slot-scope="text, record">
  82. <stateIcon :title="record.statusDictValue" :state="record.status=='WAIT'?'2':'1'"></stateIcon>
  83. </template>
  84. <!-- 操作 -->
  85. <template slot="action" slot-scope="text, record">
  86. <a-button
  87. size="small"
  88. type="link"
  89. v-if="record.status == 'WAIT' && $hasPermissions('B_urgentWriteDown')"
  90. @click="handleWriteDown(record)"
  91. class="button-primary"
  92. id="urgentItemsOffsetDetail-btn-submit">冲减</a-button>
  93. <span v-else>--</span>
  94. </template>
  95. </s-table>
  96. </a-spin>
  97. </a-card>
  98. </template>
  99. <script>
  100. import { commonMixin } from '@/utils/mixin'
  101. import { urgentList, urgentWriteDown } from '@/api/urgent'
  102. import { STable, VSelect } from '@/components'
  103. import rangeDate from '@/views/common/rangeDate.vue'
  104. import stateIcon from '@/views/common/stateIcon'
  105. import custList from '@/views/common/custList.vue'
  106. import getDate from '@/libs/getDate.js'
  107. export default {
  108. name: 'UrgentOffsetList',
  109. components: { STable, VSelect, rangeDate, custList, stateIcon },
  110. mixins: [commonMixin],
  111. data () {
  112. return {
  113. spinning: false,
  114. tableHeight: 0,
  115. advanced: true, // 高级搜索 展开/关闭
  116. time: [
  117. getDate.getCurrMonthDays().starttime,
  118. getDate.getCurrMonthDays().endtime
  119. ],
  120. queryParam: { // 查询条件
  121. beginDate: getDate.getCurrMonthDays().starttime,
  122. endDate: getDate.getCurrMonthDays().endtime,
  123. buyerName: undefined, // 客户名称
  124. bizBillNo: '', // 关联单号
  125. urgentBillNo: '', // 急件单号
  126. status: undefined, // 状态
  127. sourceType: undefined // 单据来源
  128. },
  129. disabled: false, // 查询、重置按钮是否可操作
  130. columns: [
  131. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  132. { title: '急件单号', scopedSlots: { customRender: 'urgentBillNo' }, width: '15%', align: 'center' },
  133. { title: '关联单号', dataIndex: 'bizBillNo', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  134. // { title: '销售单来源', dataIndex: 'sourceTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  135. { title: '单位名称', dataIndex: 'buyerName', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
  136. { title: '总款数', dataIndex: 'totalCategory', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  137. { title: '总数量', dataIndex: 'totalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  138. { title: '创建时间', dataIndex: 'createDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  139. { title: '冲减时间', dataIndex: 'offSetTime', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  140. { title: '状态', scopedSlots: { customRender: 'status' }, width: '3%', align: 'center' },
  141. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  142. ],
  143. // 加载数据方法 必须为 Promise 对象
  144. loadData: parameter => {
  145. this.disabled = true
  146. this.spinning = true
  147. return urgentList(Object.assign(parameter, this.queryParam)).then(res => {
  148. let data
  149. if (res.status == 200) {
  150. data = res.data
  151. const no = (data.pageNo - 1) * data.pageSize
  152. for (var i = 0; i < data.list.length; i++) {
  153. data.list[i].no = no + i + 1
  154. }
  155. this.disabled = false
  156. }
  157. this.spinning = false
  158. return data
  159. })
  160. }
  161. }
  162. },
  163. methods: {
  164. // 时间 change
  165. dateChange (date) {
  166. this.queryParam.beginDate = date[0]
  167. this.queryParam.endDate = date[1]
  168. },
  169. // 冲减
  170. handleWriteDown (row) {
  171. const _this = this
  172. this.$confirm({
  173. title: '提示',
  174. content: '确定要进行冲减吗?',
  175. centered: true,
  176. onOk () {
  177. _this.disabled = true
  178. _this.spinning = true
  179. urgentWriteDown({ urgentBillSn: row.urgentBillSn }).then(res => {
  180. if (res.status == 200) {
  181. _this.$message.success(res.message)
  182. _this.$refs.table.refresh()
  183. }
  184. _this.disabled = false
  185. _this.spinning = false
  186. })
  187. }
  188. })
  189. },
  190. // 重置
  191. resetSearchForm () {
  192. this.$refs.rangeDate.resetDate(this.time)
  193. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  194. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  195. this.queryParam.buyerName = undefined
  196. this.queryParam.bizBillNo = ''
  197. this.queryParam.urgentBillNo = ''
  198. this.queryParam.status = undefined
  199. this.queryParam.sourceType = undefined
  200. this.$refs.custList.resetForm()
  201. this.$refs.table.refresh(true)
  202. },
  203. // 详情
  204. handleDetail (row) {
  205. this.$router.push({ path: `/salesManagement/urgentItemsOffset/detail/${row.urgentBillSn}` })
  206. },
  207. pageInit () {
  208. const _this = this
  209. this.$nextTick(() => { // 页面渲染完成后的回调
  210. _this.setTableH()
  211. })
  212. },
  213. setTableH () {
  214. const tableSearchH = this.$refs.tableSearch.offsetHeight
  215. this.tableHeight = window.innerHeight - tableSearchH - 195
  216. }
  217. },
  218. mounted () {
  219. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  220. this.pageInit()
  221. this.resetSearchForm()
  222. }
  223. },
  224. watch: {
  225. advanced (newValue, oldValue) {
  226. const _this = this
  227. this.$nextTick(() => { // 页面渲染完成后的回调
  228. _this.setTableH()
  229. })
  230. },
  231. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  232. this.setTableH()
  233. }
  234. },
  235. activated () {
  236. // 如果是新页签打开,则重置当前页面
  237. if (this.$store.state.app.isNewTab) {
  238. this.pageInit()
  239. this.resetSearchForm()
  240. }
  241. // 只刷新列表
  242. if (this.$store.state.app.updateList) {
  243. this.pageInit()
  244. this.$refs.table.refresh()
  245. }
  246. },
  247. beforeRouteEnter (to, from, next) {
  248. next(vm => {})
  249. }
  250. }
  251. </script>
  252. <style lang="less">
  253. .urgentItemsOffsetList-wrap{
  254. .red{
  255. color: #ed1c24;
  256. }
  257. .green{
  258. color: #19be6b;
  259. }
  260. }
  261. </style>