index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <div class="workbench">
  3. <div class="workbench-main" v-loading="loading" v-if="powers.some((i) => i == '001')">
  4. <ul class="clear po-ul">
  5. <li class="po-li">
  6. <div class="taskTitle color1">竞价单任务</div>
  7. <div class="taskList clear">
  8. <div
  9. class="task-item"
  10. v-for="item in list"
  11. :key="item"
  12. @click="wantTo(item.infoNo)"
  13. :style="
  14. item.is_all_feed + '' === '0'
  15. ? 'background:#fdf6ec'
  16. : item.is_feed + '' == '1'
  17. ? 'background: #ecf5ff'
  18. : 'background: #fff'
  19. "
  20. >
  21. <ul class="fl item-ul">
  22. <li class="fl item-li">
  23. <span class="label">任务编号:</span>
  24. <span class="label-main">{{ item.infoNo }}</span>
  25. </li>
  26. <li class="fl item-li">
  27. <span class="label">截止时间:</span>
  28. <span class="label-main">{{ item.endtime }}</span>
  29. </li>
  30. <li class="fl item-li">
  31. <span class="label">商品分类:</span>
  32. <span class="label-main">{{ item.cat_name }}</span>
  33. </li>
  34. <li class="fl item-li">
  35. <span class="label">商品品牌:</span>
  36. <span class="label-main">{{ item.brand_name }}</span>
  37. </li>
  38. <li class="fl item-li">
  39. <span class="label">商品名称:</span>
  40. <span class="label-main">
  41. <img
  42. @click="imgclick"
  43. v-if="item.good_img"
  44. class="hover"
  45. v-viewer
  46. style="width: 20px; height: 20px"
  47. :src="item.good_img"
  48. alt=""
  49. />
  50. {{ item.good_name }}</span
  51. >
  52. </li>
  53. <li class="fl item-li">
  54. <span class="label">商品预算:</span>
  55. <span class="label-main">
  56. {{ item.original_price }}元/{{ item.num }}{{ unit }}</span
  57. >
  58. </li>
  59. <li class="fl item-li" style="wrap:nowrap;display: flex;">
  60. <span class="label" style="width:80px">业务公司编码:</span>
  61. <span class="label-main" style="flex:1">{{ item.companyNo }}</span>
  62. </li>
  63. <li class="fl item-li" style="wrap:nowrap;display: flex;">
  64. <span class="label" style="width:80px">业务公司名称:</span>
  65. <span class="label-main" style="flex:1">{{ item.companyName }}</span>
  66. </li>
  67. <li class="fl item-li" style="wrap:nowrap;display: flex;">
  68. <span class="label" style="width:80px">所属平台:</span>
  69. <span class="label-main" style="flex:1">{{ item.platform_name }}</span>
  70. </li>
  71. </ul>
  72. </div>
  73. <div class="no-data">暂无数据!</div>
  74. </div>
  75. </li>
  76. <!-- <li class="po-li">
  77. <div class="taskTitle color2">客户指定商品任务</div>
  78. <div class="taskList">
  79. <div
  80. class="task-item"
  81. v-for="item in list1"
  82. :key="item"
  83. @click="
  84. routeGoto('workbenchDetail', { id: 'INF2203151428199103' })
  85. "
  86. >
  87. {{ item }}
  88. </div>
  89. <div class="no-data">暂无数据!</div>
  90. </div>
  91. </li> -->
  92. </ul>
  93. </div>
  94. <no-auth v-else></no-auth>
  95. <!-- 弹窗 新增/修改 -->
  96. <add-edit
  97. :id="modelId"
  98. :show-model="showModel"
  99. :sitem="sitem"
  100. @refresh="searchList"
  101. @cancel="showModel = false"
  102. />
  103. </div>
  104. </template>
  105. <script>
  106. import asyncRequest from "@/apis/service/purchaseIn/workbench";
  107. import roleLevel from "@/assets/js/roleLevel";
  108. import mixinPage from "@/mixins/elPaginationHandle";
  109. import companyHelper from "@/mixins/companyHelper";
  110. import { mapGetters } from "vuex";
  111. import resToken from "@/mixins/resToken";
  112. export default {
  113. name: "workbench",
  114. mixins: [mixinPage, resToken, companyHelper],
  115. computed: {
  116. //组件SIZE设置
  117. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  118. powers() {
  119. const { btnList } = this.$store.getters
  120. const tran = btnList.find((i) => i.menu_route == "supplierWorkbench") || {};
  121. const { action } = tran ?? {};
  122. return action ?? [];
  123. },
  124. },
  125. data() {
  126. return {
  127. num: 60,
  128. timer: null,
  129. roleLevel: roleLevel,
  130. loading: false,
  131. showModel: false,
  132. modelId: "000",
  133. sitem: {},
  134. list1: [],
  135. list: [],
  136. parmValue: {
  137. page: 1, // 页码
  138. size: 1000, // 每页显示条数
  139. status: "1",
  140. },
  141. // 状态
  142. statusOptions: [
  143. { id: "0", label: "禁用" },
  144. { id: "1", label: "启用" },
  145. ],
  146. // 表格 - 数据
  147. tableData: [],
  148. // 表格 - 参数
  149. table: {
  150. stripe: true,
  151. border: true,
  152. _defaultHeader_: ["setcol"],
  153. },
  154. // 表格 - 分页
  155. pageInfo: {
  156. size: 15,
  157. curr: 1,
  158. total: 0,
  159. },
  160. // 表格 - 列参数
  161. columns: [
  162. {
  163. prop: "id",
  164. label: "ID",
  165. },
  166. {
  167. prop: "workbench",
  168. label: "活动名称",
  169. },
  170. {
  171. prop: "status",
  172. label: "状态",
  173. sortable: true,
  174. _slot_: "status",
  175. },
  176. {
  177. prop: "creater",
  178. label: "创建人",
  179. },
  180. {
  181. prop: "addtime",
  182. label: "创建时间",
  183. sortable: true,
  184. },
  185. {
  186. prop: "",
  187. label: "操作",
  188. fixed: "right",
  189. _noset_: true,
  190. _slot_: "operation",
  191. },
  192. ],
  193. };
  194. },
  195. mounted() {
  196. this.searchList(true);
  197. },
  198. beforeDestroy() {
  199. if (this.timer) {
  200. clearInterval(this.timer);
  201. }
  202. },
  203. methods: {
  204. wantTo(infoNo) {
  205. if (this.powers.some((i) => i == "007")) {
  206. // this.routeGoto("supplierWorkbenchDetail", { id: infoNo });
  207. console.log(1111)
  208. this.$router.push({
  209. path: '/supplierPurchaseIn/supplierWorkbenchDetail',
  210. query: { id: infoNo }
  211. })
  212. }
  213. },
  214. async well_timer() {
  215. this.timer = setInterval(async () => {
  216. if (this.num !== 0) {
  217. this.num--;
  218. } else {
  219. if (this.timer) {
  220. await this.searchList();
  221. this.num = 60;
  222. } else {
  223. this.clearTime();
  224. }
  225. }
  226. }, 1000);
  227. },
  228. restSearch() {
  229. // 表格 - 分页
  230. this.pageInfo = {
  231. size: 1000,
  232. curr: 1,
  233. total: 0,
  234. };
  235. this.parmValue = {
  236. page: 1, // 页码
  237. size: 15, // 每页显示条数
  238. status: "1",
  239. };
  240. this.searchList();
  241. },
  242. // 新建/编辑/详情
  243. openModal(row, type) {
  244. this.sitem = row;
  245. this.modelId = type;
  246. this.showModel = true;
  247. },
  248. // 时间
  249. async handleTime(e) {
  250. this.parmValue.starttime = e.startTime || "";
  251. this.parmValue.endtime = e.endTime || "";
  252. if (
  253. (this.parmValue.starttime !== "" && this.parmValue.endtime !== "") ||
  254. (this.parmValue.starttime === "" && this.parmValue.endtime === "")
  255. ) {
  256. this.pageInfo.curr = 1;
  257. this.parmValue.page = 1;
  258. await this.searchList();
  259. }
  260. },
  261. /**
  262. * 启用/禁用
  263. * @param {String} id id
  264. * @param {String} status 0-禁用 1-启用
  265. */
  266. async changeStatus(id, status) {
  267. await this.$confirm(`确定要改为${status + '' === "1" ? "禁用" : "启用"}?`, {
  268. confirmButtonText: "确定",
  269. cancelButtonText: "取消",
  270. type: "warning",
  271. })
  272. .then(async () => {
  273. this.loading = true;
  274. const model = {
  275. id: id,
  276. status: status + '' === "1" ? "0" : "1",
  277. };
  278. const res = await asyncRequest.status(model);
  279. if (res && res.code === 0) {
  280. this.loading = false;
  281. this.$notify.success({
  282. title: "状态修改成功!",
  283. message: "",
  284. });
  285. await this.searchList();
  286. } else if (res && res.code >= 100 && res.code <= 104) {
  287. await this.logout();
  288. } else {
  289. this.loading = false;
  290. this.$message.warning(res.message);
  291. }
  292. })
  293. .catch(() => {
  294. console.log("取消");
  295. });
  296. },
  297. imgclick(e) {
  298. e.stopPropagation();
  299. e.preventDefault();
  300. },
  301. // 刷新表格
  302. async searchList(type) {
  303. if (!this.loading) {
  304. this.loading = true;
  305. const { code, data } = await asyncRequest.list({
  306. ...this.parmValue,
  307. supplierNo:this.currentCompany,
  308. noRelation:true
  309. });
  310. if (code === 0) {
  311. const { list, count } = data;
  312. this.list = list;
  313. this.list.map((e) => {
  314. e.cat_name = "";
  315. if (e.can && e.can.length > 0) {
  316. e.can.forEach((a, ai) => {
  317. e.cat_name += `${ai !== 0 ? "_" : ""}${a.name}`;
  318. });
  319. }
  320. return e;
  321. });
  322. this.pageInfo.total = Number(count);
  323. if (type) {
  324. await this.well_timer();
  325. }
  326. } else if (code >= 100 && code <= 104) {
  327. await this.logout();
  328. } else {
  329. this.list = [];
  330. this.pageInfo.total = 0;
  331. }
  332. this.loading = false;
  333. }
  334. },
  335. },
  336. };
  337. </script>
  338. <style lang="scss" scoped>
  339. @import "~@/styles/mixin.scss";
  340. .workbench {
  341. position: relative;
  342. width: 100%;
  343. height: calc(100vh - 50px);
  344. box-sizing: border-box;
  345. background: #f0f2f5;
  346. padding: 16px;
  347. .workbench-main {
  348. position: relative;
  349. width: 100%;
  350. height: 100%;
  351. box-sizing: border-box;
  352. ul.po-ul {
  353. width: 100%;
  354. height: 100%;
  355. overflow-y: hidden;
  356. box-sizing: border-box;
  357. li.po-li {
  358. position: relative;
  359. height: 100%;
  360. width: 100%;
  361. border-radius: 5px;
  362. overflow: hidden;
  363. box-sizing: border-box;
  364. // border: 1px solid rgba(121, 121, 121, 1);
  365. .task-item {
  366. border-bottom: 1px dashed #e6ebf5;
  367. line-height: 20px;
  368. overflow: hidden;
  369. float: left;
  370. width: 100%;
  371. padding: 10px 12px;
  372. text-align: center;
  373. font-size: 12px;
  374. ul.item-ul {
  375. width: 100%;
  376. padding: 0;
  377. margin: 0;
  378. li.item-li {
  379. width: 100%;
  380. padding: 0;
  381. margin: 0;
  382. .label,
  383. .label-main {
  384. height: 20px;
  385. line-height: 20px;
  386. overflow: hidden;
  387. }
  388. .label {
  389. width: 60px;
  390. float: left;
  391. color: #909499;
  392. text-align: left;
  393. }
  394. .label-main {
  395. float: left;
  396. width: calc(100% - 60px);
  397. text-align: right;
  398. color: #454545;
  399. img {
  400. display: inline-block;
  401. vertical-align: top;
  402. margin: 0 2px 0 0;
  403. }
  404. }
  405. }
  406. }
  407. .order {
  408. width: 100%;
  409. }
  410. // &:last-child{
  411. // border: 0;
  412. // }
  413. }
  414. &:first-child {
  415. float: left;
  416. width: 100%;
  417. // margin: 0 2% 0 0;
  418. .task-item {
  419. width: 20%;
  420. &:nth-child(3n + 1) {
  421. border-right: 1px dashed #e6ebf5;
  422. }
  423. &:nth-child(3n + 2) {
  424. border-right: 1px dashed #e6ebf5;
  425. }
  426. }
  427. .tast-item-active {
  428. width: 20%;
  429. background: skyblue;
  430. &:nth-child(3n + 1) {
  431. border-right: 1px dashed #e6ebf5;
  432. }
  433. &:nth-child(3n + 2) {
  434. border-right: 1px dashed #e6ebf5;
  435. }
  436. }
  437. }
  438. // &:last-child {
  439. // margin: 0;
  440. // float: right;
  441. // width: 32%;
  442. // }
  443. .taskTitle {
  444. width: 100%;
  445. height: 55px;
  446. line-height: 55px;
  447. text-align: center;
  448. position: absolute;
  449. top: 0;
  450. left: 0;
  451. z-index: 2;
  452. // border-bottom: 1px solid rgba(121, 121, 121, 1);
  453. &.color1 {
  454. background: rgba(250, 205, 145, 1);
  455. }
  456. &.color2 {
  457. background: rgba(202, 249, 130, 1);
  458. }
  459. // &.color3 {
  460. // background: rgba(129, 211, 248, 1);
  461. // }
  462. // &.color4 {
  463. // background: rgba(255, 255, 128, 1);
  464. // }
  465. }
  466. .taskList {
  467. position: relative;
  468. // padding: 0 0 0 5px;
  469. margin: 56px 0 0 0;
  470. background: #fff;
  471. height: calc(100% - 56px);
  472. width: 100%;
  473. overflow-y: scroll;
  474. @include scrollBar();
  475. .no-data {
  476. width: 100%;
  477. height: 60px;
  478. line-height: 60px;
  479. font-size: 14px;
  480. float: left;
  481. text-align: center;
  482. color: rgba(0, 0, 0, 0.65);
  483. }
  484. }
  485. }
  486. }
  487. }
  488. }
  489. </style>