feat(dry): 新增设备维护记录功能、新增维修记录功能、设备主数据增加履历相关字段
| | |
| | | dataIndex: 'type_dictText', |
| | | }, |
| | | { |
| | | title: 'å¶é å', |
| | | align: 'center', |
| | | dataIndex: 'manufacturer', |
| | | }, |
| | | { |
| | | title: 'è´å
¥æ¥æ', |
| | | align: 'center', |
| | | dataIndex: 'purchaseDate', |
| | | }, |
| | | { |
| | | title: 'å¯ç¨æ¥æ', |
| | | align: 'center', |
| | | dataIndex: 'startDate', |
| | | }, |
| | | { |
| | | title: 'å®è£
ä½ç½®', |
| | | align: 'center', |
| | | dataIndex: 'location', |
| | | }, |
| | | { |
| | | title: '设å¤ç¶æ', |
| | | align: 'center', |
| | | dataIndex: 'status', |
| | | customRender: ({text}) => { |
| | | // 0-'æ°å¢',1-'å¨ç¨', 2-'åç¨', 3-'ç»´ä¿®', 4-'æ¥åº' |
| | | const options = { |
| | | '0': 'æ°å¢', |
| | | '1': 'å¨ç¨', |
| | | '2': 'åç¨', |
| | | '3': 'ç»´ä¿®', |
| | | '4': 'æ¥åº' |
| | | }; |
| | | return options[text] || text; |
| | | } |
| | | }, |
| | | { |
| | | title: 'æ¥åºæ¥æ', |
| | | align: 'center', |
| | | dataIndex: 'scrapDate', |
| | | }, |
| | | { |
| | | title: 'è®¾å¤æè¿°', |
| | | align: 'center', |
| | | dataIndex: 'remark', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | label: 'å¶é å', |
| | | field: 'manufacturer', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'è´å
¥æ¥æ', |
| | | field: 'purchaseDate', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | valueFormat: 'YYYY-MM-DD', |
| | | format: 'YYYY-MM-DD' |
| | | }, |
| | | }, |
| | | { |
| | | label: 'å¯ç¨æ¥æ', |
| | | field: 'startDate', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | valueFormat: 'YYYY-MM-DD', |
| | | format: 'YYYY-MM-DD' |
| | | }, |
| | | }, |
| | | { |
| | | label: 'å®è£
ä½ç½®', |
| | | field: 'location', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: '设å¤ç¶æ', |
| | | field: 'status', |
| | | component: 'Select', |
| | | componentProps: { |
| | | options: [ // 'å¨ä¿','æä¿','å£ä¿','å¹´ä¿' |
| | | { label: 'æ°å¢', value: '0' }, |
| | | { label: 'å¨ç¨', value: '1' }, |
| | | { label: 'åç¨', value: '2' }, |
| | | { label: 'ç»´ä¿®', value: '3' }, |
| | | { label: 'æ¥åº', value: '4' } |
| | | ] |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ¥åºæ¥æ', |
| | | field: 'scrapDate', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | valueFormat: 'YYYY-MM-DD', |
| | | format: 'YYYY-MM-DD' |
| | | }, |
| | | }, |
| | | { |
| | | label: '设å¤IP', |
| | | field: 'ip', |
| | | component: 'Input', |
| | |
| | | componentProps: { |
| | | dictCode: 'dry_eqp_type,name,id,tenant_id=' + getTenantId(), |
| | | }, |
| | | dynamicRules: ({ model, schema }) => { |
| | | dynamicRules: ({ }) => { |
| | | return [{ required: true, message: '请è¾å
¥è®¾å¤ç±»å!' }] |
| | | }, |
| | | }, |
| | |
| | | componentProps: { |
| | | dictCode: 'dry_shop,name,id,tenant_id=' + getTenantId(), |
| | | }, |
| | | dynamicRules: ({ model, schema }) => { |
| | | dynamicRules: ({ }) => { |
| | | return [{ required: true, message: '请è¾å
¥è½¦é´id!' }] |
| | | }, |
| | | }, |
| | |
| | | field: 'enable', |
| | | component: 'JSwitch', |
| | | componentProps: {}, |
| | | dynamicRules: ({ model, schema }) => { |
| | | dynamicRules: ({ }) => { |
| | | return [{ required: true, message: '请è¾å
¥å¯ç¨ç¶æ!' }] |
| | | }, |
| | | }, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {defHttp} from '/@/utils/http/axios'; |
| | | import { useMessage } from "/@/hooks/web/useMessage"; |
| | | |
| | | const { createConfirm } = useMessage(); |
| | | |
| | | enum Api { |
| | | list = '/dry/dryMaintenanceRecord/list', |
| | | save='/dry/dryMaintenanceRecord/add', |
| | | edit='/dry/dryMaintenanceRecord/edit', |
| | | deleteOne = '/dry/dryMaintenanceRecord/delete', |
| | | deleteBatch = '/dry/dryMaintenanceRecord/deleteBatch', |
| | | importExcel = '/dry/dryMaintenanceRecord/importExcel', |
| | | exportXls = '/dry/dryMaintenanceRecord/exportXls', |
| | | generateMaintenanceNo = '/dry/dryMaintenanceRecord/generateMaintenanceNo' |
| | | } |
| | | /** |
| | | * 导åºapi |
| | | * @param params |
| | | */ |
| | | export const getExportUrl = Api.exportXls; |
| | | /** |
| | | * 导å
¥api |
| | | */ |
| | | export const getImportUrl = Api.importExcel; |
| | | /** |
| | | * å表æ¥å£ |
| | | * @param params |
| | | */ |
| | | export const list = (params) => { |
| | | if (params.planNumber) { |
| | | params.relatedOrder = params.planNumber; |
| | | delete params.planNumber; |
| | | } |
| | | return defHttp.get({url: Api.list, params}); |
| | | }; |
| | | |
| | | /** |
| | | * å é¤å个 |
| | | */ |
| | | export const deleteOne = (params,handleSuccess) => { |
| | | return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { |
| | | handleSuccess(); |
| | | }); |
| | | } |
| | | /** |
| | | * æ¹éå é¤ |
| | | * @param params |
| | | */ |
| | | 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(); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | /** |
| | | * ä¿åæè
æ´æ° |
| | | * @param params |
| | | */ |
| | | export const saveOrUpdate = (params, isUpdate) => { |
| | | let url = isUpdate ? Api.edit : Api.save; |
| | | return defHttp.post({url: url, params}); |
| | | } |
| | | /** |
| | | * çæä¿å
»åç¼å· |
| | | */ |
| | | export const generateMaintenanceNo = () => { |
| | | return defHttp.get({url: Api.generateMaintenanceNo},{ successMessageMode: 'none' }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {BasicColumn} from '/@/components/Table'; |
| | | import {FormSchema} from '/@/components/Table'; |
| | | import { rules} from '/@/utils/helper/validator'; |
| | | import { render } from '/@/utils/common/renderUtils'; |
| | | //åè¡¨æ°æ® |
| | | export const columns: BasicColumn[] = [ |
| | | { |
| | | title: 'ä¿å
»ç¼å·', |
| | | align:"center", |
| | | dataIndex: 'planNumber' |
| | | }, |
| | | { |
| | | title: '设å¤ç¼å·', |
| | | align:"center", |
| | | dataIndex: 'equipmentId_dictText' |
| | | }, |
| | | { |
| | | title: 'ä¿å
»å¨æ', |
| | | align:"center", |
| | | dataIndex: 'cycle', |
| | | |
| | | }, |
| | | { |
| | | title: 'ä¿å
»æ¶é´', |
| | | align:"center", |
| | | dataIndex: 'maintDate', |
| | | customRender:({text}) =>{ |
| | | return !text?"":(text.length>10?text.substr(0,10):text) |
| | | }, |
| | | }, |
| | | { |
| | | title: 'ä¿å
»äººå', |
| | | align:"center", |
| | | dataIndex: 'technician' |
| | | }, |
| | | { |
| | | title: 'ä¿å
Ȍ
容', |
| | | align:"center", |
| | | dataIndex: 'content' |
| | | }, |
| | | { |
| | | title: 'å¤ä»¶ä½¿ç¨æ
åµ', |
| | | align:"center", |
| | | dataIndex: 'spareParts' |
| | | }, |
| | | { |
| | | title: '夿³¨', |
| | | align:"center", |
| | | dataIndex: 'remark' |
| | | }, |
| | | ]; |
| | | //æ¥è¯¢æ°æ® |
| | | export const searchFormSchema: FormSchema[] = [ |
| | | { |
| | | label: "设å¤ç¼å·", |
| | | field: 'equipmentId', |
| | | component: 'JDictSelectTag', |
| | | componentProps:{ |
| | | dictCode:"dry_equipment,name,id" |
| | | }, |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: 'ä¿å
»å¨æ', |
| | | field: 'cycle', |
| | | component: 'JDictSelectTag', |
| | | componentProps:{ |
| | | options: [ // 'å¨ä¿','æä¿','å£ä¿','å¹´ä¿' |
| | | { label: 'å¨ä¿', value: 'å¨ä¿' }, |
| | | { label: 'æä¿', value: 'æä¿' }, |
| | | { label: 'å£ä¿', value: 'å£ä¿' }, |
| | | { label: 'å¹´ä¿', value: 'å¹´ä¿' } |
| | | ] |
| | | }, |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: "ä¿å
»æ¶é´", |
| | | field: 'maintDate', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | showTime:true, |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss' |
| | | }, |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: "ä¿å
»äººå", |
| | | field: 'technician', |
| | | component: 'Input', |
| | | colProps: {span: 6}, |
| | | }, |
| | | ]; |
| | | //è¡¨åæ°æ® |
| | | export const formSchema: FormSchema[] = [ |
| | | { |
| | | label: 'ä¿å
»ç¼å·', |
| | | field: 'planNumber', |
| | | component: 'Input', |
| | | dynamicDisabled:true |
| | | }, |
| | | { |
| | | label: '设å¤ç¼å·', |
| | | field: 'equipmentId', |
| | | component: 'JDictSelectTag', |
| | | componentProps:{ |
| | | dictCode:"dry_equipment,name,id" |
| | | }, |
| | | rules: [{ required: true, message: 'è¯·éæ©è®¾å¤ç¼å·' }], |
| | | }, |
| | | { |
| | | label: 'ä¿å
»å¨æ', |
| | | field: 'cycle', |
| | | component: 'JDictSelectTag', |
| | | componentProps:{ |
| | | options: [ // 'å¨ä¿','æä¿','å£ä¿','å¹´ä¿' |
| | | { label: 'å¨ä¿', value: 'å¨ä¿' }, |
| | | { label: 'æä¿', value: 'æä¿' }, |
| | | { label: 'å£ä¿', value: 'å£ä¿' }, |
| | | { label: 'å¹´ä¿', value: 'å¹´ä¿' } |
| | | ] |
| | | }, |
| | | rules: [{ required: true, message: 'è¯·éæ©ä¿å
»å¨æ' }], |
| | | }, |
| | | { |
| | | label: 'ä¿å
»æ¶é´', |
| | | field: 'maintDate', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | showTime: true, |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss' |
| | | }, |
| | | rules: [{ required: true, message: 'è¯·éæ©ä¿å
»æ¶é´' }], |
| | | }, |
| | | { |
| | | label: 'ä¿å
»äººå', |
| | | field: 'technician', |
| | | component: 'Input', |
| | | rules: [{ required: true, message: '请è¾å
¥ä¿å
»äººå' }], |
| | | }, |
| | | { |
| | | label: 'ä¿å
Ȍ
容', |
| | | field: 'content', |
| | | component: 'InputTextArea', |
| | | rules: [{ required: true, message: '请è¾å
¥ä¿å
Ȍ
容' }], |
| | | }, |
| | | { |
| | | label: 'å¤ä»¶ä½¿ç¨æ
åµ', |
| | | field: 'spareParts', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: '夿³¨', |
| | | field: 'remark', |
| | | component: 'Input', |
| | | }, |
| | | // TODO 主é®éèåæ®µï¼ç®ååæ»ä¸ºID |
| | | { |
| | | label: '', |
| | | field: 'id', |
| | | component: 'Input', |
| | | show: false |
| | | }, |
| | | ]; |
| | | |
| | | |
| | | |
| | | /** |
| | | * æµç¨è¡¨åè°ç¨è¿ä¸ªæ¹æ³è·åformSchema |
| | | * @param param |
| | | */ |
| | | export function getBpmFormSchema(_formData): FormSchema[]{ |
| | | // é»è®¤ååå§è¡¨åä¿æä¸è´ 妿æµç¨ä¸é
ç½®äºæéæ°æ®ï¼è¿ééè¦åç¬å¤çformSchema |
| | | return formSchema; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <!--å¼ç¨è¡¨æ ¼--> |
| | | <BasicTable @register="registerTable" :rowSelection="rowSelection"> |
| | | <!--ææ§½:tableæ é¢--> |
| | | <template #tableTitle> |
| | | <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> æ°å¢</a-button> |
| | | <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导åº</a-button> |
| | | <j-upload-button type="primary" 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"></Icon> |
| | | å é¤ |
| | | </a-menu-item> |
| | | </a-menu> |
| | | </template> |
| | | <a-button>æ¹éæä½ |
| | | <Icon icon="mdi:chevron-down"></Icon> |
| | | </a-button> |
| | | </a-dropdown> |
| | | </template> |
| | | <!--æä½æ --> |
| | | <template #action="{ record }"> |
| | | <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> |
| | | </template> |
| | | <!--åæ®µåæ¾ææ§½--> |
| | | <template #htmlSlot="{text}"> |
| | | <div v-html="text"></div> |
| | | </template> |
| | | <!--çå¸åºåæ®µåæ¾ææ§½--> |
| | | <template #pcaSlot="{text}"> |
| | | {{ getAreaTextByCode(text) }} |
| | | </template> |
| | | <template #fileSlot="{text}"> |
| | | <span v-if="!text" style="font-size: 12px;font-style: italic;">æ æä»¶</span> |
| | | <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">ä¸è½½</a-button> |
| | | </template> |
| | | </BasicTable> |
| | | <!-- 表ååºå --> |
| | | <DryMaintenanceRecordModal @register="registerModal" @success="handleSuccess"></DryMaintenanceRecordModal> |
| | | </div> |
| | | <!--åè¡¨è¡¨æ ¼tab--> |
| | | <a-tabs defaultActiveKey="1" style="margin: 10px"> |
| | | <a-tab-pane tab="使ç¨å¤ä»¶å表" key="1" forceRender> |
| | | <DrySpareStockLogListRepair /> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | </template> |
| | | |
| | | <script lang="ts" name="dry-dryMaintenanceRecord" setup> |
| | | import {ref, computed, unref, provide} from 'vue'; |
| | | import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
| | | import {useModal} from '/@/components/Modal'; |
| | | import { useListPage } from '/@/hooks/system/useListPage' |
| | | import DryMaintenanceRecordModal from './components/DryMaintenanceRecordModal.vue' |
| | | import DrySpareStockLogListRepair from '../repair/DrySpareStockLogListRepair.vue'; |
| | | import {columns, searchFormSchema} from './DryMaintenanceRecord.data'; |
| | | import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './DryMaintenanceRecord.api'; |
| | | import { downloadFile } from '/@/utils/common/renderUtils'; |
| | | const checkedKeys = ref<Array<string | number>>([]); |
| | | //注åmodel |
| | | const [registerModal, {openModal}] = useModal(); |
| | | const selectedRows = ref<Array<any>>([]); // æ°å¢ï¼ç¨äºåå¨éä¸çè¡æ°æ® |
| | | //注åtableæ°æ® |
| | | const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ |
| | | tableProps:{ |
| | | title: 'dry_maintenance_record', |
| | | api: list, |
| | | columns, |
| | | canResize:false, |
| | | formConfig: { |
| | | //labelWidth: 120, |
| | | schemas: searchFormSchema, |
| | | autoSubmitOnEnter:true, |
| | | showAdvancedButton:true, |
| | | fieldMapToNumber: [ |
| | | ], |
| | | fieldMapToTime: [ |
| | | ], |
| | | }, |
| | | actionColumn: { |
| | | width: 120, |
| | | fixed:'right' |
| | | }, |
| | | rowSelection: { |
| | | type: 'radio', |
| | | onChange: (selectedRowKeyList: (string | number)[], selectedRowList: any[]) => { |
| | | selectedRowKeys.value = selectedRowKeyList; |
| | | selectedRows.value = selectedRowList; |
| | | }, |
| | | }, |
| | | customRow: (record) => { |
| | | return { |
| | | onClick: () => { |
| | | if (selectedRowKeys.value.includes(record.id)) { |
| | | selectedRowKeys.value = []; |
| | | selectedRows.value = []; |
| | | } else { |
| | | selectedRowKeys.value = [record.id]; |
| | | selectedRows.value = [record]; |
| | | } |
| | | }, |
| | | }; |
| | | }, |
| | | }, |
| | | exportConfig: { |
| | | name:"dry_maintenance_record", |
| | | url: getExportUrl, |
| | | }, |
| | | importConfig: { |
| | | url: getImportUrl, |
| | | success: handleSuccess |
| | | }, |
| | | }) |
| | | |
| | | const [registerTable, {reload, updateTableDataRecord},{ rowSelection, selectedRowKeys }] = tableContext |
| | | |
| | | const planNumber = computed(() => ( |
| | | unref(selectedRows).length > 0 ? unref(selectedRows)[0].planNumber : '1')) |
| | | ; |
| | | //ä¸å planNumber,åç»ä»¶æ¥æ¶ |
| | | provide('orderNumber', planNumber); |
| | | |
| | | /** |
| | | * æ°å¢äºä»¶ |
| | | */ |
| | | 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 getTableAction(record){ |
| | | return [ |
| | | { |
| | | label: 'ç¼è¾', |
| | | onClick: handleEdit.bind(null, record), |
| | | } |
| | | ] |
| | | } |
| | | /** |
| | | * 䏿æä½æ |
| | | */ |
| | | function getDropDownAction(record){ |
| | | return [ |
| | | { |
| | | label: '详æ
', |
| | | onClick: handleDetail.bind(null, record), |
| | | }, { |
| | | label: 'å é¤', |
| | | popConfirm: { |
| | | title: 'æ¯å¦ç¡®è®¤å é¤', |
| | | confirm: handleDelete.bind(null, record), |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- 注æï¼è¯¥é¡µé¢å¯¹åºçåå°ç®å½ä¸ºviews/dryæä»¶å¤¹ä¸ |
| | | -- å¦æä½ æ³æ´æ¹å°å
¶ä»ç®å½ï¼è¯·ä¿®æ¹sqlä¸componentåæ®µå¯¹åºçå¼ |
| | | |
| | | |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) |
| | | VALUES ('2025072104423690330', NULL, 'dry_maintenance_record', '/dry/dryMaintenanceRecordList', 'dry/maint/DryMaintenanceRecordList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-07-21 16:42:33', NULL, NULL, 0); |
| | | |
| | | -- æéæ§å¶sql |
| | | -- æ°å¢ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072104423690331', '2025072104423690330', 'æ·»å dry_maintenance_record', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_maintenance_record:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-21 16:42:33', NULL, NULL, 0, 0, '1', 0); |
| | | -- ç¼è¾ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072104423690332', '2025072104423690330', 'ç¼è¾dry_maintenance_record', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_maintenance_record:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-21 16:42:33', NULL, NULL, 0, 0, '1', 0); |
| | | -- å é¤ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072104423690333', '2025072104423690330', 'å é¤dry_maintenance_record', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_maintenance_record:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-21 16:42:33', NULL, NULL, 0, 0, '1', 0); |
| | | -- æ¹éå é¤ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072104423690334', '2025072104423690330', 'æ¹éå é¤dry_maintenance_record', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_maintenance_record:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-21 16:42:33', NULL, NULL, 0, 0, '1', 0); |
| | | -- 导åºexcel |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072104423690335', '2025072104423690330', '导åºexcel_dry_maintenance_record', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_maintenance_record:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-21 16:42:33', NULL, NULL, 0, 0, '1', 0); |
| | | -- 导å
¥excel |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072104423690336', '2025072104423690330', '导å
¥excel_dry_maintenance_record', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_maintenance_record:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-21 16:42:33', NULL, NULL, 0, 0, '1', 0); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="min-height: 400px"> |
| | | <BasicForm @register="registerForm"></BasicForm> |
| | | <div style="width: 100%;text-align: center" v-if="!formDisabled"> |
| | | <a-button @click="submitForm" pre-icon="ant-design:check" type="primary">æ 交</a-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import {BasicForm, useForm} from '/@/components/Form/index'; |
| | | import {computed, defineComponent} from 'vue'; |
| | | import {defHttp} from '/@/utils/http/axios'; |
| | | import { propTypes } from '/@/utils/propTypes'; |
| | | import {getBpmFormSchema} from '../DryMaintenanceRecord.data'; |
| | | import {saveOrUpdate} from '../DryMaintenanceRecord.api'; |
| | | |
| | | export default defineComponent({ |
| | | name: "DryMaintenanceRecordForm", |
| | | components:{ |
| | | BasicForm |
| | | }, |
| | | props:{ |
| | | formData: propTypes.object.def({}), |
| | | formBpm: propTypes.bool.def(true), |
| | | }, |
| | | setup(props){ |
| | | const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ |
| | | labelWidth: 150, |
| | | schemas: getBpmFormSchema(props.formData), |
| | | showActionButtonGroup: false, |
| | | baseColProps: {span: 12} |
| | | }); |
| | | |
| | | const formDisabled = computed(()=>{ |
| | | if(props.formData.disabled === false){ |
| | | return false; |
| | | } |
| | | return true; |
| | | }); |
| | | |
| | | let formData = {}; |
| | | const queryByIdUrl = '/dry/dryMaintenanceRecord/queryById'; |
| | | async function initFormData(){ |
| | | let params = {id: props.formData.dataId}; |
| | | const data = await defHttp.get({url: queryByIdUrl, params}); |
| | | formData = {...data} |
| | | //设置表åçå¼ |
| | | await setFieldsValue(formData); |
| | | //é»è®¤æ¯ç¦ç¨ |
| | | await setProps({disabled: formDisabled.value}) |
| | | } |
| | | |
| | | async function submitForm() { |
| | | let data = getFieldsValue(); |
| | | let params = Object.assign({}, formData, data); |
| | | console.log('è¡¨åæ°æ®', params) |
| | | await saveOrUpdate(params, true) |
| | | } |
| | | |
| | | initFormData(); |
| | | |
| | | return { |
| | | registerForm, |
| | | formDisabled, |
| | | submitForm, |
| | | } |
| | | } |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="896" @ok="handleSubmit"> |
| | | <BasicForm @register="registerForm"/> |
| | | </BasicModal> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import {ref, computed, unref} from 'vue'; |
| | | import {BasicModal, useModalInner} from '/@/components/Modal'; |
| | | import {BasicForm, useForm} from '/@/components/Form/index'; |
| | | import {formSchema} from '../DryMaintenanceRecord.data'; |
| | | import {saveOrUpdate, generateMaintenanceNo} from '../DryMaintenanceRecord.api'; |
| | | // Emits声æ |
| | | const emit = defineEmits(['register','success']); |
| | | const isUpdate = ref(true); |
| | | //表åé
ç½® |
| | | const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ |
| | | //labelWidth: 150, |
| | | schemas: formSchema, |
| | | showActionButtonGroup: false, |
| | | baseColProps: {span: 24} |
| | | }); |
| | | //表åèµå¼ |
| | | const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { |
| | | //é置表å |
| | | await resetFields(); |
| | | setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); |
| | | isUpdate.value = !!data?.isUpdate; |
| | | if (unref(isUpdate)) { |
| | | //表åèµå¼ |
| | | await setFieldsValue({ |
| | | ...data.record, |
| | | }); |
| | | } else { |
| | | // æ°å¢æ¨¡å¼ä¸çæä¿å
»åç¼å· |
| | | const result = await generateMaintenanceNo(); |
| | | await setFieldsValue({ |
| | | planNumber: result, |
| | | }); |
| | | } |
| | | // éèåºé¨æ¶ç¦ç¨æ´ä¸ªè¡¨å |
| | | setProps({ disabled: !data?.showFooter }) |
| | | }); |
| | | //设置æ é¢ |
| | | const title = computed(() => (!unref(isUpdate) ? 'æ°å¢' : 'ç¼è¾')); |
| | | //表åæäº¤äºä»¶ |
| | | async function handleSubmit(v) { |
| | | try { |
| | | let values = await validate(); |
| | | setModalProps({confirmLoading: true}); |
| | | //æäº¤è¡¨å |
| | | await saveOrUpdate(values, isUpdate.value); |
| | | //å
³éå¼¹çª |
| | | closeModal(); |
| | | //å·æ°å表 |
| | | emit('success'); |
| | | } finally { |
| | | setModalProps({confirmLoading: false}); |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | /** æ¶é´åæ°åè¾å
¥æ¡æ ·å¼ */ |
| | | :deep(.ant-input-number){ |
| | | width: 100% |
| | | } |
| | | |
| | | :deep(.ant-calendar-picker){ |
| | | width: 100% |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <!--å¼ç¨è¡¨æ ¼--> |
| | | <BasicTable @register="registerTable" :rowSelection="rowSelection" :search-info="searchInfo"> |
| | | <!--ææ§½:tableæ é¢--> |
| | | <template #tableTitle> |
| | | <a-button type="primary" @click="handleCreate" preIcon="ant-design:plus-outlined"> æ°å¢</a-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"></Icon> |
| | | å é¤ |
| | | </a-menu-item> |
| | | |
| | | </a-menu> |
| | | </template> |
| | | <a-button>æ¹éæä½ |
| | | <Icon icon="mdi:chevron-down"></Icon> |
| | | </a-button> |
| | | </a-dropdown> |
| | | </template> |
| | | <!--æä½æ --> |
| | | <!-- <template #action="{ record }"> |
| | | <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> |
| | | </template> --> |
| | | |
| | | </BasicTable> |
| | | <!-- 表ååºå --> |
| | | <DrySpareStockLogModal @register="registerModal" @success="handleSuccess"></DrySpareStockLogModal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts" name="dry-drySpareStockLogRepair" setup> |
| | | import {ref, computed, unref, inject, watch, nextTick} from 'vue'; |
| | | import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
| | | import {useModal} from '/@/components/Modal'; |
| | | import {useMessage} from '/@/hooks/web/useMessage'; |
| | | import { useListPage } from '/@/hooks/system/useListPage' |
| | | import DrySpareStockLogModal from '../spareParts/components/DrySpareStockLogModal.vue' |
| | | import {columns, searchFormSchema} from '../spareParts/DrySpareStockLog.data'; |
| | | import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from '../spareParts/DrySpareStockLog.api'; |
| | | import { downloadFile } from '/src/utils/common/renderUtils'; |
| | | import {isEmpty} from "/src/utils/is"; |
| | | const checkedKeys = ref<Array<string | number>>([]); |
| | | //注åmodel |
| | | |
| | | const [registerModal, {openModal}] = useModal(); |
| | | const searchInfo = {}; |
| | | |
| | | // ä»ç¶ç»ä»¶æ³¨å
¥ orderNumber |
| | | const orderNumber = inject('orderNumber', ''); // ä¿æå称为repairRecordIdï¼ä½å®é
ä¼ éçæ¯orderNumber |
| | | |
| | | //注åtableæ°æ® |
| | | const { prefixCls,tableContext } = useListPage({ |
| | | tableProps:{ |
| | | title: 'åºå
¥åºè®°å½è¡¨', |
| | | api: list, |
| | | columns, |
| | | canResize:false, |
| | | useSearchForm:false, |
| | | formConfig: { |
| | | //labelWidth: 120, |
| | | schemas: searchFormSchema, |
| | | autoSubmitOnEnter:true, |
| | | showAdvancedButton:true, |
| | | fieldMapToNumber: [ |
| | | ], |
| | | fieldMapToTime: [ |
| | | ], |
| | | }, |
| | | // actionColumn: { |
| | | // width: 120, |
| | | // fixed:'right' |
| | | // }, |
| | | showActionColumn: false, |
| | | // æ ¹æ® orderNumber è¿æ»¤æ°æ® |
| | | beforeFetch: (params) => { |
| | | console.log('beforeFetch', params, orderNumber.value) |
| | | return Object.assign(params, { orderNumber: unref(orderNumber) }); |
| | | }, |
| | | }, |
| | | exportConfig: { |
| | | name:"åºå
¥åºè®°å½è¡¨", |
| | | url: getExportUrl, |
| | | }, |
| | | importConfig: { |
| | | url: getImportUrl, |
| | | success: handleSuccess |
| | | }, |
| | | }) |
| | | |
| | | const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext |
| | | |
| | | // çå¬ orderNumber ååï¼éæ°å è½½è¡¨æ ¼æ°æ® |
| | | watch(orderNumber, () => { |
| | | reload(); |
| | | }); |
| | | |
| | | /** |
| | | * æ°å¢äºä»¶ |
| | | */ |
| | | function handleCreate() { |
| | | console.log('handleCreate', unref(orderNumber)); |
| | | const {createMessage} = useMessage(); |
| | | if (isEmpty(unref(orderNumber)) || orderNumber.value === '1') { // æ£æ¥orderNumberæ¯å¦ä¸ºç©º |
| | | createMessage.warning('è¯·éæ©ä¸ä¸ªç»´ä¿®å'); |
| | | return; |
| | | } |
| | | nextTick(() => { |
| | | console.log('handleCreate', unref(orderNumber)); |
| | | openModal(true, { |
| | | isUpdate: false, |
| | | showFooter: true, |
| | | stockType: 'out', |
| | | relatedOrder: unref(orderNumber), // ä¼ é orderNumber |
| | | }); |
| | | }); |
| | | } |
| | | /** |
| | | * ç¼è¾äºä»¶ |
| | | */ |
| | | 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 getTableAction(record){ |
| | | // return [ |
| | | // { |
| | | // label: 'ç¼è¾', |
| | | // onClick: handleEdit.bind(null, record), |
| | | // } |
| | | // ] |
| | | // } |
| | | // /** |
| | | // * 䏿æä½æ |
| | | // */ |
| | | // function getDropDownAction(record){ |
| | | // return [ |
| | | // { |
| | | // label: '详æ
', |
| | | // onClick: handleDetail.bind(null, record), |
| | | // }, { |
| | | // label: 'å é¤', |
| | | // popConfirm: { |
| | | // title: 'æ¯å¦ç¡®è®¤å é¤', |
| | | // confirm: handleDelete.bind(null, record), |
| | | // } |
| | | // } |
| | | // ] |
| | | // } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {defHttp} from '/@/utils/http/axios'; |
| | | import { useMessage } from "/@/hooks/web/useMessage"; |
| | | |
| | | const { createConfirm } = useMessage(); |
| | | |
| | | enum Api { |
| | | list = '/dry/drySpareParts/list', |
| | | save='/dry/drySpareParts/add', |
| | | edit='/dry/drySpareParts/edit', |
| | | deleteOne = '/dry/drySpareParts/delete', |
| | | deleteBatch = '/dry/drySpareParts/deleteBatch', |
| | | importExcel = '/dry/drySpareParts/importExcel', |
| | | exportXls = '/dry/drySpareParts/exportXls', |
| | | addStock = '/dry/drySpareParts/addStock', |
| | | reduceStock = '/dry/drySpareParts/reduceStock', |
| | | } |
| | | /** |
| | | * 导åºapi |
| | | * @param params |
| | | */ |
| | | export const getExportUrl = Api.exportXls; |
| | | /** |
| | | * 导å
¥api |
| | | */ |
| | | export const getImportUrl = Api.importExcel; |
| | | /** |
| | | * å表æ¥å£ |
| | | * @param params |
| | | */ |
| | | export const list = (params) => |
| | | defHttp.get({url: Api.list, params}); |
| | | |
| | | /** |
| | | * å é¤å个 |
| | | */ |
| | | export const deleteOne = (params,handleSuccess) => { |
| | | return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { |
| | | handleSuccess(); |
| | | }); |
| | | } |
| | | /** |
| | | * æ¹éå é¤ |
| | | * @param params |
| | | */ |
| | | 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(); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | /** |
| | | * ä¿åæè
æ´æ° |
| | | * @param params |
| | | */ |
| | | export const saveOrUpdate = (params, isUpdate) => { |
| | | let url = isUpdate ? Api.edit : Api.save; |
| | | return defHttp.post({url: url, params}); |
| | | } |
| | | |
| | | /** |
| | | * å¢å åºå |
| | | * @param params |
| | | */ |
| | | export const addStock = (params) => { |
| | | return defHttp.post({url: Api.addStock, params}); |
| | | } |
| | | |
| | | /** |
| | | * åå°åºå |
| | | * @param params |
| | | */ |
| | | export const reduceStock = (params) => { |
| | | return defHttp.post({url: Api.reduceStock, params}); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {BasicColumn} from '/@/components/Table'; |
| | | import {FormSchema} from '/@/components/Table'; |
| | | import { rules} from '/@/utils/helper/validator'; |
| | | import { render } from '/@/utils/common/renderUtils'; |
| | | //åè¡¨æ°æ® |
| | | export const columns: BasicColumn[] = [ |
| | | { |
| | | title: 'é¶ä»¶ç¼å·', |
| | | align:"center", |
| | | dataIndex: 'partNumber' |
| | | }, |
| | | { |
| | | title: 'é¶ä»¶åç§°', |
| | | align:"center", |
| | | dataIndex: 'partName' |
| | | }, |
| | | { |
| | | title: 'åç±»', |
| | | align:"center", |
| | | dataIndex: 'category', |
| | | customRender: ({ text }) => { |
| | | // æºæ¢°ç±»ï¼å¦è½´æ¿ã齿轮ã龿¡çã |
| | | // çµæ°ç±»ï¼å¦ç»§çµå¨ãæ¥è§¦å¨ãçµç¼çã |
| | | // æ¶²åç±»ï¼å¦æ³µãéãæ²¹ç®¡çã |
| | | // æ°å¨ç±»ï¼å¦æ°ç¼¸ãçµç£éã空æ°è¿æ»¤å¨çã |
| | | // çµåç±»ï¼å¦çµè·¯æ¿ãä¼ æå¨ãæ¾ç¤ºå¨çã |
| | | return render.renderSwitch(text, [ |
| | | { text: 'æºæ¢°ç±»', value: '0' }, |
| | | { text: 'çµæ°ç±»', value: '1' }, |
| | | { text: 'æ¶²åç±»', value: '2' }, |
| | | { text: 'æ°å¨ç±»', value: '3' }, |
| | | { text: 'çµåç±»', value: '4' }, |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: 'è§æ ¼åå·', |
| | | align:"center", |
| | | dataIndex: 'specModel' |
| | | }, |
| | | { |
| | | title: 'åä½', |
| | | align:"center", |
| | | dataIndex: 'unit', |
| | | customRender: ({ text }) => { |
| | | // 个/ä»¶ï¼éç¨äºå¤§å¤æ°ç¬ç«çé¶é¨ä»¶ï¼å¦èºä¸ãèºå¸½ãç»§çµå¨çã |
| | | // ç±³ï¼mï¼ï¼éå线æç±»äº§åï¼å¦çµçº¿ãçµç¼ã管éçã |
| | | // å
¬æ¤ï¼kgï¼ï¼ç¨äºè¡¡éééè¾å¤§çæææäº§åï¼ä¾å¦æ¶¦æ»æ²¹ãéå±åçã |
| | | // åï¼Lï¼ï¼æ¶²ä½ç±»ç©èµï¼å¦æºæ²¹ãå·å´æ¶²çã |
| | | // å¥ï¼å
å«å¤ä¸ªç¸å
³å°é¨ä»¶ç»æçéåä½ï¼å¦å·¥å
·å¥è£
ãç»´ä¿®å
çã |
| | | // å·ï¼æäºé¿æ¡å½¢ä¸é¾ä»¥ç²¾ç¡®è®¡æ°çç©åï¼å¦è¶å¸¦ãç»ç¼å¸¦çã |
| | | // ç»ï¼ç±è¥å¹²ä¸ªç¸åæä¸åç±»åçå
ä»¶ç»æçåè½åå
ï¼å¦ä¸ç»çµæ± ãä¸å¥éé¨ç»çã |
| | | |
| | | return render.renderSwitch(text, [ |
| | | { text: '个/件', value: '0' }, |
| | | { text: 'ç±³ï¼mï¼', value: '1' }, |
| | | { text: 'å
¬æ¤ï¼kgï¼', value: '2' }, |
| | | { text: 'åï¼Lï¼', value: '3' }, |
| | | { text: 'å¥', value: '4' }, |
| | | { text: 'å·', value: '5' }, |
| | | { text: 'ç»', value: '6' }, |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: 'ä¾åºå', |
| | | align:"center", |
| | | dataIndex: 'supplier' |
| | | }, |
| | | { |
| | | title: 'æä½åºå', |
| | | align:"center", |
| | | dataIndex: 'minStock' |
| | | }, |
| | | { |
| | | title: 'å®å
¨åºå', |
| | | align:"center", |
| | | dataIndex: 'safeStock' |
| | | }, |
| | | { |
| | | title: 'åºä½', |
| | | align:"center", |
| | | dataIndex: 'location' |
| | | }, |
| | | { |
| | | title: 'å½ååºå', |
| | | align:"center", |
| | | dataIndex: 'currentStock' |
| | | }, |
| | | { |
| | | title: 'å»ç»åºå', |
| | | align:"center", |
| | | dataIndex: 'frozenStock' |
| | | }, |
| | | { |
| | | title: '夿³¨', |
| | | align:"center", |
| | | dataIndex: 'remark' |
| | | }, |
| | | { |
| | | title: 'ç¶æ', |
| | | align:"center", |
| | | dataIndex: 'status', |
| | | customRender: ({ text }) => { |
| | | // 'å¯ç¨', 'å»ç»', 'æ¥åº' |
| | | return render.renderSwitch(text, [ |
| | | { text: 'å¯ç¨', value: '0' }, |
| | | { text: 'å»ç»', value: '1' }, |
| | | { text: 'æ¥åº', value: '2' }, |
| | | ]) |
| | | }, |
| | | }, |
| | | ]; |
| | | //æ¥è¯¢æ°æ® |
| | | export const searchFormSchema: FormSchema[] = [ |
| | | { |
| | | label: "é¶ä»¶ç¼å·", |
| | | field: 'partNumber', |
| | | component: 'Input', |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: "é¶ä»¶åç§°", |
| | | field: 'partName', |
| | | component: 'Input', |
| | | colProps: {span: 6}, |
| | | }, |
| | | ]; |
| | | //è¡¨åæ°æ® |
| | | export const formSchema: FormSchema[] = [ |
| | | { |
| | | label: 'é¶ä»¶ç¼å·', |
| | | field: 'partNumber', |
| | | component: 'Input', |
| | | dynamicRules: ({model,schema}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥é¶ä»¶ç¼å·!'}, |
| | | {...rules.duplicateCheckRule('dry_spare_parts', 'part_number',model,schema)[0]}, |
| | | ]; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'é¶ä»¶åç§°', |
| | | field: 'partName', |
| | | component: 'Input', |
| | | dynamicRules: ({}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥é¶ä»¶åç§°!'}, |
| | | ]; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'åç±»', |
| | | field: 'category', |
| | | component: 'Select', |
| | | componentProps:{ |
| | | options: [ |
| | | { label: 'æºæ¢°ç±»', value: '0' }, |
| | | { label: 'çµæ°ç±»', value: '1' }, |
| | | { label: 'æ¶²åç±»', value: '2' }, |
| | | { label: 'æ°å¨ç±»', value: '3' }, |
| | | { label: 'çµåç±»', value: '4' }, |
| | | ] |
| | | }, |
| | | dynamicRules: ({}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥åç±»!'}, |
| | | ]; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'è§æ ¼åå·', |
| | | field: 'specModel', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'åä½', |
| | | field: 'unit', |
| | | component: 'Select', |
| | | |
| | | componentProps:{ |
| | | options: [ |
| | | { label: '个/件', value: '0' }, |
| | | { label: 'ç±³ï¼mï¼', value: '1' }, |
| | | { label: 'å
¬æ¤ï¼kgï¼', value: '2' }, |
| | | { label: 'åï¼Lï¼', value: '3' }, |
| | | { label: 'å¥', value: '4' }, |
| | | { label: 'å·', value: '5' }, |
| | | { label: 'ç»', value: '6' }, |
| | | ] |
| | | }, |
| | | dynamicRules: ({}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥åä½!'}, |
| | | ]; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'ä¾åºå', |
| | | field: 'supplier', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'æä½åºå', |
| | | field: 'minStock', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'å®å
¨åºå', |
| | | field: 'safeStock', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'åºä½', |
| | | field: 'location', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'å½ååºå', |
| | | field: 'currentStock', |
| | | component: 'InputNumber', |
| | | dynamicRules: ({}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥å½ååºå!'}, |
| | | ]; |
| | | }, |
| | | }, |
| | | { |
| | | label: 'å»ç»åºå', |
| | | field: 'frozenStock', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: '夿³¨', |
| | | field: 'remark', |
| | | component: 'InputTextArea', |
| | | }, |
| | | { |
| | | label: 'ç¶æ', |
| | | field: 'status', |
| | | component: 'Select', |
| | | defaultValue: '0', |
| | | componentProps:{ |
| | | options: [ |
| | | { label: 'å¯ç¨', value: '0' }, |
| | | { label: 'å»ç»', value: '1' }, |
| | | { label: 'æ¥åº', value: '2' }, |
| | | ] |
| | | }, |
| | | dynamicRules: ({}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥ç¶æ!'}, |
| | | ]; |
| | | }, |
| | | }, |
| | | // TODO 主é®éèåæ®µï¼ç®ååæ»ä¸ºID |
| | | { |
| | | label: '', |
| | | field: 'id', |
| | | component: 'Input', |
| | | show: false |
| | | }, |
| | | ]; |
| | | |
| | | |
| | | |
| | | /** |
| | | * æµç¨è¡¨åè°ç¨è¿ä¸ªæ¹æ³è·åformSchema |
| | | * @param param |
| | | */ |
| | | export function getBpmFormSchema(_formData): FormSchema[]{ |
| | | // é»è®¤ååå§è¡¨åä¿æä¸è´ 妿æµç¨ä¸é
ç½®äºæéæ°æ®ï¼è¿ééè¦åç¬å¤çformSchema |
| | | return formSchema; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <!--å¼ç¨è¡¨æ ¼--> |
| | | <BasicTable @register="registerTable" :rowSelection="rowSelection"> |
| | | <!--ææ§½:tableæ é¢--> |
| | | <template #tableTitle> |
| | | <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> æ°å¢</a-button> |
| | | <a-button type="primary" @click="handleStockIn" preIcon="ant-design:download-outlined"> å
¥åº</a-button> |
| | | <a-button type="primary" @click="handleStockOut" preIcon="ant-design:upload-outlined"> åºåº</a-button> |
| | | <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导åº</a-button> |
| | | <j-upload-button type="primary" 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"></Icon> |
| | | å é¤ |
| | | </a-menu-item> |
| | | </a-menu> |
| | | </template> |
| | | <a-button>æ¹éæä½ |
| | | <Icon icon="mdi:chevron-down"></Icon> |
| | | </a-button> |
| | | </a-dropdown> |
| | | </template> |
| | | <!--æä½æ --> |
| | | <template #action="{ record }"> |
| | | <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> |
| | | </template> |
| | | <!--åæ®µåæ¾ææ§½--> |
| | | <template #htmlSlot="{text}"> |
| | | <div v-html="text"></div> |
| | | </template> |
| | | |
| | | <template #fileSlot="{text}"> |
| | | <span v-if="!text" style="font-size: 12px;font-style: italic;">æ æä»¶</span> |
| | | <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">ä¸è½½</a-button> |
| | | </template> |
| | | </BasicTable> |
| | | <!-- 表ååºå --> |
| | | <DrySparePartsModal @register="registerModal" @success="handleSuccess"></DrySparePartsModal> |
| | | <DrySpareStockLogModal @register="registerStockLogModal" @success="handleSuccess"></DrySpareStockLogModal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts" name="dry-drySpareParts" setup> |
| | | import {ref, computed, unref} from 'vue'; |
| | | import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
| | | import {useModal} from '/@/components/Modal'; |
| | | import { useListPage } from '/@/hooks/system/useListPage' |
| | | import DrySparePartsModal from './components/DrySparePartsModal.vue' |
| | | import DrySpareStockLogModal from './components/DrySpareStockLogModal.vue' |
| | | import {columns, searchFormSchema} from './DrySpareParts.data'; |
| | | import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './DrySpareParts.api'; |
| | | import { downloadFile } from '/@/utils/common/renderUtils'; |
| | | const checkedKeys = ref<Array<string | number>>([]); |
| | | //注åmodel |
| | | const [registerModal, {openModal}] = useModal(); |
| | | const [registerStockLogModal, {openModal: openStockLogModal}] = useModal(); |
| | | //注åtableæ°æ® |
| | | const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ |
| | | tableProps:{ |
| | | title: 'å¤åå¤ä»¶', |
| | | api: list, |
| | | columns, |
| | | canResize:false, |
| | | formConfig: { |
| | | //labelWidth: 120, |
| | | schemas: searchFormSchema, |
| | | autoSubmitOnEnter:true, |
| | | showAdvancedButton:true, |
| | | fieldMapToNumber: [ |
| | | ], |
| | | fieldMapToTime: [ |
| | | ], |
| | | }, |
| | | actionColumn: { |
| | | width: 120, |
| | | 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 handleStockIn() { |
| | | openStockLogModal(true, { |
| | | isUpdate: false, |
| | | showFooter: true, |
| | | stockType: 'in' |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * åºåºäºä»¶ |
| | | */ |
| | | function handleStockOut() { |
| | | openStockLogModal(true, { |
| | | isUpdate: false, |
| | | showFooter: true, |
| | | stockType: 'out' |
| | | }); |
| | | } |
| | | /** |
| | | * ç¼è¾äºä»¶ |
| | | */ |
| | | 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 getTableAction(record){ |
| | | return [ |
| | | { |
| | | label: 'ç¼è¾', |
| | | onClick: handleEdit.bind(null, record), |
| | | } |
| | | ] |
| | | } |
| | | /** |
| | | * 䏿æä½æ |
| | | */ |
| | | function getDropDownAction(record){ |
| | | return [ |
| | | { |
| | | label: '详æ
', |
| | | onClick: handleDetail.bind(null, record), |
| | | }, { |
| | | label: 'å é¤', |
| | | popConfirm: { |
| | | title: 'æ¯å¦ç¡®è®¤å é¤', |
| | | confirm: handleDelete.bind(null, record), |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- 注æï¼è¯¥é¡µé¢å¯¹åºçåå°ç®å½ä¸ºviews/dryæä»¶å¤¹ä¸ |
| | | -- å¦æä½ æ³æ´æ¹å°å
¶ä»ç®å½ï¼è¯·ä¿®æ¹sqlä¸componentåæ®µå¯¹åºçå¼ |
| | | |
| | | |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) |
| | | VALUES ('2025072308576550150', NULL, 'å¤åå¤ä»¶', '/dry/drySparePartsList', 'dry/spareParts/DrySparePartsList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-07-23 08:57:15', NULL, NULL, 0); |
| | | |
| | | -- æéæ§å¶sql |
| | | -- æ°å¢ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072308576550151', '2025072308576550150', 'æ·»å å¤åå¤ä»¶', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_parts:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:15', NULL, NULL, 0, 0, '1', 0); |
| | | -- ç¼è¾ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072308576550152', '2025072308576550150', 'ç¼è¾å¤åå¤ä»¶', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_parts:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:15', NULL, NULL, 0, 0, '1', 0); |
| | | -- å é¤ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072308576550153', '2025072308576550150', 'å é¤å¤åå¤ä»¶', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_parts:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:15', NULL, NULL, 0, 0, '1', 0); |
| | | -- æ¹éå é¤ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072308576550154', '2025072308576550150', 'æ¹éå é¤å¤åå¤ä»¶', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_parts:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:15', NULL, NULL, 0, 0, '1', 0); |
| | | -- 导åºexcel |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072308576550155', '2025072308576550150', '导åºexcel_å¤åå¤ä»¶', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_parts:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:15', NULL, NULL, 0, 0, '1', 0); |
| | | -- 导å
¥excel |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('2025072308576550156', '2025072308576550150', '导å
¥excel_å¤åå¤ä»¶', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_parts:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:15', NULL, NULL, 0, 0, '1', 0); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {defHttp} from '/@/utils/http/axios'; |
| | | import {addStock, reduceStock} from './DrySpareParts.api'; |
| | | import { useMessage } from "/@/hooks/web/useMessage"; |
| | | |
| | | const { createConfirm } = useMessage(); |
| | | |
| | | enum Api { |
| | | list = '/dry/drySpareStockLog/list', |
| | | save='/dry/drySpareStockLog/add', |
| | | edit='/dry/drySpareStockLog/edit', |
| | | deleteOne = '/dry/drySpareStockLog/delete', |
| | | deleteBatch = '/dry/drySpareStockLog/deleteBatch', |
| | | importExcel = '/dry/drySpareStockLog/importExcel', |
| | | exportXls = '/dry/drySpareStockLog/exportXls', |
| | | generateStockNo = '/dry/drySpareStockLog/generateStockNo', |
| | | } |
| | | /** |
| | | * 导åºapi |
| | | * @param params |
| | | */ |
| | | export const getExportUrl = Api.exportXls; |
| | | /** |
| | | * 导å
¥api |
| | | */ |
| | | export const getImportUrl = Api.importExcel; |
| | | /** |
| | | * å表æ¥å£ |
| | | * @param params |
| | | */ |
| | | export const list = (params) => { |
| | | if (params.orderNumber) { |
| | | return defHttp.get({url: Api.list, params: { ...params, relatedOrder: params.orderNumber }}); |
| | | } else { |
| | | return defHttp.get({url: Api.list, params}); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * å é¤å个 |
| | | */ |
| | | export const deleteOne = (params,handleSuccess) => { |
| | | return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { |
| | | handleSuccess(); |
| | | }); |
| | | } |
| | | /** |
| | | * æ¹éå é¤ |
| | | * @param params |
| | | */ |
| | | 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(); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | /** |
| | | * ä¿åæè
æ´æ° |
| | | * @param params |
| | | */ |
| | | export const saveOrUpdate = (params, isUpdate) => { |
| | | let url = isUpdate ? Api.edit : Api.save; |
| | | // æ ¹æ®æä½ç±»åæ´æ°åºå |
| | | // if (params.operationType === '0') { // å
¥åº |
| | | // // è°ç¨å¤åå¤ä»¶çæ´æ°æ¥å£ï¼å¢å åºå |
| | | // addStock({partNumber: params.partNumber, quantity: params.quantity}); |
| | | // } else if (params.operationType === '1') { // åºåº |
| | | // // è°ç¨å¤åå¤ä»¶çæ´æ°æ¥å£ï¼åå°åºå |
| | | // reduceStock({partNumber: params.partNumber, quantity: params.quantity}); |
| | | // } |
| | | return defHttp.post({url: url, params}); |
| | | } |
| | | |
| | | /** |
| | | * çæåºå
¥åºåå· |
| | | * @param type åå·ç±»åï¼CKï¼åºåºï¼æ RKï¼å
¥åºï¼ |
| | | */ |
| | | export const generateStockNo = (type) => defHttp.get({url: Api.generateStockNo, params: {type}},{ successMessageMode: 'none' }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { BasicColumn } from '/@/components/Table' |
| | | import { FormSchema } from '/@/components/Table' |
| | | //åè¡¨æ°æ® |
| | | export const columns: BasicColumn[] = [ |
| | | { |
| | | title: 'æä½ç¼å·', |
| | | align: 'center', |
| | | dataIndex: 'operationNumber', |
| | | }, |
| | | { |
| | | title: 'é¶ä»¶ç¼å·', |
| | | align: 'center', |
| | | dataIndex: 'partNumber_dictText', |
| | | }, |
| | | { |
| | | title: 'æä½ç±»å', |
| | | align: 'center', |
| | | dataIndex: 'operationType', |
| | | customRender: ({ text }) => { |
| | | // 'å
¥åº', 'åºåº', 'è°æ¨', 'æ¥åº' |
| | | const options = { |
| | | '0': 'å
¥åº', |
| | | '1': 'åºåº', |
| | | '2': 'è°æ¨', |
| | | '3': 'æ¥åº', |
| | | } |
| | | return options[text] || text |
| | | }, |
| | | }, |
| | | { |
| | | title: 'æ°é', |
| | | align: 'center', |
| | | dataIndex: 'quantity', |
| | | }, |
| | | // { |
| | | // title: 'æä½æ¶é´', |
| | | // align: 'center', |
| | | // dataIndex: 'operationTime', |
| | | // customRender: ({ text }) => { |
| | | // return !text ? '' : text.length > 10 ? text.substr(0, 10) : text |
| | | // }, |
| | | // }, |
| | | // { |
| | | // title: 'æä½äºº', |
| | | // align: 'center', |
| | | // dataIndex: 'operator', |
| | | // }, |
| | | // { |
| | | // title: 'å
³èåå·ï¼å¦ç»´ä¿®åå·ï¼', |
| | | // align: 'center', |
| | | // dataIndex: 'relatedOrder', |
| | | // }, |
| | | // { |
| | | // title: 'åºä½', |
| | | // align: 'center', |
| | | // dataIndex: 'location', |
| | | // }, |
| | | { |
| | | title: '夿³¨', |
| | | align: 'center', |
| | | dataIndex: 'remark', |
| | | }, |
| | | ] |
| | | //æ¥è¯¢æ°æ® |
| | | export const searchFormSchema: FormSchema[] = [ |
| | | { |
| | | label: 'é¶ä»¶ç¼å·', |
| | | field: 'partNumber', |
| | | component: 'JDictSelectTag', |
| | | componentProps: { |
| | | dictCode: 'dry_spare_parts,part_name,part_number', |
| | | }, |
| | | colProps: { span: 6 }, |
| | | }, |
| | | { |
| | | label: 'æä½ç±»å', |
| | | field: 'operationType', |
| | | component: 'JDictSelectTag', |
| | | componentProps: { |
| | | options: [ |
| | | { label: 'å
¥åº', value: '0' }, |
| | | { label: 'åºåº', value: '1' }, |
| | | { label: 'è°æ¨', value: '2' }, |
| | | { label: 'æ¥åº', value: '3' }, |
| | | ], |
| | | }, |
| | | colProps: { span: 6 }, |
| | | }, |
| | | ] |
| | | //è¡¨åæ°æ® |
| | | export const formSchema = (params): FormSchema[] => { |
| | | const { isUpdate, stockType } = params |
| | | return [ |
| | | |
| | | { |
| | | label: 'åºå
¥åºåå·', |
| | | field: 'operationNumber', |
| | | component: 'Input', |
| | | dynamicDisabled: ({}) => { |
| | | return true |
| | | }, |
| | | dynamicRules: ({}) => { |
| | | return [ |
| | | { required: !isUpdate, message: '请è¾å
¥åºå
¥åºåå·!' }, |
| | | ] |
| | | }, |
| | | }, |
| | | { |
| | | label: 'é¶ä»¶ç¼å·', |
| | | field: 'partNumber', |
| | | component: 'JDictSelectTag', |
| | | componentProps: { |
| | | dictCode: 'dry_spare_parts,part_name,part_number', |
| | | }, |
| | | dynamicRules: ({}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥é¶ä»¶ç¼å·!' }, // å§ç»å¿
å¡« |
| | | ] |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æä½ç±»å', |
| | | field: 'operationType', |
| | | component: 'JDictSelectTag', |
| | | defaultValue: stockType === 'in' ? '0' : stockType === 'out' ? '1' : undefined, |
| | | componentProps: { |
| | | options: [ |
| | | { label: 'å
¥åº', value: '0' }, |
| | | { label: 'åºåº', value: '1' }, |
| | | { label: 'è°æ¨', value: '2' }, |
| | | { label: 'æ¥åº', value: '3' }, |
| | | ], |
| | | }, |
| | | dynamicRules: ({}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥æä½ç±»å!' }, // å§ç»å¿
å¡« |
| | | ] |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ°é', |
| | | field: 'quantity', |
| | | component: 'Input', |
| | | dynamicRules: ({}) => { |
| | | return [ |
| | | { required: true, message: '请è¾å
¥æ°é!' }, // å§ç»å¿
å¡« |
| | | { pattern: /^[0-9]*$/, message: '请è¾å
¥æ°å!' }, |
| | | { |
| | | validator: (_, value) => { |
| | | if (stockType === 'in' && parseFloat(value) <= 0) { |
| | | return Promise.reject('å
¥åºæ°éå¿
须大äº0') |
| | | } |
| | | if (stockType === 'out' && parseFloat(value) <= 0) { |
| | | return Promise.reject('åºåºæ°éå¿
须大äº0') |
| | | } |
| | | return Promise.resolve() |
| | | }, |
| | | trigger: 'change', |
| | | }, |
| | | ] |
| | | }, |
| | | }, |
| | | // { |
| | | // label: 'æä½æ¶é´', |
| | | // field: 'operationTime', |
| | | // component: 'DatePicker', |
| | | // }, |
| | | // { |
| | | // label: 'æä½äºº', |
| | | // field: 'operator', |
| | | // component: 'Input', |
| | | // }, |
| | | { |
| | | label: 'å
³èåå·ï¼å¦ç»´ä¿®åå·ï¼', |
| | | field: 'relatedOrder', |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | // { |
| | | // label: 'åºä½', |
| | | // field: 'location', |
| | | // component: 'Input', |
| | | // }, |
| | | { |
| | | label: '夿³¨', |
| | | field: 'remark', |
| | | component: 'InputTextArea', |
| | | }, |
| | | // TODO 主é®éèåæ®µï¼ç®ååæ»ä¸ºID |
| | | { |
| | | label: '', |
| | | field: 'id', |
| | | component: 'Input', |
| | | show: false, |
| | | }, |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * æµç¨è¡¨åè°ç¨è¿ä¸ªæ¹æ³è·åformSchema |
| | | * @param param |
| | | */ |
| | | export function getBpmFormSchema(_formData): FormSchema[] { |
| | | // é»è®¤ååå§è¡¨åä¿æä¸è´ 妿æµç¨ä¸é
ç½®äºæéæ°æ®ï¼è¿ééè¦åç¬å¤çformSchema |
| | | return formSchema(_formData); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <!--å¼ç¨è¡¨æ ¼--> |
| | | <BasicTable @register="registerTable" :rowSelection="rowSelection"> |
| | | <!--ææ§½:tableæ é¢--> |
| | | <template #tableTitle> |
| | | <!-- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> æ°å¢</a-button> --> |
| | | <!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导åº</a-button> |
| | | <j-upload-button type="primary" 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"></Icon> |
| | | å é¤ |
| | | </a-menu-item> |
| | | </a-menu> |
| | | </template> |
| | | <a-button>æ¹éæä½ |
| | | <Icon icon="mdi:chevron-down"></Icon> |
| | | </a-button> |
| | | </a-dropdown> |
| | | </template> |
| | | <!--æä½æ --> |
| | | <template #action="{ record }"> |
| | | <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> |
| | | </template> |
| | | <!--åæ®µåæ¾ææ§½--> |
| | | <template #htmlSlot="{text}"> |
| | | <div v-html="text"></div> |
| | | </template> |
| | | <template #fileSlot="{text}"> |
| | | <span v-if="!text" style="font-size: 12px;font-style: italic;">æ æä»¶</span> |
| | | <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">ä¸è½½</a-button> |
| | | </template> |
| | | </BasicTable> |
| | | <!-- 表ååºå --> |
| | | <DrySpareStockLogModal @register="registerModal" @success="handleSuccess"></DrySpareStockLogModal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts" name="dry-drySpareStockLog" setup> |
| | | import {ref, computed, unref} from 'vue'; |
| | | import {BasicTable, useTable, TableAction} from '/@/components/Table'; |
| | | import {useModal} from '/@/components/Modal'; |
| | | import { useListPage } from '/@/hooks/system/useListPage' |
| | | import DrySpareStockLogModal from './components/DrySpareStockLogModal.vue' |
| | | import {columns, searchFormSchema} from './DrySpareStockLog.data'; |
| | | import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './DrySpareStockLog.api'; |
| | | import { downloadFile } from '/@/utils/common/renderUtils'; |
| | | const checkedKeys = ref<Array<string | number>>([]); |
| | | //注åmodel |
| | | const [registerModal, {openModal}] = useModal(); |
| | | //注åtableæ°æ® |
| | | const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ |
| | | tableProps:{ |
| | | title: 'åºå
¥åºè®°å½è¡¨', |
| | | api: list, |
| | | columns, |
| | | canResize:false, |
| | | formConfig: { |
| | | //labelWidth: 120, |
| | | schemas: searchFormSchema, |
| | | autoSubmitOnEnter:true, |
| | | showAdvancedButton:true, |
| | | fieldMapToNumber: [ |
| | | ], |
| | | fieldMapToTime: [ |
| | | ], |
| | | }, |
| | | actionColumn: { |
| | | width: 120, |
| | | fixed:'right' |
| | | }, |
| | | showActionColumn: false |
| | | }, |
| | | 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 getTableAction(record){ |
| | | return [ |
| | | { |
| | | label: 'ç¼è¾', |
| | | onClick: handleEdit.bind(null, record), |
| | | } |
| | | ] |
| | | } |
| | | /** |
| | | * 䏿æä½æ |
| | | */ |
| | | function getDropDownAction(record){ |
| | | return [ |
| | | { |
| | | label: '详æ
', |
| | | onClick: handleDetail.bind(null, record), |
| | | }, { |
| | | label: 'å é¤', |
| | | popConfirm: { |
| | | title: 'æ¯å¦ç¡®è®¤å é¤', |
| | | confirm: handleDelete.bind(null, record), |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | |
| | | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- 注æï¼è¯¥é¡µé¢å¯¹åºçåå°ç®å½ä¸ºviews/dryæä»¶å¤¹ä¸ |
| | | -- å¦æä½ æ³æ´æ¹å°å
¶ä»ç®å½ï¼è¯·ä¿®æ¹sqlä¸componentåæ®µå¯¹åºçå¼ |
| | | |
| | | |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external) |
| | | VALUES ('202507230857430230', NULL, 'åºå
¥åºè®°å½è¡¨', '/dry/drySpareStockLogList', 'dry/spareParts/DrySpareStockLogList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2025-07-23 08:57:23', NULL, NULL, 0); |
| | | |
| | | -- æéæ§å¶sql |
| | | -- æ°å¢ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('202507230857430231', '202507230857430230', 'æ·»å åºå
¥åºè®°å½è¡¨', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_stock_log:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:23', NULL, NULL, 0, 0, '1', 0); |
| | | -- ç¼è¾ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('202507230857430232', '202507230857430230', 'ç¼è¾åºå
¥åºè®°å½è¡¨', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_stock_log:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:23', NULL, NULL, 0, 0, '1', 0); |
| | | -- å é¤ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('202507230857430233', '202507230857430230', 'å é¤åºå
¥åºè®°å½è¡¨', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_stock_log:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:23', NULL, NULL, 0, 0, '1', 0); |
| | | -- æ¹éå é¤ |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('202507230857430234', '202507230857430230', 'æ¹éå é¤åºå
¥åºè®°å½è¡¨', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_stock_log:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:23', NULL, NULL, 0, 0, '1', 0); |
| | | -- 导åºexcel |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('202507230857430235', '202507230857430230', '导åºexcel_åºå
¥åºè®°å½è¡¨', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_stock_log:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:23', NULL, NULL, 0, 0, '1', 0); |
| | | -- 导å
¥excel |
| | | INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external) |
| | | VALUES ('202507230857430236', '202507230857430230', '导å
¥excel_åºå
¥åºè®°å½è¡¨', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_spare_stock_log:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2025-07-23 08:57:23', NULL, NULL, 0, 0, '1', 0); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="min-height: 400px"> |
| | | <BasicForm @register="registerForm"></BasicForm> |
| | | <div style="width: 100%;text-align: center" v-if="!formDisabled"> |
| | | <a-button @click="submitForm" pre-icon="ant-design:check" type="primary">æ 交</a-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import {BasicForm, useForm} from '/@/components/Form/index'; |
| | | import {computed, defineComponent} from 'vue'; |
| | | import {defHttp} from '/@/utils/http/axios'; |
| | | import { propTypes } from '/@/utils/propTypes'; |
| | | import {getBpmFormSchema} from '../DrySpareParts.data'; |
| | | import {saveOrUpdate} from '../DrySpareParts.api'; |
| | | |
| | | export default defineComponent({ |
| | | name: "DrySparePartsForm", |
| | | components:{ |
| | | BasicForm |
| | | }, |
| | | props:{ |
| | | formData: propTypes.object.def({}), |
| | | formBpm: propTypes.bool.def(true), |
| | | }, |
| | | setup(props){ |
| | | const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ |
| | | labelWidth: 150, |
| | | schemas: getBpmFormSchema(props.formData), |
| | | showActionButtonGroup: false, |
| | | baseColProps: {span: 24} |
| | | }); |
| | | |
| | | const formDisabled = computed(()=>{ |
| | | if(props.formData.disabled === false){ |
| | | return false; |
| | | } |
| | | return true; |
| | | }); |
| | | |
| | | let formData = {}; |
| | | const queryByIdUrl = '/dry/drySpareParts/queryById'; |
| | | async function initFormData(){ |
| | | let params = {id: props.formData.dataId}; |
| | | const data = await defHttp.get({url: queryByIdUrl, params}); |
| | | formData = {...data} |
| | | //设置表åçå¼ |
| | | await setFieldsValue(formData); |
| | | //é»è®¤æ¯ç¦ç¨ |
| | | await setProps({disabled: formDisabled.value}) |
| | | } |
| | | |
| | | async function submitForm() { |
| | | let data = getFieldsValue(); |
| | | let params = Object.assign({}, formData, data); |
| | | console.log('è¡¨åæ°æ®', params) |
| | | await saveOrUpdate(params, true) |
| | | } |
| | | |
| | | initFormData(); |
| | | |
| | | return { |
| | | registerForm, |
| | | formDisabled, |
| | | submitForm, |
| | | } |
| | | } |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> |
| | | <BasicForm @register="registerForm"/> |
| | | </BasicModal> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import {ref, computed, unref} from 'vue'; |
| | | import {BasicModal, useModalInner} from '/@/components/Modal'; |
| | | import {BasicForm, useForm} from '/@/components/Form/index'; |
| | | import {formSchema} from '../DrySpareParts.data'; |
| | | import {saveOrUpdate} from '../DrySpareParts.api'; |
| | | // Emits声æ |
| | | const emit = defineEmits(['register','success']); |
| | | const isUpdate = ref(true); |
| | | //表åé
ç½® |
| | | const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ |
| | | //labelWidth: 150, |
| | | schemas: formSchema, |
| | | showActionButtonGroup: false, |
| | | baseColProps: {span: 24} |
| | | }); |
| | | //表åèµå¼ |
| | | const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { |
| | | //é置表å |
| | | await resetFields(); |
| | | setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); |
| | | isUpdate.value = !!data?.isUpdate; |
| | | if (unref(isUpdate)) { |
| | | //表åèµå¼ |
| | | await setFieldsValue({ |
| | | ...data.record, |
| | | }); |
| | | } |
| | | // éèåºé¨æ¶ç¦ç¨æ´ä¸ªè¡¨å |
| | | setProps({ disabled: !data?.showFooter }) |
| | | }); |
| | | //设置æ é¢ |
| | | const title = computed(() => (!unref(isUpdate) ? 'æ°å¢' : 'ç¼è¾')); |
| | | //表åæäº¤äºä»¶ |
| | | async function handleSubmit(v) { |
| | | try { |
| | | let values = await validate(); |
| | | setModalProps({confirmLoading: true}); |
| | | //æäº¤è¡¨å |
| | | await saveOrUpdate(values, isUpdate.value); |
| | | //å
³éå¼¹çª |
| | | closeModal(); |
| | | //å·æ°å表 |
| | | emit('success'); |
| | | } finally { |
| | | setModalProps({confirmLoading: false}); |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | /** æ¶é´åæ°åè¾å
¥æ¡æ ·å¼ */ |
| | | :deep(.ant-input-number){ |
| | | width: 100% |
| | | } |
| | | |
| | | :deep(.ant-calendar-picker){ |
| | | width: 100% |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div style="min-height: 400px"> |
| | | <BasicForm @register="registerForm" /> |
| | | <div style="width: 100%; text-align: center" v-if="!formDisabled"> |
| | | <a-button @click="submitForm" pre-icon="ant-design:check" type="primary">æ 交</a-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { BasicForm, useForm } from '/@/components/Form/index' |
| | | import { computed, defineComponent } from 'vue' |
| | | import { defHttp } from '/@/utils/http/axios' |
| | | import { propTypes } from '/@/utils/propTypes' |
| | | import { getBpmFormSchema } from '../DrySpareStockLog.data' |
| | | import { saveOrUpdate } from '../DrySpareStockLog.api' |
| | | |
| | | export default defineComponent({ |
| | | name: 'DrySpareStockLogForm', |
| | | components: { |
| | | BasicForm, |
| | | }, |
| | | props: { |
| | | formData: propTypes.object.def({}), |
| | | formBpm: propTypes.bool.def(true), |
| | | }, |
| | | setup(props) { |
| | | const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({ |
| | | labelWidth: 150, |
| | | schemas: getBpmFormSchema(props.formData), |
| | | showActionButtonGroup: false, |
| | | baseColProps: { span: 24 }, |
| | | }) |
| | | |
| | | const formDisabled = computed(() => { |
| | | if (props.formData.disabled === false) { |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | |
| | | let formData = {} |
| | | const queryByIdUrl = '/dry/drySpareStockLog/queryById' |
| | | async function initFormData() { |
| | | let params = { id: props.formData.dataId } |
| | | const data = await defHttp.get({ url: queryByIdUrl, params }) |
| | | formData = { ...data } |
| | | //设置表åçå¼ |
| | | await setFieldsValue(formData) |
| | | //é»è®¤æ¯ç¦ç¨ |
| | | await setProps({ disabled: formDisabled.value }) |
| | | } |
| | | |
| | | async function submitForm() { |
| | | let data = getFieldsValue() |
| | | let params = Object.assign({}, formData, data) |
| | | console.log('è¡¨åæ°æ®', params) |
| | | await saveOrUpdate(params, true) |
| | | } |
| | | |
| | | initFormData() |
| | | |
| | | return { |
| | | registerForm, |
| | | formDisabled, |
| | | submitForm, |
| | | } |
| | | }, |
| | | }) |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit"> |
| | | <BasicForm @register="registerForm" /> |
| | | </BasicModal> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { ref, computed, unref, reactive, nextTick } from 'vue' |
| | | import { BasicModal, useModalInner } from '/@/components/Modal' |
| | | import { BasicForm, useForm } from '/@/components/Form/index' |
| | | import { formSchema } from '../DrySpareStockLog.data' |
| | | import { formatToDate } from '/@/utils/dateUtil' |
| | | import { saveOrUpdate } from '../DrySpareStockLog.api' |
| | | import { generateStockNo } from '../DrySpareStockLog.api' |
| | | // Emits声æ |
| | | const emit = defineEmits(['register', 'success']) |
| | | const isUpdate = ref(true) |
| | | const stockType = ref('in') |
| | | const relatedOrder = ref(''); |
| | | const modalParams = reactive({ |
| | | isUpdate: isUpdate, |
| | | stockType: stockType, |
| | | }) |
| | | //表åé
ç½® |
| | | const [registerForm, { setProps, resetFields, setFieldsValue, validate }] = useForm({ |
| | | //labelWidth: 150, |
| | | schemas: formSchema(unref(modalParams)), |
| | | showActionButtonGroup: false, |
| | | baseColProps: { span: 24 }, |
| | | }) |
| | | //表åèµå¼ |
| | | const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { |
| | | //é置表å |
| | | await resetFields() |
| | | Object.assign(modalParams, data.record || {}); |
| | | isUpdate.value = !!data?.isUpdate |
| | | stockType.value = data.stockType |
| | | relatedOrder.value = data.relatedOrder; |
| | | |
| | | // ç¡®ä¿å¨DOMæ´æ°åæ§è¡ï¼é¿å
useModalå®ä¾æªå®ä¹çé®é¢ |
| | | await nextTick(async () => { |
| | | setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter}) |
| | | if (unref(isUpdate)) { |
| | | //表åèµå¼ |
| | | await setFieldsValue({ |
| | | operationTime: data.record.operationTime ? formatToDate(data.record.operationTime, 'YYYY-MM-DD') : null, |
| | | ...data.record, |
| | | }) |
| | | } |
| | | if (!unref(isUpdate)) { |
| | | // æ°å¢æ¶çæåºå
¥åºåå· |
| | | const type = stockType.value === 'in' ? 'RK' : 'CK'; |
| | | const res = await generateStockNo(type); |
| | | await setFieldsValue({ operationNumber: res, operationType: stockType.value === 'in' ? '0' : '1', relatedOrder: unref(relatedOrder) }); |
| | | } |
| | | // éèåºé¨æ¶ç¦ç¨æ´ä¸ªè¡¨å |
| | | setProps({ disabled: !data?.showFooter }) |
| | | }) |
| | | }) |
| | | //设置æ é¢ |
| | | const title = computed(() => (!unref(isUpdate) ? 'æ°å¢' : 'ç¼è¾')) |
| | | //表åæäº¤äºä»¶ |
| | | async function handleSubmit(v) { |
| | | try { |
| | | let values = await validate() |
| | | setModalProps({ confirmLoading: true }) |
| | | values.relatedOrder = unref(relatedOrder); |
| | | //æäº¤è¡¨å |
| | | await saveOrUpdate(values, unref(isUpdate)) |
| | | //å
³éå¼¹çª |
| | | closeModal() |
| | | //å·æ°å表 |
| | | emit('success') |
| | | } finally { |
| | | setModalProps({ confirmLoading: false }) |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | /** æ¶é´åæ°åè¾å
¥æ¡æ ·å¼ */ |
| | | :deep(.ant-input-number) { |
| | | width: 100%; |
| | | } |
| | | |
| | | :deep(.ant-calendar-picker) { |
| | | width: 100%; |
| | | } |
| | | </style> |