list.vue 12 KB

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