qauMaWeb/node_modules/.cache/babel-loader/9eeab6b00d913c2c167d9fe1189...

1 line
16 KiB
JSON
Raw Normal View History

2024-10-13 18:02:27 +08:00
{"ast":null,"code":"import \"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//\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 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 this.user.password = md5(\"123456\");\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 = '新增用户';\n this.dialogFormVisible = true;\n this.user = {};\n },\n //编辑\n handleEdit: function handleEdit(row) {\n this.user = JSON.parse(JSON.stringify(row));\n this.dialogTitle = '编辑用户';\n this.dialogFormVisible = true;\n },\n //删除\n handleDelete: function handleDelete(id) {\n var _this3 = this;\n\n this.$confirm('确认删除该用户吗?', '提示', {\n confirmButtonText: '确定',\n cancelButtonText: '取消',\n type: 'warning'\n }).then(function () {\n _this3.request.delete(\"/user/\" + id).then(function (res) {\n if (res.code === '200') {\n _this3.$message({\n type: \"success\",\n message: \"删除成功\"\n });\n\n _this3.load();\n } else {\n _this3.$message.error(res.msg);\n }\n });\n });\n },\n //批量删除\n delBatch: function delBatch() {\n var _this4 = this;\n\n var ids = this.multipleSelection.map(function (v) {\n return v.id;\n });\n console.log(ids);\n this