| | |
| | | |
| | | // cl-upsert |
| | | const Upsert = useUpsert({ |
| | | items: [ |
| | | { |
| | | label: t("站点编码"), |
| | | prop: "businessId", |
| | | component: { name: "el-input", props: { clearable: true } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("名称"), |
| | | prop: "businessName", |
| | | component: { name: "el-input", props: { clearable: true } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("选择部门"), |
| | | prop: "departmentId", |
| | | //component: { name: "el-input", props: { clearable: true } }, |
| | | component: { |
| | | name: 'cl-dept-select', |
| | | props: { |
| | | multiple: false, // 单选 / true 多选 |
| | | placeholder: "请选择部门", |
| | | checkStrictly: true, // 父子节点不联动 |
| | | immediate: true // 立即加载部门树 |
| | | } |
| | | }, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("站点类型"), |
| | | prop: "siteType", |
| | | component: { |
| | | name: "cl-select", |
| | | props: { options: dict.get("sitetype") }, |
| | | }, |
| | | value: "收集点", |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("地址"), |
| | | prop: "address", |
| | | component: { name: "el-input", props: { clearable: true } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("负责人"), |
| | | prop: "leader", |
| | | component: { name: "el-input", props: { clearable: true } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("经度"), |
| | | prop: "longitude", |
| | | hook: "number", |
| | | component: { name: "el-input-number", props: { min: 0 } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("纬度"), |
| | | prop: "latitude", |
| | | hook: "number", |
| | | component: { name: "el-input-number", props: { min: 0 } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { label: t("照片"), prop: "photo", component: { name: "cl-upload" } }, |
| | | { |
| | | label: t("是否启用"), |
| | | prop: "status", |
| | | component: { name: "el-radio-group", options: options.status }, |
| | | value: 1, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("备注"), |
| | | prop: "remark", |
| | | component: { |
| | | name: "el-input", |
| | | props: { type: "textarea", rows: 4 }, |
| | | }, |
| | | }, |
| | | ], |
| | | onOpen: (mode, data) => { |
| | | if (mode === 'update' && data?.departmentId) { |
| | | data.departmentId = Number(data.departmentId); |
| | | } |
| | | return data; |
| | | }, |
| | | |
| | | items: [ |
| | | { |
| | | label: t("站点编码"), |
| | | prop: "businessId", |
| | | component: { name: "el-input", props: { clearable: true } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("名称"), |
| | | prop: "businessName", |
| | | component: { name: "el-input", props: { clearable: true } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("选择部门"), |
| | | prop: "departmentId", |
| | | component: { |
| | | name: 'cl-dept-select', |
| | | props: { |
| | | multiple: false, |
| | | placeholder: "请选择部门", |
| | | checkStrictly: true, |
| | | immediate: true, |
| | | clearable: true, |
| | | defaultExpandAll: true, |
| | | }, |
| | | }, |
| | | value: undefined, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("站点类型"), |
| | | prop: "siteType", |
| | | component: { |
| | | name: "cl-select", |
| | | props: { options: dict.get("sitetype") }, |
| | | }, |
| | | value: "收集点", |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("地址"), |
| | | prop: "address", |
| | | component: { name: "el-input", props: { clearable: true } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("负责人"), |
| | | prop: "leader", |
| | | component: { name: "el-input", props: { clearable: true } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("经度"), |
| | | prop: "longitude", |
| | | hook: "number", |
| | | component: { name: "el-input-number", props: { min: 0 } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("纬度"), |
| | | prop: "latitude", |
| | | hook: "number", |
| | | component: { name: "el-input-number", props: { min: 0 } }, |
| | | span: 12, |
| | | required: true, |
| | | }, |
| | | { label: t("照片"), prop: "photo", component: { name: "cl-upload" } }, |
| | | { |
| | | label: t("是否启用"), |
| | | prop: "status", |
| | | component: { name: "el-radio-group", options: options.status }, |
| | | value: 1, |
| | | required: true, |
| | | }, |
| | | { |
| | | label: t("备注"), |
| | | prop: "remark", |
| | | component: { |
| | | name: "el-input", |
| | | props: { type: "textarea", rows: 4 }, |
| | | }, |
| | | }, |
| | | ], |
| | | }); |
| | | |
| | | // cl-table |
| | |
| | | }); |
| | | |
| | | // cl-search |
| | | const Search = useSearch(); |
| | | const Search = useSearch({ |
| | | items: [ |
| | | { |
| | | label: t('归属单位'), |
| | | prop: 'departmentId', |
| | | component: { |
| | | name: 'cl-dept-select', |
| | | props: { |
| | | placeholder: t('请选择归属单位'), |
| | | checkStrictly: true, // 父子不联动 |
| | | immediate: true, // 按当前用户权限加载 |
| | | clearable: true, |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | label: t('站点类型'), |
| | | prop: 'siteType', |
| | | component: { |
| | | name: 'cl-select', |
| | | props: { |
| | | options: dict.get('sitetype'), |
| | | placeholder: t('请选择站点类型'), |
| | | clearable: true, |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | label: t('状态'), |
| | | prop: 'status', |
| | | component: { |
| | | name: 'cl-select', |
| | | props: { |
| | | options: options.status, |
| | | placeholder: t('请选择状态'), |
| | | clearable: true, |
| | | }, |
| | | }, |
| | | }, |
| | | { |
| | | label: t('关键字'), |
| | | prop: 'keyWord', |
| | | component: { |
| | | name: 'el-input', |
| | | props: { |
| | | placeholder: t('站点编码 / 名称 / 地址 / 负责人'), |
| | | clearable: true, |
| | | }, |
| | | }, |
| | | }, |
| | | ], |
| | | }); |
| | | |
| | | // cl-crud |
| | | const Crud = useCrud( |