|
@ -8,27 +8,52 @@ |
|
|
@click="handleDelete(selectedRowKeys)" |
|
|
@click="handleDelete(selectedRowKeys)" |
|
|
:disabled="!hasSelected()" |
|
|
:disabled="!hasSelected()" |
|
|
:loading="loading" |
|
|
:loading="loading" |
|
|
>删除</a-button> |
|
|
>删除</a-button |
|
|
<a-button type="primary" icon="redo" @click="getDataList()">刷新</a-button> |
|
|
> |
|
|
|
|
|
<a-button type="primary" icon="redo" @click="getDataListByParent(selectThree, 4)">刷新</a-button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="table-page-search-wrapper"> |
|
|
<div class="table-page-search-wrapper"> |
|
|
<a-form layout="inline"> |
|
|
<a-form layout="inline"> |
|
|
<a-row :gutter="10"> |
|
|
<a-row :gutter="10"> |
|
|
<a-col :md="4" :sm="24"> |
|
|
<a-col :md="4" :sm="24"> |
|
|
<a-form-item label="查询类别"> |
|
|
<a-form-item label="一级类目"> |
|
|
<a-select allowClear v-model="queryParam.condition"> |
|
|
<a-select allowClear @change="oneCatChange"> |
|
|
<a-select-option key="Text">品类词</a-select-option> |
|
|
<a-select-option v-for="item in oneCats" :key="item.Id">{{ item.Name }}</a-select-option> |
|
|
|
|
|
</a-select> |
|
|
|
|
|
</a-form-item> |
|
|
|
|
|
</a-col> |
|
|
|
|
|
<a-col :md="4" :sm="24"> |
|
|
|
|
|
<a-form-item label="二级类目"> |
|
|
|
|
|
<a-select allowClear v-model="selectTwo" @change="twoCatChange"> |
|
|
|
|
|
<a-select-option v-for="item in twoCats" :key="item.Id">{{ item.Name }}</a-select-option> |
|
|
</a-select> |
|
|
</a-select> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
</a-col> |
|
|
</a-col> |
|
|
|
|
|
<a-col :md="4" :sm="24"> |
|
|
|
|
|
<a-form-item label="三级类目"> |
|
|
|
|
|
<a-select allowClear v-model="selectThree"> |
|
|
|
|
|
<a-select-option v-for="item in threeCats" :key="item.Id">{{ item.Name }}</a-select-option> |
|
|
|
|
|
</a-select> |
|
|
|
|
|
</a-form-item> |
|
|
|
|
|
</a-col> |
|
|
|
|
|
|
|
|
<a-col :md="4" :sm="24"> |
|
|
<a-col :md="4" :sm="24"> |
|
|
<a-form-item> |
|
|
<a-form-item> |
|
|
<a-input v-model="queryParam.keyword" placeholder="关键字" /> |
|
|
<a-input v-model="searchKey" placeholder="关键字" /> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
</a-col> |
|
|
</a-col> |
|
|
<a-col :md="6" :sm="24"> |
|
|
<a-col :md="6" :sm="24"> |
|
|
<a-button type="primary" @click="() => {this.pagination.current = 1; this.getDataList()}">查询</a-button> |
|
|
<a-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
@click=" |
|
|
|
|
|
() => { |
|
|
|
|
|
this.pagination.current = 1 |
|
|
|
|
|
this.getDataListByParent(this.selectThree, 4) |
|
|
|
|
|
} |
|
|
|
|
|
" |
|
|
|
|
|
>查询</a-button |
|
|
|
|
|
> |
|
|
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button> |
|
|
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button> |
|
|
</a-col> |
|
|
</a-col> |
|
|
</a-row> |
|
|
</a-row> |
|
@ -38,7 +63,7 @@ |
|
|
<a-table |
|
|
<a-table |
|
|
ref="table" |
|
|
ref="table" |
|
|
:columns="columns" |
|
|
:columns="columns" |
|
|
:rowKey="row => row.Id" |
|
|
:rowKey="(row) => row.Id" |
|
|
:dataSource="data" |
|
|
:dataSource="data" |
|
|
:pagination="pagination" |
|
|
:pagination="pagination" |
|
|
:loading="loading" |
|
|
:loading="loading" |
|
@ -54,15 +79,6 @@ |
|
|
<a @click="handleDelete([record.Id])">删除</a> |
|
|
<a @click="handleDelete([record.Id])">删除</a> |
|
|
</template> |
|
|
</template> |
|
|
</span> |
|
|
</span> |
|
|
|
|
|
|
|
|
<span slot="catKey" slot-scope="text, record"> |
|
|
|
|
|
<span v-if="record.Level===4">{{record.Text}}</span> |
|
|
|
|
|
<sapn v-else>-</sapn> |
|
|
|
|
|
</span> |
|
|
|
|
|
<span slot="Text" slot-scope="text, record"> |
|
|
|
|
|
<span v-if="record.Level!=4">{{record.Text}}</span> |
|
|
|
|
|
<sapn v-else></sapn> |
|
|
|
|
|
</span> |
|
|
|
|
|
</a-table> |
|
|
</a-table> |
|
|
|
|
|
|
|
|
<edit-form ref="editForm" :parentObj="this"></edit-form> |
|
|
<edit-form ref="editForm" :parentObj="this"></edit-form> |
|
@ -75,33 +91,41 @@ import EditForm from './EditForm' |
|
|
import EditNameForm from './EditNameForm' |
|
|
import EditNameForm from './EditNameForm' |
|
|
|
|
|
|
|
|
const columns = [ |
|
|
const columns = [ |
|
|
{ title: '类目', dataIndex: 'Text', width: '10%', scopedSlots: { customRender: 'Text' } }, |
|
|
{ title: '品类词', dataIndex: 'Name', width: '10%' }, |
|
|
{ title: '品类词', dataIndex: 'catKey', width: '10%', scopedSlots: { customRender: 'catKey' } }, |
|
|
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } }, |
|
|
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } } |
|
|
|
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
components: { |
|
|
components: { |
|
|
EditForm, |
|
|
EditForm, |
|
|
EditNameForm |
|
|
EditNameForm, |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
this.getDataList() |
|
|
this.getDataList() |
|
|
|
|
|
this.getDataListByParent('', 1) |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
data: [], |
|
|
data: [], |
|
|
|
|
|
parentData: [], |
|
|
|
|
|
oneCats: [], |
|
|
|
|
|
twoCats: [], |
|
|
|
|
|
threeCats: [], |
|
|
|
|
|
searchKey:undefined, |
|
|
|
|
|
selectThree: undefined, |
|
|
|
|
|
selectOne: undefined, |
|
|
|
|
|
selectTwo: undefined, |
|
|
pagination: { |
|
|
pagination: { |
|
|
current: 1, |
|
|
current: 1, |
|
|
pageSize: 10, |
|
|
pageSize: 500, |
|
|
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}` |
|
|
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}`, |
|
|
}, |
|
|
}, |
|
|
filters: {}, |
|
|
filters: {}, |
|
|
sorter: { field: 'Id', order: 'asc' }, |
|
|
sorter: { field: 'Id', order: 'asc' }, |
|
|
loading: false, |
|
|
loading: false, |
|
|
columns, |
|
|
columns, |
|
|
queryParam: {}, |
|
|
queryParam: { Condition: 'Id', Keyword: '' }, |
|
|
selectedRowKeys: [] |
|
|
selectedRowKeys: [], |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
@ -109,27 +133,69 @@ export default { |
|
|
this.pagination = { ...pagination } |
|
|
this.pagination = { ...pagination } |
|
|
this.filters = { ...filters } |
|
|
this.filters = { ...filters } |
|
|
this.sorter = { ...sorter } |
|
|
this.sorter = { ...sorter } |
|
|
this.getDataList() |
|
|
this.getDataListByParent(this.selectThree, 4) |
|
|
}, |
|
|
}, |
|
|
getDataList() { |
|
|
oneCatChange(val) { |
|
|
|
|
|
this.selectOne = val |
|
|
|
|
|
this.selectTwo=undefined |
|
|
|
|
|
this.selectThree=undefined |
|
|
|
|
|
this.getDataListByParent(val, 2) |
|
|
|
|
|
}, |
|
|
|
|
|
twoCatChange(val) { |
|
|
|
|
|
this.selectTwo = val |
|
|
|
|
|
this.selectThree=undefined |
|
|
|
|
|
this.getDataListByParent(val, 3) |
|
|
|
|
|
}, |
|
|
|
|
|
getDataListByParent(parentId, type) { |
|
|
|
|
|
this.queryParam.Keyword = parentId |
|
|
this.selectedRowKeys = [] |
|
|
this.selectedRowKeys = [] |
|
|
|
|
|
|
|
|
this.loading = true |
|
|
this.loading = true |
|
|
|
|
|
var url='/HuiYan/cats/GetDataByParent' |
|
|
|
|
|
if(type==4&&this.searchKey) |
|
|
|
|
|
{ |
|
|
|
|
|
url=`${url}?key=${this.searchKey}` |
|
|
|
|
|
} |
|
|
this.$http |
|
|
this.$http |
|
|
.post('/HuiYan/cats/GetTreeDataList', { |
|
|
.post(url, { |
|
|
PageIndex: this.pagination.current, |
|
|
PageIndex: this.pagination.current, |
|
|
PageRows: this.pagination.pageSize, |
|
|
PageRows: this.pagination.pageSize, |
|
|
SortField: this.sorter.field || 'Id', |
|
|
SortField: this.sorter.field || 'Id', |
|
|
SortType: this.sorter.order, |
|
|
SortType: this.sorter.order, |
|
|
Search: this.queryParam, |
|
|
Search: this.queryParam, |
|
|
...this.filters |
|
|
...this.filters, |
|
|
}) |
|
|
}) |
|
|
.then(resJson => { |
|
|
.then((resJson) => { |
|
|
this.loading = false |
|
|
this.loading = false |
|
|
|
|
|
if (type == 1) { |
|
|
|
|
|
this.oneCats = resJson.Data |
|
|
|
|
|
} |
|
|
|
|
|
if (type == 2) { |
|
|
|
|
|
this.twoCats = resJson.Data |
|
|
|
|
|
} |
|
|
|
|
|
if (type == 3) { |
|
|
|
|
|
this.threeCats = resJson.Data |
|
|
|
|
|
} |
|
|
|
|
|
if (type == 4) { |
|
|
this.data = resJson.Data |
|
|
this.data = resJson.Data |
|
|
const pagination = { ...this.pagination } |
|
|
const pagination = { ...this.pagination } |
|
|
pagination.total = resJson.Total |
|
|
pagination.total = resJson.Total |
|
|
this.pagination = pagination |
|
|
this.pagination = pagination |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getDataList() { |
|
|
|
|
|
this.$http |
|
|
|
|
|
.post('/HuiYan/cats/GetTreeDataList', { |
|
|
|
|
|
PageIndex: this.pagination.current, |
|
|
|
|
|
PageRows: this.pagination.pageSize, |
|
|
|
|
|
SortField: this.sorter.field || 'Id', |
|
|
|
|
|
SortType: this.sorter.order, |
|
|
|
|
|
...this.filters, |
|
|
|
|
|
}) |
|
|
|
|
|
.then((resJson) => { |
|
|
|
|
|
this.parentData = resJson.Data |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
onSelectChange(selectedRowKeys) { |
|
|
onSelectChange(selectedRowKeys) { |
|
@ -150,21 +216,22 @@ export default { |
|
|
title: '确认删除吗?', |
|
|
title: '确认删除吗?', |
|
|
onOk() { |
|
|
onOk() { |
|
|
return new Promise((resolve, reject) => { |
|
|
return new Promise((resolve, reject) => { |
|
|
thisObj.$http.post('/HuiYan/cats/DeleteData', ids).then(resJson => { |
|
|
thisObj.$http.post('/HuiYan/cats/DeleteData', ids).then((resJson) => { |
|
|
resolve() |
|
|
resolve() |
|
|
|
|
|
|
|
|
if (resJson.Success) { |
|
|
if (resJson.Success) { |
|
|
thisObj.$message.success('操作成功!') |
|
|
thisObj.$message.success('操作成功!') |
|
|
|
|
|
|
|
|
thisObj.getDataList() |
|
|
thisObj.pagination.current = 1 |
|
|
|
|
|
thisObj.getDataListByParent(thisObj.selectThree, 4) |
|
|
} else { |
|
|
} else { |
|
|
thisObj.$message.error(resJson.Msg) |
|
|
thisObj.$message.error(resJson.Msg) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
} |
|
|
}, |
|
|
} |
|
|
}, |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |