|
@@ -1,36 +1,34 @@
|
|
<template>
|
|
<template>
|
|
- <avue-crud ref="crud" :page="page" :data="dataList" :table-loading="dataListLoading" :permission="permission"
|
|
|
|
- :option="tableOption" @search-change="searchChange" @selection-change="selectionChange" @on-load="getDataList">
|
|
|
|
|
|
+ <avue-crud ref="crud" :page="page" :data="dataList" :table-loading="dataListLoading" :option="tableOption"
|
|
|
|
+ @search-change="searchChange" @on-load="getDataList">
|
|
<template slot="menuLeft">
|
|
<template slot="menuLeft">
|
|
- <el-button type="primary" icon="el-icon-plus" size="small" v-if="isAuth('shop:pickAddr:save')"
|
|
|
|
- @click.stop="addOrUpdateHandle()">新增</el-button>
|
|
|
|
|
|
+ <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addOrUpdateHandle()">新增</el-button>
|
|
<!--el-button type="danger" @click="deleteHandle()" size="small" v-if="isAuth('shop:pickAddr:delete')"
|
|
<!--el-button type="danger" @click="deleteHandle()" size="small" v-if="isAuth('shop:pickAddr:delete')"
|
|
:disabled="dataListSelections.length <= 0">批量删除</el-button-->
|
|
:disabled="dataListSelections.length <= 0">批量删除</el-button-->
|
|
</template>
|
|
</template>
|
|
|
|
|
|
- <template slot-scope="scope" slot="menu">
|
|
|
|
- <el-button type="primary" icon="el-icon-edit" size="small" v-if="isAuth('prod:prod:update')"
|
|
|
|
- @click="addOrUpdateHandle(scope.row.prodId)">修改</el-button>
|
|
|
|
- <el-button type="danger" icon="el-icon-delete" size="small" v-if="isAuth('prod:prod:delete')"
|
|
|
|
- @click="deleteGood(scope.row.id)">删除</el-button>
|
|
|
|
|
|
+ <template slot-scope="{row,index}" slot="menu">
|
|
|
|
+ <el-button type="primary" icon="el-icon-edit" size="small" @click="addOrUpdateHandle(row.id)">修改</el-button>
|
|
|
|
+ <el-button type="danger" icon="el-icon-delete" size="small" @click="deleteGood(row.id)">删除</el-button>
|
|
</template>
|
|
</template>
|
|
</avue-crud>
|
|
</avue-crud>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
|
|
|
+<script lang="ts">
|
|
|
|
+import Vue from 'vue'
|
|
import { tableOption } from '@/avue/crud/prodList.js'
|
|
import { tableOption } from '@/avue/crud/prodList.js'
|
|
-import Axios from 'axios'
|
|
|
|
import httpx from '@/utils/httpx'
|
|
import httpx from '@/utils/httpx'
|
|
|
|
+import { IPage } from '@/utils/vo'
|
|
|
|
|
|
-export default {
|
|
|
|
|
|
+export default Vue.extend({
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
dataForm: {
|
|
dataForm: {
|
|
prodName: ''
|
|
prodName: ''
|
|
},
|
|
},
|
|
- permission: {
|
|
|
|
- delBtn: this.isAuth('prod:prod:delete')
|
|
|
|
- },
|
|
|
|
|
|
+ // permission: {
|
|
|
|
+ // delBtn: this.isAuth('prod:prod:delete')
|
|
|
|
+ // },
|
|
dataList: [],
|
|
dataList: [],
|
|
page: {
|
|
page: {
|
|
total: 0, // 总页数
|
|
total: 0, // 总页数
|
|
@@ -40,12 +38,14 @@ export default {
|
|
dataListSelections: [],
|
|
dataListSelections: [],
|
|
dataListLoading: false,
|
|
dataListLoading: false,
|
|
tableOption: tableOption,
|
|
tableOption: tableOption,
|
|
- resourcesUrl: process.env.VUE_APP_RESOURCES_URL
|
|
|
|
|
|
+ resourcesUrl: process.env.VUE_APP_RESOURCES_URL,
|
|
|
|
+
|
|
|
|
+ row: { id: 0 }, // 为了让ts类型检查器不报错(好像不支持 slot-scope 属性)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 获取数据列表
|
|
// 获取数据列表
|
|
- getDataList(page, params, done) {
|
|
|
|
|
|
+ getDataList(page?: IPage, params?: { name: string }, done?: Function) {
|
|
this.dataListLoading = true
|
|
this.dataListLoading = true
|
|
httpx.post(httpx.makeurl('/goods/queryGoodList'), {
|
|
httpx.post(httpx.makeurl('/goods/queryGoodList'), {
|
|
name: params?.name || "",
|
|
name: params?.name || "",
|
|
@@ -61,7 +61,8 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- deleteGood(id) {
|
|
|
|
|
|
+
|
|
|
|
+ deleteGood(id: number) {
|
|
this.$confirm(`确定进行删除操作?`, '提示', {
|
|
this.$confirm(`确定进行删除操作?`, '提示', {
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
@@ -82,51 +83,25 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 新增 / 修改
|
|
// 新增 / 修改
|
|
- addOrUpdateHandle(id) {
|
|
|
|
|
|
+ addOrUpdateHandle(id?: number) {
|
|
this.$router.push({
|
|
this.$router.push({
|
|
- path: '/prodInfo',
|
|
|
|
- query: { prodId: id }
|
|
|
|
|
|
+ path: `/prod/product/${id ? id : "new"}`
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 删除和批量删除
|
|
|
|
- // deleteHandle(id) {
|
|
|
|
- // let prodIds = this.getSeleProdIds()
|
|
|
|
- // if (id) {
|
|
|
|
- // prodIds.push(id)
|
|
|
|
- // }
|
|
|
|
- // this.$confirm(`确定进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
|
|
|
- // confirmButtonText: '确定',
|
|
|
|
- // cancelButtonText: '取消',
|
|
|
|
- // type: 'warning'
|
|
|
|
- // }).then(() => {
|
|
|
|
- // this.$http({
|
|
|
|
- // url: this.$http.adornUrl(`/prod/prod`),
|
|
|
|
- // method: 'delete',
|
|
|
|
- // data: this.$http.adornData(prodIds, false)
|
|
|
|
- // }).then(({ data }) => {
|
|
|
|
- // this.getDataList(this.page)
|
|
|
|
- // this.$message({
|
|
|
|
- // message: '操作成功',
|
|
|
|
- // type: 'success',
|
|
|
|
- // duration: 1500
|
|
|
|
- // })
|
|
|
|
- // })
|
|
|
|
- // })
|
|
|
|
- // },
|
|
|
|
// 条件查询
|
|
// 条件查询
|
|
- searchChange(params, done) {
|
|
|
|
|
|
+ searchChange(params: { name: string }, done: Function) {
|
|
this.getDataList(this.page, params, done)
|
|
this.getDataList(this.page, params, done)
|
|
},
|
|
},
|
|
// 多选变化
|
|
// 多选变化
|
|
- selectionChange(val) {
|
|
|
|
- this.dataListSelections = val
|
|
|
|
- },
|
|
|
|
|
|
+ // selectionChange(val: any) {
|
|
|
|
+ // this.dataListSelections = val
|
|
|
|
+ // },
|
|
// 获取选中的商品Id列表
|
|
// 获取选中的商品Id列表
|
|
- getSeleProdIds() {
|
|
|
|
- return this.dataListSelections.map(item => {
|
|
|
|
- return item.prodId
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ // getSeleProdIds() {
|
|
|
|
+ // return this.dataListSelections.map(item => {
|
|
|
|
+ // return item.prodId
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+})
|
|
</script>
|
|
</script>
|