index.vue 13 KB

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