index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <div class="productWeido 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%">
  28. <el-row style="padding: 0 0 0 80px">
  29. <el-col :span="24">
  30. <el-col :span="5">
  31. <el-select
  32. v-model="value"
  33. :size="searchSize"
  34. filterable
  35. placeholder="请选择商品"
  36. >
  37. <el-option
  38. v-for="item in options"
  39. :key="item.value"
  40. :label="item.label"
  41. :value="item.value"
  42. >
  43. </el-option>
  44. </el-select>
  45. </el-col>
  46. <!-- 搜索 -->
  47. <el-col :span="4" style="width: 74px; margin-left: 10px">
  48. <el-button
  49. :size="searchSize"
  50. type="primary"
  51. class="fr"
  52. icon="el-icon-search"
  53. label=""
  54. @click="searchList"
  55. >搜索</el-button
  56. >
  57. </el-col>
  58. <!-- 重置 -->
  59. <el-col
  60. :span="4"
  61. style="width: 74px; margin-left: 10px"
  62. class="mr5"
  63. >
  64. <el-button
  65. :size="searchSize"
  66. class="fr"
  67. icon="el-icon-refresh-right"
  68. @click="searchList"
  69. >重置</el-button
  70. >
  71. </el-col>
  72. <!-- <el-col :span="4" style="width: 120px">
  73. <el-select
  74. :size="searchSize"
  75. v-model="parmValue.status"
  76. filterable
  77. clearable
  78. placeholder="账号状态"
  79. style="width: 100%"
  80. @change="
  81. pageInfo.curr = 1;
  82. parmValue.page = 1;
  83. searchList();
  84. "
  85. >
  86. <el-option
  87. v-for="item in statusList"
  88. :key="'status' + item.code"
  89. :label="item.name"
  90. :value="item.code"
  91. />
  92. </el-select>
  93. </el-col>
  94. <el-col :span="4" style="width: 150px; padding: 0 0 0 10px">
  95. <el-input
  96. :size="searchSize"
  97. v-model="parmValue.name"
  98. :maxlength="40"
  99. placeholder="业务员姓名"
  100. />
  101. </el-col>
  102. <el-col :span="4" style="width: 160px; padding: 0 0 0 10px">
  103. <el-input
  104. :size="searchSize"
  105. v-model="parmValue.username"
  106. :maxlength="40"
  107. placeholder="手机号"
  108. />
  109. </el-col>
  110. <el-col :span="4" style="width: 54px">
  111. <el-button
  112. :size="searchSize"
  113. type="primary"
  114. class="fr"
  115. icon="el-icon-search"
  116. @click="searchList"
  117. /></el-col>
  118. <el-col
  119. :span="4"
  120. style="width: 66px"
  121. >
  122. <el-button
  123. type="warning"
  124. class="fr"
  125. :size="searchSize"
  126. @click="restSearch"
  127. >
  128. 重置
  129. </el-button>
  130. </el-col>
  131. <el-col
  132. :span="3"
  133. style="width: 66px; float: right"
  134. >
  135. <el-button
  136. :size="searchSize"
  137. type="primary"
  138. style="float: right; margin-left: 5px"
  139. @click="searchList"
  140. >
  141. 刷新
  142. </el-button>
  143. </el-col> -->
  144. </el-col>
  145. </el-row>
  146. </div>
  147. </template>
  148. <!-- <template #status="{ scope }">
  149. <el-tag
  150. :size="tablebtnSize"
  151. :type="scope.row.status == '0' ? 'warning' : ''"
  152. v-text="
  153. (statusOptions.find((item) => item.id == scope.row.status) || {})
  154. .label || '--'
  155. "
  156. ></el-tag>
  157. </template> -->
  158. <template #operation="{ scope }">
  159. <el-tooltip
  160. v-if="powers.some((item) => item == '002')"
  161. effect="dark"
  162. content="重置密码"
  163. placement="top"
  164. >
  165. <i
  166. class="el-icon-refresh-left tb-icon"
  167. @click="openPasswordModal(scope.row.id, false)"
  168. ></i>
  169. </el-tooltip>
  170. <el-tooltip
  171. v-if="powers.some((item) => item == '007')"
  172. effect="dark"
  173. content="详情"
  174. placement="top"
  175. >
  176. <i
  177. class="el-icon-view tb-icon"
  178. @click="openModal(scope.row.id, true, scope.row)"
  179. ></i>
  180. </el-tooltip>
  181. <el-tooltip
  182. v-if="powers.some((item) => item == '005')"
  183. effect="dark"
  184. content="修改"
  185. placement="top"
  186. >
  187. <i
  188. class="el-icon-edit tb-icon"
  189. @click="openModal(scope.row.id, false, scope.row)"
  190. ></i>
  191. </el-tooltip>
  192. <el-tooltip
  193. v-if="
  194. powers.some((item) => item == '004') && scope.row.status === '1'
  195. "
  196. effect="dark"
  197. content="禁用"
  198. placement="top"
  199. >
  200. <i
  201. class="el-icon-video-pause tb-icon"
  202. @click="statusConfirm(scope.row.id, scope.row.status)"
  203. ></i>
  204. </el-tooltip>
  205. <el-tooltip
  206. v-if="
  207. powers.some((item) => item == '004') && scope.row.status === '0'
  208. "
  209. effect="dark"
  210. content="启用"
  211. placement="top"
  212. >
  213. <i
  214. class="el-icon-video-play tb-icon"
  215. @click="statusConfirm(scope.row.id, scope.row.status)"
  216. ></i>
  217. </el-tooltip>
  218. </template>
  219. </ex-table>
  220. <add-edit
  221. :id="modelId"
  222. :sitem="sitem"
  223. :show-model="showModel"
  224. :is-detail="isDetail"
  225. @refresh="searchList"
  226. @cancel="showModel = false"
  227. />
  228. </div>
  229. <div v-else>
  230. <no-auth></no-auth>
  231. </div>
  232. <add-edit
  233. :showModel="showModel"
  234. :id="modelId"
  235. :isDetail="isDetail"
  236. @refresh="searchList"
  237. @cancel="showModel = false"
  238. ></add-edit>
  239. </div>
  240. </template>
  241. <script>
  242. import mixinPage from "@/mixins/elPaginationHandle";
  243. import resToken from "@/mixins/resToken";
  244. import ExTable from "@/components/ExTableNew.vue";
  245. import statusList from "@/assets/js/statusList";
  246. // import asyncRequest from "@/apis/service/stock/productWeido";
  247. import asyncRequest from "@/mock/service/stock/allot"; //获取商品假数据
  248. import addEdit from "./addEdit";
  249. import { mapGetters } from "vuex";
  250. export default {
  251. name: "productWeido",
  252. mixins: [mixinPage, resToken],
  253. components: {
  254. addEdit,
  255. ExTable,
  256. },
  257. computed: {
  258. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  259. powers() {
  260. let tran =
  261. this.$store.getters.btnList.find(
  262. (item) => item.menu_route == "stockCount"
  263. ) || {};
  264. if (tran && tran.action && tran.action.length > 0) {
  265. return tran.action;
  266. } else {
  267. return [];
  268. }
  269. },
  270. },
  271. data() {
  272. return {
  273. options: [
  274. //选择商品下拉框
  275. // {
  276. // value: "选项1",
  277. // label: "黄金糕",
  278. // },
  279. // {
  280. // value: "选项2",
  281. // label: "双皮奶",
  282. // },
  283. // {
  284. // value: "选项3",
  285. // label: "蚵仔煎",
  286. // },
  287. // {
  288. // value: "选项4",
  289. // label: "龙须面",
  290. // },
  291. // {
  292. // value: "选项5",
  293. // label: "北京烤鸭",
  294. // },
  295. ],
  296. sitem: null,
  297. // 状态
  298. statusOptions: [
  299. { id: "0", label: "禁用" },
  300. { id: "1", label: "启用" },
  301. ],
  302. statusList: statusList,
  303. loading: true,
  304. showModel: false,
  305. isDetail: false,
  306. modelId: 0,
  307. parmValue: {
  308. //入参参数
  309. name: "", // 业务员名字
  310. username: "", // 账号
  311. status: "", //
  312. page: 1, // 页码
  313. size: 15, // 每页显示条数
  314. },
  315. tableData: [], //渲染表格数据
  316. passwordModel: false,
  317. passwordModelId: 0,
  318. isPasswordDetail: false,
  319. // 表格 - 数据
  320. tableData: [],
  321. // 表格 - 参数
  322. table: {
  323. stripe: true,
  324. border: true,
  325. _defaultHeader_: ["setcol"],
  326. },
  327. // 表格 - 分页
  328. pageInfo: {
  329. size: 15,
  330. curr: 1,
  331. total: 0,
  332. },
  333. // 表格 - 列参数
  334. columns: [
  335. {
  336. prop: "nickname",
  337. label: "商品编码",
  338. },
  339. {
  340. prop: "role_name",
  341. label: "商品名称",
  342. },
  343. {
  344. prop: "mobile",
  345. label: "分类",
  346. },
  347. {
  348. prop: "email",
  349. label: "单位",
  350. },
  351. {
  352. prop: "status",
  353. label: "当前库存",
  354. _slot_: "status",
  355. width: "80px",
  356. },
  357. {
  358. prop: "addtime",
  359. label: "待入库",
  360. // sortable: true,
  361. },
  362. {
  363. prop: "addtime",
  364. label: "待出库",
  365. // sortable: true,
  366. },
  367. {
  368. prop: "addtime",
  369. label: "可用库存",
  370. // sortable: true,
  371. },
  372. {
  373. prop: "addtime",
  374. label: "在途库存",
  375. // sortable: true,
  376. },
  377. ],
  378. };
  379. },
  380. mounted() {
  381. this.searchList();
  382. },
  383. methods: {
  384. //重置参数
  385. restSearch() {
  386. this.parmValue = {
  387. // name: "", // 业务员名字
  388. // username: "", // 账号
  389. // status: "", //
  390. // page: 1, // 页码
  391. // size: 10, // 每页显示条数
  392. };
  393. this.searchList();
  394. },
  395. openModal(id, isDetail, sitem) {
  396. this.showModel = true;
  397. this.modelId = id;
  398. this.isDetail = isDetail;
  399. this.sitem = sitem;
  400. },
  401. //删除功能
  402. async deleteById(id, status) {
  403. // await this.$confirm("确定要删除?", {
  404. // confirmButtonText: "确定",
  405. // cancelButtonText: "取消",
  406. // type: "warning",
  407. // })
  408. // .then(async () => {
  409. // const model = {
  410. // id: id,
  411. // status: status === "1" ? "0" : "1",
  412. // };
  413. // const res = await asyncRequest.status(model);
  414. // if (res && res.code === 0) {
  415. // this.$notify.success({
  416. // title: "删除成功",
  417. // message: "",
  418. // });
  419. // this.searchList();
  420. // } else if (res && res.code >= 100 && res.code <= 104) {
  421. // await this.logout();
  422. // } else {
  423. // this.$message.warning(res.message);
  424. // }
  425. // })
  426. // .catch(() => {
  427. // console.log("取消");
  428. // });
  429. },
  430. //获取列表功能
  431. async searchList() {
  432. console.log("无列表接口");
  433. const res = await asyncRequest.goodsList(this.parmValue);
  434. console.log(res.data.list);
  435. res.data.list.forEach((element) => {
  436. // console.log(element);
  437. let op = {
  438. value: element.orderNo,
  439. label: element.goods,
  440. };
  441. this.options.push(op);
  442. // console.log(this.options);
  443. });
  444. // this.loading = true;
  445. // const res = await asyncRequest.list(this.parmValue);
  446. // if (res && res.code === 0 && res.data) {
  447. // this.tableData = res.data.list;
  448. // this.pageInfo.total = Number(res.data.count);
  449. // } else if (res && res.code >= 100 && res.code <= 104) {
  450. // await this.logout();
  451. // } else {
  452. // this.tableData = [];
  453. // this.pageInfo.total = 0;
  454. // }
  455. // this.loading = false;
  456. },
  457. //启用禁用状态更改
  458. async statusConfirm(id, status) {
  459. // let str = status === "1" ? "禁用" : "启用";
  460. // await this.$confirm("确定要改为" + str + "?", {
  461. // confirmButtonText: "确定",
  462. // cancelButtonText: "取消",
  463. // type: "warning",
  464. // })
  465. // .then(async () => {
  466. // this.loading = true;
  467. // const model = {
  468. // id: id,
  469. // status: status === "1" ? "0" : "1",
  470. // };
  471. // const res = await asyncRequest.status(model);
  472. // if (res && res.code === 0) {
  473. // this.loading = false;
  474. // this.$notify.success({
  475. // title: "状态修改成功!",
  476. // message: "",
  477. // });
  478. // await this.searchList();
  479. // } else if (res && res.code >= 100 && res.code <= 104) {
  480. // await this.logout();
  481. // } else {
  482. // this.$message.warning(res.message);
  483. // }
  484. // })
  485. // .catch(() => {
  486. // console.log("取消");
  487. // });
  488. },
  489. },
  490. };
  491. </script>
  492. <style lang="scss" scoped>
  493. </style>