index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div>
  3. <ex-table
  4. v-loading="loading"
  5. :table="table"
  6. :data="tableData"
  7. :columns="columns"
  8. :page="pageInfo"
  9. :size="size"
  10. @page-curr-change="handlePageChange"
  11. @page-size-change="handleSizeChange"
  12. @screen-reset="
  13. pageInfo.curr = 1;
  14. parmValue.page = 1;
  15. searchList();
  16. "
  17. @screen-submit="
  18. pageInfo.curr = 1;
  19. parmValue.page = 1;
  20. searchList();
  21. "
  22. @selection="selection_change"
  23. >
  24. <template #table-header="{}">
  25. <div style="width: 100%">
  26. <el-row style="padding: 0 0 0 80px">
  27. <el-col :span="6" style="width: 363px;">
  28. <periodDatePickerActive
  29. :start="parmValue.start_date"
  30. :end="parmValue.end_date"
  31. :placeholder="'下线'"
  32. :width="'165px'"
  33. :size="searchSize"
  34. @timeReturned="time"
  35. />
  36. </el-col>
  37. <el-col :span="6" style="width: 163px;">
  38. <el-input
  39. :size="searchSize"
  40. v-model="parmValue.creater"
  41. :maxlength="40"
  42. @blur="
  43. pageInfo.curr = 1;
  44. parmValue.page = 1;
  45. searchList();
  46. "
  47. placeholder="创建人"
  48. ></el-input>
  49. </el-col>
  50. <el-col :span="3" style="width: 66px; float: right">
  51. <el-button
  52. :size="searchSize"
  53. type="primary"
  54. style="float: right; margin-left: 5px"
  55. @click="searchList"
  56. >
  57. 刷新
  58. </el-button>
  59. </el-col>
  60. <el-col :span="4" style="width: 66px; float: right">
  61. <el-button
  62. type="warning"
  63. class="fr"
  64. :size="searchSize"
  65. @click="restSearch"
  66. >
  67. 重置
  68. </el-button>
  69. </el-col>
  70. </el-row>
  71. </div>
  72. </template>
  73. <template #operation="{ scope }">
  74. <el-tooltip
  75. v-if="powers.some((item) => item == '007')"
  76. effect="dark"
  77. content="详情"
  78. placement="top"
  79. >
  80. <i
  81. class="el-icon-view tb-icon"
  82. @click="getRouter('goodsOfflineDetail', scope.row.spuCode)"
  83. ></i>
  84. </el-tooltip>
  85. </template>
  86. </ex-table>
  87. </div>
  88. </template>
  89. <script>
  90. import mixinPage from "@/mixins/elPaginationHandle";
  91. import resToken from "@/mixins/resToken";
  92. import urlConfig from "@/apis/url-config";
  93. import asyncRequest from "@/apis/service/goodStore/goodsOffline";
  94. import periodDatePickerActive from "./period-date-picker/main.vue";
  95. import { columns} from "./columns";
  96. import { mapGetters } from "vuex";
  97. export default {
  98. name: "goodsOffline",
  99. mixins: [mixinPage, resToken],
  100. components: {
  101. periodDatePickerActive
  102. },
  103. computed: {
  104. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  105. powers() {
  106. let tran =
  107. this.$store.getters.btnList.find((item) => item.menu_route == "goodsOffline") ||
  108. {};
  109. if (tran && tran.action && tran.action.length > 0) {
  110. return tran.action;
  111. } else {
  112. return [];
  113. }
  114. },
  115. },
  116. data() {
  117. return {
  118. //选中数组
  119. changeList: [],
  120. //全局url
  121. fileUrl: urlConfig.baseURL,
  122. //loading
  123. loading: false,
  124. //请求参数集合
  125. parmValue: {
  126. start_date: "", //起始时间
  127. end_date: "", // 结束时间
  128. // is_export:0,//是否导出0/1
  129. creater:"",//创建人
  130. page: 1, // 页码
  131. size: 15, // 每页显示条数
  132. },
  133. // 表格 - 数据集合
  134. tableData: [],
  135. // 表格 - 参数
  136. table: {
  137. stripe: true,
  138. border: true,
  139. _defaultHeader_: ["setcol"],
  140. },
  141. // 表格 - 分页
  142. pageInfo: {
  143. size: 15,
  144. curr: 1,
  145. total: 0,
  146. },
  147. // 表格表头 - 列参数
  148. columns: columns,
  149. };
  150. },
  151. mounted() {
  152. // alert("此页面暂时只用做开发人员测试、数据不真实")
  153. const { back } = this.$route.query;
  154. if (back) {
  155. this.parmValue = JSON.parse(back);
  156. console.log(this.parmValue);
  157. const { page, size } = this.parmValue;
  158. this.pageInfo = {
  159. size: size,
  160. curr: page,
  161. total: 0,
  162. };
  163. //多选条件
  164. // this.select = this.parmValue.select;
  165. // this.sselect = this.parmValue.sselect;
  166. // this.sinput = this.parmValue.sinput;
  167. } else {
  168. // this.select = "1";
  169. // this.sselect = "创建时间"
  170. }
  171. this.searchList();
  172. },
  173. methods: {
  174. getRouter(toRouter, queryId){
  175. if (toRouter && queryId) {
  176. let model = {
  177. id: queryId,
  178. type: 'view',
  179. };
  180. //有多选框的条件
  181. // this.parmValue.select = this.select ;
  182. // this.parmValue.sselect = this.sselect ;
  183. // this.parmValue.sinput= this.sinput;
  184. //
  185. // console.log(this.parmValue)
  186. let routerModel = {
  187. options: JSON.parse(JSON.stringify(this.parmValue)),
  188. router: this.$route.path,
  189. };
  190. model.preModel = JSON.stringify(routerModel);
  191. this.routeGoto(toRouter, model);
  192. } else {
  193. this.$message.warning("暂未找到相关流程!");
  194. }
  195. },
  196. //初始化http请求
  197. async searchList() {
  198. if (
  199. (this.parmValue.start_date !== "" && this.parmValue.end_date === "") ||
  200. (this.parmValue.start_date === "" && this.parmValue.end_date !== "")
  201. ) {
  202. this.$message.warning("时间区间不完整!");
  203. return;
  204. }
  205. this.loading = true;
  206. console.log(this.parmValue)
  207. const res = await asyncRequest.goodofflist(this.parmValue);
  208. if (res && res.code === 0 && res.data) {
  209. this.tableData = res.data.list;
  210. this.pageInfo.total = Number(res.data.count);
  211. } else if (res && res.code >= 100 && res.code <= 104) {
  212. await this.logout();
  213. } else {
  214. this.$message.warning(res.message)
  215. this.tableData = [];
  216. this.pageInfo.total = 0;
  217. }
  218. this.loading = false;
  219. },
  220. //重置
  221. restSearch() {
  222. this.parmValue = {
  223. start_date: "", //新建起始时间
  224. end_date: "", // 新建结束时间
  225. creater:"",//创建人
  226. // is_export:0,//是否导出0/1
  227. page: 1, // 页码
  228. size: 15, // 每页显示条数
  229. };
  230. // 表格 - 分页
  231. this.pageInfo = {
  232. size: 15,
  233. curr: 1,
  234. total: 0,
  235. };
  236. this.searchList();
  237. },
  238. // 时间函数
  239. async time(e) {
  240. this.parmValue.start_date = e.startTime || "";
  241. this.parmValue.end_date = e.endTime || "";
  242. if (
  243. (this.parmValue.start_date !== "" && this.parmValue.end_date === "") ||
  244. (this.parmValue.start_date === "" && this.parmValue.end_date !== "")
  245. ) {
  246. this.$message.warning("时间区间不完整!");
  247. return;
  248. }
  249. this.pageInfo.curr = 1;
  250. this.parmValue.page = 1;
  251. await this.searchList();
  252. },
  253. //选中触发函数
  254. selection_change(e) {
  255. const { list } = e;
  256. //选中的数组集合
  257. this.changeList = list.length > 0 ? JSON.parse(JSON.stringify(list)) : [];
  258. },
  259. },
  260. };
  261. </script>
  262. <style lang="scss" scoped>
  263. .purchaseOrder {
  264. // text-align: right;
  265. }
  266. </style>