index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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 statusList from "@/assets/js/statusList";
  245. // import asyncRequest from "@/apis/service/stock/productWeido";
  246. import asyncRequest from "@/mock/service/stock/allot"; //获取商品假数据
  247. import addEdit from "./addEdit";
  248. import { mapGetters } from "vuex";
  249. export default {
  250. name: "productWeido",
  251. mixins: [mixinPage, resToken],
  252. components: {
  253. addEdit,
  254. },
  255. computed: {
  256. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  257. powers() {
  258. let tran =
  259. this.$store.getters.btnList.find(
  260. (item) => item.menu_route == "stockCount"
  261. ) || {};
  262. if (tran && tran.action && tran.action.length > 0) {
  263. return tran.action;
  264. } else {
  265. return [];
  266. }
  267. },
  268. },
  269. data() {
  270. return {
  271. options: [
  272. //选择商品下拉框
  273. // {
  274. // value: "选项1",
  275. // label: "黄金糕",
  276. // },
  277. // {
  278. // value: "选项2",
  279. // label: "双皮奶",
  280. // },
  281. // {
  282. // value: "选项3",
  283. // label: "蚵仔煎",
  284. // },
  285. // {
  286. // value: "选项4",
  287. // label: "龙须面",
  288. // },
  289. // {
  290. // value: "选项5",
  291. // label: "北京烤鸭",
  292. // },
  293. ],
  294. sitem: null,
  295. // 状态
  296. statusOptions: [
  297. { id: "0", label: "禁用" },
  298. { id: "1", label: "启用" },
  299. ],
  300. statusList: statusList,
  301. loading: true,
  302. showModel: false,
  303. isDetail: false,
  304. modelId: 0,
  305. parmValue: {
  306. //入参参数
  307. name: "", // 业务员名字
  308. username: "", // 账号
  309. status: "", //
  310. page: 1, // 页码
  311. size: 15, // 每页显示条数
  312. },
  313. tableData: [], //渲染表格数据
  314. passwordModel: false,
  315. passwordModelId: 0,
  316. isPasswordDetail: false,
  317. // 表格 - 数据
  318. tableData: [],
  319. // 表格 - 参数
  320. table: {
  321. stripe: true,
  322. border: true,
  323. _defaultHeader_: ["setcol"],
  324. },
  325. // 表格 - 分页
  326. pageInfo: {
  327. size: 15,
  328. curr: 1,
  329. total: 0,
  330. },
  331. // 表格 - 列参数
  332. columns: [
  333. {
  334. prop: "nickname",
  335. label: "商品编码",
  336. },
  337. {
  338. prop: "role_name",
  339. label: "商品名称",
  340. },
  341. {
  342. prop: "mobile",
  343. label: "分类",
  344. },
  345. {
  346. prop: "email",
  347. label: "单位",
  348. },
  349. {
  350. prop: "status",
  351. label: "当前库存",
  352. _slot_: "status",
  353. width: "80px",
  354. },
  355. {
  356. prop: "addtime",
  357. label: "待入库",
  358. // sortable: true,
  359. },
  360. {
  361. prop: "addtime",
  362. label: "待出库",
  363. // sortable: true,
  364. },
  365. {
  366. prop: "addtime",
  367. label: "可用库存",
  368. // sortable: true,
  369. },
  370. {
  371. prop: "addtime",
  372. label: "在途库存",
  373. // sortable: true,
  374. },
  375. ],
  376. };
  377. },
  378. mounted() {
  379. this.searchList();
  380. },
  381. methods: {
  382. //重置参数
  383. restSearch() {
  384. this.parmValue = {
  385. // name: "", // 业务员名字
  386. // username: "", // 账号
  387. // status: "", //
  388. // page: 1, // 页码
  389. // size: 10, // 每页显示条数
  390. };
  391. this.searchList();
  392. },
  393. openModal(id, isDetail, sitem) {
  394. this.showModel = true;
  395. this.modelId = id;
  396. this.isDetail = isDetail;
  397. this.sitem = sitem;
  398. },
  399. //删除功能
  400. async deleteById(id, status) {
  401. // await this.$confirm("确定要删除?", {
  402. // confirmButtonText: "确定",
  403. // cancelButtonText: "取消",
  404. // type: "warning",
  405. // })
  406. // .then(async () => {
  407. // const model = {
  408. // id: id,
  409. // status: status === "1" ? "0" : "1",
  410. // };
  411. // const res = await asyncRequest.status(model);
  412. // if (res && res.code === 0) {
  413. // this.$notify.success({
  414. // title: "删除成功",
  415. // message: "",
  416. // });
  417. // this.searchList();
  418. // } else if (res && res.code >= 100 && res.code <= 104) {
  419. // await this.logout();
  420. // } else {
  421. // this.$message.warning(res.message);
  422. // }
  423. // })
  424. // .catch(() => {
  425. // console.log("取消");
  426. // });
  427. },
  428. //获取列表功能
  429. async searchList() {
  430. console.log("无列表接口");
  431. const res = await asyncRequest.goodsList(this.parmValue);
  432. console.log(res.data.list);
  433. res.data.list.forEach((element) => {
  434. // console.log(element);
  435. let op = {
  436. value: element.orderNo,
  437. label: element.goods,
  438. };
  439. this.options.push(op);
  440. // console.log(this.options);
  441. });
  442. // this.loading = true;
  443. // const res = await asyncRequest.list(this.parmValue);
  444. // if (res && res.code === 0 && res.data) {
  445. // this.tableData = res.data.list;
  446. // this.pageInfo.total = Number(res.data.count);
  447. // } else if (res && res.code >= 100 && res.code <= 104) {
  448. // await this.logout();
  449. // } else {
  450. // this.tableData = [];
  451. // this.pageInfo.total = 0;
  452. // }
  453. // this.loading = false;
  454. },
  455. //启用禁用状态更改
  456. async statusConfirm(id, status) {
  457. // let str = status === "1" ? "禁用" : "启用";
  458. // await this.$confirm("确定要改为" + str + "?", {
  459. // confirmButtonText: "确定",
  460. // cancelButtonText: "取消",
  461. // type: "warning",
  462. // })
  463. // .then(async () => {
  464. // this.loading = true;
  465. // const model = {
  466. // id: id,
  467. // status: status === "1" ? "0" : "1",
  468. // };
  469. // const res = await asyncRequest.status(model);
  470. // if (res && res.code === 0) {
  471. // this.loading = false;
  472. // this.$notify.success({
  473. // title: "状态修改成功!",
  474. // message: "",
  475. // });
  476. // await this.searchList();
  477. // } else if (res && res.code >= 100 && res.code <= 104) {
  478. // await this.logout();
  479. // } else {
  480. // this.$message.warning(res.message);
  481. // }
  482. // })
  483. // .catch(() => {
  484. // console.log("取消");
  485. // });
  486. },
  487. },
  488. };
  489. </script>
  490. <style lang="scss" scoped>
  491. </style>