consumeList.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <ContainerQuery>
  3. <div slot="left">
  4. <el-button size="small" type="primary" @click="add_consume=true">
  5. 消耗品调拨
  6. </el-button>
  7. </div>
  8. <div slot="more">
  9. <el-form inline size="small">
  10. <el-form-item>
  11. <el-input v-model="searchKey" style="width: 220px" placeholder="商品名称" clearable
  12. @keyup.enter.native="pageChange(1)" @clear="pageChange(1)">
  13. <el-button slot="append" @click="pageChange(1)">
  14. <i class="el-icon-search"></i>
  15. </el-button>
  16. </el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-input v-model="mobile" style="width: 220px" placeholder="调拨人手机号" clearable
  20. @keyup.enter.native="pageChange(1)" @clear="pageChange(1)">
  21. <el-button slot="append" @click="pageChange(1)">
  22. <i class="el-icon-search"></i>
  23. </el-button>
  24. </el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-input v-model="write_mobile" style="width: 220px" placeholder="核销人手机号" clearable
  28. @keyup.enter.native="pageChange(1)" @clear="pageChange(1)">
  29. <el-button slot="append" @click="pageChange(1)">
  30. <i class="el-icon-search"></i>
  31. </el-button>
  32. </el-input>
  33. </el-form-item>
  34. </el-form>
  35. </div>
  36. <!-- 切换类型-->
  37. <el-tabs v-model="state" type="card" @tab-click="selTopType">
  38. <el-tab-pane label="全部" name="All"></el-tab-pane>
  39. <el-tab-pane label="使用中" name="in"></el-tab-pane>
  40. <el-tab-pane label="已核销" name="out"></el-tab-pane>
  41. </el-tabs>
  42. <!-- 表格-->
  43. <div class="table">
  44. <el-table :data="tableData" style="width: 100%" type="index">
  45. <el-table-column prop="goods" label="商品名" width="180">
  46. <template slot-scope="scope">
  47. {{ scope.row.name }}<br />
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="number" label="数量">
  51. </el-table-column>
  52. <el-table-column prop="createTime" label="出仓日期" min-width="150">
  53. <template slot-scope="scope">
  54. {{ $_common.formatDate(scope.row.createTime) }}
  55. </template>
  56. </el-table-column>
  57. <el-table-column prop="mobile" label="调拨人" min-width="100">
  58. <template slot-scope="scope">
  59. {{ scope.row.transferor }}<br />
  60. {{ scope.row.mobile }}
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="writeTime" label="核销日期" min-width="150">
  64. <template slot-scope="scope">
  65. {{ $_common.formatDate(scope.row.writeTime) }}
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="write_mobile" label="核销人" min-width="100">
  69. <template slot-scope="scope">
  70. {{ scope.row.write_off_person }}<br />
  71. {{ scope.row.write_mobile }}
  72. </template>
  73. </el-table-column>
  74. <el-table-column prop="status" label="状态" min-width="100">
  75. <template slot-scope="scope">
  76. <span v-if="scope.row.status==1" class='success-status'>使用中</span>
  77. <span v-if="scope.row.status==2" class='info-status'>已核销</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="操作" min-width="130" fixed="right" header->
  81. <template slot-scope="scope">
  82. <!-- <el-button type="text" @click="openEditModel(scope.row.id)">
  83. 编辑
  84. </el-button> -->
  85. <el-button v-if="scope.row.status==1" type="text" @click="writeOff(scope.row.id)">
  86. 核销
  87. </el-button>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. </div>
  92. <!-- 分页查询-->
  93. <FooterPage :page-size="pageSize" :total-page.sync="total" :current-page.sync="page" @pageChange="pageChange"
  94. @sizeChange="sizeChange"></FooterPage>
  95. <AddConsume v-if="add_consume" :visible="add_consume" @close="add_consume = false"
  96. @confirm="addConfirm"></AddConsume>
  97. </ContainerQuery>
  98. </template>
  99. <script>
  100. import {
  101. ConsumeList,
  102. ConsumeWrite_off
  103. } from "@/api/Stock";
  104. import AddConsume from "./addConsume.vue";
  105. export default {
  106. name: "ConsumeList",
  107. components: {
  108. AddConsume,
  109. },
  110. data() {
  111. return {
  112. // 显示弹窗
  113. add_consume:false,
  114. state: "All",
  115. searchKey: '', //商品名称
  116. "mobile": "", //调拨人
  117. "write_mobile": "", //核销人
  118. searchPm: '', //1使用中2使用完 搜索条件
  119. total: 0,
  120. page: 1,
  121. pageSize: 10,
  122. tableData: [],
  123. };
  124. },
  125. created() {
  126. if (this.$route.query.id) {
  127. this.staffId = this.$route.query.id - 0;
  128. this.staffName = this.$route.query.name;
  129. }
  130. this.ConsumeList();
  131. },
  132. activated() {
  133. if (this.$_isInit()) return;
  134. if (this.$route.query.id) {
  135. this.staffId = this.$route.query.id - 0;
  136. this.staffName = this.$route.query.name;
  137. }
  138. this.ConsumeList();
  139. },
  140. methods: {
  141. // 添加完成
  142. addConfirm(res){
  143. this.ConsumeList();
  144. console.log(res);
  145. },
  146. // 切换类型
  147. selTopType(tag) {
  148. switch (this.state) {
  149. case "All": // 全部
  150. this.searchPm = '';
  151. break;
  152. case "in": // 使用中
  153. this.searchPm = 1;
  154. break;
  155. case "out": // 已核销
  156. this.searchPm = 2;
  157. break;
  158. }
  159. this.pageChange(1);
  160. },
  161. // 核销消耗品
  162. writeOff(id) {
  163. console.log(id);
  164. this.$confirm("你确定核销消耗品吗?", {
  165. confirmButtonText: "确定",
  166. cancelButtonText: "取消",
  167. type: "warning",
  168. }).then(async () => {
  169. const data = await ConsumeWrite_off({
  170. id: id
  171. });
  172. this.ConsumeList();
  173. this.$message({
  174. type: "success",
  175. message: "核销成功!",
  176. });
  177. });
  178. },
  179. async ConsumeList() {
  180. const {
  181. data,
  182. pageTotal
  183. } = await ConsumeList({
  184. name: this.searchKey, //商品名称
  185. status: this.searchPm, //1使用中2使用完 搜索条件
  186. mobile: this.mobile, //调拨人
  187. write_mobile: this.write_mobile, //核销人
  188. page: this.page,
  189. pageSize: this.pageSize,
  190. });
  191. this.tableData = data;
  192. this.total = pageTotal;
  193. },
  194. pageChange(page) {
  195. this.page = page;
  196. this.ConsumeList();
  197. },
  198. // 每页数据大小改变
  199. sizeChange(val) {
  200. this.pageSize = val;
  201. this.pageChange(1);
  202. },
  203. },
  204. };
  205. </script>
  206. <style></style>