index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <div class="storeManage pagePadding">
  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%">
  28. <el-row style="padding: 0 0 0 80px">
  29. <el-col :span="24">
  30. <el-col :span="4" style="width: 295px">
  31. <period-date-picker
  32. :start="parmValue.start"
  33. :end="parmValue.end"
  34. :width="'135px'"
  35. :size="searchSize"
  36. @timeReturned="handleTime"
  37. />
  38. </el-col>
  39. <el-col style="width: 130px; padding-left: 10px">
  40. <search-account
  41. :value="apply_name"
  42. :disabled="false"
  43. :is-detail="false"
  44. :size="searchSize"
  45. :placeholder="'申请人'"
  46. @searchChange="handleResignName"
  47. />
  48. </el-col>
  49. <el-col style="width: 110px; padding: 0 0 0 10px">
  50. <el-input
  51. v-model="parmValue.status"
  52. placeholder="节点查询"
  53. :size="searchSize"
  54. />
  55. </el-col>
  56. <el-col :span="3" style="width: 66px; float: right">
  57. <el-button
  58. :size="searchSize"
  59. type="primary"
  60. style="float: right; margin-left: 5px"
  61. @click="searchList"
  62. >
  63. 刷新
  64. </el-button>
  65. </el-col>
  66. <el-col
  67. :span="3"
  68. style="width: 56px"
  69. class="mr10 fr"
  70. v-if="powers.some((item) => item == '003')"
  71. >
  72. <el-button
  73. class="fl"
  74. :size="searchSize"
  75. type="success"
  76. @click="openModal('add', false)"
  77. >
  78. 新建
  79. </el-button>
  80. </el-col>
  81. </el-col>
  82. </el-row>
  83. <el-row>
  84. <el-col style="width: 190px; padding-top: 10px">
  85. <el-input
  86. :size="searchSize"
  87. placeholder="商品名称"
  88. v-model="parmValue.good_name"
  89. clearable
  90. @blur="searchList"
  91. />
  92. </el-col>
  93. <el-col :span="4" style="width: 195px; padding: 10px 0 0 10px">
  94. <el-input
  95. placeholder="商品编码"
  96. :size="searchSize"
  97. v-model="parmValue.good_code"
  98. />
  99. </el-col>
  100. <el-col :span="4" style="width: 195px; padding: 10px 0 0 10px">
  101. <el-input
  102. :size="searchSize"
  103. v-model="parmValue.bk_code"
  104. :maxlength="40"
  105. placeholder="申请编码"
  106. @blur="searchList"
  107. />
  108. </el-col>
  109. <el-col :span="4" style="width: 54px; padding-top: 10px">
  110. <el-button
  111. :size="searchSize"
  112. type="primary"
  113. class="fr"
  114. icon="el-icon-search"
  115. @click="searchList"
  116. /></el-col>
  117. <el-col :span="4" style="width: 66px; padding-top: 10px">
  118. <el-button
  119. type="warning"
  120. class="fr"
  121. :size="searchSize"
  122. @click="restSearch"
  123. >
  124. 重置
  125. </el-button>
  126. </el-col>
  127. </el-row>
  128. </div>
  129. </template>
  130. <template #status="{ scope }">
  131. <el-tag
  132. :size="tablebtnSize"
  133. :type="
  134. scope.row.status == '0'
  135. ? 'warning'
  136. : scope.row.status == '3'
  137. ? 'success'
  138. : scope.row.status == '4'
  139. ? 'danger'
  140. : ''
  141. "
  142. v-text="
  143. (statusOptions.find((item) => item.id == scope.row.status) || {})
  144. .label || '--'
  145. "
  146. ></el-tag>
  147. </template>
  148. <template #operation="{ scope }">
  149. <el-tooltip
  150. v-if="powers.some((item) => item == '007')"
  151. effect="dark"
  152. content="详情"
  153. placement="top"
  154. >
  155. <i
  156. class="el-icon-view tb-icon"
  157. @click="routeGoto('storeManageFlow', { id: scope.row.id })"
  158. ></i>
  159. </el-tooltip>
  160. </template>
  161. </ex-table>
  162. <add-model
  163. :id="modelId"
  164. :show-model="showModel"
  165. :is-detail="isDetail"
  166. @refresh="searchList"
  167. @closeModel="showModel = false"
  168. />
  169. </div>
  170. <div v-else>
  171. <no-auth></no-auth>
  172. </div>
  173. </div>
  174. </template>
  175. <script>
  176. import mixinPage from "@/mixins/elPaginationHandle";
  177. import resToken from "@/mixins/resToken";
  178. import asyncRequest from "@/apis/service/purchaseIn/storeManage";
  179. import addModel from "./addModel.vue";
  180. import { mapGetters } from "vuex";
  181. import columns from "./columns";
  182. export default {
  183. name: "storeManage",
  184. mixins: [mixinPage, resToken],
  185. components: {
  186. addModel,
  187. },
  188. computed: {
  189. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  190. powers() {
  191. let tran =
  192. this.$store.getters.btnList.find(
  193. (item) => item.menu_route == "storeManage"
  194. ) || {};
  195. if (tran && tran.action && tran.action.length > 0) {
  196. return tran.action;
  197. } else {
  198. return [];
  199. }
  200. },
  201. },
  202. data() {
  203. return {
  204. statusOptions: [
  205. { id: "0", label: "待申请" },
  206. { id: "1", label: "待反馈" },
  207. { id: "2", label: "已反馈" },
  208. { id: "3", label: "同意反馈" },
  209. { id: "4", label: "拒绝反馈" },
  210. ],
  211. loading: true,
  212. showModel: false,
  213. isDetail: false,
  214. modelId: 0,
  215. apply_name: [],
  216. parmValue: {
  217. good_code: "",
  218. bk_code: "",
  219. status: "",
  220. apply_name: "",
  221. start: "",
  222. end: "",
  223. good_name: "",
  224. page: 1,
  225. size: 15,
  226. },
  227. // 表格 - 数据
  228. tableData: [],
  229. // 表格 - 参数
  230. table: {
  231. stripe: true,
  232. border: true,
  233. _defaultHeader_: ["setcol"],
  234. },
  235. // 表格 - 分页
  236. pageInfo: {
  237. size: 15,
  238. curr: 1,
  239. total: 0,
  240. },
  241. // 表格 - 列参数
  242. columns: columns,
  243. };
  244. },
  245. mounted() {
  246. this.searchList();
  247. },
  248. methods: {
  249. // 选择时间操作
  250. handleTime(e) {
  251. console.log(e);
  252. if (e) {
  253. this.parmValue.start = e.startTime;
  254. this.parmValue.end = e.endTime;
  255. } else {
  256. this.parmValue.start = "";
  257. this.parmValue.end = "";
  258. }
  259. if (this.parmValue.start != "" && this.parmValue.end != "") {
  260. this.searchList();
  261. } else if (this.parmValue.start === "" && this.parmValue.end === "") {
  262. this.searchList();
  263. }
  264. console.log(this.parmValue);
  265. },
  266. // 重置参数
  267. restSearch() {
  268. this.apply_name = [];
  269. this.parmValue = {
  270. status: "",
  271. apply_name: "",
  272. good_code: "",
  273. good_name: "",
  274. start: "",
  275. end: "",
  276. bk_code: "", //备库编号
  277. page: 1, // 页码
  278. size: 15, // 每页显示条数
  279. };
  280. // 表格 - 分页
  281. this.pageInfo = {
  282. size: 15,
  283. curr: 1,
  284. total: 0,
  285. };
  286. this.searchList();
  287. },
  288. openModal(id, isDetail) {
  289. this.showModel = true;
  290. this.modelId = id;
  291. this.isDetail = isDetail;
  292. },
  293. // 列表搜索
  294. async searchList() {
  295. this.loading = true;
  296. let { status, apply_name, bk_code, start, end, page, size, good_name } =
  297. this.parmValue;
  298. if ((start !== "" && end === "") || (start == "" && end != "")) {
  299. this.$message.warning("开始时间和结束时间不能为空");
  300. return;
  301. }
  302. let model = {
  303. status,
  304. apply_name,
  305. start,
  306. end,
  307. page,
  308. size,
  309. good_name,
  310. bk_code,
  311. };
  312. const res = await asyncRequest.list(model);
  313. if (res && res.code === 0 && res.data) {
  314. this.tableData = res.data.list;
  315. this.pageInfo.total = Number(res.data.count);
  316. } else if (res && res.code >= 100 && res.code <= 104) {
  317. await this.logout();
  318. } else {
  319. this.tableData = [];
  320. this.pageInfo.total = 0;
  321. }
  322. this.loading = false;
  323. },
  324. async handleResignName(e) {
  325. console.log(e);
  326. this.parmValue.apply_name = e && e.id ? e.label : "";
  327. this.apply_name = e && e.id ? [e.id] : [];
  328. this.parmValue.page = 1;
  329. await this.searchList();
  330. },
  331. },
  332. };
  333. </script>