| | |
| | | <!--ææ§½:tableæ é¢--> |
| | | <template #tableTitle> |
| | | <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> æ°å¢</a-button> |
| | | <a-button type="primary" @click="handleSend" preIcon="ant-design:vertical-align-bottom-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"> |
| | |
| | | |
| | | <script lang="ts" name="dry-dryOrder" setup> |
| | | import { ref } from 'vue' |
| | | import { batchDelete, deleteOne, getExportUrl, getImportUrl, list } from './api/DryOrder.api' |
| | | import { batchDelete, deleteOne, getExportUrl, getImportUrl, list,batchSend } from './api/DryOrder.api' |
| | | import DryOrderModal from './components/dryOrder/DryOrderModal.vue' |
| | | import TrendModal from './components/dryOrder/TrendModal.vue' |
| | | import { columns, searchFormSchema } from './dataDefine/DryOrder.data' |
| | |
| | | import { useListPage } from '/@/hooks/system/useListPage' |
| | | import { downloadFile } from '/@/utils/common/renderUtils' |
| | | import { router } from '/@/router' |
| | | import {message} from "ant-design-vue"; |
| | | |
| | | const checkedKeys = ref<Array<string | number>>([]) |
| | | //注åmodel |
| | |
| | | }, |
| | | }) |
| | | |
| | | const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext |
| | | const [registerTable, { reload }, { rowSelection,selectedRows, selectedRowKeys }] = tableContext |
| | | |
| | | /** |
| | | * æ°å¢äºä»¶ |
| | |
| | | showFooter: true, |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * ä¸åå·¥å |
| | | */ |
| | | const handleSend = async () => { |
| | | // åªææ°å»ºç¶æçå·¥åæå
许ä¸åï¼æ ¹æ®å¾éçè®°å½idå表ï¼éåselectedRowsï¼å¤ææ¯ä¸æ¯æ°å»ºå·¥åï¼å
å«éæ°å»ºå·¥åè¿è¡æç¤º |
| | | if (selectedRowKeys.value.length > 0) { |
| | | const newOrderList = selectedRows.value.filter(row => { |
| | | return row.orderStatus > 0 |
| | | }) |
| | | if (newOrderList.length > 0) { |
| | | message.warning('è¯·éæ©æ°å»ºç¶æçå·¥å') |
| | | return |
| | | }else { |
| | | await batchSend({ ids: selectedRowKeys.value }, handleSuccess) |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | /** |
| | | * ç¼è¾äºä»¶ |
| | | */ |
| | |
| | | list = '/dry/dryHerbInfo/list', |
| | | save='/dry/dryHerbInfo/add', |
| | | edit='/dry/dryHerbInfo/edit', |
| | | queryById = '/dry/dryHerbInfo/queryById', |
| | | deleteOne = '/dry/dryHerbInfo/delete', |
| | | deleteBatch = '/dry/dryHerbInfo/deleteBatch', |
| | | importExcel = '/dry/dryHerbInfo/importExcel', |
| | |
| | | defHttp.get({url: Api.list, params}); |
| | | |
| | | /** |
| | | * å表æ¥å£ |
| | | * @param params |
| | | */ |
| | | export const queryById = (params) => |
| | | defHttp.get({url: Api.queryById, params}); |
| | | |
| | | /** |
| | | * å é¤å个 |
| | | */ |
| | | export const deleteOne = (params,handleSuccess) => { |
| | |
| | | deleteBatch = '/dry/dryOrder/deleteBatch', |
| | | importExcel = '/dry/dryOrder/importExcel', |
| | | exportXls = '/dry/dryOrder/exportXls', |
| | | sendBatch = '/dry/dryOrder/sendBatch' |
| | | } |
| | | /** |
| | | * 导åºapi |
| | |
| | | }, |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * æ¹éä¸åå·¥å |
| | | */ |
| | | export const batchSend = (params, handleSuccess) => { |
| | | createConfirm({ |
| | | iconType: 'warning', |
| | | title: '确认ä¸å', |
| | | content: 'æ¯å¦å°éä¸å·¥åä¸åå°æºå°', |
| | | okText: 'ä¸å', |
| | | cancelText: 'åæ¶', |
| | | onOk: () => { |
| | | return defHttp.post({ url: Api.sendBatch, data: params }, { joinParamsToUrl: true }).then(() => { |
| | | handleSuccess() |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | /** |
| | | * ä¿åæè
æ´æ° |
| | | * @param params |
| | |
| | | <script setup lang="ts"> |
| | | import { onMounted, ref } from 'vue' |
| | | import { router } from '/@/router' |
| | | console.log(`output->router1`, router) |
| | | import { getTenantId, getToken } from '/@/utils/auth' |
| | | const token = getToken() |
| | | const tenantId = getTenantId() |
| | | console.log(`output->tenantId`, tenantId ) |
| | | const reportUrl = ref('') |
| | | reportUrl.value = window._CONFIG['domianURL'] + '/jmreport/view/833110227445567488?batch=' + router.currentRoute.value.query.batch |
| | | reportUrl.value = window._CONFIG['domianURL'] + '/jmreport/view/833110227445567488?batch=' + router.currentRoute.value.query.batch +'&token=' + token+'&tenantId=' + tenantId |
| | | //reportUrl.value = 'www.baidu.com' |
| | | console.log(`output->reportUrl.value`, reportUrl.value) |
| | | // onMounted(() => { |
| | |
| | | showActionButtonGroup: false, |
| | | baseColProps: { span: 24 }, |
| | | }) |
| | | |
| | | //表åèµå¼ |
| | | const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { |
| | | //é置表å |
| | |
| | | // éèåºé¨æ¶ç¦ç¨æ´ä¸ªè¡¨å |
| | | setProps({ disabled: !data?.showFooter }) |
| | | }) |
| | | const updateNameValue = (v) => { |
| | | console.log(v) |
| | | } |
| | | |
| | | //设置æ é¢ |
| | | const title = computed(() => (!unref(isUpdate) ? 'æ°å¢' : 'ç¼è¾')) |
| | | //表åæäº¤äºä»¶ |
| | |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import dayjs from 'dayjs'; |
| | | import { computed, ref, unref } from 'vue' |
| | | import { saveOrUpdate } from '../../api/DryOrder.api' |
| | | import { formSchema } from '../../dataDefine/DryOrder.data' |
| | |
| | | await setFieldsValue({ |
| | | ...data.record, |
| | | }) |
| | | } else { |
| | | await setFieldsValue({ |
| | | orderTime: dayjs(getDateStr(new Date()), 'YYYY-MM-DD'), |
| | | code: getCodeByDate(new Date()), |
| | | dryer: 1, |
| | | feed: 16, |
| | | orderStatus: 0, |
| | | }) |
| | | } |
| | | // éèåºé¨æ¶ç¦ç¨æ´ä¸ªè¡¨å |
| | | setProps({ disabled: !data?.showFooter }) |
| | |
| | | async function handleSubmit(v) { |
| | | try { |
| | | let values = await validate() |
| | | values.orderTime = dayjs(values.orderTime).format('YYYY-MM-DD HH:mm:ss') |
| | | |
| | | setModalProps({ confirmLoading: true }) |
| | | //æäº¤è¡¨å |
| | | await saveOrUpdate(values, isUpdate.value) |
| | |
| | | setModalProps({ confirmLoading: false }) |
| | | } |
| | | } |
| | | const getCodeByDate = (date) => { |
| | | let year = date.getFullYear() |
| | | let month = date.getMonth() + 1 |
| | | let day = date.getDate() |
| | | let hour = date.getHours() |
| | | let minute = date.getMinutes() |
| | | let second = date.getSeconds() |
| | | return `${year}${month}${day}${hour}${minute}${second}` |
| | | } |
| | | const getDateStr = (date) => { |
| | | let year = date.getFullYear() |
| | | let month = date.getMonth() + 1 |
| | | let day = date.getDate() |
| | | if (month < 10) { |
| | | month = '0' + month |
| | | } |
| | | if (day < 10) { |
| | | day = '0' + day |
| | | } |
| | | return `${year}-${month}-${day}` |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | |
| | | import { BasicColumn, FormSchema } from '/@/components/Table' |
| | | import {render} from "/@/utils/common/renderUtils"; |
| | | import {rules} from "/@/utils/helper/validator"; |
| | | import {queryById} from "/@/views/dry/api/DryHerbInfo.api" |
| | | //åè¡¨æ°æ® |
| | | export const columns: BasicColumn[] = [ |
| | | { |
| | |
| | | align: 'center', |
| | | dataIndex: 'herbId_dictText', |
| | | }, |
| | | // { |
| | | // title: 'è¯æåç§°', |
| | | // align: 'center', |
| | | // dataIndex: 'herbName', |
| | | // }, |
| | | { |
| | | title: 'é
æ¹åç§°', |
| | | align: 'center', |
| | | dataIndex: 'name', |
| | | }, |
| | | { |
| | | title: 'éç¨è®¾å¤', |
| | | align: 'center', |
| | | dataIndex: 'eqpType_dictText', |
| | | }, |
| | | { |
| | | title: 'é
æ¹åç±»', |
| | | align: 'center', |
| | | dataIndex: 'category', |
| | | customRender: ({ text }) => { |
| | | return render.renderDict(text, 'formula_category'); |
| | | }, |
| | | }, |
| | | { |
| | | title: 'ç®æ 嫿°´ç', |
| | |
| | | dataIndex: 'windTemp', |
| | | }, |
| | | { |
| | | title: 'ç¯å¢æ¸©åº¦', |
| | | title: '飿ºåå§é¢ç', |
| | | align: 'center', |
| | | dataIndex: 'envTemp', |
| | | dataIndex: 'fanSpeed', |
| | | }, |
| | | { |
| | | title: 'ç¯å¢æ¹¿åº¦', |
| | | align: 'center', |
| | | dataIndex: 'envHum', |
| | | }, |
| | | // { |
| | | // title: 'ç¯å¢æ¸©åº¦', |
| | | // align: 'center', |
| | | // dataIndex: 'envTemp', |
| | | // }, |
| | | // { |
| | | // title: 'ç¯å¢æ¹¿åº¦', |
| | | // align: 'center', |
| | | // dataIndex: 'envHum', |
| | | // }, |
| | | { |
| | | title: 'è¡æå»¶æ¶ms', |
| | | align: 'center', |
| | | dataIndex: 'delay', |
| | | }, |
| | | // { |
| | | // title: 'ç¿»ææ¬¡æ°', |
| | | // align: 'center', |
| | | // dataIndex: 'turn', |
| | | // }, |
| | | { |
| | | title: 'ç¿»ææ¬¡æ°', |
| | | title: '嫿°´çè¡¥å¿', |
| | | align: 'center', |
| | | dataIndex: 'turn', |
| | | dataIndex: 'moisOffset', |
| | | }, |
| | | { |
| | | title: 'å·é£æ¶é¿', |
| | | align: 'center', |
| | | dataIndex: 'coolingDuration', |
| | | }, |
| | | // { |
| | | // title: 'ç§æ·id', |
| | |
| | | field: 'herbId', |
| | | component: 'JSearchSelect', |
| | | componentProps: { |
| | | dict: 'dry_herb,name,id', |
| | | dict: 'dry_herb_info,name,id', |
| | | }, |
| | | colProps: { span: 6 }, |
| | | }, |
| | |
| | | label: 'è¯æ', |
| | | field: 'herbId', |
| | | component: 'JSearchSelect', |
| | | componentProps: { |
| | | dict: 'dry_herb,name,id', |
| | | componentProps: ({formModel})=>{ |
| | | return { |
| | | dict: 'dry_herb_info,name,id', |
| | | onChange: e => { |
| | | let param = { |
| | | id: e, |
| | | } |
| | | queryById(param).then(res => { |
| | | formModel.name = res.name |
| | | }) |
| | | }, |
| | | } |
| | | }, |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: true, message: 'è¯·éæ©è¯æ!' }] |
| | | }, |
| | | }, |
| | | // { |
| | | // label: 'è¯æåç§°', |
| | | // field: 'herbName', |
| | | // component: 'Input', |
| | | // }, |
| | | { |
| | | label: 'é
æ¹åç§°', |
| | | field: 'name', |
| | | component: 'Input', |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: true, message: '请è¾å
¥é
æ¹åç§°!' }, { ...rules.duplicateCheckRule('dry_herb_formula', 'name', model, schema)[0] }] |
| | | }, |
| | | }, |
| | | { |
| | | label: '设å¤ç±»å', |
| | | field: 'eqpType', |
| | |
| | | }, |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: true, message: '请设å¤è®¾å¤ç±»å!' }] |
| | | }, |
| | | }, |
| | | { |
| | | label: 'é
æ¹åç±»', |
| | | field: 'category', |
| | | component: 'JDictSelectTag', |
| | | componentProps: { |
| | | dictCode: 'formula_category', |
| | | placeholder: 'è¯·éæ©é
æ¹åç±»', |
| | | stringToNumber: true, |
| | | }, |
| | | }, |
| | | { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | label: 'ç¯å¢æ¸©åº¦', |
| | | field: 'envTemp', |
| | | label: '飿ºåå§é¢ç', |
| | | field: 'fanSpeed', |
| | | component: 'Input', |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请è¾å
¥æ°å!' }] |
| | | }, |
| | | renderComponentContent: () => { |
| | | return { |
| | | suffix: () => 'â', |
| | | suffix: () => 'Hz', |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: 'ç¯å¢æ¹¿åº¦', |
| | | field: 'envHum', |
| | | component: 'Input', |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请è¾å
¥æ°å!' }] |
| | | }, |
| | | renderComponentContent: () => { |
| | | return { |
| | | suffix: () => 'rh', |
| | | } |
| | | }, |
| | | }, |
| | | // { |
| | | // label: 'ç¯å¢æ¸©åº¦', |
| | | // field: 'envTemp', |
| | | // component: 'Input', |
| | | // dynamicRules: ({ model, schema }) => { |
| | | // return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请è¾å
¥æ°å!' }] |
| | | // }, |
| | | // renderComponentContent: () => { |
| | | // return { |
| | | // suffix: () => 'â', |
| | | // } |
| | | // }, |
| | | // }, |
| | | // { |
| | | // label: 'ç¯å¢æ¹¿åº¦', |
| | | // field: 'envHum', |
| | | // component: 'Input', |
| | | // dynamicRules: ({ model, schema }) => { |
| | | // return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请è¾å
¥æ°å!' }] |
| | | // }, |
| | | // renderComponentContent: () => { |
| | | // return { |
| | | // suffix: () => 'rh', |
| | | // } |
| | | // }, |
| | | // }, |
| | | { |
| | | label: 'è¡æå»¶æ¶', |
| | | field: 'delay', |
| | |
| | | } |
| | | }, |
| | | }, |
| | | // { |
| | | // label: 'ç¿»ææ¬¡æ°', |
| | | // field: 'turn', |
| | | // component: 'Input', |
| | | // dynamicRules: ({ model, schema }) => { |
| | | // return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请è¾å
¥æ°å!' }] |
| | | // }, |
| | | // renderComponentContent: () => { |
| | | // return { |
| | | // suffix: () => '次', |
| | | // } |
| | | // }, |
| | | // }, |
| | | { |
| | | label: 'ç¿»ææ¬¡æ°', |
| | | field: 'turn', |
| | | label: '嫿°´çè¡¥å¿', |
| | | field: 'moisOffset', |
| | | component: 'Input', |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请è¾å
¥æ°å!' }] |
| | | }, |
| | | renderComponentContent: () => { |
| | | return { |
| | | suffix: () => '次', |
| | | suffix: () => '%', |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | label: 'å·é£æ¶é¿', |
| | | field: 'coolingDuration', |
| | | component: 'Input', |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请è¾å
¥æ°å!' }] |
| | | }, |
| | | renderComponentContent: () => { |
| | | return { |
| | | suffix: () => 'min', |
| | | } |
| | | }, |
| | | }, |
| | |
| | | import {BasicColumn} from '/@/components/Table'; |
| | | import {FormSchema} from '/@/components/Table'; |
| | | import {rules} from "/@/utils/helper/validator"; |
| | | |
| | | //åè¡¨æ°æ® |
| | | export const columns: BasicColumn[] = [ |
| | |
| | | title: 'è±æå', |
| | | align:"center", |
| | | dataIndex: 'english' |
| | | }, |
| | | { |
| | | title: 'è¯æåç±»', |
| | | align: 'center', |
| | | dataIndex: 'type_dictText', |
| | | }, |
| | | { |
| | | title: 'è¯ç¨é¨ä½', |
| | |
| | | align:"center", |
| | | dataIndex: 'usageTaboo' |
| | | }, |
| | | { |
| | | title: 'ç§æ·id', |
| | | align:"center", |
| | | dataIndex: 'tenantId' |
| | | }, |
| | | // { |
| | | // title: 'ç§æ·id', |
| | | // align:"center", |
| | | // dataIndex: 'tenantId' |
| | | // }, |
| | | ]; |
| | | //æ¥è¯¢æ°æ® |
| | | export const searchFormSchema: FormSchema[] = [ |
| | |
| | | component: 'JInput', |
| | | colProps: {span: 6}, |
| | | }, |
| | | // { |
| | | // label: "è±æå", |
| | | // field: 'english', |
| | | // component: 'JInput', |
| | | // colProps: {span: 6}, |
| | | // }, |
| | | // { |
| | | // label: "产å°åå¸", |
| | | // field: 'origin', |
| | | // component: 'JInput', |
| | | // colProps: {span: 6}, |
| | | // }, |
| | | // { |
| | | // label: "åæä¸ä½ç¨", |
| | | // field: 'efficacy', |
| | | // component: 'JInput', |
| | | // colProps: {span: 6}, |
| | | // }, |
| | | { |
| | | label: "è±æå", |
| | | field: 'english', |
| | | component: 'JInput', |
| | | colProps: {span: 6}, |
| | | label: 'è¯æåç±»', |
| | | field: 'type', |
| | | component: 'JTreeSelect', |
| | | componentProps: { |
| | | dict: 'dry_herb_type,name,id', |
| | | pidField: 'pid', |
| | | hasChildField: 'has_child', |
| | | converIsLeafVal: 1, |
| | | }, |
| | | { |
| | | label: "产å°åå¸", |
| | | field: 'origin', |
| | | component: 'JInput', |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: "åæä¸ä½ç¨", |
| | | field: 'efficacy', |
| | | component: 'JInput', |
| | | colProps: {span: 6}, |
| | | }, |
| | | ]; |
| | |
| | | label: 'ä¸è¯å', |
| | | field: 'name', |
| | | component: 'Input', |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: true, message: '请è¾å
¥è¯æåç§°!' }, { ...rules.duplicateCheckRule('dry_herb_info', 'name', model, schema)[0] }] |
| | | }, |
| | | }, |
| | | { |
| | | label: 'æ¼é³', |
| | | field: 'pinyin', |
| | | component: 'Input', |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: true, message: '请è¾å
¥è¯ææ¼é³!' }, { ...rules.duplicateCheckRule('dry_herb_info', 'pinyin', model, schema)[0] }] |
| | | }, |
| | | }, |
| | | { |
| | | label: 'å«å', |
| | |
| | | label: 'è±æå', |
| | | field: 'english', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'è¯æåç±»', |
| | | field: 'type', |
| | | component: 'JTreeSelect', |
| | | componentProps: { |
| | | dict: 'dry_herb_type,name,id', |
| | | pidField: 'pid', |
| | | hasChildField: 'has_child', |
| | | converIsLeafVal: 1, |
| | | }, |
| | | dynamicRules: ({ model, schema }) => { |
| | | return [{ required: true, message: '请è¾å
¥è¯æåç±»!' }] |
| | | }, |
| | | }, |
| | | { |
| | | label: 'è¯ç¨é¨ä½', |
| | |
| | | field: 'usageTaboo', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'ç§æ·id', |
| | | field: 'tenantId', |
| | | component: 'InputNumber', |
| | | }, |
| | | // { |
| | | // label: 'ç§æ·id', |
| | | // field: 'tenantId', |
| | | // component: 'InputNumber', |
| | | // }, |
| | | // TODO 主é®éèåæ®µï¼ç®ååæ»ä¸ºID |
| | | { |
| | | label: '', |
| | |
| | | align: 'center', |
| | | dataIndex: 'equId_dictText', |
| | | }, |
| | | { |
| | | title: 'å·¥åç¶æ', |
| | | align: 'center', |
| | | dataIndex: 'orderStatus_dictText', |
| | | }, |
| | | // { |
| | | // title: '车é´', |
| | | // align: 'center', |
| | |
| | | dataIndex: 'remain', |
| | | }, |
| | | |
| | | { |
| | | title: 'å·¥åç¶æ', |
| | | align: 'center', |
| | | dataIndex: 'orderStatus', |
| | | }, |
| | | |
| | | { |
| | | title: 'æä½äºº', |
| | | align: 'center', |
| | |
| | | field: 'orderTime', |
| | | component: 'DatePicker', |
| | | componentProps: { |
| | | showTime: true, |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | valueFormat: 'YYYY-MM-DD', |
| | | }, |
| | | }, |
| | | { |
| | |
| | | field: 'herbId', |
| | | component: 'JDictSelectTag', |
| | | componentProps: { |
| | | dictCode: 'dry_herb,name,id,tenant_id=' + getTenantId(), |
| | | dictCode: 'dry_herb_formula,name,id,tenant_id=' + getTenantId(), |
| | | }, |
| | | }, |
| | | // { |
| | |
| | | dictCode: 'dry_equipment,name,id,tenant_id=' + getTenantId(), |
| | | }, |
| | | }, |
| | | // { |
| | | // label: '车é´', |
| | | // field: 'shopId', |
| | | // component: 'JDictSelectTag', |
| | | // componentProps: { |
| | | // dictCode: 'dry_shop,name,id,tenant_id=' + getTenantId(), |
| | | // }, |
| | | // }, |
| | | { |
| | | label: '车é´', |
| | | field: 'shopId', |
| | | label: 'å·¥åç¶æ', |
| | | field: 'orderStatus', |
| | | component: 'JDictSelectTag', |
| | | componentProps: { |
| | | dictCode: 'dry_shop,name,id,tenant_id=' + getTenantId(), |
| | | dictCode: 'dry_order_status', |
| | | stringToNumber: true, |
| | | }, |
| | | }, |
| | | // { |
| | | // label: 'å·¥åç¶æ', |
| | | // field: 'orderStatus', |
| | | // component: 'InputNumber', |
| | | // }, |
| | | // { |
| | | // label: 'æä½äºº', |
| | | // field: 'operator', |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {defHttp} from '/@/utils/http/axios'; |
| | | import { useMessage } from "/@/hooks/web/useMessage"; |
| | | |
| | | const { createConfirm } = useMessage(); |
| | | |
| | | enum Api { |
| | | list = '/dry/dryHerbFormulaHis/list', |
| | | save='/dry/dryHerbFormulaHis/add', |
| | | edit='/dry/dryHerbFormulaHis/edit', |
| | | deleteOne = '/dry/dryHerbFormulaHis/delete', |
| | | deleteBatch = '/dry/dryHerbFormulaHis/deleteBatch', |
| | | importExcel = '/dry/dryHerbFormulaHis/importExcel', |
| | | exportXls = '/dry/dryHerbFormulaHis/exportXls', |
| | | } |
| | | /** |
| | | * 导åº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}); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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: 'eqpId_dictText' |
| | | }, |
| | | // { |
| | | // title: 'å·¥åå·', |
| | | // align:"center", |
| | | // dataIndex: 'orderCode' |
| | | // }, |
| | | { |
| | | title: 'æ¶é´', |
| | | align:"center", |
| | | sorter: true, |
| | | dataIndex: 'orderTime', |
| | | customRender:({text}) =>{ |
| | | return !text?"":(text.length>10?text.substr(0,10):text) |
| | | }, |
| | | }, |
| | | { |
| | | title: 'ç´¢å¼', |
| | | align:"center", |
| | | sorter: true, |
| | | dataIndex: 'formulaIndex' |
| | | }, |
| | | { |
| | | title: 'ç¼ç ', |
| | | align:"center", |
| | | dataIndex: 'code' |
| | | }, |
| | | { |
| | | title: 'åç§°', |
| | | align:"center", |
| | | sorter: true, |
| | | dataIndex: 'name' |
| | | }, |
| | | { |
| | | title: 'ç±»å', |
| | | align:"center", |
| | | sorter: true, |
| | | dataIndex: 'typ' |
| | | }, |
| | | { |
| | | title: 'ab', |
| | | align:"center", |
| | | dataIndex: 'ab' |
| | | }, |
| | | { |
| | | title: 'ææéï¼çï¼', |
| | | align:"center", |
| | | dataIndex: 'weight1' |
| | | }, |
| | | { |
| | | title: 'åå§éé', |
| | | align:"center", |
| | | dataIndex: 'weight2' |
| | | }, |
| | | { |
| | | title: 'ç飿¸©åº¦', |
| | | align:"center", |
| | | dataIndex: 'temp1' |
| | | }, |
| | | { |
| | | title: 'ç¯å¢æ¸©åº¦', |
| | | align:"center", |
| | | dataIndex: 'temp2' |
| | | }, |
| | | { |
| | | title: 'ç¯å¢æ¹¿åº¦', |
| | | align:"center", |
| | | dataIndex: 'temp3' |
| | | }, |
| | | { |
| | | title: 'è¡æå»¶æ¶ms', |
| | | align:"center", |
| | | dataIndex: 'delay' |
| | | }, |
| | | { |
| | | title: 'ç¿»ææ¬¡æ°', |
| | | align:"center", |
| | | dataIndex: 'turntime' |
| | | }, |
| | | { |
| | | title: 'åå§å«æ°´ç', |
| | | align:"center", |
| | | dataIndex: 'moisture1' |
| | | }, |
| | | { |
| | | title: 'ç®æ 嫿°´ç', |
| | | align:"center", |
| | | dataIndex: 'moisture3' |
| | | }, |
| | | { |
| | | title: 'è¯æåç±»', |
| | | align:"center", |
| | | dataIndex: 'mtype' |
| | | }, |
| | | { |
| | | title: '嫿°´çè¡¥å¿', |
| | | align:"center", |
| | | dataIndex: 'moisoffset' |
| | | }, |
| | | { |
| | | title: 'å·é£æ¶é¿', |
| | | align:"center", |
| | | dataIndex: 'coldwind' |
| | | }, |
| | | { |
| | | title: 'ç§æ·id', |
| | | align:"center", |
| | | dataIndex: 'tenantId' |
| | | }, |
| | | ]; |
| | | //æ¥è¯¢æ°æ® |
| | | export const searchFormSchema: FormSchema[] = [ |
| | | { |
| | | label: "设å¤", |
| | | field: 'eqpId', |
| | | component: 'Input', |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: "æ¶é´", |
| | | field: 'orderTime', |
| | | component: 'DatePicker', |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: "åç§°", |
| | | field: 'name', |
| | | component: 'Input', |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: "ç´¢å¼", |
| | | field: 'formulaIndex', |
| | | component: 'Input', |
| | | colProps: {span: 6}, |
| | | }, |
| | | { |
| | | label: "ç¼ç ", |
| | | field: 'code', |
| | | component: 'Input', |
| | | colProps: {span: 6}, |
| | | }, |
| | | |
| | | { |
| | | label: "ç±»å", |
| | | field: 'typ', |
| | | component: 'Input', |
| | | colProps: {span: 6}, |
| | | }, |
| | | ]; |
| | | //è¡¨åæ°æ® |
| | | export const formSchema: FormSchema[] = [ |
| | | { |
| | | label: '设å¤', |
| | | field: 'eqpId', |
| | | component: 'Input', |
| | | }, |
| | | // { |
| | | // label: 'å·¥åå·', |
| | | // field: 'orderCode', |
| | | // component: 'Input', |
| | | // }, |
| | | { |
| | | label: 'æ¶é´', |
| | | field: 'orderTime', |
| | | component: 'DatePicker', |
| | | }, |
| | | { |
| | | label: 'ç´¢å¼', |
| | | field: 'formulaIndex', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'ç¼ç ', |
| | | field: 'code', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'åç§°', |
| | | field: 'name', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'ç±»å', |
| | | field: 'typ', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'ab', |
| | | field: 'ab', |
| | | component: 'Input', |
| | | }, |
| | | { |
| | | label: 'ææéï¼çï¼', |
| | | field: 'weight1', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'åå§éé', |
| | | field: 'weight2', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'ç飿¸©åº¦', |
| | | field: 'temp1', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'ç¯å¢æ¸©åº¦', |
| | | field: 'temp2', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'ç¯å¢æ¹¿åº¦', |
| | | field: 'temp3', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'è¡æå»¶æ¶ms', |
| | | field: 'delay', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'ç¿»ææ¬¡æ°', |
| | | field: 'turntime', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'åå§å«æ°´ç', |
| | | field: 'moisture1', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'ç®æ 嫿°´ç', |
| | | field: 'moisture3', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'è¯æåç±»', |
| | | field: 'mtype', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: '嫿°´çè¡¥å¿', |
| | | field: 'moisoffset', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'å·é£æ¶é¿', |
| | | field: 'coldwind', |
| | | component: 'InputNumber', |
| | | }, |
| | | { |
| | | label: 'ç§æ·id', |
| | | field: 'tenantId', |
| | | component: 'InputNumber', |
| | | }, |
| | | // 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> |
| | | <!-- 表ååºå --> |
| | | <DryHerbFormulaHisModal @register="registerModal" @success="handleSuccess"></DryHerbFormulaHisModal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts" name="dry-dryHerbFormulaHis" 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 DryHerbFormulaHisModal from './components/DryHerbFormulaHisModal.vue' |
| | | import {columns, searchFormSchema} from './DryHerbFormulaHis.data'; |
| | | import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './DryHerbFormulaHis.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' |
| | | }, |
| | | }, |
| | | 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 ('2024081902069470350', NULL, 'é
æ¹è®°å½', '/dry/dryHerbFormulaHisList', 'dry/DryHerbFormulaHisList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2024-08-19 14:06:35', 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 ('2024081902069470351', '2024081902069470350', 'æ·»å é
æ¹è®°å½', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_herb_formula_his:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-08-19 14:06:35', 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 ('2024081902069470352', '2024081902069470350', 'ç¼è¾é
æ¹è®°å½', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_herb_formula_his:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-08-19 14:06:35', 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 ('2024081902069470353', '2024081902069470350', 'å é¤é
æ¹è®°å½', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_herb_formula_his:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-08-19 14:06:35', 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 ('2024081902069470354', '2024081902069470350', 'æ¹éå é¤é
æ¹è®°å½', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_herb_formula_his:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-08-19 14:06:35', 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 ('2024081902069470355', '2024081902069470350', '导åºexcel_é
æ¹è®°å½', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_herb_formula_his:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-08-19 14:06:35', 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 ('2024081902069470356', '2024081902069470350', '导å
¥excel_é
æ¹è®°å½', NULL, NULL, 0, NULL, NULL, 2, 'dry:dry_herb_formula_his:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-08-19 14:06:35', 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 '../DryHerbFormulaHis.data'; |
| | | import {saveOrUpdate} from '../DryHerbFormulaHis.api'; |
| | | |
| | | export default defineComponent({ |
| | | name: "DryHerbFormulaHisForm", |
| | | 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/dryHerbFormulaHis/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 '../DryHerbFormulaHis.data'; |
| | | import {saveOrUpdate} from '../DryHerbFormulaHis.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> |