| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- import { BasicColumn } from '/@/components/Table';
- import { FormSchema } from '/@/components/Table';
- import { useMineDepartmentStore } from '/@/store/modules/mine';
- // 3. 生成动态表格列(接收动态状态映射)
- export function getColumns(): BasicColumn[] {
- return [
- {
- title: '煤矿名称',
- dataIndex: 'mineName',
- width: 100,
- },
- {
- title: '图纸名称',
- dataIndex: 'fileName',
- width: 100,
- },
- {
- title: '图纸类型',
- dataIndex: 'fileType',
- width: 100,
- },
- {
- title: '更新时间',
- dataIndex: 'createTime',
- width: 100,
- },
- {
- title: '备注',
- dataIndex: 'remark',
- width: 100,
- },
- ];
- }
- // 4. 生成动态搜索表单配置
- export function getSearchFormSchema(): FormSchema[] {
- return [
- {
- field: 'deptId',
- label: '煤矿名称',
- component: 'MineCascader',
- colProps: { span: 6 },
- },
- {
- field: 'fileName',
- label: '图纸名称',
- component: 'Input',
- colProps: { span: 6 },
- },
- {
- field: 'fileType',
- label: '图纸分类',
- component: 'Select',
- componentProps: {
- options: [
- { label: '安全监控部署图', value: '安全监控部署图' },
- { label: '通风系统图', value: '通风系统图' },
- { label: '防灭火图', value: '防灭火图' },
- { label: '人员位置监测系统图', value: '人员位置监测系统图' },
- { label: '采掘工程平面图', value: '采掘工程平面图' },
- ],
- },
- colProps: { span: 6 },
- },
- ];
- }
- export const formSchema: FormSchema[] = [
- {
- label: '',
- field: 'id',
- component: 'Input',
- show: false,
- },
- {
- label: '',
- field: 'wjId',
- component: 'Input',
- show: false,
- },
- {
- label: '煤矿名称',
- field: 'mineCode',
- component: 'MineCascader',
- componentProps: {
- changeOnSelect: false,
- },
- required: true,
- dynamicRules: () => {
- //需要return
- return [
- {
- //默认开启表单检验
- required: true,
- // value 当前手机号输入的值
- validator: (_, value) => {
- //需要return 一个Promise对象
- const dept = useMineDepartmentStore().findDepartById(value);
- return new Promise((resolve, reject) => {
- if (!dept) {
- reject('请选择部门');
- }
- if (!dept?.isLeaf) {
- reject('请选择具体矿井');
- }
- resolve();
- });
- },
- },
- ];
- },
- },
- {
- label: '文件名称',
- field: 'fileName',
- component: 'Input',
- required: true,
- },
- {
- label: '文件类型',
- field: 'fileType',
- component: 'Select',
- componentProps: {
- options: [
- { label: '安全监控部署图', value: '安全监控部署图' },
- { label: '通风系统图', value: '通风系统图' },
- { label: '防灭火图', value: '防灭火图' },
- { label: '人员位置监测系统图', value: '人员位置监测系统图' },
- { label: '采掘工程平面图', value: '采掘工程平面图' },
- ],
- },
- required: true,
- },
- {
- label: '文件',
- field: 'fileAttach',
- component: 'Input',
- slot: 'fileupload',
- required: true,
- ifShow({ values }) {
- return !values.id;
- },
- },
- {
- label: '备注',
- field: 'remark',
- component: 'Input',
- },
- ];
- // 地图编辑弹框表单
- export const mapEditForm: FormSchema[] = [
- {
- field: 'mineCode',
- label: '煤矿编码',
- component: 'MineCascader',
- colProps: { span: 6 },
- groupName: '常规查询',
- // show: false,
- },
- {
- field: 'mineName',
- label: '煤矿名称',
- component: 'Input',
- colProps: { span: 6 },
- groupName: '常规查询',
- },
- {
- field: 'fileName',
- label: '图纸名称',
- component: 'Input',
- colProps: { span: 6 },
- groupName: '常规查询',
- },
- {
- field: 'fileType',
- label: '图纸类型',
- component: 'Select',
- componentProps: {
- options: [
- { label: '安全监控部署图', value: '安全监控部署图' },
- { label: '通风系统图', value: '通风系统图' },
- { label: '防灭火图', value: '防灭火图' },
- { label: '人员位置监测系统图', value: '人员位置监测系统图' },
- { label: '采掘工程平面图', value: '采掘工程平面图' },
- ],
- },
- colProps: { span: 6 },
- groupName: '常规查询',
- },
- {
- field: 'fileAttach',
- label: '附件',
- component: 'Upload',
- colProps: { span: 6 },
- groupName: '常规查询',
- },
- {
- field: 'remark',
- label: '备注',
- component: 'InputTextArea',
- colProps: { span: 6 },
- groupName: '常规查询',
- },
- ];
|