index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div class="spaceCount pagePadding" style="padding: 0">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <ex-table
  7. v-loading="loading"
  8. :table="table"
  9. :data="tableData"
  10. :columns="columns"
  11. :page="pageInfo"
  12. :size="size"
  13. @page-curr-change="handlePageChange"
  14. @page-size-change="handleSizeChange"
  15. @screen-reset="
  16. pageInfo.curr = 1;
  17. parmValue.page = 1;
  18. searchList();
  19. "
  20. @screen-submit="
  21. pageInfo.curr = 1;
  22. parmValue.page = 1;
  23. searchList();
  24. "
  25. >
  26. <template #table-header="{}">
  27. <div style="width: 100%" class="min">
  28. <el-row style="padding: 0 0 0 80px">
  29. <el-col :span="6" style="width: 303px; padding: 0 0 0 0">
  30. <period-date-picker
  31. :start="parmValue.start"
  32. :end="parmValue.end"
  33. :width="'135px'"
  34. :size="searchSize"
  35. @timeReturned="handleTime"
  36. />
  37. </el-col>
  38. <el-col :span="10" style="width: 290px">
  39. <el-input
  40. v-model="parmValue.type_code"
  41. :size="searchSize"
  42. placeholder="商品属性编码"
  43. />
  44. </el-col>
  45. <!-- 刷新 -->
  46. <el-col :span="4" style="width: 66px" class="fr">
  47. <el-button
  48. :size="searchSize"
  49. type="primary"
  50. label=""
  51. @click="searchList"
  52. >刷新</el-button
  53. >
  54. </el-col>
  55. <!-- 重置 -->
  56. <el-col :span="4" style="width: 66px" class="fr">
  57. <el-button
  58. :size="searchSize"
  59. class="fl"
  60. type="warning"
  61. @click="restSearch"
  62. >重置</el-button
  63. >
  64. </el-col>
  65. </el-row>
  66. <el-row style="padding: 10px 0 0 0">
  67. <el-col :span="12" style="width: 280px">
  68. <search-work-company
  69. :value="parmValue.companyNo"
  70. :names="''"
  71. :size="searchSize"
  72. :is-detail="id !== 'add'"
  73. :placeholder="'业务公司'"
  74. @searchChange="supplierChange"
  75. />
  76. </el-col>
  77. <el-col :span="12" style="width: 310px; padding: 0 0 0 10px">
  78. <search-supplier
  79. :size="searchSize"
  80. :placeholder="'供应商公司'"
  81. :disabled="parmValue.companyNo === ''"
  82. :value="parmValue.supplier_code"
  83. @searchChange="selectSupplier"
  84. />
  85. </el-col>
  86. <el-col :span="12" style="width: 310px; padding-left: 10px">
  87. <search-stock
  88. :isDetail="true"
  89. :size="searchSize"
  90. :value="parmValue.stock_code"
  91. :disabled="supplier_code === ''"
  92. :placeholder="'出库仓库'"
  93. :isRelation="true"
  94. :companyCode="supplier_code"
  95. :names="''"
  96. @searchChange="selectStock"
  97. />
  98. </el-col>
  99. </el-row>
  100. </div>
  101. </template>
  102. <template #status="{ scope }">
  103. <el-tag
  104. :size="tablebtnSize"
  105. :type="scope.row.status == '0' ? 'warning' : ''"
  106. v-text="
  107. (statusOptions.find((item) => item.id == scope.row.status) || {})
  108. .label || '--'
  109. "
  110. ></el-tag>
  111. </template>
  112. </ex-table>
  113. </div>
  114. <div v-else>
  115. <no-auth></no-auth>
  116. </div>
  117. </div>
  118. </template>
  119. <script>
  120. import mixinPage from "@/mixins/elPaginationHandle";
  121. import resToken from "@/mixins/resToken";
  122. import asyncRequest from "@/apis/service/stock/spaceCount";
  123. import columns from "./columns";
  124. import { mapGetters } from "vuex";
  125. export default {
  126. name: "spaceCount",
  127. mixins: [mixinPage, resToken],
  128. components: {},
  129. computed: {
  130. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  131. powers() {
  132. let tran =
  133. this.$store.getters.btnList.find(
  134. (item) => item.menu_route == "stockCount"
  135. ) || {};
  136. if (tran && tran.action && tran.action.length > 0) {
  137. return tran.action;
  138. } else {
  139. return [];
  140. }
  141. },
  142. },
  143. data() {
  144. return {
  145. stock_code: "",
  146. supplier_code: "",
  147. parmValue: {
  148. supplier_code: [], //供应商编码
  149. stock_code: [], //仓库编码
  150. companyNo: "",
  151. start: "",
  152. end: "",
  153. type_code: "", //商品编码
  154. page: 1, // 页码
  155. size: 15, // 每页显示条数
  156. },
  157. loading: true,
  158. // 表格 - 数据
  159. tableData: [],
  160. // 表格 - 参数
  161. table: {
  162. stripe: true,
  163. border: true,
  164. _defaultHeader_: ["setcol"],
  165. },
  166. // 表格 - 分页
  167. pageInfo: {
  168. size: 15,
  169. curr: 1,
  170. total: 0,
  171. },
  172. // 表格 - 列参数
  173. columns: columns,
  174. };
  175. },
  176. mounted() {
  177. this.searchList();
  178. },
  179. methods: {
  180. //业务公司选择
  181. async supplierChange(e) {
  182. const { code } = e;
  183. this.parmValue.companyNo = code || ""; //业务公司编码
  184. this.parmValue.supplier_code = [];
  185. this.supplier_code = "";
  186. this.parmValue.stock_code = [];
  187. this.stock_code = "";
  188. this.parmValue.page = 1;
  189. this.pageInfo.curr = 1;
  190. await this.searchList();
  191. },
  192. // 选择时间操作
  193. async handleTime(e) {
  194. this.parmValue.start = e.startTime || "";
  195. this.parmValue.end = e.endTime || "";
  196. this.parmValue.page = 1;
  197. this.pageInfo.curr = 1;
  198. await this.searchList();
  199. },
  200. // 选择供应商仓库
  201. async selectStock(e) {
  202. const { code } = e;
  203. this.parmValue.stock_code = code ? [code] : [];
  204. this.stock_code = code || "";
  205. this.parmValue.stock_code = [];
  206. this.stock_code = "";
  207. this.parmValue.page = 1;
  208. this.pageInfo.curr = 1;
  209. await this.searchList();
  210. },
  211. // 选择供应商
  212. async selectSupplier(e) {
  213. const { code } = e;
  214. this.parmValue.supplier_code = code ? [code] : [];
  215. this.supplier_code = code || "";
  216. this.parmValue.stock_code = [];
  217. this.stock_code = "";
  218. this.parmValue.page = 1;
  219. this.pageInfo.curr = 1;
  220. await this.searchList();
  221. },
  222. restSearch() {
  223. // 表格 - 分页
  224. this.pageInfo = {
  225. size: 15,
  226. curr: 1,
  227. total: 0,
  228. };
  229. this.parmValue = {
  230. start: "",
  231. end: "",
  232. companyNo: "",
  233. type_code: "", //商品编码
  234. supplier_code: [],
  235. stock_code: [], //仓库编码
  236. page: 1, // 页码
  237. size: 15, // 每页显示条数
  238. };
  239. this.searchList();
  240. },
  241. async searchList() {
  242. this.loading = true;
  243. let model = JSON.parse(JSON.stringify(this.parmValue));
  244. model.supplierNo = model.supplier_code.toString() || "";
  245. model.wsm_code = model.stock_code.toString() || "";
  246. delete model["supplier_code"];
  247. delete model["stock_code"];
  248. const res = await asyncRequest.list(model);
  249. if (res && res.code === 0 && res.data) {
  250. this.tableData = res.data.list;
  251. this.tableData.forEach((e) => {
  252. e.supplier_wsm_name =
  253. e.supplier_name === e.wsm_name
  254. ? e.supplier_name
  255. : e.supplier_name + "/" + e.wsm_name;
  256. });
  257. this.pageInfo.total = Number(res.data.count);
  258. } else if (res && res.code >= 100 && res.code <= 104) {
  259. await this.logout();
  260. } else {
  261. this.tableData = [];
  262. this.pageInfo.total = 0;
  263. }
  264. this.loading = false;
  265. },
  266. },
  267. };
  268. </script>