index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <div class="check pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <el-button
  7. type="primary"
  8. :size="'mini'"
  9. @click="exportGood('导出盘点商品')"
  10. >导出盘点商品
  11. </el-button>
  12. <!-- <ex-table
  13. v-loading="false"
  14. :table="table"
  15. :data="tableData"
  16. :columns="columns"
  17. :page="pageInfo"
  18. :size="size"
  19. @page-curr-change="handlePageChange"
  20. @page-size-change="handleSizeChange"
  21. @screen-reset="
  22. pageInfo.curr = 1;
  23. parmValue.page = 1;
  24. searchList();
  25. "
  26. @screen-submit="
  27. pageInfo.curr = 1;
  28. parmValue.page = 1;
  29. searchList();
  30. "
  31. >
  32. <template #table-header="{}">
  33. <div style="width: 100%">
  34. <el-row style="padding: 0 0 0 80px">
  35. <el-col :span="24">
  36. <el-col :span="6" style="width: 292px">
  37. <period-date-picker
  38. :start="parmValue.start"
  39. :end="parmValue.end"
  40. :type="1"
  41. :width="'135px'"
  42. :size="searchSize"
  43. @timeReturned="timeReturned($event)"
  44. />
  45. </el-col>
  46. <el-col :span="4" style="width: 180px; padding: 0 0 0 10px">
  47. <el-select
  48. :size="searchSize"
  49. v-model="parmValue.status"
  50. filterable
  51. clearable
  52. placeholder="盘点状态"
  53. style="width: 100%"
  54. @change="
  55. pageInfo.curr = 1;
  56. parmValue.page = 1;
  57. searchList();
  58. "
  59. >
  60. <el-option
  61. v-for="item in statusOptions"
  62. :key="'status' + item.id"
  63. :label="item.label"
  64. :value="item.id"
  65. />
  66. </el-select>
  67. </el-col>
  68. <el-col :span="4" style="width: 130px; padding: 0 0 0 10px">
  69. <el-select
  70. :size="searchSize"
  71. v-model="parmValue.type"
  72. filterable
  73. clearable
  74. placeholder="盘点类型"
  75. style="width: 100%"
  76. @change="
  77. pageInfo.curr = 1;
  78. parmValue.page = 1;
  79. searchList();
  80. "
  81. >
  82. <el-option
  83. v-for="item in typeOptions"
  84. :key="'type' + item.id"
  85. :label="item.label"
  86. :value="item.id"
  87. />
  88. </el-select>
  89. </el-col>
  90. <el-col :span="3" style="width: 66px; float: right">
  91. <el-button
  92. :size="searchSize"
  93. type="primary"
  94. style="float: right; margin-left: 5px"
  95. @click="searchList"
  96. >
  97. 刷新
  98. </el-button>
  99. </el-col>
  100. </el-col>
  101. </el-row>
  102. <el-row style="padding: 10px 0 0 0">
  103. <el-col :span="24">
  104. <el-col :span="4" style="width: 260px">
  105. <el-input
  106. :size="searchSize"
  107. v-model="parmValue.wsm_code"
  108. :maxlength="40"
  109. placeholder="仓库编号"
  110. />
  111. </el-col>
  112. <el-col :span="4" style="width: 250px; padding: 0 0 0 10px">
  113. <el-input
  114. :size="searchSize"
  115. v-model="parmValue.check_code"
  116. :maxlength="40"
  117. placeholder="盘点编号"
  118. />
  119. </el-col>
  120. <el-col :span="4" style="width: 54px">
  121. <el-button
  122. :size="searchSize"
  123. type="primary"
  124. class="fr"
  125. icon="el-icon-search"
  126. @click="
  127. pageInfo.curr = 1;
  128. parmValue.page = 1;
  129. searchList();
  130. "
  131. /></el-col>
  132. <el-col :span="4" style="width: 66px">
  133. <el-button
  134. type="warning"
  135. class="fr"
  136. :size="searchSize"
  137. @click="restSearch"
  138. >
  139. 重置
  140. </el-button>
  141. </el-col>
  142. <el-col
  143. :span="3"
  144. style="width: 66px; float: right"
  145. v-if="powers.some((item) => item == '003')"
  146. >
  147. <el-button
  148. @click="openModal('add', false, {})"
  149. :size="searchSize"
  150. type="success"
  151. style="float: right; margin-left: 5px"
  152. >
  153. 添加
  154. </el-button>
  155. </el-col>
  156. </el-col>
  157. </el-row>
  158. </div>
  159. </template>
  160. <template #status="{ scope }">
  161. <el-tag
  162. :size="tablebtnSize"
  163. :type="scope.row.status == '0' ? 'warning' : ''"
  164. v-text="
  165. (statusOptions.find((item) => item.id == scope.row.status) || {})
  166. .label || '--'
  167. "
  168. ></el-tag>
  169. </template>
  170. <template #type="{ scope }">
  171. <el-tag
  172. :size="tablebtnSize"
  173. :type="scope.row.type == '1' ? 'success' : ''"
  174. v-text="
  175. (typeOptions.find((item) => item.id == scope.row.type) || {})
  176. .label || '--'
  177. "
  178. ></el-tag>
  179. </template>
  180. <template #operation="{ scope }">
  181. <el-tooltip
  182. v-if="powers.some((item) => item == '007')"
  183. effect="dark"
  184. content="详情"
  185. placement="top"
  186. >
  187. <i
  188. class="el-icon-view tb-icon"
  189. @click="routeGoto('checkDetail', { id: scope.row.id })"
  190. ></i>
  191. </el-tooltip>
  192. </template>
  193. </ex-table> -->
  194. <!-- <add-model
  195. :id="modelId"
  196. :sitem="sitem"
  197. :show-model="showModel"
  198. :is-detail="isDetail"
  199. @refresh="searchList"
  200. @cancel="showModel = false"
  201. /> -->
  202. </div>
  203. <div v-else>
  204. <no-auth></no-auth>
  205. </div>
  206. </div>
  207. </template>
  208. <script>
  209. import mixinPage from "@/mixins/elPaginationHandle";
  210. import resToken from "@/mixins/resToken";
  211. import asyncRequest from "@/apis/service/stock/check";
  212. import addModel from "./addModel";
  213. import { getToken } from "@/utils/auth";
  214. import { mapGetters } from "vuex";
  215. export default {
  216. name: "check",
  217. mixins: [mixinPage, resToken],
  218. components: {
  219. addModel,
  220. },
  221. computed: {
  222. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  223. powers() {
  224. let tran =
  225. this.$store.getters.btnList.find(
  226. (item) => item.menu_route == "check"
  227. ) || {};
  228. if (tran && tran.action && tran.action.length > 0) {
  229. return tran.action;
  230. } else {
  231. return [];
  232. }
  233. },
  234. },
  235. data() {
  236. return {
  237. sitem: null,
  238. // 节点状态
  239. statusOptions: [
  240. { id: "0", label: "待发起流程" },
  241. { id: "1", label: "待上传盘点结果" },
  242. { id: "2", label: "待审核盘点结果" },
  243. { id: "3", label: "待系统更新" },
  244. { id: "4", label: "盘点已结束" },
  245. ],
  246. // 盘点类型
  247. typeOptions: [
  248. { id: "1", label: "全盘" },
  249. { id: "2", label: "抽盘" },
  250. ],
  251. loading: true,
  252. showModel: false,
  253. isDetail: false,
  254. modelId: 0,
  255. parmValue: {
  256. page: 1, // 页码
  257. size: 15, // 每页显示条数
  258. wsm_code: "", // 盘点仓库
  259. check_code: "", // 盘点编号
  260. type: "", //盘点类型
  261. status: "", //判断状态
  262. start: "",
  263. end: "",
  264. },
  265. tableData: [],
  266. passwordModel: false,
  267. passwordModelId: 0,
  268. isPasswordDetail: false,
  269. // 表格 - 数据
  270. tableData: [],
  271. // 表格 - 参数
  272. table: {
  273. stripe: true,
  274. border: true,
  275. _defaultHeader_: ["setcol"],
  276. },
  277. // 表格 - 分页
  278. pageInfo: {
  279. size: 15,
  280. curr: 1,
  281. total: 0,
  282. },
  283. // 表格 - 列参数
  284. columns: [
  285. {
  286. prop: "check_code",
  287. label: "盘点编号",
  288. width: "155px",
  289. },
  290. {
  291. prop: "wsm_code",
  292. label: "仓库编码",
  293. width: "170px",
  294. },
  295. {
  296. prop: "name",
  297. label: "仓库名称",
  298. },
  299. {
  300. prop: "code",
  301. label: "公司编码",
  302. width: "140px",
  303. },
  304. {
  305. prop: "caname",
  306. label: "公司名称",
  307. },
  308. {
  309. prop: "status",
  310. label: "盘点状态",
  311. _slot_: "status",
  312. width: "120px",
  313. },
  314. {
  315. prop: "type",
  316. label: "盘点类型",
  317. _slot_: "type",
  318. width: "70px",
  319. },
  320. {
  321. prop: "addtime",
  322. label: "创建时间",
  323. width: "140px",
  324. },
  325. {
  326. prop: "",
  327. label: "操作",
  328. fixed: "right",
  329. _noset_: true,
  330. width: "50px",
  331. _slot_: "operation",
  332. },
  333. ],
  334. };
  335. },
  336. mounted() {
  337. // this.searchList();
  338. },
  339. methods: {
  340. restSearch() {
  341. // 表格 - 分页
  342. this.pageInfo = {
  343. size: 15,
  344. curr: 1,
  345. total: 0,
  346. };
  347. this.parmValue = {
  348. wsm_code: "", // 盘点仓库
  349. check_code: "", // 盘点编号
  350. type: "", //盘点类型
  351. status: "", //判断状态
  352. start: "",
  353. end: "",
  354. page: 1, // 页码
  355. size: 15, // 每页显示条数
  356. };
  357. this.searchList();
  358. },
  359. openModal(id, isDetail, sitem) {
  360. this.showModel = true;
  361. this.modelId = id;
  362. this.isDetail = isDetail;
  363. this.sitem = sitem;
  364. },
  365. async timeReturned(e) {
  366. if (e.startTime !== "") {
  367. this.parmValue.start = e.startTime;
  368. } else {
  369. this.parmValue.start = "";
  370. }
  371. if (e.endTime !== "") {
  372. this.parmValue.end = e.endTime;
  373. } else {
  374. this.parmValue.end = "";
  375. }
  376. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  377. this.parmValue.page = 1;
  378. await this.searchList();
  379. }
  380. },
  381. async exportGood(message) {
  382. // if (!this.loading) {
  383. this.loading = true;
  384. let httpType = `aplication/zip`;
  385. let model = {
  386. end: "2021-10-29",
  387. start: "2021-10-01",
  388. token: getToken(),
  389. // id: this.queryId,
  390. // token: getToken(),
  391. };
  392. axios({
  393. method: "post",
  394. //urlConfig.baseURL + "admin/checkexport"
  395. url: "http://inv.sitw.wanyuhengtong.com/downqrdinv",
  396. responseType: "blob",
  397. data: model,
  398. headers: {
  399. Accept: httpType,
  400. },
  401. })
  402. .then((res) => {
  403. if (res && res.status == 200 && res.data) {
  404. let blob = new Blob([res.data], {
  405. type: httpType,
  406. });
  407. let url = window.URL.createObjectURL(blob);
  408. let aLink = document.createElement("a");
  409. aLink.style.display = "none";
  410. aLink.href = url;
  411. aLink.setAttribute("download", `${message}.zip`);
  412. document.body.appendChild(aLink);
  413. aLink.click();
  414. document.body.removeChild(aLink); //下载完成移除元素
  415. window.URL.revokeObjectURL(url); //释放掉blob对象
  416. this.$message.success(`${message}导出成功!`);
  417. setTimeout(() => {
  418. this.loading = false;
  419. }, 500);
  420. } else {
  421. // this.$message.error(res.data.message);
  422. setTimeout(() => {
  423. this.loading = false;
  424. }, 500);
  425. }
  426. })
  427. .catch((error) => {
  428. console.log(error);
  429. this.loading = false;
  430. });
  431. // }
  432. },
  433. async searchList() {
  434. if (
  435. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  436. (this.parmValue.start === "" && this.parmValue.end !== "")
  437. ) {
  438. this.$message.warning("时间区间不完整!");
  439. return;
  440. }
  441. this.loading = true;
  442. const res = await asyncRequest.list(this.parmValue);
  443. if (res && res.code === 0 && res.data) {
  444. this.tableData = res.data.list;
  445. this.pageInfo.total = Number(res.data.count);
  446. } else if (res && res.code >= 100 && res.code <= 104) {
  447. await this.logout();
  448. } else {
  449. this.tableData = [];
  450. this.pageInfo.total = 0;
  451. }
  452. this.loading = false;
  453. },
  454. },
  455. };
  456. </script>
  457. <style lang="scss" scoped>
  458. </style>