list.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <a-card size="small" :bordered="false" class="inventoryCheckingList-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="inventoryCheckingList-creatTime"
  12. :disabledDate="disabledDate"
  13. @change="creatTimechange"
  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. <v-select code="ENABLED_FLAG" id="inventoryCheckingList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryCheckingList-refresh">查询</a-button>
  25. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="inventoryCheckingList-reset">重置</a-button>
  26. </a-col>
  27. </a-row>
  28. </a-form>
  29. </div>
  30. <!-- 操作按钮 -->
  31. <div class="table-operator">
  32. <a-button id="inventoryCheckingList-add" type="primary" class="button-error" @click="handleEdit()">新增</a-button>
  33. </div>
  34. <!-- 列表 -->
  35. <s-table
  36. class="sTable"
  37. ref="table"
  38. size="small"
  39. :rowKey="(record) => record.id"
  40. :columns="columns"
  41. :data="loadData"
  42. :showPagination="false"
  43. :scroll="{ x: 1480 }"
  44. bordered>
  45. <!-- 状态 -->
  46. <template slot="state" slot-scope="text, record">
  47. <a-tag :color="record.state==1?'green':'red'" >{{ record.state==1? '待提交': '待单据审核' }}</a-tag>
  48. </template>
  49. <!-- 操作 -->
  50. <template slot="action" slot-scope="text, record">
  51. <a-button size="small" type="link" class="button-warning" @click="handleEexamine(record)" id="inventoryCheckingList-eexamine-btn">审核</a-button>
  52. <a-divider type="vertical" style="margin: 0;" />
  53. <a-button size="small" type="link" @click="handleInventory(record)" id="inventoryCheckingList-inventory-btn">盘点</a-button>
  54. <a-divider type="vertical" style="margin: 0;" />
  55. <a-button size="small" type="link" class="button-info" @click="handleEdit(record)" id="inventoryCheckingList-edit-btn">编辑</a-button>
  56. <a-divider type="vertical" style="margin: 0;" />
  57. <a-button size="small" type="link" @click="handleDetail(record)" id="inventoryCheckingList-detail-btn">详情</a-button>
  58. <a-divider type="vertical" style="margin: 0;" />
  59. <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="inventoryCheckingList-del-btn">删除</a-button>
  60. </template>
  61. </s-table>
  62. <!-- 新增/编辑盘点单 -->
  63. <inventory-checking-tips-modal :openModal="openModal" :nowData="nowData" :itemId="itemId" @ok="handleOk" @close="closeModal" />
  64. </a-card>
  65. </template>
  66. <script>
  67. import { warehouseAllList, warehouseDel } from '@/api/warehouse'
  68. import { STable, VSelect } from '@/components'
  69. import inventoryCheckingTipsModal from './checkingTipsModal.vue'
  70. export default {
  71. components: { STable, VSelect, inventoryCheckingTipsModal },
  72. data () {
  73. return {
  74. queryParam: { // 查询条件
  75. enabledFlag: undefined, // 状态
  76. beginDate: '', // 创建时间 开始时间
  77. endDate: '' // 创建时间 结束时间
  78. },
  79. disabled: false, // 查询、重置按钮是否可操作
  80. dateFormat: 'YYYY-MM-DD',
  81. columns: [
  82. { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
  83. { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  84. { title: '盘点单号', dataIndex: 'nsso', align: 'center', customRender: function (text) { return text || '--' } },
  85. { title: '库存总款数', dataIndex: 'no3', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  86. { title: '库存总数量', dataIndex: 'n4o', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  87. { title: '开单人', dataIndex: 'neo', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  88. { title: '单据审核时间', dataIndex: 'shcreateDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
  89. { title: '状态', scopedSlots: { customRender: 'state' }, width: 100, align: 'center' },
  90. { title: '盘点类型', dataIndex: 'sort', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  91. { title: '操作', scopedSlots: { customRender: 'action' }, width: 260, align: 'center', fixed: 'right' }
  92. ],
  93. // 加载数据方法 必须为 Promise 对象
  94. loadData: parameter => {
  95. this.disabled = true
  96. // return warehouseAllList( this.queryParam ).then(res => {
  97. // const data = res.data
  98. // this.disabled = false
  99. // return data
  100. // })
  101. const _this = this
  102. return new Promise(function (resolve, reject) {
  103. const data = {
  104. pageNo: 1,
  105. pageSize: 10,
  106. list: [
  107. { id: '1', state: 1, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
  108. { id: '2', state: 2, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
  109. { id: '3', state: 3, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
  110. { id: '4', state: 4, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
  111. { id: '5', state: 5, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
  112. ],
  113. count: 10
  114. }
  115. for (var i = 0; i < data.list.length; i++) {
  116. data.list[i].no = i + 1
  117. }
  118. _this.disabled = false
  119. resolve(data)
  120. })
  121. },
  122. openModal: false, // 新增编辑 弹框
  123. itemId: '', // 当前id
  124. nowData: null // 当前记录数据
  125. }
  126. },
  127. methods: {
  128. // 不可选日期
  129. disabledDate (date, dateStrings) {
  130. return date && date.valueOf() > Date.now()
  131. },
  132. // 创建时间 change
  133. creatTimechange (dates, dateStrings) {
  134. this.queryParam.beginDate = dateStrings[0]
  135. this.queryParam.endDate = dateStrings[1]
  136. },
  137. // 重置
  138. resetSearchForm () {
  139. this.queryParam.name = ''
  140. this.$refs.table.refresh(true)
  141. },
  142. // 新增/编辑
  143. handleEdit (row) {
  144. this.itemId = row ? row.id : null
  145. this.nowData = row || null
  146. this.openModal = true
  147. },
  148. // 新增/编辑 成功
  149. handleOk (type) {
  150. if (type == 'a') {
  151. this.$router.push({ path: `/inventoryManagement/inventoryChecking/overall/${this.itemId}` })
  152. } else if (type == 'b') {
  153. this.$router.push({ path: `/inventoryManagement/inventoryChecking/selfDisk/${this.itemId}` })
  154. }
  155. },
  156. // 关闭弹框
  157. closeModal () {
  158. this.itemId = ''
  159. this.openModal = false
  160. },
  161. // 详情
  162. handleDetail (row) {
  163. if (row.state == 3) { // 待盘点 详情
  164. this.$router.push({ path: `/inventoryManagement/inventoryChecking/makeInventory/detail/${row.id}` })
  165. } else if (row.state == 4) { // 待财务审核 详情
  166. this.$router.push({ path: `/inventoryManagement/inventoryChecking/financialAudit/detail/${row.id}` })
  167. } else { // 其他状态 详情
  168. this.$router.push({ path: `/inventoryManagement/inventoryChecking/detail/${row.id}` })
  169. }
  170. },
  171. // 审核
  172. handleEexamine (row) {
  173. const _this = this
  174. this.$confirm({
  175. title: '提示',
  176. content: '确认要审核通过吗?',
  177. okText: row.state == 2 ? '确定' : '审核通过',
  178. cancelText: row.state == 2 ? '取消' : '驳回重盘',
  179. centered: true,
  180. onOk () {
  181. // delectRolePower({
  182. // id: row.id
  183. // }).then(res => {
  184. // console.log(res, 'res1111')
  185. // if (res.status == 200) {
  186. // _this.$message.success(res.message)
  187. // _this.$refs.table.refresh()
  188. // }
  189. // })
  190. }
  191. })
  192. },
  193. // 盘点
  194. handleInventory (row) {
  195. this.$router.push({ path: `/inventoryManagement/inventoryChecking/makeInventory/${row.id}` })
  196. },
  197. // 删除
  198. handleDel (row) {
  199. const _this = this
  200. this.$confirm({
  201. title: '提示',
  202. content: '删除后不可恢复,确定要进行删除吗?',
  203. centered: true,
  204. onOk () {
  205. // warehouseDel({
  206. // id: row.id
  207. // }).then(res => {
  208. // if (res.status == 200) {
  209. // _this.$message.success(res.message)
  210. // _this.$refs.table.refresh()
  211. // }
  212. // })
  213. }
  214. })
  215. }
  216. }
  217. }
  218. </script>