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

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

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

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

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

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

@ -61,7 +61,7 @@
@handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
:isSearchTableItem="true"
:isSearchTableItem="true"
/>
<!-- 详情 -->
@ -83,6 +83,8 @@
:detailValidate="detailValidate"
@detailSubmitForm="detailSubmitForm"
:isSearchTableItem="true"
:buttonControllFunction="buttonControllFunction"
@detailOnChange="detailOnChange"
/>
<!-- 导入 -->
@ -260,11 +262,7 @@ const onChange = (field, cur, item) => {
// -
const buttonTableClick = async (val, row) => {
DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = false
if (val == 'view') {
showView.value = true
urls.value = row.filePathList
viewKey.value += 1
} else if (val == 'edit') {
if (val == 'edit') {
//
openForm('update', row)
DeviceMaintainOrderMain.allSchemas.formSchema[0].componentProps.disabled = true
@ -496,4 +494,26 @@ onMounted(async () => {
getList()
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>

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

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

Loading…
Cancel
Save