detail.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div class="checkDetail pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <add-edit :id="$route.query.id" />
  7. </div>
  8. <div v-else>
  9. <no-auth></no-auth>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. import mixinPage from "@/mixins/elPaginationHandle";
  15. import resToken from "@/mixins/resToken";
  16. import statusList from "@/assets/js/statusList";
  17. import asyncRequest from "@/apis/service/stock/check/detail";
  18. import addEdit from "./components/addEdit";
  19. import { mapGetters } from "vuex";
  20. export default {
  21. name: "checkDetail",
  22. mixins: [mixinPage, resToken],
  23. components: {
  24. addEdit,
  25. },
  26. computed: {
  27. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  28. powers() {
  29. let tran =
  30. this.$store.getters.btnList.find(
  31. (item) => item.menu_route == "checkDetail"
  32. ) || {};
  33. if (tran && tran.action && tran.action.length > 0) {
  34. return tran.action;
  35. } else {
  36. return [];
  37. }
  38. },
  39. },
  40. data() {
  41. return {
  42. sitem: null,
  43. // 状态
  44. statusOptions: [
  45. { id: "0", label: "禁用" },
  46. { id: "1", label: "启用" },
  47. ],
  48. statusList: statusList,
  49. loading: true,
  50. showModel: false,
  51. isDetail: false,
  52. modelId: 0,
  53. parmValue: {
  54. name: "", // 业务员名字
  55. username: "", // 账号
  56. status: "", //
  57. page: 1, // 页码
  58. size: 15, // 每页显示条数
  59. },
  60. tableData: [],
  61. passwordModel: false,
  62. passwordModelId: 0,
  63. isPasswordDetail: false,
  64. // 表格 - 数据
  65. tableData: [],
  66. // 表格 - 参数
  67. table: {
  68. stripe: true,
  69. border: true,
  70. _defaultHeader_: ["setcol"],
  71. },
  72. // 表格 - 分页
  73. pageInfo: {
  74. size: 15,
  75. curr: 1,
  76. total: 0,
  77. },
  78. // 表格 - 列参数
  79. columns: [
  80. {
  81. prop: "nickname",
  82. label: "真实姓名",
  83. },
  84. {
  85. prop: "role_name",
  86. label: "角色名称",
  87. },
  88. {
  89. prop: "mobile",
  90. label: "联系电话",
  91. },
  92. {
  93. prop: "email",
  94. label: "邮箱",
  95. },
  96. {
  97. prop: "status",
  98. label: "状态",
  99. _slot_: "status",
  100. width: "80px",
  101. },
  102. {
  103. prop: "addtime",
  104. label: "创建时间",
  105. sortable: true,
  106. },
  107. {
  108. prop: "",
  109. label: "操作",
  110. fixed: "right",
  111. _noset_: true,
  112. _slot_: "operation",
  113. },
  114. ],
  115. };
  116. },
  117. mounted() {
  118. console.log(this.$route.query.id);
  119. // this.searchList();
  120. },
  121. methods: {
  122. restSearch() {
  123. this.parmValue = {
  124. name: "", // 业务员名字
  125. username: "", // 账号
  126. status: "", //
  127. page: 1, // 页码
  128. size: 10, // 每页显示条数
  129. };
  130. this.searchList();
  131. },
  132. openModal(id, isDetail, sitem) {
  133. this.showModel = true;
  134. this.modelId = id;
  135. this.isDetail = isDetail;
  136. this.sitem = sitem;
  137. },
  138. async deleteById(id, status) {
  139. await this.$confirm("确定要删除?", {
  140. confirmButtonText: "确定",
  141. cancelButtonText: "取消",
  142. type: "warning",
  143. })
  144. .then(async () => {
  145. const model = {
  146. id: id,
  147. status: status === "1" ? "0" : "1",
  148. };
  149. const res = await asyncRequest.status(model);
  150. if (res && res.code === 0) {
  151. this.$notify.success({
  152. title: "删除成功",
  153. message: "",
  154. });
  155. this.searchList();
  156. } else if (res && res.code >= 100 && res.code <= 104) {
  157. await this.logout();
  158. } else {
  159. this.$message.warning(res.message);
  160. }
  161. })
  162. .catch(() => {
  163. console.log("取消");
  164. });
  165. },
  166. async searchList() {
  167. this.loading = true;
  168. const res = await asyncRequest.list(this.parmValue);
  169. if (res && res.code === 0 && res.data) {
  170. this.tableData = res.data.list;
  171. this.pageInfo.total = Number(res.data.count);
  172. } else if (res && res.code >= 100 && res.code <= 104) {
  173. await this.logout();
  174. } else {
  175. this.tableData = [];
  176. this.pageInfo.total = 0;
  177. }
  178. this.loading = false;
  179. },
  180. async statusConfirm(id, status) {
  181. let str = status === "1" ? "禁用" : "启用";
  182. await this.$confirm("确定要改为" + str + "?", {
  183. confirmButtonText: "确定",
  184. cancelButtonText: "取消",
  185. type: "warning",
  186. })
  187. .then(async () => {
  188. this.loading = true;
  189. const model = {
  190. id: id,
  191. status: status === "1" ? "0" : "1",
  192. };
  193. const res = await asyncRequest.status(model);
  194. if (res && res.code === 0) {
  195. this.loading = false;
  196. this.$notify.success({
  197. title: "状态修改成功!",
  198. message: "",
  199. });
  200. await this.searchList();
  201. } else if (res && res.code >= 100 && res.code <= 104) {
  202. await this.logout();
  203. } else {
  204. this.$message.warning(res.message);
  205. }
  206. })
  207. .catch(() => {
  208. console.log("取消");
  209. });
  210. },
  211. },
  212. };
  213. </script>
  214. <style lang="scss" scoped>
  215. .checkDetail {
  216. }
  217. </style>