|
|
@@ -17,9 +17,9 @@
|
|
|
<button @click="handleEdit({ goafId: record.id, mineCode: last(expandedRowKeys) }, 'goaf')" class="action-btn">
|
|
|
<SvgIcon name="edit" />
|
|
|
</button>
|
|
|
- <button @click="handleAdd({ goafId: record.id, mineCode: last(expandedRowKeys) }, 'goaf')" class="action-btn ml-1">
|
|
|
+ <!-- <button @click="handleAdd({ goafId: record.id, mineCode: last(expandedRowKeys) }, 'goaf')" class="action-btn ml-1">
|
|
|
<PlusOutlined />
|
|
|
- </button>
|
|
|
+ </button> -->
|
|
|
<a-popconfirm title="确认删除?" @confirm="handleDelete(record, 'coal')">
|
|
|
<button @click="handleDelete(record, 'goaf')" class="action-btn ml-1">
|
|
|
<SvgIcon name="delete" />
|
|
|
@@ -33,9 +33,9 @@
|
|
|
<button @click="handleEdit({ coalSeamId: record.id, mineCode: record.mineCode }, 'coal')" class="action-btn">
|
|
|
<SvgIcon name="edit" />
|
|
|
</button>
|
|
|
- <button @click="handleAdd({ coalSeamId: record.id, mineCode: record.mineCode }, 'coal')" class="action-btn ml-1">
|
|
|
+ <!-- <button @click="handleAdd({ coalSeamId: record.id, mineCode: record.mineCode }, 'coal')" class="action-btn ml-1">
|
|
|
<PlusOutlined />
|
|
|
- </button>
|
|
|
+ </button> -->
|
|
|
<a-popconfirm title="确认删除?" @confirm="handleDelete(record, 'coal')">
|
|
|
<button class="action-btn ml-1">
|
|
|
<SvgIcon name="delete" />
|
|
|
@@ -73,6 +73,15 @@
|
|
|
</a-input-group>
|
|
|
</a-form-item>
|
|
|
</template>
|
|
|
+ <template #InputRangeGoaf="{ model, field, schema }">
|
|
|
+ <a-form-item v-if="model[field]">
|
|
|
+ <a-input-group>
|
|
|
+ <a-input-number v-model:value="model[field][`lowerLimit`]" style="width: calc(50% - 100px)" placeholder="-" />
|
|
|
+ <a-input style="width: 200px; border-left: 0; pointer-events: none; color: inherit" :value="schema.groupName" disabled />
|
|
|
+ <a-input-number v-model:value="model[field][`upperLimit`]" style="width: calc(50% - 100px); border-left: 0" placeholder="-" />
|
|
|
+ </a-input-group>
|
|
|
+ </a-form-item>
|
|
|
+ </template>
|
|
|
</BasicForm>
|
|
|
</BasicModal>
|
|
|
</template>
|
|
|
@@ -85,7 +94,7 @@
|
|
|
import { useForm, BasicForm } from '/@/components/Form';
|
|
|
import { BasicTable, useTable } from '/@/components/Table';
|
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
- import { columnsCoalAlarm, columnsGoafLimit, schemasCoalAlarm, schemasGoafLimit, searchFormSchema } from './algorithm.data';
|
|
|
+ import { columnsCoalAlarm, columnsGoafLimit, schemasCoalAlarm, schemasGoafLimit, searchFormSchema, goafAlarmModel } from './algorithm.data';
|
|
|
import {
|
|
|
addCoalSeamAlarmRule,
|
|
|
deleteCoalSeamAlarmRule,
|
|
|
@@ -99,9 +108,9 @@
|
|
|
getGoafDataLimit,
|
|
|
} from './algorithm.api';
|
|
|
import { Flex } from 'ant-design-vue';
|
|
|
- import { PlusOutlined } from '@ant-design/icons-vue';
|
|
|
- import { last } from 'lodash-es';
|
|
|
-
|
|
|
+ // import { PlusOutlined } from '@ant-design/icons-vue';
|
|
|
+ import { forEach, isNil, last, map } from 'lodash-es';
|
|
|
+ import { message } from 'ant-design-vue';
|
|
|
import { SvgIcon } from '/@/components/Icon';
|
|
|
|
|
|
const { prefixCls } = useDesign('algorithm-list');
|
|
|
@@ -165,8 +174,30 @@
|
|
|
'goaf',
|
|
|
{
|
|
|
schemas: schemasGoafLimit,
|
|
|
- submitFunc: (res) => (res.id ? updateGoafDataLimit(res) : addGoafDataLimit(res)),
|
|
|
- fetchRecord: (params) => getGoafDataLimit(params).then((r) => last(r)),
|
|
|
+ submitFunc: (res) =>
|
|
|
+ Promise.all(
|
|
|
+ map(res, (item) => {
|
|
|
+ if (item.id) {
|
|
|
+ return updateGoafDataLimit(item);
|
|
|
+ }
|
|
|
+ if (!isNil(item.lowerLimit) || !isNil(item.upperLimit)) {
|
|
|
+ return addGoafDataLimit(item);
|
|
|
+ }
|
|
|
+ return Promise.resolve();
|
|
|
+ })
|
|
|
+ ),
|
|
|
+ fetchRecord: (params) =>
|
|
|
+ getGoafDataLimit(params).then((r) => {
|
|
|
+ const result: any = {};
|
|
|
+ forEach(goafAlarmModel, (item, key) => {
|
|
|
+ result[key] = { ...params, ...item };
|
|
|
+ });
|
|
|
+ forEach(r, (item) => {
|
|
|
+ result[item.alarmField] = item;
|
|
|
+ });
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }),
|
|
|
},
|
|
|
],
|
|
|
]);
|
|
|
@@ -174,7 +205,7 @@
|
|
|
['coal', { title: '预警参数设置', visible: true, loading: true }],
|
|
|
['goaf', { title: '超限预警设置', visible: true, loading: true }],
|
|
|
]);
|
|
|
- const submitResolver = ref<(res: any) => Promise<void>>();
|
|
|
+ const submitResolver = ref<(res: any) => Promise<unknown>>();
|
|
|
// 点击编辑后,获取对应的表单和弹窗配置
|
|
|
async function handleEdit(record, sign: string) {
|
|
|
if (!modalPropsMap.has(sign)) return;
|
|
|
@@ -196,26 +227,26 @@
|
|
|
|
|
|
setModalProps({ loading: false });
|
|
|
}
|
|
|
- async function handleAdd(record, sign: string) {
|
|
|
- if (!modalPropsMap.has(sign)) return;
|
|
|
- if (!formPropsMap.has(sign)) return;
|
|
|
- setModalProps(modalPropsMap.get(sign) as ModalProps);
|
|
|
- const { schemas, submitFunc } = formPropsMap.get(sign)!;
|
|
|
- await nextTick();
|
|
|
- await resetSchema(schemas);
|
|
|
+ // async function handleAdd(record, sign: string) {
|
|
|
+ // if (!modalPropsMap.has(sign)) return;
|
|
|
+ // if (!formPropsMap.has(sign)) return;
|
|
|
+ // setModalProps(modalPropsMap.get(sign) as ModalProps);
|
|
|
+ // const { schemas, submitFunc } = formPropsMap.get(sign)!;
|
|
|
+ // await nextTick();
|
|
|
+ // await resetSchema(schemas);
|
|
|
|
|
|
- await nextTick();
|
|
|
+ // await nextTick();
|
|
|
|
|
|
- await resetFields();
|
|
|
+ // await resetFields();
|
|
|
|
|
|
- await nextTick();
|
|
|
+ // await nextTick();
|
|
|
|
|
|
- // 不要使用setFormProps因为它会错误的触发submit方法
|
|
|
- // await setFormProps({ submitFunc });
|
|
|
- submitResolver.value = (res) => submitFunc(Object.assign(res, record));
|
|
|
+ // // 不要使用setFormProps因为它会错误的触发submit方法
|
|
|
+ // // await setFormProps({ submitFunc });
|
|
|
+ // submitResolver.value = (res) => submitFunc(Object.assign(res, record));
|
|
|
|
|
|
- setModalProps({ loading: false });
|
|
|
- }
|
|
|
+ // setModalProps({ loading: false });
|
|
|
+ // }
|
|
|
|
|
|
const deletionPropsMap = new Map<string, { api: (id: string) => Promise<void> }>([
|
|
|
['coal', { api: (id) => deleteCoalSeamAlarmRule({ id }) }],
|
|
|
@@ -228,7 +259,7 @@
|
|
|
}
|
|
|
|
|
|
const [registerModal, { setModalProps }] = useModal();
|
|
|
- const [registerForm, { resetFields, setFieldsValue, validate, resetSchema }] = useForm({
|
|
|
+ const [registerForm, { setFieldsValue, validate, resetSchema }] = useForm({
|
|
|
model: {},
|
|
|
schemas: schemasCoalAlarm,
|
|
|
showResetButton: false,
|
|
|
@@ -239,7 +270,11 @@
|
|
|
|
|
|
function handleSubmit() {
|
|
|
return validate().then((res) => {
|
|
|
- submitResolver.value && submitResolver.value(res);
|
|
|
+ submitResolver.value &&
|
|
|
+ submitResolver.value(res).then(() => {
|
|
|
+ message.success('操作成功');
|
|
|
+ setModalProps({ visible: false });
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
</script>
|