index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. <template>
  2. <div class="supplierBrand">
  3. <div class="supplierBrand_show_box" v-if="powers.some((i) => i == '001')">
  4. <div class="rule-view">
  5. <ex-table
  6. v-loading="loading"
  7. :table="table"
  8. :data="tableData"
  9. :columns="columns"
  10. :page="pageInfo"
  11. :size="size"
  12. @page-curr-change="handlePageChange"
  13. @page-size-change="handleSizeChange"
  14. @screen-reset="
  15. pageInfo.curr = 1;
  16. parmValue.page = 1;
  17. searchList();
  18. "
  19. @screen-submit="
  20. pageInfo.curr = 1;
  21. parmValue.page = 1;
  22. searchList();
  23. "
  24. >
  25. <template #table-header="{}">
  26. <div style="width: 100%">
  27. <el-row style="padding: 0 0 0 0px">
  28. <el-col :span="24">
  29. <div class="fl" style="height: 28px; line-height: 28px;display:flex">
  30. <search-supplier
  31. style="margin-right:10px;width:260px"
  32. :size="'mini'"
  33. :value="parmValue.supplierNo"
  34. :disabled="false"
  35. :placeholder="'供应商名称'"
  36. :is-detail="true"
  37. :no-disabled="true"
  38. @searchChange="supplierChange"
  39. />
  40. <el-select v-model="parmValue.status" style="margin-right: 10px;width:90px" size="mini" clearable placeholder="状态"
  41. @change="pageInfo.curr = 1;parmValue.page = 1;searchList();"
  42. >
  43. <el-option label="启用" value="1" />
  44. <el-option label="禁用" value="0" />
  45. </el-select>
  46. <el-input v-model="parmValue.creater" style="margin-right: 10px;width:120px" size="mini" placeholder="创建人" clearable
  47. @change="pageInfo.curr = 1;parmValue.page = 1;searchList();"
  48. />
  49. <period-date-picker
  50. :start="parmValue.start"
  51. :end="parmValue.end"
  52. :type="1"
  53. :width="'135px'"
  54. :size="searchSize"
  55. @timeReturned="timeReturned($event)"
  56. />
  57. </div>
  58. <el-button
  59. type="primary"
  60. class="fr"
  61. style="margin: 0 0 0 10px"
  62. :size="searchSize"
  63. @click="searchList"
  64. >
  65. 刷新
  66. </el-button>
  67. <el-button
  68. type="warning"
  69. style="margin: 0 0 0 10px"
  70. :size="searchSize"
  71. class="fr"
  72. @click="restSearch"
  73. >
  74. 重置
  75. </el-button>
  76. <el-button
  77. v-if="powers.some((i) => i == '003')"
  78. type="success"
  79. class="fr"
  80. style="margin: 0 0 0 10px"
  81. :size="searchSize"
  82. @click="openModal(-1, 'add')"
  83. >
  84. 添加
  85. </el-button></el-col
  86. >
  87. </el-row>
  88. </div>
  89. </template>
  90. <template #status="{ scope }">
  91. <el-tag
  92. :size="tablebtnSize"
  93. :type="scope.row.status == '0' ? 'warning' : ''"
  94. v-text="
  95. (options2.find((item) => item.id == scope.row.status) || {}).name || '--'
  96. "
  97. ></el-tag>
  98. </template>
  99. <template #operation="{ scope }">
  100. <!-- <el-tooltip
  101. effect="dark"
  102. content="详情"
  103. v-if="powers.some((i) => i == '007')"
  104. placement="top"
  105. >
  106. <i
  107. class="el-icon-view tb-icon"
  108. @click="openModal(scope.row.id, 'view')"
  109. ></i>
  110. </el-tooltip>
  111. <el-tooltip
  112. effect="dark"
  113. content="修改"
  114. v-if="powers.some((i) => i == '005') && scope.row.status + '' === '0'"
  115. placement="top"
  116. >
  117. <i
  118. class="el-icon-edit tb-icon"
  119. @click="openModal(scope.row.id, 'edit')"
  120. ></i> </el-tooltip > -->
  121. <el-tooltip
  122. v-if="powers.some((i) => i == '004') && scope.row.status + '' === '1'"
  123. effect="dark"
  124. content="禁用"
  125. placement="top"
  126. >
  127. <i
  128. class="el-icon-video-pause tb-icon"
  129. @click="changeStatus(scope.row.id, scope.row.status)"
  130. ></i>
  131. </el-tooltip>
  132. <el-tooltip
  133. v-if="powers.some((i) => i == '004') && scope.row.status + '' === '0'"
  134. effect="dark"
  135. content="启用"
  136. placement="top"
  137. >
  138. <i
  139. class="el-icon-video-play tb-icon"
  140. @click="changeStatus(scope.row.id, scope.row.status)"
  141. ></i> </el-tooltip
  142. >
  143. <!-- <el-tooltip
  144. effect="dark"
  145. content="删除"
  146. placement="top"
  147. v-if="powers.some((i) => i == '006') && scope.row.status + '' === '0'"
  148. >
  149. <i class="el-icon-delete tb-icon" @click="deleteItem(scope.row.id)"></i>
  150. </el-tooltip> -->
  151. </template>
  152. </ex-table>
  153. <add-edit
  154. :id="modelId"
  155. :type="isDetail"
  156. :showModel="showModel"
  157. :sitem="sitem"
  158. @cancel="showModel = false"
  159. @refresh="(showModel = false), searchList()"
  160. />
  161. </div>
  162. </div>
  163. <no-auth v-else></no-auth>
  164. </div>
  165. </template>
  166. <script>
  167. import asyncRequest from "@/apis/service/serviceParam/supplierCat";
  168. import { statusList } from "@/assets/js/statusList";
  169. import mixinPage from "@/mixins/elPaginationHandle";
  170. import { mapGetters } from "vuex";
  171. import supplierlist from "./supplierlist";
  172. import addEdit from "./addEdit";
  173. import resToken from "@/mixins/resToken";
  174. import columns from "./columns";
  175. export default {
  176. name: "supplierBrand",
  177. mixins: [mixinPage, resToken],
  178. components: {
  179. supplierlist,
  180. addEdit,
  181. },
  182. computed: {
  183. //组件SIZE设置
  184. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  185. powers() {
  186. const tran =
  187. this.$store.getters.btnList.find((item) => item.menu_route == "supplierBrand") ||
  188. {};
  189. const { action } = tran ?? {};
  190. return action ?? [];
  191. },
  192. },
  193. data() {
  194. return {
  195. statusList: statusList,
  196. options1: [
  197. { id: "0", name: "长期" },
  198. { id: "1", name: "非长期" },
  199. ],
  200. options2: [
  201. { id: "0", name: "禁用" },
  202. { id: "1", name: "启用" },
  203. ],
  204. showModel: false,
  205. modelSitem: null,
  206. modelId: "",
  207. modelType: "",
  208. selectLoading: false,
  209. loading: true,
  210. showModelThis: false,
  211. parmValue: {
  212. supplierNo: [],
  213. start:"",
  214. end:"",
  215. status: "",
  216. creater: "", // 供应商code
  217. page: 1, // 页码
  218. size: 15, // 每页显示条数
  219. },
  220. tableData: [],
  221. passwordModel: false,
  222. passwordModelId: 0,
  223. isPasswordDetail: false,
  224. // 表格 - 数据
  225. tableData: [],
  226. // 表格 - 参数
  227. table: {
  228. stripe: true,
  229. border: true,
  230. // _defaultHeader_: ["setcol"],
  231. },
  232. // 表格 - 分页
  233. pageInfo: {
  234. size: 15,
  235. curr: 1,
  236. total: 0,
  237. },
  238. // 表格 - 列参数
  239. columns,
  240. };
  241. },
  242. mounted(){
  243. this.searchList();
  244. },
  245. methods: {
  246. supplierChange(e){
  247. const { code } = e;
  248. this.parmValue.supplierNo = code ? [code] : [];
  249. this.searchList();
  250. },
  251. restSearch() {
  252. // 表格 - 分页
  253. this.pageInfo = { size: 15, curr: 1, total: 0 };
  254. this.parmValue.page = 1;
  255. this.parmValue.size = 15;
  256. this.parmValue.supplierNo = [];
  257. this.parmValue.start = "";
  258. this.parmValue.end = "";
  259. this.parmValue.status = "";
  260. this.parmValue.creater = "";
  261. this.searchList();
  262. },
  263. openModal(id, isDetail) {
  264. this.modelId = id;
  265. this.isDetail = isDetail;
  266. this.showModel = true;
  267. },
  268. gotoEdit(row, type) {
  269. const { status } = row;
  270. if (type === "005" && status + '' === "1") {
  271. this.$message.warning("禁用后,才可以修改!");
  272. return;
  273. }
  274. this.routeGoto("supplierBrandDetail", {
  275. id: row.code,
  276. type: "edit",
  277. });
  278. },
  279. /**
  280. * 启用/禁用
  281. * @param {String} id id
  282. * @param {String} status 0-禁用 1-启用
  283. */
  284. async changeStatus(id, status) {
  285. await this.$confirm(`确定要改为${status + '' === "1" ? "禁用" : "启用"}?`, {
  286. confirmButtonText: "确定",
  287. cancelButtonText: "取消",
  288. type: "warning",
  289. })
  290. .then(async () => {
  291. this.loading = true;
  292. const model = {
  293. id: id, status: status + '' === "1" ? "0" : "1",
  294. };
  295. const res = await asyncRequest.status(model);
  296. if (res && res.code === 0) {
  297. this.loading = false;
  298. this.$notify.success({
  299. title: "状态修改成功!",
  300. message: "",
  301. });
  302. await this.searchList();
  303. } else if (res && res.code >= 100 && res.code <= 104) {
  304. await this.logout();
  305. } else {
  306. this.loading = false;
  307. this.$message.warning(res.message);
  308. }
  309. })
  310. .catch(() => {
  311. console.log("取消");
  312. });
  313. },
  314. async deleteItem(id) {
  315. await this.$confirm("确定要删除?", {
  316. confirmButtonText: "确定",
  317. cancelButtonText: "取消",
  318. type: "warning",
  319. })
  320. .then(async () => {
  321. const model = {
  322. id: id,
  323. };
  324. const res = await asyncRequest.delete(model);
  325. if (res && res.code === 0) {
  326. this.$notify.success({
  327. title: "删除成功",
  328. message: "",
  329. });
  330. this.searchList();
  331. } else if (res && res.code >= 100 && res.code <= 104) {
  332. await this.logout();
  333. } else {
  334. this.$message.warning(res.message);
  335. }
  336. })
  337. .catch(() => {
  338. console.log("取消");
  339. });
  340. },
  341. async timeReturned(e) {
  342. if (e.startTime !== "") {
  343. this.parmValue.start = e.startTime;
  344. } else {
  345. this.parmValue.start = "";
  346. }
  347. if (e.endTime !== "") {
  348. this.parmValue.end = e.endTime;
  349. } else {
  350. this.parmValue.end = "";
  351. }
  352. await this.searchList();
  353. },
  354. // 刷新表格
  355. async searchList() {
  356. if (
  357. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  358. (this.parmValue.start === "" && this.parmValue.end !== "")
  359. ) {
  360. this.$message.warning("时间区间不完整!");
  361. return;
  362. }
  363. this.loading = true;
  364. const { code, data, message } = await asyncRequest.list({
  365. ...this.parmValue,
  366. supplierNo:Array.isArray(this.parmValue.supplierNo) ? this.parmValue.supplierNo[0] : ""
  367. });
  368. let scode = parseInt(code + "");
  369. if (scode === 0) {
  370. const { list, count } = data;
  371. this.tableData = list;
  372. this.pageInfo.total = Number(count + "");
  373. } else if (scode >= 100 && scode <= 104) {
  374. await this.logout();
  375. } else {
  376. this.tableData = [];
  377. this.pageInfo.total = 0;
  378. }
  379. this.loading = false;
  380. },
  381. },
  382. };
  383. </script>
  384. <style lang="scss" scoped>
  385. @import "~@/styles/mixin.scss";
  386. .supplierBrand {
  387. position: relative;
  388. width: 100%;
  389. height: calc(100vh - 50px);
  390. overflow: hidden;
  391. .supplierBrand_show_box {
  392. // position: relative;
  393. // height: calc(100% - 50px);
  394. // min-height: calc(100% - 50px);
  395. display: relative;
  396. width: 100%;
  397. height: 100%;
  398. // height: calc(100vh - 50px);
  399. // overflow: hidden;
  400. // text-align: left;
  401. //左侧
  402. .role-list {
  403. height: 100%;
  404. overflow-y: auto;
  405. width: 320px;
  406. // padding: 8px 16px;
  407. min-height: 100%;
  408. flex-shrink: 0;
  409. border-right: 2px solid #dfe6ec;
  410. @include scrollBar();
  411. &::after {
  412. content: "";
  413. position: absolute;
  414. top: 0;
  415. right: 0;
  416. height: 100%;
  417. width: 2px;
  418. background-color: #e4e7ed;
  419. z-index: 1;
  420. }
  421. .role-list__title {
  422. color: #b4b6c0;
  423. line-height: 32px;
  424. }
  425. .role-list__item {
  426. position: relative;
  427. white-space: nowrap;
  428. text-overflow: ellipsis;
  429. overflow: hidden;
  430. height: 32px;
  431. line-height: 32px;
  432. padding-left: 8px;
  433. color: rgb(48, 49, 51);
  434. cursor: pointer;
  435. i {
  436. position: absolute;
  437. right: 0;
  438. line-height: 32px;
  439. }
  440. }
  441. .role-list__item.active {
  442. color: #6954f0;
  443. background: #f7f7f7;
  444. }
  445. }
  446. //右侧
  447. .rule-view {
  448. width:100%;
  449. // height: calc(100% - 50px);
  450. // width: calc(100% - 320px);
  451. overflow-y: auto;
  452. padding: 10px 16px;
  453. @include scrollBar();
  454. .rule-list {
  455. border-right: 1px solid #dfe6ec;
  456. .title {
  457. padding: 18px 18px 12px 18px;
  458. border-bottom: 1px dashed #dfe6ec;
  459. font-size: 15px;
  460. color: #000;
  461. }
  462. .main {
  463. padding: 18px 18px 12px 18px;
  464. border-bottom: 1px solid #dfe6ec;
  465. }
  466. .main-title {
  467. width: 80px;
  468. }
  469. .main-item {
  470. width: calc(100% - 80px);
  471. }
  472. }
  473. }
  474. .rule-bottom {
  475. padding: 10px 18px 8px 0;
  476. background: #fff;
  477. width: calc(100% - 200px);
  478. position: absolute;
  479. text-align: right;
  480. bottom: 0;
  481. right: 0;
  482. &::before {
  483. content: "";
  484. position: absolute;
  485. top: 0;
  486. right: 0;
  487. height: 2px;
  488. width: 100%;
  489. background-color: #e4e7ed;
  490. z-index: 1;
  491. }
  492. }
  493. }
  494. }
  495. </style>