detail.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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: 15, // 每页显示条数
  129. };
  130. // 表格 - 分页
  131. this.pageInfo = {
  132. size: 15,
  133. curr: 1,
  134. total: 0,
  135. };
  136. this.searchList();
  137. },
  138. openModal(id, isDetail, sitem) {
  139. this.showModel = true;
  140. this.modelId = id;
  141. this.isDetail = isDetail;
  142. this.sitem = sitem;
  143. },
  144. async deleteById(id, status) {
  145. await this.$confirm("确定要删除?", {
  146. confirmButtonText: "确定",
  147. cancelButtonText: "取消",
  148. type: "warning",
  149. })
  150. .then(async () => {
  151. const model = {
  152. id: id,
  153. status: status === "1" ? "0" : "1",
  154. };
  155. const res = await asyncRequest.status(model);
  156. if (res && res.code === 0) {
  157. this.$notify.success({
  158. title: "删除成功",
  159. message: "",
  160. });
  161. this.searchList();
  162. } else if (res && res.code >= 100 && res.code <= 104) {
  163. await this.logout();
  164. } else {
  165. this.$message.warning(res.message);
  166. }
  167. })
  168. .catch(() => {
  169. console.log("取消");
  170. });
  171. },
  172. async searchList() {
  173. this.loading = true;
  174. const res = await asyncRequest.list(this.parmValue);
  175. if (res && res.code === 0 && res.data) {
  176. this.tableData = res.data.list;
  177. this.pageInfo.total = Number(res.data.count);
  178. } else if (res && res.code >= 100 && res.code <= 104) {
  179. await this.logout();
  180. } else {
  181. this.tableData = [];
  182. this.pageInfo.total = 0;
  183. }
  184. this.loading = false;
  185. },
  186. async statusConfirm(id, status) {
  187. let str = status === "1" ? "禁用" : "启用";
  188. await this.$confirm("确定要改为" + str + "?", {
  189. confirmButtonText: "确定",
  190. cancelButtonText: "取消",
  191. type: "warning",
  192. })
  193. .then(async () => {
  194. this.loading = true;
  195. const model = {
  196. id: id,
  197. status: status === "1" ? "0" : "1",
  198. };
  199. const res = await asyncRequest.status(model);
  200. if (res && res.code === 0) {
  201. this.loading = false;
  202. this.$notify.success({
  203. title: "状态修改成功!",
  204. message: "",
  205. });
  206. await this.searchList();
  207. } else if (res && res.code >= 100 && res.code <= 104) {
  208. await this.logout();
  209. } else {
  210. this.$message.warning(res.message);
  211. }
  212. })
  213. .catch(() => {
  214. console.log("取消");
  215. });
  216. },
  217. },
  218. };
  219. </script>
  220. <style lang="scss" scoped>
  221. .checkDetail {
  222. }
  223. </style>