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

View File

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

View File

@ -98,13 +98,13 @@ export const crudOptions = (vm) => {
type: 'cascader', type: 'cascader',
dict: { dict: {
cache: false, cache: false,
url: dictionaryPrefix + '?status=1&limit=999', url: dictionaryPrefix,
isTree: true, isTree: true,
value: 'id', // 数据字典中value字段的属性名 value: 'id', // 数据字典中value字段的属性名
label: 'label', // 数据字典中label字段的属性名 label: 'label', // 数据字典中label字段的属性名
children: 'children', // 数据字典中children字段的属性名 children: 'children', // 数据字典中children字段的属性名
getData: (url, dict) => { // 配置此参数会覆盖全局的getRemoteDictFunc 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 }) }] 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: { options: {
rowId: 'id', rowId: 'id',
height: '100%', // 表格高度100%, 使用toolbar必须设置 height: '100%', // 表格高度100%, 使用toolbar必须设置
highlightCurrentRow: false highlightCurrentRow: false,
defaultExpandAll: true
}, },
rowHandle: { rowHandle: {
view: { view: {
@ -129,14 +130,14 @@ export const crudOptions = (vm) => {
}, },
type: 'cascader', type: 'cascader',
dict: { dict: {
url: menuPrefix + '?limit=999&status=1&is_catalog=1', url: menuPrefix,
cache: false, cache: false,
isTree: true, isTree: true,
value: 'id', // 数据字典中value字段的属性名 value: 'id', // 数据字典中value字段的属性名
label: 'name', // 数据字典中label字段的属性名 label: 'name', // 数据字典中label字段的属性名
children: 'children', // 数据字典中children字段的属性名 children: 'children', // 数据字典中children字段的属性名
getData: (url, dict, { form, component }) => { // 配置此参数会覆盖全局的getRemoteDictFunc 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 responseData = ret.data.data
const result = XEUtils.toArrayTree(responseData, { parentKey: 'parent', strict: true }) const result = XEUtils.toArrayTree(responseData, { parentKey: 'parent', strict: true })
return [{ id: null, name: '根节点', children: result }] 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', title: 'ID',
key: 'id', key: 'id',
width: 90,
disabled: true, disabled: true,
form: { form: {
disabled: true disabled: true
@ -96,7 +95,7 @@ export const crudOptions = (vm) => {
search: { search: {
disabled: false disabled: false
}, },
width: 140, minWidth: 100,
type: 'input', type: 'input',
form: { form: {
rules: [ // 表单校验规则 rules: [ // 表单校验规则
@ -119,6 +118,7 @@ export const crudOptions = (vm) => {
{ {
title: '姓名', title: '姓名',
key: 'name', key: 'name',
minWidth: 90,
search: { search: {
disabled: false disabled: false
}, },
@ -167,9 +167,9 @@ export const crudOptions = (vm) => {
}, },
component: { component: {
span: 12, span: 12,
pagination: true,
props: { multiple: false }, props: { multiple: false },
elProps: { elProps: {
pagination: true,
columns: [ columns: [
{ {
field: 'name', field: 'name',
@ -306,9 +306,9 @@ export const crudOptions = (vm) => {
}, },
component: { component: {
span: 12, span: 12,
pagination: true,
props: { multiple: true }, props: { multiple: true },
elProps: { elProps: {
pagination: true,
columns: [ columns: [
{ {
field: 'name', field: 'name',

View File

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