list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <a-card size="small" :bordered="false" class="purchaseOrderList-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="purchaseOrderList-creatDate"
  12. :disabledDate="disabledDate"
  13. v-model="time"
  14. :format="dateFormat"
  15. :placeholder="['开始时间', '结束时间']" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="采购单号">
  20. <a-input id="purchaseOrderList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="供应商" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  25. <a-select
  26. id="purchaseOrderList-dealerName"
  27. placeholder="请选择供应商"
  28. allowClear
  29. v-model="queryParam.dealerName"
  30. :showSearch="true"
  31. option-filter-prop="children"
  32. :filter-option="filterOption">
  33. <a-select-option v-for="item in customeList" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
  34. </a-select>
  35. </a-form-item>
  36. </a-col>
  37. <template v-if="advanced">
  38. <a-col :md="6" :sm="24">
  39. <a-form-item label="单据状态">
  40. <v-select
  41. v-model="queryParam.auditStatus"
  42. ref="auditStatus"
  43. id="purchaseOrderList-auditStatus"
  44. code="PAYMENT_TYPE"
  45. placeholder="请选择单据状态"
  46. allowClear></v-select>
  47. </a-form-item>
  48. </a-col>
  49. <a-col :md="6" :sm="24">
  50. <a-form-item label="结算状态">
  51. <v-select
  52. v-model="queryParam.financialStatus"
  53. ref="financialStatus"
  54. id="purchaseOrderList-financialStatus"
  55. code="PAYMENT_TYPE"
  56. placeholder="请选择结算状态"
  57. allowClear></v-select>
  58. </a-form-item>
  59. </a-col>
  60. </template>
  61. <a-col :md="6" :sm="24">
  62. <span class="table-page-search-submitButtons">
  63. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseOrderList-refresh">查询</a-button>
  64. <a-button style="margin-left: 8px" @click="resetSearchForm()" :disabled="disabled" id="purchaseOrderList-reset">重置</a-button>
  65. <a @click="advanced=!advanced" style="margin-left: 8px">
  66. {{ advanced ? '收起' : '展开' }}
  67. <a-icon :type="advanced ? 'up' : 'down'"/>
  68. </a>
  69. </span>
  70. </a-col>
  71. </a-row>
  72. </a-form>
  73. </div>
  74. <!-- 操作按钮 -->
  75. <div class="table-operator">
  76. <a-button id="purchaseOrderList-add" type="primary" class="button-error" @click="handleAdd">新增</a-button>
  77. </div>
  78. <!-- alert -->
  79. <a-alert type="info" showIcon style="margin-bottom:15px">
  80. <div slot="message">共 <strong>6</strong> 条记录,采购数量合计 <strong>14</strong> ,采购金额合计¥<strong>14.00</strong> </div>
  81. </a-alert>
  82. <!-- 列表 -->
  83. <s-table
  84. class="sTable"
  85. ref="table"
  86. size="default"
  87. :rowKey="(record) => record.id"
  88. :columns="columns"
  89. :data="loadData"
  90. :scroll="{ x: 1495 }"
  91. bordered>
  92. <!-- 采购单号 -->
  93. <template slot="purchaseBillNo" slot-scope="text, record">
  94. <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.purchaseBillNo }}</span>
  95. </template>
  96. <!-- 业务/审核状态 -->
  97. <template slot="auditStatus" slot-scope="text, record">
  98. <a-tag :color="record.state=='FINISH'?'green':'red'" >{{ record.state=='FINISH'? '待备货审核': '待单据审核' }}</a-tag>
  99. </template>
  100. <!-- 财务状态 -->
  101. <template slot="financialStatus" slot-scope="text, record">
  102. <a-tag :color="record.state==1?'green':'red'" >{{ record.state==1? '待提交': '待单据审核' }}</a-tag>
  103. </template>
  104. <!-- 操作 -->
  105. <template slot="action" slot-scope="text, record">
  106. <a-button
  107. size="small"
  108. type="primary"
  109. class="button-info"
  110. @click="handleEdit(record)"
  111. id="purchasingManagement-edit-btn">编辑</a-button>
  112. <a-button
  113. size="small"
  114. type="primary"
  115. class="button-success"
  116. @click="handleDetail(record)"
  117. id="purchasingManagement-detail-btn">详情</a-button>
  118. <a-button
  119. size="small"
  120. type="primary"
  121. class="button-primary"
  122. @click="handleSubmit(record)"
  123. id="purchasingManagement-submit-btn">提交</a-button>
  124. <a-button
  125. size="small"
  126. type="primary"
  127. class="button-warning"
  128. @click="handleWarehouse(record)"
  129. id="purchasingManagement-warehouse-btn">签收入库</a-button>
  130. <a-button
  131. size="small"
  132. type="primary"
  133. class="button-error"
  134. @click="handleDel(record)"
  135. id="purchasingManagement-del-btn">删除</a-button>
  136. </template>
  137. </s-table>
  138. <!-- 选择基本信息弹框 -->
  139. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  140. </a-card>
  141. </template>
  142. <script>
  143. import { STable, VSelect } from '@/components'
  144. import basicInfoModal from './basicInfoModal.vue'
  145. import { purchaseList } from '@/api/purchase'
  146. export default {
  147. components: { STable, VSelect, basicInfoModal },
  148. data () {
  149. return {
  150. advanced: false, // 高级搜索 展开/关闭
  151. disabled: false, // 查询、重置按钮是否可操作
  152. openModal: false, // 基本信息弹框是否显示
  153. customeList: [],
  154. dateFormat: 'YYYY-MM-DD',
  155. time: [], // 创建时间
  156. // 查询参数
  157. queryParam: {},
  158. // 表头
  159. columns: [
  160. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  161. { title: '采购单号', scopedSlots: { customRender: 'purchaseBillNo' }, width: 140, align: 'center' },
  162. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  163. { title: '供应商', dataIndex: 'dealerName', align: 'center', customRender: function (text) { return text || '--' } },
  164. { title: '产品款数', dataIndex: 'totalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  165. { title: '采购数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  166. { title: '采购金额(¥)', dataIndex: 'totalAmount', width: 115, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  167. { title: '业务状态', scopedSlots: { customRender: 'auditStatus' }, width: 100, align: 'center' },
  168. { title: '财务状态', scopedSlots: { customRender: 'financialStatus' }, width: 100, align: 'center' },
  169. { title: '操作', scopedSlots: { customRender: 'action' }, width: 350, align: 'center', fixed: 'right' }
  170. ],
  171. // 加载数据方法 必须为 Promise 对象
  172. loadData: parameter => {
  173. this.disabled = true
  174. return purchaseList(Object.assign(parameter, this.queryParam)).then(res => {
  175. const data = res.data
  176. const no = (data.pageNo - 1) * data.pageSize
  177. for (var i = 0; i < data.list.length; i++) {
  178. data.list[i].no = no + i + 1
  179. }
  180. this.disabled = false
  181. return data
  182. })
  183. }
  184. }
  185. },
  186. methods: {
  187. // 不可选日期
  188. disabledDate (date, dateStrings) {
  189. return date && date.valueOf() > Date.now()
  190. },
  191. // 新增
  192. handleAdd () {
  193. this.openModal = true
  194. },
  195. // 基本信息 保存
  196. handleOk () {
  197. this.$router.push({ path: `/purchasingManagement/purchaseOrder/add` })
  198. },
  199. // 编辑
  200. handleEdit (row) {
  201. this.$router.push({ path: `/purchasingManagement/purchaseOrder/edit/${row.id}` })
  202. },
  203. // 详情
  204. handleDetail (row) {
  205. this.$router.push({ path: `/purchasingManagement/purchaseOrder/detail/${row.id}` })
  206. },
  207. // 提交
  208. handleSubmit () {
  209. },
  210. // 签收入库
  211. handleWarehouse (row) {
  212. this.$router.push({ path: `/purchasingManagement/purchaseOrder/warehousing/${row.id}` })
  213. },
  214. // 删除
  215. handleDel (row) {
  216. const _this = this
  217. this.$confirm({
  218. title: '提示',
  219. content: '删除后不可恢复,确定要进行删除吗?',
  220. centered: true,
  221. onOk () {
  222. // delectRolePower({
  223. // id: row.id
  224. // }).then(res => {
  225. // console.log(res, 'res1111')
  226. // if (res.status == 200) {
  227. // _this.$message.success(res.message)
  228. // _this.$refs.table.refresh()
  229. // }
  230. // })
  231. }
  232. })
  233. },
  234. // 重置
  235. resetSearchForm () {
  236. this.queryParam.orderBundleNo = ''
  237. this.queryParam.orderBundle.custMobile = ''
  238. this.queryParam.bundleName = ''
  239. this.queryParam.itemName = ''
  240. this.oldTime = undefined
  241. this.newTime = undefined
  242. this.$refs.table.refresh(true)
  243. },
  244. filterOption (input, option) {
  245. return (
  246. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  247. )
  248. }
  249. },
  250. beforeRouteEnter (to, from, next) {
  251. next(vm => {
  252. vm.openModal = false
  253. })
  254. }
  255. }
  256. </script>
  257. <style lang="less">
  258. .purchaseOrderList-wrap{
  259. .sTable{
  260. margin-top: 15px;
  261. }
  262. }
  263. </style>