const App = { mixins: [sharedMixin],/////共用的方法///// data() { return { loading: { loading: false, addLoading: false, }, attachmentList: [], clearable: false, messageList: [], other: {}, clearable: false, searchdata: { page: 1, page_size: 20, kw: '', }, }; }, mounted() { this.getMessageList(); }, created() { }, methods: { ///修改扩展字段的值//// updateExt(row, field) { if (row.id) { let that = this; let url = "/admin/" + viewPath + "/updateExt.html" postRequest(url, { id: row.id, [field]: row[field] }).then(res => { if (res.data.code == 200) { that.$notify({ title: "成功", message: res.data.message, position: "top-left", type: "success", }); } else { that.$notify.error({ title: "错误", position: "top-left", message: res.data.message, }); } }); } }, // 编辑公告 editMessage(id) { let url = "/admin/" + viewPath + "/create/id/" + id + ".html"; window.location.href = url; }, // 创建公告 create() { let url = "/admin/" + viewPath + "/create.html"; window.location.href = url; }, handleSizeChange(val) { //////设置每页多少条 this.searchdata.page_size = val this.getMessageList(); }, handleCurrentChange(val) { ///改变当前页/////// this.searchdata.p = val this.getMessageList(); }, // 获取公告列表 getMessageList() { let that = this; that.loading.loading = true; let url = "/admin/" + viewPath + "/getMessageList.html" postRequest(url, that.searchdata).then(res => { if (res.data.code == 200) { that.messageList = res.data.list; that.other = res.data.other; } that.loading.loading = false; }).catch(() => { that.loading.loading = false; //取消,不做处理 }); }, // 删除公告 deleteMessage(index) { const that = this; let { id } = that.messageList[index]; that.$confirm( '确定删除吗?', '警告', { confirmButtonText: '删除', cancelButtonText: '取消', type: 'warning', center: true, } ).then(() => { let url = "/admin/" + viewPath + "/deleteMessage.html" postRequest(url, { id: id }).then(res => { if (res.data.code === 200) { that.$notify({ title: '成功', message: res.data.message, position: 'top-left', type: 'success' }); that.messageList.splice(index, 1) } else { that.$notify.error({ title: '错误', position: 'top-left', message: res.data.message }); } }).catch((error) => { that.$notify.error({ title: "错误", position: "top-left", message: "请求发生错误,请稍后重试", }); }); ///////////// }).catch(() => { //取消,不做处理 }) }, } }; const app = Vue.createApp(App); for (const [key, component] of Object.entries(ElementPlusIconsVue)) { app.component(key, component) } app.use(ElementPlus, { locale: ElementPlusLocaleZhCn, }); app.mount("#vue_item");