|
@@ -12,6 +12,7 @@
|
|
|
import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated'
|
|
|
import { updateProject } from '/@/api/sys/project'
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
+ import { propTypes } from '/@/utils/propTypes'
|
|
|
|
|
|
export default defineComponent({
|
|
|
components: {
|
|
@@ -21,7 +22,8 @@
|
|
|
info: {
|
|
|
type: Object as PropType<ProjectListItem>,
|
|
|
required: true
|
|
|
- }
|
|
|
+ },
|
|
|
+ hasPermission: propTypes.bool
|
|
|
},
|
|
|
emits: ['updateInfo:info'],
|
|
|
setup(props, { emit }) {
|
|
@@ -50,7 +52,8 @@
|
|
|
label: '停用',
|
|
|
value: ProjectStatusEnum.STOP
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ disabled: !props.hasPermission
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -65,7 +68,6 @@
|
|
|
field: 'code',
|
|
|
component: 'Input',
|
|
|
label: '项目编号',
|
|
|
-
|
|
|
componentProps: {
|
|
|
disabled: true
|
|
|
}
|
|
@@ -74,7 +76,7 @@
|
|
|
field: 'name',
|
|
|
component: 'Input',
|
|
|
label: '项目名称',
|
|
|
-
|
|
|
+ disabled: !props.hasPermission,
|
|
|
required: true
|
|
|
},
|
|
|
{
|
|
@@ -82,10 +84,10 @@
|
|
|
component: 'Select',
|
|
|
componentProps: {
|
|
|
options,
|
|
|
- showArrow: true
|
|
|
+ showArrow: true,
|
|
|
+ disabled: !props.hasPermission
|
|
|
},
|
|
|
label: '所在办事处',
|
|
|
-
|
|
|
required: true
|
|
|
},
|
|
|
{
|
|
@@ -94,7 +96,8 @@
|
|
|
label: '销售负责人',
|
|
|
componentProps: {
|
|
|
options,
|
|
|
- showArrow: true
|
|
|
+ showArrow: true,
|
|
|
+ disabled: !props.hasPermission
|
|
|
},
|
|
|
colProps: {
|
|
|
span: 14
|
|
@@ -107,7 +110,8 @@
|
|
|
disabledLabelWidth: true,
|
|
|
componentProps: {
|
|
|
options: staffOptions,
|
|
|
- showArrow: true
|
|
|
+ showArrow: true,
|
|
|
+ disabled: !props.hasPermission
|
|
|
},
|
|
|
label: '',
|
|
|
colProps: {
|
|
@@ -119,12 +123,16 @@
|
|
|
{
|
|
|
field: 'remark',
|
|
|
component: 'InputTextArea',
|
|
|
+ componentProps: {
|
|
|
+ disabled: !props.hasPermission
|
|
|
+ },
|
|
|
label: '备注'
|
|
|
}
|
|
|
])
|
|
|
const [register, { updateSchema, setFieldsValue }] = useForm({
|
|
|
labelWidth: 120,
|
|
|
schemas,
|
|
|
+ showActionButtonGroup: props.hasPermission,
|
|
|
actionColOptions: {
|
|
|
flex: '280px',
|
|
|
span: 14
|
|
@@ -193,15 +201,17 @@
|
|
|
if (values.staffId) {
|
|
|
newVal.staffName = staffOptions.value.find(item => item.value === values.staffId)?.label || ''
|
|
|
}
|
|
|
- await updateProject(newVal)
|
|
|
- info.value = { ...info.value, ...newVal }
|
|
|
- }
|
|
|
- function handleSubmit(values) {
|
|
|
try {
|
|
|
- handleOnSave(values)
|
|
|
- } finally {
|
|
|
- createMessage.success('更新成功')
|
|
|
+ await updateProject(newVal)
|
|
|
+ } catch (error) {
|
|
|
+ return false
|
|
|
}
|
|
|
+ info.value = { ...info.value, ...newVal }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ async function handleSubmit(values) {
|
|
|
+ const result = await handleOnSave(values)
|
|
|
+ result && createMessage.success('更新成功')
|
|
|
}
|
|
|
return { register, schemas, handleSubmit }
|
|
|
}
|