|
|
@@ -1,4 +1,4 @@
|
|
|
-import { fGet, fSave, fPut, fDelete } from '@/api/rest'
|
|
|
+import { fGet, fSave, fPut, fDelete, fSort } from '@/api/rest'
|
|
|
|
|
|
function hasArea(obj, key) {
|
|
|
const k = key || 'area'
|
|
|
@@ -115,10 +115,14 @@ function fnDelete(options) {
|
|
|
const listObj = this.self.list[opt.list] || {}
|
|
|
this.self.$confirm(`您是否确认要删除${title}`, '删除确认').then(() => {
|
|
|
const url = opt.url || listObj.url || this.self.URI
|
|
|
+ console.log(opt.url)
|
|
|
fDelete(url, opt.row).then(res => {
|
|
|
this.list(opt.reload)
|
|
|
+ alert('删除成功')
|
|
|
})
|
|
|
- }).catch(() => {})
|
|
|
+ }).catch(() => {
|
|
|
+ alert('删除失败')
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function fnSave(options) {
|
|
|
@@ -199,6 +203,13 @@ function fnMultiSelect(options) {
|
|
|
listObj.selectedRows = opt.rows || []
|
|
|
}
|
|
|
|
|
|
+function fnSort(options) {
|
|
|
+ const opt = Options(options, { form: 'form', title: '排序' })
|
|
|
+ fSort(opt.url, opt.data).then(res => {
|
|
|
+ this.list(opt.reload)
|
|
|
+ }).catch(() => {})
|
|
|
+}
|
|
|
+
|
|
|
// 批量操作
|
|
|
function fnBatchOp(options) {
|
|
|
const opt = Options(options, { params: {}})
|
|
|
@@ -323,6 +334,7 @@ export function M(self) {
|
|
|
this.upload = fnUpload
|
|
|
this.beforeUpload = fnBeforeUpload
|
|
|
this.closeUploader = fnCloseUploader
|
|
|
+ this.sort = fnSort
|
|
|
}
|
|
|
|
|
|
// --- 以下为工具类
|