Browse Source

添加详情按钮权限控制

master
ljlong_2630 9 months ago
parent
commit
d88faab9fd
  1. 29
      src/components/Detail/src/Detail.vue
  2. 8
      src/views/eam/device/deviceAccounts/deviceAccounts.data.ts
  3. 12
      src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts
  4. 32
      src/views/eam/device/deviceMaintainOrderMain/index.vue
  5. 8
      src/views/eam/mold/moldAccounts/moldAccounts.data.ts

29
src/components/Detail/src/Detail.vue

@ -117,6 +117,7 @@
:apiCreate="apiCreate" :apiCreate="apiCreate"
:fromeWhere="fromeWhere" :fromeWhere="fromeWhere"
:isDetail="true" :isDetail="true"
@onChange="onChange"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:detailData="detailData" :detailData="detailData"
@submitForm="submitForm" @submitForm="submitForm"
@ -135,7 +136,6 @@ import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue' import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { isString } from '@/utils/is' import { isString } from '@/utils/is'
import { Console } from 'console'
defineOptions({ name: 'Detail' }) defineOptions({ name: 'Detail' })
@ -277,6 +277,12 @@ const props = defineProps({
required: false, required: false,
default: true default: true
}, },
//
buttonControllFunction: {
type: Function,
required: false,
default: undefined
},
}) })
const isShowDrawer = ref(false) const isShowDrawer = ref(false)
const detailLoading = ref(false) const detailLoading = ref(false)
@ -350,7 +356,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
let detailButtonAdd: any = [] let detailButtonAdd: any = []
detailButtonAdd = props.isShowAddBtn?[ detailButtonAdd = props.isShowAddBtn?[
defaultButtons.defaultAddBtn({ defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1']) hide: !isShowMainButton(row, 'add')
}) })
]:[] ]:[]
HeadButttondata.value = [...detailButtonAdd] HeadButttondata.value = [...detailButtonAdd]
@ -359,10 +365,10 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
buttondata.value = [ buttondata.value = [
...[ ...[
defaultButtons.mainListEditBtn({ defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1']) hide: !isShowMainButton(row, 'edit')
}), // }), //
defaultButtons.mainListDeleteBtn({ defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['1']) hide: !isShowMainButton(row, 'delete')
}) })
], // ], //
...props.buttondataTable ...props.buttondataTable
@ -404,7 +410,12 @@ detailAllSchemasRef.value = props.detailAllSchemas
// //
const isShowMainButton = (row, val) => { const isShowMainButton = (row, val) => {
return false if (props.buttonControllFunction != undefined) {
return props.buttonControllFunction(row, val)
} else {
return true
}
} }
// //
@ -504,7 +515,8 @@ const emit = defineEmits([
'detailOpenForm', 'detailOpenForm',
'tableFormButton', 'tableFormButton',
'openImage', 'openImage',
'detailSubmitForm' 'detailSubmitForm',
'detailOnChange'
]) ])
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
@ -576,6 +588,11 @@ watch(
getList() getList()
} }
) )
function onChange(field, cur, item) {
emit('detailOnChange', field, cur, item)
}
</script> </script>
<style lang="scss"> <style lang="scss">
.el-drawer__body { .el-drawer__body {

8
src/views/eam/device/deviceAccounts/deviceAccounts.data.ts

@ -226,6 +226,14 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
isForm: false, isForm: false,
}, },
{
label: '描述',
field: 'describes',
sort: 'custom',
isSearch: false,
isForm: false,
},
{ {
label: '操作', label: '操作',

12
src/views/eam/device/deviceMaintainOrderMain/deviceMaintainOrderMain.data.ts

@ -1,19 +1,12 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { selectAllFactoryArea } from '@/api/system/dept' import { selectAllFactoryArea } from '@/api/system/dept'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import { useUserStore } from '@/store/modules/user'
import { selecUserByType } from '@/api/system/dept' import { selecUserByType } from '@/api/system/dept'
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { ItemSearchTable } from '../../basic/item/item.data' import { ItemSearchTable } from '../../basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item' import * as ItemApi from '@/api/eam/basic/item'
const userStore = useUserStore()
const factoryList = await selectAllFactoryArea() const factoryList = await selectAllFactoryArea()
const deviceList = await DeviceAccountsApi.getDeviceAccountsNoPage({})
const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: 1 }) const userList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: 1 })
const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: undefined }) const dutyUserList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: undefined })
const engineerList = await selecUserByType({ classType: 'DEVICE', factoryAreaNumber: undefined, flag: 2})
const repairList = await DeviceMaintenanceMainApi.getDeviceMainTempList('DEVICE')
// 表单校验 // 表单校验
export const DeviceMaintainOrderMainRules = reactive({ export const DeviceMaintainOrderMainRules = reactive({
@ -270,7 +263,7 @@ export const DeviceMaintainOrderDetailRules = reactive({
actualMinutes: [required], actualMinutes: [required],
chargePeoples: [required], chargePeoples: [required],
completionTime: [required], completionTime: [required],
engineer: [required] engineer: [required],
}) })
export const DeviceMaintainOrderDetail = useCrudSchemas(reactive<CrudSchema[]>([ export const DeviceMaintainOrderDetail = useCrudSchemas(reactive<CrudSchema[]>([
@ -396,7 +389,8 @@ export const DeviceMaintainOrderDetail = useCrudSchemas(reactive<CrudSchema[]>([
form: { form: {
component: 'Input', component: 'Input',
componentProps: { componentProps: {
type:'textarea' type: 'textarea',
disabled: true,
} }
} }
}, },

32
src/views/eam/device/deviceMaintainOrderMain/index.vue

@ -61,7 +61,7 @@
@handleDeleteTable="handleDeleteTable" @handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
@submitForm="submitForm" @submitForm="submitForm"
:isSearchTableItem="true" :isSearchTableItem="true"
/> />
<!-- 详情 --> <!-- 详情 -->
@ -83,6 +83,8 @@
:detailValidate="detailValidate" :detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm" @detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true" :isSearchTableItem="true"
:buttonControllFunction="buttonControllFunction"
@detailOnChange="detailOnChange"
/> />
<!-- 导入 --> <!-- 导入 -->
@ -260,11 +262,7 @@ const onChange = (field, cur, item) => {
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'view') { if (val == 'edit') {
showView.value = true
urls.value = row.filePathList
viewKey.value += 1
} else if (val == 'edit') {
// //
openForm('update', row) openForm('update', row)
DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = true DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = true
@ -496,4 +494,26 @@ onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await DeviceMaintainOrderMainApi.importTemplate() importTemplateData.templateUrl = await DeviceMaintainOrderMainApi.importTemplate()
}) })
function buttonControllFunction(row, val) {
if (val == 'delete') {
return false
} else {
return true
}
}
function detailOnChange(field, cur, item) {
if (field == 'status') {
if (cur == '1') {
DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = false
DeviceMaintainOrderDetailRules.uncompleted = [required]
} else {
DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.disabled = true
DeviceMaintainOrderDetail.allSchemas.formSchema.find(item => item.field == 'uncompleted').componentProps.value = ''
delete DeviceMaintainOrderDetailRules.uncompleted;
}
}
}
</script> </script>

8
src/views/eam/mold/moldAccounts/moldAccounts.data.ts

@ -129,6 +129,14 @@ export const MoldAccounts = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
isForm: false, isForm: false,
}, },
{
label: '描述',
field: 'describes',
sort: 'custom',
isSearch: false,
isForm: false,
},
{ {
label: '操作', label: '操作',

Loading…
Cancel
Save