index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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="false"
  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="24">
  30. <!-- 请选择仓库 -->
  31. <!-- <el-col :span="5" style="width: 250px">
  32. <el-cascader
  33. placeholder="请选择仓库"
  34. filterable
  35. clearable
  36. :size="searchSize"
  37. v-model="value"
  38. :options="options"
  39. style="width: 100%"
  40. @change="
  41. pageInfo.curr = 1;
  42. parmValue.page = 1;
  43. searchList();
  44. "
  45. ></el-cascader>
  46. </el-col> -->
  47. <!-- <el-col :span="4" style="width: 160px; padding-left: 10px">
  48. <el-select
  49. v-model="value"
  50. :size="searchSize"
  51. filterable
  52. placeholder="请选择商品"
  53. >
  54. <el-option
  55. v-for="item in product"
  56. :key="item.value"
  57. :label="item.label"
  58. :value="item.value"
  59. >
  60. </el-option>
  61. </el-select>
  62. </el-col> -->
  63. <el-col :span="8" style="width: 500px">
  64. <el-input
  65. :size="searchSize"
  66. placeholder="请输入内容"
  67. v-model="content"
  68. class="input-with-select"
  69. >
  70. <el-select
  71. style="width: 100px"
  72. v-model="select"
  73. slot="prepend"
  74. placeholder="请选择"
  75. >
  76. <el-option label="商品" value="product"></el-option>
  77. <el-option label="仓库" value="stock"></el-option>
  78. </el-select>
  79. <el-button
  80. slot="append"
  81. icon="el-icon-search"
  82. type="primary"
  83. ></el-button>
  84. </el-input>
  85. </el-col>
  86. <el-col :span="6" style="width: 303px; padding: 0 0 0 10px">
  87. <PeriodDatePicker
  88. :start="parmValue.total_low"
  89. :end="parmValue.total_up"
  90. :type="1"
  91. :width="'135px'"
  92. :title="'开始时间'"
  93. :size="searchSize"
  94. @numReturned="numReturned($event, 0)"
  95. />
  96. </el-col>
  97. <!-- 重置 -->
  98. <el-col
  99. :span="4"
  100. style="width: 74px; margin-left: 10px"
  101. class="mr5"
  102. >
  103. <el-button
  104. :size="searchSize"
  105. class="fl"
  106. type="warning"
  107. @click="searchList"
  108. >重置</el-button
  109. >
  110. </el-col>
  111. </el-col>
  112. </el-row>
  113. </div>
  114. <!-- 刷新 -->
  115. <el-col :span="4" style="width: 74px; margin-left: 10px">
  116. <el-button
  117. :size="searchSize"
  118. type="primary"
  119. class="fr"
  120. label=""
  121. @click="searchList"
  122. >刷新</el-button
  123. >
  124. </el-col>
  125. </template>
  126. <template #status="{ scope }">
  127. <el-tag
  128. :size="tablebtnSize"
  129. :type="scope.row.status == '0' ? 'warning' : ''"
  130. v-text="
  131. (statusOptions.find((item) => item.id == scope.row.status) || {})
  132. .label || '--'
  133. "
  134. ></el-tag>
  135. </template>
  136. </ex-table>
  137. <add-edit
  138. :id="modelId"
  139. :sitem="sitem"
  140. :show-model="showModel"
  141. :is-detail="isDetail"
  142. @refresh="searchList"
  143. @cancel="showModel = false"
  144. />
  145. </div>
  146. <div v-else>
  147. <no-auth></no-auth>
  148. </div>
  149. </div>
  150. </template>
  151. <script>
  152. import mixinPage from "@/mixins/elPaginationHandle";
  153. import resToken from "@/mixins/resToken";
  154. // import statusList from "@/assets/js/statusList";
  155. // import asyncRequest from "@/apis/service/stock/spaceCount";
  156. import asyncRequest from "@/mock/service/stock/spaceCount";
  157. import addEdit from "./addEdit";
  158. import { mapGetters } from "vuex";
  159. export default {
  160. name: "spaceCount",
  161. mixins: [mixinPage, resToken],
  162. components: {
  163. addEdit,
  164. },
  165. computed: {
  166. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  167. powers() {
  168. let tran =
  169. this.$store.getters.btnList.find(
  170. (item) => item.menu_route == "stockCount"
  171. ) || {};
  172. if (tran && tran.action && tran.action.length > 0) {
  173. return tran.action;
  174. } else {
  175. return [];
  176. }
  177. },
  178. },
  179. data() {
  180. return {
  181. select: "",
  182. product: "",
  183. stock: "",
  184. content: "",
  185. options: [],
  186. loading: true,
  187. showModel: false,
  188. isDetail: false,
  189. modelId: 0,
  190. tableData: [],
  191. // 表格 - 数据
  192. tableData: [],
  193. // 表格 - 参数
  194. table: {
  195. stripe: true,
  196. border: true,
  197. _defaultHeader_: ["setcol"],
  198. },
  199. // 表格 - 分页
  200. pageInfo: {
  201. size: 15,
  202. curr: 1,
  203. total: 0,
  204. },
  205. // 表格 - 列参数
  206. columns: [
  207. {
  208. prop: "nickname",
  209. label: "仓库编码",
  210. },
  211. {
  212. prop: "role_name",
  213. label: "仓库",
  214. },
  215. {
  216. prop: "mobile",
  217. label: "商品编码",
  218. },
  219. {
  220. prop: "email",
  221. label: "商品名称",
  222. },
  223. {
  224. prop: "status",
  225. label: "分类",
  226. // _slot_: "status",
  227. // width: "80px",
  228. },
  229. {
  230. prop: "addtime",
  231. label: "单位",
  232. // sortable: true,
  233. },
  234. {
  235. prop: "addtime",
  236. label: "已入库",
  237. // sortable: true,
  238. },
  239. {
  240. prop: "addtime",
  241. label: "已出库",
  242. // sortable: true,
  243. },
  244. {
  245. prop: "addtime",
  246. label: "待入库",
  247. // sortable: true,
  248. },
  249. {
  250. prop: "addtime",
  251. label: "待出库",
  252. // sortable: true,
  253. },
  254. ],
  255. // sitem: null,
  256. // // 状态
  257. // statusOptions: [
  258. // { id: "0", label: "禁用" },
  259. // { id: "1", label: "启用" },
  260. // ],
  261. // passwordModel: false,
  262. // passwordModelId: 0,
  263. // isPasswordDetail: false,
  264. // statusList: statusList,
  265. parmValue: {},
  266. };
  267. },
  268. mounted() {
  269. this.searchList();
  270. this.stockName();
  271. },
  272. methods: {
  273. restSearch() {
  274. this.parmValue = {};
  275. this.searchList();
  276. },
  277. openModal(id, isDetail, sitem) {
  278. this.showModel = true;
  279. this.modelId = id;
  280. this.isDetail = isDetail;
  281. this.sitem = sitem;
  282. },
  283. async deleteById(id, status) {
  284. // await this.$confirm("确定要删除?", {
  285. // confirmButtonText: "确定",
  286. // cancelButtonText: "取消",
  287. // type: "warning",
  288. // })
  289. // .then(async () => {
  290. // const model = {
  291. // id: id,
  292. // status: status === "1" ? "0" : "1",
  293. // };
  294. // const res = await asyncRequest.status(model);
  295. // if (res && res.code === 0) {
  296. // this.$notify.success({
  297. // title: "删除成功",
  298. // message: "",
  299. // });
  300. // this.searchList();
  301. // } else if (res && res.code >= 100 && res.code <= 104) {
  302. // await this.logout();
  303. // } else {
  304. // this.$message.warning(res.message);
  305. // }
  306. // })
  307. // .catch(() => {
  308. // console.log("取消");
  309. // });
  310. },
  311. async searchList() {
  312. // this.loading = true;
  313. // const res = await asyncRequest.list(this.parmValue);
  314. // if (res && res.code === 0 && res.data) {
  315. // this.tableData = res.data.list;
  316. // this.pageInfo.total = Number(res.data.count);
  317. // } else if (res && res.code >= 100 && res.code <= 104) {
  318. // await this.logout();
  319. // } else {
  320. // this.tableData = [];
  321. // this.pageInfo.total = 0;
  322. // }
  323. // this.loading = false;
  324. },
  325. async statusConfirm(id, status) {
  326. // let str = status === "1" ? "禁用" : "启用";
  327. // await this.$confirm("确定要改为" + str + "?", {
  328. // confirmButtonText: "确定",
  329. // cancelButtonText: "取消",
  330. // type: "warning",
  331. // })
  332. // .then(async () => {
  333. // this.loading = true;
  334. // const model = {
  335. // id: id,
  336. // status: status === "1" ? "0" : "1",
  337. // };
  338. // const res = await asyncRequest.status(model);
  339. // if (res && res.code === 0) {
  340. // this.loading = false;
  341. // this.$notify.success({
  342. // title: "状态修改成功!",
  343. // message: "",
  344. // });
  345. // await this.searchList();
  346. // } else if (res && res.code >= 100 && res.code <= 104) {
  347. // await this.logout();
  348. // } else {
  349. // this.$message.warning(res.message);
  350. // }
  351. // })
  352. // .catch(() => {
  353. // console.log("取消");
  354. // });
  355. },
  356. async stockName() {
  357. //获取多级仓库名称的方法
  358. const res = await asyncRequest.listAll(this.parmValue);
  359. // console.log(res.data);
  360. // this.options = res.data;
  361. // console.log(this.options);
  362. let arr = res.data;
  363. // console.log(arr);
  364. arr.forEach((ele) => {
  365. let item = {
  366. value: ele.id,
  367. label: ele.name,
  368. children: [],
  369. };
  370. ele.child.forEach((elem) => {
  371. let model = {
  372. value: elem.id,
  373. label: elem.name,
  374. };
  375. item.children.push(model);
  376. });
  377. this.options.push(item);
  378. });
  379. // console.log(this.options);
  380. // console.log(this.pageInfo.total);
  381. },
  382. },
  383. };
  384. </script>
  385. <style lang="scss" scoped>
  386. @media screen and (max-width: 1200px) {
  387. .mr5 {
  388. margin-top: 10px;
  389. }
  390. }
  391. </style>