refactor(frontend request params): #

pull/53/head
Angelo 2022-04-26 15:38:35 +08:00
parent b02b673e1b
commit 7f0a46c7d7
6 changed files with 31 additions and 27 deletions

View File

@ -273,7 +273,7 @@ Vue.prototype.commonEndColumns = function (param = {}) {
type: 'table-selector',
dict: {
cache: true,
url: deptPrefix + '?limit=999&status=1',
url: deptPrefix,
isTree: true,
value: 'id', // 数据字典中value字段的属性名
label: 'name', // 数据字典中label字段的属性名
@ -283,7 +283,8 @@ Vue.prototype.commonEndColumns = function (param = {}) {
component
}) => {
return request({
url: url
url: url,
params: { limit: 999, status: 1 }
}).then(ret => {
return ret.data.data
})

View File

@ -97,13 +97,13 @@ export const crudOptions = (vm) => {
type: 'cascader',
dict: {
cache: false,
url: deptPrefix + '?limit=999&status=1',
url: deptPrefix,
isTree: true,
value: 'id', // 数据字典中value字段的属性名
label: 'name', // 数据字典中label字段的属性名
children: 'children', // 数据字典中children字段的属性名
getData: (url, dict) => { // 配置此参数会覆盖全局的getRemoteDictFunc
return request({ url: url }).then(ret => {
return request({ url: url, params: { limit: 999, status: 1 } }).then(ret => {
const data = XEUtils.toArrayTree(ret.data.data, { parentKey: 'parent', strict: true })
return [{ id: '0', name: '根节点', children: data }]
})

View File

@ -98,13 +98,13 @@ export const crudOptions = (vm) => {
type: 'cascader',
dict: {
cache: false,
url: dictionaryPrefix + '?status=1&limit=999',
url: dictionaryPrefix,
isTree: true,
value: 'id', // 数据字典中value字段的属性名
label: 'label', // 数据字典中label字段的属性名
children: 'children', // 数据字典中children字段的属性名
getData: (url, dict) => { // 配置此参数会覆盖全局的getRemoteDictFunc
return request({ url: url }).then(ret => {
return request({ url: url, params: { limit: 999, status: 1 } }).then(ret => {
return [{ id: null, label: '根节点', children: XEUtils.toArrayTree(ret.data.data, { parentKey: 'parent', strict: true }) }]
})
}

View File

@ -27,7 +27,8 @@ export const crudOptions = (vm) => {
options: {
rowId: 'id',
height: '100%', // 表格高度100%, 使用toolbar必须设置
highlightCurrentRow: false
highlightCurrentRow: false,
defaultExpandAll: true
},
rowHandle: {
view: {
@ -129,14 +130,14 @@ export const crudOptions = (vm) => {
},
type: 'cascader',
dict: {
url: menuPrefix + '?limit=999&status=1&is_catalog=1',
url: menuPrefix,
cache: false,
isTree: true,
value: 'id', // 数据字典中value字段的属性名
label: 'name', // 数据字典中label字段的属性名
children: 'children', // 数据字典中children字段的属性名
getData: (url, dict, { form, component }) => { // 配置此参数会覆盖全局的getRemoteDictFunc
return request({ url: url }).then(ret => {
return request({ url: url, params: { limit: 999, status: 1, is_catalog: 1 } }).then(ret => {
const responseData = ret.data.data
const result = XEUtils.toArrayTree(responseData, { parentKey: 'parent', strict: true })
return [{ id: null, name: '根节点', children: result }]
@ -457,6 +458,8 @@ export const crudOptions = (vm) => {
}
}
}
].concat(vm.commonEndColumns({ update_datetime: { showTable: false } }))
].concat(vm.commonEndColumns({
update_datetime: { showTable: false }
}))
}
}

View File

@ -84,7 +84,6 @@ export const crudOptions = (vm) => {
{
title: 'ID',
key: 'id',
width: 90,
disabled: true,
form: {
disabled: true
@ -96,7 +95,7 @@ export const crudOptions = (vm) => {
search: {
disabled: false
},
width: 140,
minWidth: 100,
type: 'input',
form: {
rules: [ // 表单校验规则
@ -119,6 +118,7 @@ export const crudOptions = (vm) => {
{
title: '姓名',
key: 'name',
minWidth: 90,
search: {
disabled: false
},
@ -167,9 +167,9 @@ export const crudOptions = (vm) => {
},
component: {
span: 12,
pagination: true,
props: { multiple: false },
elProps: {
pagination: true,
columns: [
{
field: 'name',
@ -306,9 +306,9 @@ export const crudOptions = (vm) => {
},
component: {
span: 12,
pagination: true,
props: { multiple: true },
elProps: {
pagination: true,
columns: [
{
field: 'name',

View File

@ -79,18 +79,18 @@ export default {
// callback()
// }
// }
// return {
// dialogFormVisible: false,
// resetPwdForm: {
// id: null,
// pwd: null,
// pwd2: null
// },
// passwordRules: {
// pwd: [{ required: true, message: '' }, { validator: validatePass, trigger: 'blur' }],
// pwd2: [{ required: true, message: '' }, { validator: validatePass2, trigger: 'blur' }]
// }
// }
return {
// dialogFormVisible: false,
// resetPwdForm: {
// id: null,
// pwd: null,
// pwd2: null
// },
// passwordRules: {
// pwd: [{ required: true, message: '' }, { validator: validatePass, trigger: 'blur' }],
// pwd2: [{ required: true, message: '' }, { validator: validatePass2, trigger: 'blur' }]
// }
}
},
methods: {
getCrudOptions () {
@ -109,7 +109,7 @@ export default {
return api.DelObj(row.id)
},
resetPassword (scope) {
api.ResetPwd(scope.row).then(res => {
api.ResetPwd(scope.row).then((res) => {
this.$message.success('密码重置成功')
})
}