2024-08-13 18:53:03 +08:00
|
|
|
export const commonMixin = {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 修改时的数据源
|
|
|
|
|
editParams: null,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
/** 新建 */
|
2024-08-14 18:36:07 +08:00
|
|
|
handleAddData() {
|
|
|
|
|
this.editParams = null
|
|
|
|
|
this.dialogConfig.outerTitle = this.addDialogTitle
|
|
|
|
|
this.dialogConfig.outerVisible = true
|
|
|
|
|
},
|
|
|
|
|
/** 新建-物资类型 */
|
|
|
|
|
handleAddMaData(level) {
|
|
|
|
|
if(level == null) {
|
|
|
|
|
this.$modal.msgError('请在左侧菜单选择设备类型!')
|
|
|
|
|
} else if(level > 3) {
|
|
|
|
|
this.$modal.msgError('该类型无法添加子类型!')
|
|
|
|
|
} else {
|
|
|
|
|
this.editParams = null
|
|
|
|
|
this.dialogConfig.outerTitle = this.addDialogTitle
|
|
|
|
|
this.dialogConfig.outerVisible = true
|
|
|
|
|
}
|
2024-08-13 18:53:03 +08:00
|
|
|
},
|
|
|
|
|
/** 删除 */
|
|
|
|
|
handleDeleteData(id, method) {
|
2024-08-14 18:36:07 +08:00
|
|
|
this.$modal.confirm('是否确定删除').then(() => {
|
|
|
|
|
console.log('确定删除--', id)
|
|
|
|
|
method(id).then(res => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
if(res.code === 200) {
|
|
|
|
|
this.$modal.msgSuccess('操作成功!')
|
|
|
|
|
this.$refs.tableRef.getTableList()
|
|
|
|
|
}
|
|
|
|
|
}).catch(err => {})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 删除-物资类型 */
|
|
|
|
|
handleDeleteMaType(id, method) {
|
2024-08-13 18:53:03 +08:00
|
|
|
this.$modal.confirm('是否确定删除').then(() => {
|
|
|
|
|
console.log('确定删除--', id)
|
|
|
|
|
method(id).then(res => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
if(res.code === 200) {
|
2024-08-14 10:38:18 +08:00
|
|
|
this.$modal.msgSuccess('操作成功!')
|
2024-08-13 18:53:03 +08:00
|
|
|
this.$refs.tableRef.getTableList()
|
2024-08-14 10:38:18 +08:00
|
|
|
this.getTreeData()
|
2024-08-13 18:53:03 +08:00
|
|
|
}
|
|
|
|
|
}).catch(err => {})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/** 编辑 */
|
|
|
|
|
handleEditData(data) {
|
|
|
|
|
this.editParams = data
|
|
|
|
|
this.dialogConfig.outerTitle = this.editDialogTitle
|
|
|
|
|
this.dialogConfig.outerVisible = true
|
|
|
|
|
},
|
|
|
|
|
/** 导入数据 */
|
|
|
|
|
handleImportData() {
|
|
|
|
|
console.log('导入--')
|
|
|
|
|
},
|
|
|
|
|
/** 导出数据 */
|
|
|
|
|
handleExportData(data, url, fileName) {
|
|
|
|
|
this.download(
|
|
|
|
|
url,
|
|
|
|
|
{
|
|
|
|
|
...data
|
|
|
|
|
},
|
|
|
|
|
`${fileName}_${new Date().getTime()}.xlsx`,
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
/** 关闭外侧弹框 */
|
|
|
|
|
closeDialogOuter() {
|
|
|
|
|
this.dialogConfig.outerVisible = false
|
|
|
|
|
},
|
|
|
|
|
/** 关闭内侧弹框 */
|
|
|
|
|
closeDialogInner() {
|
|
|
|
|
this.dialogConfig.innerVisible = false
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 关闭弹框 由表单组件通知父组件关闭弹框的自定义事件 */
|
|
|
|
|
closeDialog(type) {
|
|
|
|
|
this.dialogConfig.outerVisible = false
|
|
|
|
|
if(type) {
|
|
|
|
|
this.$refs.tableRef.getTableList()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|