qauMaWeb/node_modules/.cache/babel-loader/8805d1d43e02fb71f88a1705352...

1 line
20 KiB
JSON
Raw Normal View History

2024-10-13 18:02:27 +08:00
{"ast":null,"code":"import \"core-js/modules/es.string.trim.js\";\nimport \"core-js/modules/es.json.stringify.js\";\nimport \"core-js/modules/es.array.map.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport md5 from \"js-md5\";\nexport default {\n name: \"User\",\n created: function created() {\n this.load();\n },\n data: function data() {\n return {\n tableData: [],\n roleOptions: [{\n value: \"admin\",\n label: \"管理员\"\n }, {\n value: \"user\",\n label: \"用户\"\n }],\n roleValue: \"\",\n total: 0,\n pageSize: 5,\n currentPage: 1,\n searchMode: \"id\",\n searchParams: {\n id: \"\",\n username: \"\",\n nickname: \"\"\n },\n dialogFormVisible: false,\n dialogTitle: \"\",\n user: {\n username: \"\",\n nickname: \"\",\n newPassword: \"\",\n role: \"\",\n phone: \"\",\n email: \"\",\n address: \"\"\n },\n multipleSelection: []\n };\n },\n methods: {\n handleSizeChange: function handleSizeChange(pageSize) {\n this.pageSize = pageSize;\n this.load();\n },\n handleCurrentPage: function handleCurrentPage(currentPage) {\n this.currentPage = currentPage;\n this.load();\n },\n handleSelectionChange: function handleSelectionChange(val) {\n this.multipleSelection = val;\n },\n load: function load() {\n var _this = this;\n\n this.request.get(\"/user/page\", {\n params: {\n pageNum: this.currentPage,\n pageSize: this.pageSize,\n id: this.searchParams.id,\n username: this.searchParams.username,\n nickname: this.searchParams.nickname\n }\n }).then(function (res) {\n if (res.code === \"200\") {\n _this.tableData = res.data.records;\n _this.total = res.data.total;\n }\n });\n },\n search: function search() {\n this.currentPage = 1;\n this.load();\n },\n reload: function reload() {\n this.searchParams.id = \"\";\n this.searchParams.username = \"\";\n this.searchParams.nickname = \"\";\n this.load();\n },\n //插入或修改\n save: function save() {\n var _this2 = this;\n\n if (this.dialogTitle == \"新增用户\") {\n if (this.user.username.trim() == \"\") {\n this.$message.error(\"账号不能为空\");\n return;\n }\n\n this.user.newPassword = md5(\"123456\");\n }\n\n if (this.user.nickname.trim() == \"\") {\n this.$message.error(\"昵称不能为空\");\n return;\n }\n\n if (this.user.role.trim() == \"\") {\n this.$message.error(\"身份不能为空\");\n return;\n }\n\n if (this.user.phone.trim() == \"\") {\n this.$message.error(\"电话不能为空\");\n return;\n }\n\n if (this.user.email.trim() == \"\") {\n this.$message.error(\"邮箱不能为空\");\n return;\n }\n\n this.dialogTitle = \"新增用户\";\n this.request.post(\"/user\", this.user).then(function (res) {\n if (res.code === \"200\") {\n _this2.$message.success(\"保存成功\");\n\n _this2.dialogFormVisible = false;\n\n _this2.load();\n } else {\n _this2.$message.error(res.msg);\n }\n });\n },\n handleAdd: function handleAdd() {\n this.dialogTitle = \"<EFBFBD>