index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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. <!-- 时间区间 -->
  31. <el-col :span="4" style="width: 295px">
  32. <period-date-picker
  33. :width="'135px'"
  34. :size="searchSize"
  35. @timeReturned="handleTime"
  36. />
  37. </el-col>
  38. <!-- 商品编码 -->
  39. <el-col :span="4" style="width: 150px; padding: 0 0 0 10px">
  40. <el-input
  41. :size="searchSize"
  42. placeholder="商品名称"
  43. v-model="parmValue.good_name"
  44. clearable
  45. />
  46. </el-col>
  47. <!-- 备货申请编码 -->
  48. <el-col :span="4" style="width: 160px; padding: 0 0 0 10px">
  49. <el-input
  50. :size="searchSize"
  51. v-model="parmValue.username"
  52. :maxlength="40"
  53. placeholder="备货申请编码"
  54. />
  55. </el-col>
  56. <el-col :span="4" style="width: 54px">
  57. <el-button
  58. :size="searchSize"
  59. type="primary"
  60. class="fr"
  61. icon="el-icon-search"
  62. @click="searchList"
  63. /></el-col>
  64. <el-col :span="4" style="width: 66px">
  65. <el-button
  66. type="warning"
  67. class="fr"
  68. :size="searchSize"
  69. @click="restSearch"
  70. >
  71. 重置
  72. </el-button>
  73. </el-col>
  74. <el-col :span="3" style="width: 66px; float: right">
  75. <el-button
  76. :size="searchSize"
  77. type="primary"
  78. style="float: right; margin-left: 5px"
  79. @click="searchList"
  80. >
  81. 刷新
  82. </el-button>
  83. </el-col>
  84. <el-col
  85. :span="3"
  86. style="width: 56px"
  87. class="mr10 fr"
  88. v-if="powers.some((item) => item == '003')"
  89. >
  90. <el-button
  91. class="fl"
  92. :size="searchSize"
  93. type="success"
  94. @click="addStockFlow"
  95. >
  96. 新建
  97. </el-button>
  98. </el-col>
  99. </el-col>
  100. </el-row>
  101. </div>
  102. </template>
  103. <template #status="{ scope }">
  104. <el-tag
  105. :size="tablebtnSize"
  106. :type="scope.row.status == '0' ? 'warning' : ''"
  107. v-text="
  108. (statusOptions.find((item) => item.id == scope.row.status) || {})
  109. .label || '--'
  110. "
  111. ></el-tag>
  112. </template>
  113. <template #operation="{ scope }">
  114. <el-tooltip
  115. v-if="powers.some((item) => item == '002')"
  116. effect="dark"
  117. content="重置密码"
  118. placement="top"
  119. >
  120. <i
  121. class="el-icon-refresh-left tb-icon"
  122. @click="openPasswordModal(scope.row.id, false)"
  123. ></i>
  124. </el-tooltip>
  125. <el-tooltip
  126. v-if="powers.some((item) => item == '007')"
  127. effect="dark"
  128. content="详情"
  129. placement="top"
  130. >
  131. <i
  132. class="el-icon-view tb-icon"
  133. @click="openModal(scope.row.id, true, scope.row)"
  134. ></i>
  135. </el-tooltip>
  136. <el-tooltip
  137. v-if="powers.some((item) => item == '005')"
  138. effect="dark"
  139. content="修改"
  140. placement="top"
  141. >
  142. <i
  143. class="el-icon-edit tb-icon"
  144. @click="openModal(scope.row.id, false, scope.row)"
  145. ></i>
  146. </el-tooltip>
  147. <el-tooltip
  148. v-if="
  149. powers.some((item) => item == '004') && scope.row.status === '1'
  150. "
  151. effect="dark"
  152. content="禁用"
  153. placement="top"
  154. >
  155. <i
  156. class="el-icon-video-pause tb-icon"
  157. @click="statusConfirm(scope.row.id, scope.row.status)"
  158. ></i>
  159. </el-tooltip>
  160. <el-tooltip
  161. v-if="
  162. powers.some((item) => item == '004') && scope.row.status === '0'
  163. "
  164. effect="dark"
  165. content="启用"
  166. placement="top"
  167. >
  168. <i
  169. class="el-icon-video-play tb-icon"
  170. @click="statusConfirm(scope.row.id, scope.row.status)"
  171. ></i>
  172. </el-tooltip>
  173. </template>
  174. </ex-table>
  175. <add-edit
  176. :id="modelId"
  177. :sitem="sitem"
  178. :show-model="showModel"
  179. :is-detail="isDetail"
  180. @refresh="searchList"
  181. @cancel="showModel = false"
  182. />
  183. </div>
  184. <div v-else>
  185. <no-auth></no-auth>
  186. </div>
  187. </div>
  188. </template>
  189. <script>
  190. import mixinPage from "@/mixins/elPaginationHandle";
  191. import resToken from "@/mixins/resToken";
  192. import statusList from "@/assets/js/statusList";
  193. import asyncRequest from "@/apis/service/purchaseIn/storeManage";
  194. import addEdit from "./addEdit";
  195. import { mapGetters } from "vuex";
  196. export default {
  197. name: "storeManage",
  198. mixins: [mixinPage, resToken],
  199. components: {
  200. addEdit,
  201. },
  202. computed: {
  203. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  204. powers() {
  205. let tran =
  206. this.$store.getters.btnList.find(
  207. (item) => item.menu_route == "storeManage"
  208. ) || {};
  209. if (tran && tran.action && tran.action.length > 0) {
  210. return tran.action;
  211. } else {
  212. return [];
  213. }
  214. },
  215. },
  216. data() {
  217. return {
  218. sitem: null,
  219. // 状态
  220. statusOptions: [
  221. { id: "0", label: "禁用" },
  222. { id: "1", label: "启用" },
  223. ],
  224. statusList: statusList,
  225. loading: true,
  226. showModel: false,
  227. isDetail: false,
  228. modelId: 0,
  229. parmValue: {
  230. name: "", // 业务员名字
  231. username: "", // 账号
  232. status: "", //
  233. page: 1, // 页码
  234. size: 15, // 每页显示条数
  235. },
  236. tableData: [],
  237. passwordModel: false,
  238. passwordModelId: 0,
  239. isPasswordDetail: false,
  240. // 表格 - 数据
  241. tableData: [],
  242. // 表格 - 参数
  243. table: {
  244. stripe: true,
  245. border: true,
  246. _defaultHeader_: ["setcol"],
  247. },
  248. // 表格 - 分页
  249. pageInfo: {
  250. size: 15,
  251. curr: 1,
  252. total: 0,
  253. },
  254. // 表格 - 列参数
  255. columns: [
  256. {
  257. prop: "nickname",
  258. label: "申请编号",
  259. },
  260. {
  261. prop: "role_name",
  262. label: "申请人",
  263. },
  264. {
  265. prop: "mobile",
  266. label: "商品名称",
  267. },
  268. {
  269. prop: "email",
  270. label: "商品属性",
  271. },
  272. {
  273. prop: "unit",
  274. label: "单位",
  275. },
  276. {
  277. prop: "num",
  278. label: "数量",
  279. },
  280. {
  281. prop: "time",
  282. label: "期望入库时间",
  283. },
  284. {
  285. prop: "status",
  286. label: "状态",
  287. _slot_: "status",
  288. width: "80px",
  289. },
  290. {
  291. prop: "addtime",
  292. label: "创建时间",
  293. sortable: true,
  294. },
  295. {
  296. prop: "",
  297. label: "操作",
  298. fixed: "right",
  299. _noset_: true,
  300. _slot_: "operation",
  301. },
  302. ],
  303. };
  304. },
  305. mounted() {
  306. // this.searchList();
  307. },
  308. methods: {
  309. //跳转到新建页面
  310. addStockFlow() {
  311. console.log("新建申请");
  312. this.$router.push({
  313. path: "storeManageFlow",
  314. });
  315. },
  316. restSearch() {
  317. this.parmValue = {
  318. name: "", // 业务员名字
  319. username: "", // 账号
  320. status: "", //
  321. page: 1, // 页码
  322. size: 10, // 每页显示条数
  323. };
  324. this.searchList();
  325. },
  326. openModal(id, isDetail, sitem) {
  327. this.showModel = true;
  328. this.modelId = id;
  329. this.isDetail = isDetail;
  330. this.sitem = sitem;
  331. },
  332. async deleteById(id, status) {
  333. await this.$confirm("确定要删除?", {
  334. confirmButtonText: "确定",
  335. cancelButtonText: "取消",
  336. type: "warning",
  337. })
  338. .then(async () => {
  339. const model = {
  340. id: id,
  341. status: status === "1" ? "0" : "1",
  342. };
  343. const res = await asyncRequest.status(model);
  344. if (res && res.code === 0) {
  345. this.$notify.success({
  346. title: "删除成功",
  347. message: "",
  348. });
  349. this.searchList();
  350. } else if (res && res.code >= 100 && res.code <= 104) {
  351. await this.logout();
  352. } else {
  353. this.$message.warning(res.message);
  354. }
  355. })
  356. .catch(() => {
  357. console.log("取消");
  358. });
  359. },
  360. async searchList() {
  361. this.loading = true;
  362. const res = await asyncRequest.list(this.parmValue);
  363. if (res && res.code === 0 && res.data) {
  364. this.tableData = res.data.list;
  365. this.pageInfo.total = Number(res.data.count);
  366. } else if (res && res.code >= 100 && res.code <= 104) {
  367. await this.logout();
  368. } else {
  369. this.tableData = [];
  370. this.pageInfo.total = 0;
  371. }
  372. this.loading = false;
  373. },
  374. async statusConfirm(id, status) {
  375. let str = status === "1" ? "禁用" : "启用";
  376. await this.$confirm("确定要改为" + str + "?", {
  377. confirmButtonText: "确定",
  378. cancelButtonText: "取消",
  379. type: "warning",
  380. })
  381. .then(async () => {
  382. this.loading = true;
  383. const model = {
  384. id: id,
  385. status: status === "1" ? "0" : "1",
  386. };
  387. const res = await asyncRequest.status(model);
  388. if (res && res.code === 0) {
  389. this.loading = false;
  390. this.$notify.success({
  391. title: "状态修改成功!",
  392. message: "",
  393. });
  394. await this.searchList();
  395. } else if (res && res.code >= 100 && res.code <= 104) {
  396. await this.logout();
  397. } else {
  398. this.$message.warning(res.message);
  399. }
  400. })
  401. .catch(() => {
  402. console.log("取消");
  403. });
  404. },
  405. },
  406. };
  407. </script>
  408. <style lang="scss" scoped>
  409. .storeManage {
  410. }
  411. </style>