diff --git a/web/src/management/api/survey.js b/web/src/management/api/survey.js
index 24781e57..e92ec532 100644
--- a/web/src/management/api/survey.js
+++ b/web/src/management/api/survey.js
@@ -1,11 +1,12 @@
import axios from './base';
-export const getSurveyList = (curPage, filter) => {
+export const getSurveyList = (curPage, filter, order) => {
return axios.get('/surveyManage/list', {
params: {
pageSize: 10,
curPage,
filter,
+ order
},
});
};
diff --git a/web/src/management/pages/list/components/baseList.vue b/web/src/management/pages/list/components/baseList.vue
index 0786a2cf..b47378bd 100644
--- a/web/src/management/pages/list/components/baseList.vue
+++ b/web/src/management/pages/list/components/baseList.vue
@@ -4,12 +4,23 @@
+
effectValue)
+ .reduce((prev, item) => {
+ const [effectKey, effectValue] = item
+ prev.push({field: effectKey, value: effectValue})
+ return prev
+ }, [])
+ return JSON.stringify(formatOrder)
}
},
created() {
@@ -180,7 +207,8 @@ export default {
const filter = JSON.stringify(this.filter.filter(item => {
return item.condition[0].field === 'title' || item.condition[0].value
}))
- const res = await getSurveyList(this.currentPage, filter);
+
+ const res = await getSurveyList(this.currentPage, filter, this.order);
this.loading = false;
if (res.code === CODE_MAP.SUCCESS) {
this.total = res.data.count;
@@ -289,6 +317,14 @@ export default {
this.selectValueMap[selectKey] = selectValue
this.currentPage = 1
this.init()
+ },
+ onButtonChange(effectValue, effectKey){
+ this.buttonValueMap = {
+ 'curStatus.date': '',
+ createDate: ''
+ }
+ this.buttonValueMap[effectKey] = effectValue
+ this.init()
}
},
components: {
@@ -298,6 +334,7 @@ export default {
ToolBar,
TextSearch,
TextSelect,
+ TextButton,
State,
},
};
diff --git a/web/src/management/pages/list/components/textButton.vue b/web/src/management/pages/list/components/textButton.vue
index f5123dc0..e793b432 100644
--- a/web/src/management/pages/list/components/textButton.vue
+++ b/web/src/management/pages/list/components/textButton.vue
@@ -1,7 +1,9 @@
-
- {{ currentOption.label }}
+
+ {{ option.label }}
@@ -10,13 +12,12 @@ export default{
name: 'TextButton',
data(){
return {
- optionIndex: 0,
- optionValue: ''
+ iconIndex: 0
}
},
props: {
- options: {
- type: Array,
+ option: {
+ type: Object,
required: true
},
effectFun: {
@@ -27,31 +28,35 @@ export default{
}
},
computed: {
- optionsLength(){
- return this.options.length
+ toggleOptionIcons(){
+ return this.option.icons.slice(1)
},
- currentOption(){
- return this.options[this.optionIndex % this.optionsLength]
+ iconsLength(){
+ return this.toggleOptionIcons.length
+ },
+ currentIconItem(){
+ let finalIconIndex = this.iconIndex % this.iconsLength
+ return this.toggleOptionIcons[finalIconIndex]
}
},
- watch: {
- currentOption(newOption){
- typeof this.effectFun === 'function' && this.effectFun(newOption, this.effectKey)
- }
- },
methods: {
onClick(){
- if(this.optionIndex > this.optionsLength){
- this.optionIndex = 0
- return
+ this.iconIndex++
+ if(this.iconIndex >= this.iconsLength){
+ this.iconIndex = 0
}
- this.optionIndex++
+ typeof this.effectFun === 'function' && this.effectFun(this.currentIconItem.effectValue, this.effectKey)
}
},
+ created(){
+ this.iconIndex = this.toggleOptionIcons.findIndex(iconItem => iconItem.isDefaultValue)
+ }
}
\ No newline at end of file
diff --git a/web/src/management/pages/list/config/index.js b/web/src/management/pages/list/config/index.js
index 24811b9b..29a7b728 100644
--- a/web/src/management/pages/list/config/index.js
+++ b/web/src/management/pages/list/config/index.js
@@ -134,4 +134,44 @@ export const selectOptionsDict = Object.freeze({
'curStatus.status': curStatusSelect
})
+export const buttonOptionsDict = Object.freeze({
+ 'curStatus.date': {
+ label: '更新时间',
+ icons: [
+ {
+ name: 'el-icon-sort',
+ effectValue: '',
+ isDefaultValue: true
+ },
+ {
+ name: 'el-icon-sort-up',
+ effectValue: 1
+ },
+ {
+ name: 'el-icon-sort-down',
+ effectValue: -1,
+ },
+ ]
+ },
+ createDate: {
+ label: '创建时间',
+ icons: [
+ {
+ name: 'el-icon-sort',
+ effectValue: '',
+
+ },
+ {
+ name: 'el-icon-sort-up',
+ effectValue: 1
+ },
+ {
+ name: 'el-icon-sort-down',
+ effectValue: -1,
+ isDefaultValue: true
+ },
+ ]
+ }
+})
+