list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <a-card size="small" :bordered="false" class="allocateBillList-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="allocateBillList-targetName" v-model.trim="queryParam.targetName" allowClear placeholder="请输入调往对象"/>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="调拨类型">
  20. <AllocateType id="allocateBillList-allocateTypeSn" v-model="queryParam.allocateTypeSn"></AllocateType>
  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. <dealerSubareaScopeList ref="receiverSn" defValKey="buyerSn" @change="custChange" v-model="queryParam.receiverSn" />
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="4" :sm="24">
  30. <a-form-item label="业务状态">
  31. <v-select
  32. v-model="queryParam.state"
  33. ref="state"
  34. id="allocateBillList-state"
  35. code="ALLOCATE_STATUS"
  36. placeholder="请选择业务状态"
  37. allowClear
  38. ></v-select>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="4" :sm="24">
  42. <a-form-item label="调拨单号">
  43. <a-input id="allocateBillList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :md="4" :sm="24">
  47. <a-form-item label="对单状态">
  48. <v-select
  49. v-model="queryParam.checkStatus"
  50. ref="checkStatus"
  51. id="allocateBillList-checkStatus"
  52. code="CHECK_STATUS"
  53. placeholder="请选择对单状态"
  54. allowClear
  55. ></v-select>
  56. </a-form-item>
  57. </a-col>
  58. </template>
  59. <a-col :md="6" :sm="24">
  60. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="allocateBillList-refresh">查询</a-button>
  61. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="allocateBillList-reset">重置</a-button>
  62. <a @click="advanced=!advanced" style="margin-left: 5px">
  63. {{ advanced ? '收起' : '展开' }}
  64. <a-icon :type="advanced ? 'up' : 'down'"/>
  65. </a>
  66. </a-col>
  67. </a-row>
  68. </a-form>
  69. </div>
  70. <!-- 列表 -->
  71. <s-table
  72. class="sTable fixPagination"
  73. ref="table"
  74. :style="{ height: tableHeight+84.5+'px' }"
  75. size="small"
  76. :rowKey="(record) => record.id"
  77. :columns="columns"
  78. :data="loadData"
  79. :defaultLoadData="false"
  80. :scroll="{ y: tableHeight }"
  81. bordered>
  82. <!-- 单号 -->
  83. <template slot="allocateNo" slot-scope="text, record">
  84. <span v-if="$hasPermissions('M_mso_detail')" class="link-bule" @click="handleDetail(record)">{{ record.allocateNo }}</span>
  85. <span v-else>{{ record.allocateNo }}</span>
  86. </template>
  87. <!-- 操作 -->
  88. <template slot="action" slot-scope="text, record">
  89. <a-button
  90. size="small"
  91. type="link"
  92. v-if="record.checkStatus == 'WAIT'&&$hasPermissions('B_YxAudit')"
  93. class="button-warning"
  94. @click="handleYxAudit(record)"
  95. id="allocateBillList-checkStatus">对单通过</a-button>
  96. <span v-else>--</span>
  97. </template>
  98. </s-table>
  99. </a-spin>
  100. </a-card>
  101. </template>
  102. <script>
  103. import { commonMixin } from '@/utils/mixin'
  104. import moment from 'moment'
  105. import getDate from '@/libs/getDate.js'
  106. import { STable, VSelect } from '@/components'
  107. import rangeDate from '@/views/common/rangeDate.vue'
  108. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  109. import { allocateBillList, allocateBillCheck } from '@/api/allocateBill'
  110. import AllocateType from '@/views/common/allocateType.js'
  111. export default {
  112. name: 'TransferOutList',
  113. mixins: [commonMixin],
  114. components: { STable, VSelect, rangeDate, AllocateType, dealerSubareaScopeList },
  115. data () {
  116. return {
  117. spinning: false,
  118. advanced: true, // 高级搜索 展开/关闭
  119. tableHeight: 0,
  120. time: [
  121. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  122. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  123. ],
  124. queryParam: { // 查询条件
  125. beginDate: getDate.getThreeMonthDays().starttime,
  126. endDate: getDate.getCurrMonthDays().endtime,
  127. targetName: '', // 调往对象
  128. allocateTypeSn: undefined, // 调拨类型
  129. state: undefined, // 业务状态
  130. allocateNo: '', // 调拨单号
  131. receiverSn: undefined,
  132. checkStatus: undefined,
  133. printState: undefined
  134. },
  135. disabled: false, // 查询、重置按钮是否可操作
  136. exportLoading: false,
  137. // 加载数据方法 必须为 Promise 对象
  138. loadData: parameter => {
  139. this.disabled = true
  140. this.spinning = true
  141. return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
  142. let data
  143. if (res.status == 200) {
  144. data = res.data
  145. const no = (data.pageNo - 1) * data.pageSize
  146. for (var i = 0; i < data.list.length; i++) {
  147. data.list[i].no = no + i + 1
  148. }
  149. this.disabled = false
  150. }
  151. this.spinning = false
  152. return data
  153. })
  154. },
  155. visibleAudit: false,
  156. auditInfo: null,
  157. spinningAudit: false,
  158. openModal: false // 新增编辑 弹框
  159. }
  160. },
  161. computed: {
  162. columns () {
  163. const arr = [
  164. { title: '序号', dataIndex: 'no', width: '3.5%', align: 'center' },
  165. { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  166. { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, align: 'center', width: '13.5%' },
  167. { title: '调往对象', dataIndex: 'targetName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  168. { title: '发货编号', dataIndex: 'sendNo', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  169. { title: '收货客户名称', dataIndex: 'receiverName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  170. { title: '总数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  171. { title: '调拨类型', dataIndex: 'allocateTypeName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  172. { title: '业务状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  173. { title: '对单状态', dataIndex: 'checkStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  174. { title: '对单人员', dataIndex: 'checkPersonName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  175. { title: '对单时间', dataIndex: 'checkDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  176. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  177. ]
  178. return arr
  179. }
  180. },
  181. methods: {
  182. custChange (val) {
  183. this.queryParam.receiverSn = val.key || ''
  184. this.queryParam.receiverName = val.name || ''
  185. },
  186. // 创建时间 change
  187. dateChange (date) {
  188. this.queryParam.beginDate = date[0]
  189. this.queryParam.endDate = date[1]
  190. },
  191. // 重置
  192. resetSearchForm () {
  193. this.$refs.rangeDate.resetDate(this.time)
  194. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  195. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  196. this.queryParam.targetName = ''
  197. this.queryParam.allocateTypeSn = undefined
  198. this.queryParam.state = undefined
  199. this.queryParam.allocateNo = ''
  200. this.queryParam.receiverSn = ''
  201. this.queryParam.receiverName = ''
  202. this.queryParam.checkStatus = undefined
  203. this.$refs.table.refresh(true)
  204. this.$refs.receiverSn.resetForm()
  205. },
  206. // 允许打印
  207. handleYxAudit (row) {
  208. const _this = this
  209. this.$confirm({
  210. title: '提示',
  211. content: '确认对单通过吗?',
  212. centered: true,
  213. onOk () {
  214. _this.spinning = true
  215. allocateBillCheck({ sn: row.allocateSn }).then(res => {
  216. if (res.status == 200) {
  217. _this.$message.success(res.message)
  218. _this.$refs.table.refresh()
  219. _this.spinning = false
  220. } else {
  221. _this.spinning = false
  222. }
  223. })
  224. }
  225. })
  226. },
  227. // 详情
  228. handleDetail (row) {
  229. if (this.$hasPermissions('M_transferOut_detail')) {
  230. this.$router.push({ path: `/allocationManagement/transferOut/detail/${row.allocateSn}` })
  231. }
  232. },
  233. pageInit () {
  234. const _this = this
  235. this.$nextTick(() => { // 页面渲染完成后的回调
  236. _this.setTableH()
  237. })
  238. this.openModal = false
  239. },
  240. setTableH () {
  241. const tableSearchH = this.$refs.tableSearch.offsetHeight
  242. this.tableHeight = window.innerHeight - tableSearchH - 238
  243. }
  244. },
  245. watch: {
  246. advanced (newValue, oldValue) {
  247. const _this = this
  248. this.$nextTick(() => { // 页面渲染完成后的回调
  249. _this.setTableH()
  250. })
  251. },
  252. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  253. this.setTableH()
  254. }
  255. },
  256. mounted () {
  257. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  258. this.pageInit()
  259. this.resetSearchForm()
  260. }
  261. },
  262. activated () {
  263. // 如果是新页签打开,则重置当前页面
  264. if (this.$store.state.app.isNewTab) {
  265. this.pageInit()
  266. this.resetSearchForm()
  267. }
  268. // 仅刷新列表,不重置页面
  269. if (this.$store.state.app.updateList) {
  270. this.pageInit()
  271. this.$refs.table.refresh()
  272. }
  273. },
  274. beforeRouteEnter (to, from, next) {
  275. next(vm => {})
  276. }
  277. }
  278. </script>
  279. <style lang="less">
  280. .active{
  281. color: #ed1c24;
  282. cursor: pointer;
  283. }
  284. .common{
  285. color: rgba(0, 0, 0);
  286. }
  287. </style>