快检实验方法新增
This commit is contained in:
@@ -1,64 +1,128 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
|
||||
|
||||
enum Api {
|
||||
|
||||
list = '/xslmes/mesXslRubberQuickTestMethod/list',
|
||||
|
||||
nextMethodCode = '/xslmes/mesXslRubberQuickTestMethod/nextMethodCode',
|
||||
|
||||
checkMethodName = '/xslmes/mesXslRubberQuickTestMethod/checkMethodName',
|
||||
|
||||
save = '/xslmes/mesXslRubberQuickTestMethod/add',
|
||||
|
||||
edit = '/xslmes/mesXslRubberQuickTestMethod/edit',
|
||||
|
||||
deleteOne = '/xslmes/mesXslRubberQuickTestMethod/delete',
|
||||
|
||||
deleteBatch = '/xslmes/mesXslRubberQuickTestMethod/deleteBatch',
|
||||
|
||||
importExcel = '/xslmes/mesXslRubberQuickTestMethod/importExcel',
|
||||
|
||||
exportXls = '/xslmes/mesXslRubberQuickTestMethod/exportXls',
|
||||
|
||||
queryById = '/xslmes/mesXslRubberQuickTestMethod/queryById',
|
||||
|
||||
queryLineList = '/xslmes/mesXslRubberQuickTestMethod/queryLineListByMethodId',
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
|
||||
|
||||
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
|
||||
|
||||
export const queryLineListByMethodId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
|
||||
|
||||
|
||||
|
||||
export const fetchNextMethodCode = () => defHttp.get({ url: Api.nextMethodCode }, { successMessageMode: 'none' });
|
||||
|
||||
|
||||
|
||||
export const checkMethodName = (params: { methodName: string; dataId?: string }) =>
|
||||
|
||||
defHttp.get(
|
||||
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
|
||||
|
||||
enum Api {
|
||||
|
||||
list = '/xslmes/mesXslRubberQuickTestMethod/list',
|
||||
|
||||
nextMethodCode = '/xslmes/mesXslRubberQuickTestMethod/nextMethodCode',
|
||||
|
||||
checkMethodName = '/xslmes/mesXslRubberQuickTestMethod/checkMethodName',
|
||||
|
||||
save = '/xslmes/mesXslRubberQuickTestMethod/add',
|
||||
|
||||
edit = '/xslmes/mesXslRubberQuickTestMethod/edit',
|
||||
|
||||
deleteOne = '/xslmes/mesXslRubberQuickTestMethod/delete',
|
||||
|
||||
deleteBatch = '/xslmes/mesXslRubberQuickTestMethod/deleteBatch',
|
||||
|
||||
importExcel = '/xslmes/mesXslRubberQuickTestMethod/importExcel',
|
||||
|
||||
exportXls = '/xslmes/mesXslRubberQuickTestMethod/exportXls',
|
||||
|
||||
queryById = '/xslmes/mesXslRubberQuickTestMethod/queryById',
|
||||
|
||||
queryLineList = '/xslmes/mesXslRubberQuickTestMethod/queryLineListByMethodId',
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
|
||||
|
||||
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
|
||||
|
||||
export const queryLineListByMethodId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
|
||||
|
||||
|
||||
|
||||
export const fetchNextMethodCode = () => defHttp.get({ url: Api.nextMethodCode }, { successMessageMode: 'none' });
|
||||
|
||||
|
||||
|
||||
export const checkMethodName = (params: { methodName: string; dataId?: string }) =>
|
||||
|
||||
defHttp.get(
|
||||
|
||||
{ url: Api.checkMethodName, params },
|
||||
|
||||
{
|
||||
|
||||
successMessageMode: 'none',
|
||||
|
||||
errorMessageMode: 'none',
|
||||
|
||||
},
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
export const deleteOne = (params, handleSuccess) => {
|
||||
|
||||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
|
||||
handleSuccess();
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
|
||||
createConfirm({
|
||||
|
||||
iconType: 'warning',
|
||||
|
||||
title: '确认删除',
|
||||
|
||||
content: '是否删除选中数据',
|
||||
|
||||
okText: '确认',
|
||||
|
||||
cancelText: '取消',
|
||||
|
||||
onOk: () => {
|
||||
|
||||
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
|
||||
handleSuccess();
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
|
||||
return defHttp.post({ url, params });
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,136 +1,272 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
|
||||
<template #tableTitle>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_rubber_quick_test_method:add'"
|
||||
|
||||
@click="handleAdd"
|
||||
|
||||
preIcon="ant-design:plus-outlined"
|
||||
|
||||
>
|
||||
|
||||
新增
|
||||
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_rubber_quick_test_method:exportXls'"
|
||||
|
||||
preIcon="ant-design:export-outlined"
|
||||
|
||||
@click="onExportXls"
|
||||
|
||||
>
|
||||
|
||||
导出
|
||||
|
||||
</a-button>
|
||||
|
||||
<j-upload-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_rubber_quick_test_method:importExcel'"
|
||||
|
||||
preIcon="ant-design:import-outlined"
|
||||
|
||||
@click="onImportXls"
|
||||
|
||||
>
|
||||
|
||||
导入
|
||||
|
||||
</j-upload-button>
|
||||
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
|
||||
<template #overlay>
|
||||
|
||||
<a-menu>
|
||||
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
|
||||
<Icon icon="ant-design:delete-outlined" />
|
||||
|
||||
删除
|
||||
|
||||
</a-menu-item>
|
||||
|
||||
</a-menu>
|
||||
|
||||
</template>
|
||||
|
||||
<a-button v-auth="'mes:mes_xsl_rubber_quick_test_method:deleteBatch'">
|
||||
|
||||
批量操作
|
||||
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
|
||||
</a-button>
|
||||
|
||||
</a-dropdown>
|
||||
|
||||
</template>
|
||||
|
||||
<template #action="{ record }">
|
||||
|
||||
<TableAction
|
||||
|
||||
:actions="[
|
||||
|
||||
{
|
||||
|
||||
label: '编辑',
|
||||
|
||||
onClick: handleEdit.bind(null, record),
|
||||
|
||||
auth: 'mes:mes_xsl_rubber_quick_test_method:edit',
|
||||
|
||||
},
|
||||
|
||||
]"
|
||||
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
</BasicTable>
|
||||
|
||||
<MesXslRubberQuickTestMethodModal @register="registerModal" @success="handleSuccess" />
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslRubberQuickTestMethod" setup>
|
||||
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
|
||||
import { useModal } from '/@/components/Modal';
|
||||
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
|
||||
import Icon from '/@/components/Icon';
|
||||
|
||||
import MesXslRubberQuickTestMethodModal from './components/MesXslRubberQuickTestMethodModal.vue';
|
||||
|
||||
import { columns, searchFormSchema } from './MesXslRubberQuickTestMethod.data';
|
||||
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberQuickTestMethod.api';
|
||||
|
||||
<template>
|
||||
|
||||
<div>
|
||||
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
|
||||
<template #tableTitle>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_rubber_quick_test_method:add'"
|
||||
|
||||
@click="handleAdd"
|
||||
|
||||
preIcon="ant-design:plus-outlined"
|
||||
|
||||
>
|
||||
|
||||
新增
|
||||
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_rubber_quick_test_method:exportXls'"
|
||||
|
||||
preIcon="ant-design:export-outlined"
|
||||
|
||||
@click="onExportXls"
|
||||
|
||||
>
|
||||
|
||||
导出
|
||||
|
||||
</a-button>
|
||||
|
||||
<j-upload-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_rubber_quick_test_method:importExcel'"
|
||||
|
||||
preIcon="ant-design:import-outlined"
|
||||
|
||||
@click="onImportXls"
|
||||
|
||||
>
|
||||
|
||||
导入
|
||||
|
||||
</j-upload-button>
|
||||
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
|
||||
<template #overlay>
|
||||
|
||||
<a-menu>
|
||||
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
|
||||
<Icon icon="ant-design:delete-outlined" />
|
||||
|
||||
删除
|
||||
|
||||
</a-menu-item>
|
||||
|
||||
</a-menu>
|
||||
|
||||
</template>
|
||||
|
||||
<a-button v-auth="'mes:mes_xsl_rubber_quick_test_method:deleteBatch'">
|
||||
|
||||
批量操作
|
||||
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
|
||||
</a-button>
|
||||
|
||||
</a-dropdown>
|
||||
|
||||
</template>
|
||||
|
||||
<template #action="{ record }">
|
||||
|
||||
<TableAction
|
||||
|
||||
:actions="[
|
||||
|
||||
{
|
||||
|
||||
label: '编辑',
|
||||
|
||||
onClick: handleEdit.bind(null, record),
|
||||
|
||||
auth: 'mes:mes_xsl_rubber_quick_test_method:edit',
|
||||
|
||||
},
|
||||
|
||||
]"
|
||||
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
</BasicTable>
|
||||
|
||||
<MesXslRubberQuickTestMethodModal @register="registerModal" @success="handleSuccess" />
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslRubberQuickTestMethod" setup>
|
||||
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
|
||||
import { useModal } from '/@/components/Modal';
|
||||
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
|
||||
import Icon from '/@/components/Icon';
|
||||
|
||||
import MesXslRubberQuickTestMethodModal from './components/MesXslRubberQuickTestMethodModal.vue';
|
||||
|
||||
import { columns, searchFormSchema } from './MesXslRubberQuickTestMethod.data';
|
||||
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberQuickTestMethod.api';
|
||||
|
||||
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
|
||||
tableProps: {
|
||||
|
||||
title: '胶料快检实验方法',
|
||||
|
||||
api: list,
|
||||
|
||||
columns,
|
||||
|
||||
canResize: true,
|
||||
|
||||
formConfig: {
|
||||
|
||||
schemas: searchFormSchema,
|
||||
|
||||
labelWidth: 120,
|
||||
|
||||
autoSubmitOnEnter: true,
|
||||
|
||||
showAdvancedButton: true,
|
||||
|
||||
},
|
||||
|
||||
actionColumn: {
|
||||
|
||||
width: 200,
|
||||
|
||||
fixed: 'right',
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
exportConfig: {
|
||||
|
||||
name: '胶料快检实验方法',
|
||||
|
||||
url: getExportUrl,
|
||||
|
||||
},
|
||||
|
||||
importConfig: {
|
||||
|
||||
url: getImportUrl,
|
||||
|
||||
success: handleSuccess,
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
|
||||
|
||||
function handleAdd() {
|
||||
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function handleDelete(record) {
|
||||
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function batchHandleDelete() {
|
||||
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function handleSuccess() {
|
||||
|
||||
selectedRowKeys.value = [];
|
||||
|
||||
reload();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getDropDownAction(record) {
|
||||
|
||||
return [
|
||||
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
|
||||
{
|
||||
|
||||
label: '删除',
|
||||
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
|
||||
auth: 'mes:mes_xsl_rubber_quick_test_method:delete',
|
||||
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,78 +1,156 @@
|
||||
<template>
|
||||
|
||||
<BasicModal v-bind="$attrs" :title="modalTitle" :width="1000" @register="registerModal" @ok="handleOk">
|
||||
|
||||
<BasicTable @register="registerTable" />
|
||||
|
||||
</BasicModal>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
|
||||
import { BasicTable, useTable } from '/@/components/Table';
|
||||
|
||||
import { list } from '/@/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.api';
|
||||
|
||||
|
||||
|
||||
const emit = defineEmits(['register', 'select']);
|
||||
|
||||
|
||||
|
||||
const filterQuickTestTypeId = ref('');
|
||||
|
||||
const selectedRows = ref<Recordable[]>([]);
|
||||
|
||||
|
||||
|
||||
const modalTitle = computed(() => '选择数据点(可多选)');
|
||||
|
||||
|
||||
|
||||
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||
|
||||
selectedRows.value = rows || [];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function fetchPointPage(params: Recordable) {
|
||||
|
||||
const p = { ...params };
|
||||
|
||||
if (filterQuickTestTypeId.value) {
|
||||
|
||||
p.quickTestTypeId = filterQuickTestTypeId.value;
|
||||
|
||||
}
|
||||
|
||||
return list(p);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({
|
||||
|
||||
api: fetchPointPage,
|
||||
|
||||
columns: [
|
||||
|
||||
{ title: '数据点名称', dataIndex: 'pointName', width: 160 },
|
||||
|
||||
{ title: '实验类型', dataIndex: 'quickTestTypeName', width: 140 },
|
||||
|
||||
{ title: '单位类型', dataIndex: 'unitType', width: 120 },
|
||||
|
||||
{ title: '描述', dataIndex: 'pointDesc', width: 200, ellipsis: true },
|
||||
|
||||
],
|
||||
|
||||
<template>
|
||||
|
||||
<BasicModal v-bind="$attrs" :title="modalTitle" :width="1000" @register="registerModal" @ok="handleOk">
|
||||
|
||||
<BasicTable @register="registerTable" />
|
||||
|
||||
</BasicModal>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
|
||||
import { BasicTable, useTable } from '/@/components/Table';
|
||||
|
||||
import { list } from '/@/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.api';
|
||||
|
||||
|
||||
|
||||
const emit = defineEmits(['register', 'select']);
|
||||
|
||||
|
||||
|
||||
const filterQuickTestTypeId = ref('');
|
||||
|
||||
const selectedRows = ref<Recordable[]>([]);
|
||||
|
||||
|
||||
|
||||
const modalTitle = computed(() => '选择数据点(可多选)');
|
||||
|
||||
|
||||
|
||||
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||
|
||||
selectedRows.value = rows || [];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function fetchPointPage(params: Recordable) {
|
||||
|
||||
const p = { ...params };
|
||||
|
||||
if (filterQuickTestTypeId.value) {
|
||||
|
||||
p.quickTestTypeId = filterQuickTestTypeId.value;
|
||||
|
||||
}
|
||||
|
||||
return list(p);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({
|
||||
|
||||
api: fetchPointPage,
|
||||
|
||||
columns: [
|
||||
|
||||
{ title: '数据点名称', dataIndex: 'pointName', width: 160 },
|
||||
|
||||
{ title: '实验类型', dataIndex: 'quickTestTypeName', width: 140 },
|
||||
|
||||
{ title: '单位类型', dataIndex: 'unitType', width: 120 },
|
||||
|
||||
{ title: '描述', dataIndex: 'pointDesc', width: 200, ellipsis: true },
|
||||
|
||||
],
|
||||
|
||||
rowKey: 'id',
|
||||
|
||||
useSearchForm: true,
|
||||
|
||||
formConfig: {
|
||||
|
||||
labelWidth: 90,
|
||||
|
||||
schemas: [
|
||||
|
||||
{ label: '数据点名称', field: 'pointName', component: 'Input', colProps: { span: 8 } },
|
||||
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
pagination: { pageSize: 10 },
|
||||
|
||||
canResize: false,
|
||||
|
||||
showIndexColumn: false,
|
||||
|
||||
immediate: true,
|
||||
|
||||
rowSelection: {
|
||||
|
||||
type: 'checkbox',
|
||||
|
||||
columnWidth: 48,
|
||||
|
||||
onChange: handleSelectionChange,
|
||||
|
||||
},
|
||||
|
||||
clickToRowSelect: true,
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
|
||||
filterQuickTestTypeId.value = data?.quickTestTypeId ? String(data.quickTestTypeId) : '';
|
||||
|
||||
selectedRows.value = [];
|
||||
|
||||
clearSelectedRowKeys?.();
|
||||
|
||||
setModalProps({ confirmLoading: false });
|
||||
|
||||
reload();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
async function handleOk() {
|
||||
|
||||
let rows = selectedRows.value?.length ? [...selectedRows.value] : ((getSelectRows?.() || []) as Recordable[]);
|
||||
|
||||
const valid = rows.filter((r) => r?.id && r.pointName != null);
|
||||
|
||||
if (!valid.length) {
|
||||
|
||||
closeModal();
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
emit('select', valid);
|
||||
|
||||
closeModal();
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user