| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import http from '@/api/http.js' |
| | | import { defineAsyncComponent } from "vue"; |
| | | import { ElMessage } from 'element-plus'; // å¼å
¥ElMessageï¼è§£å³æç¤ºæ ååº |
| | | import { h,createVNode, render,reactive } from 'vue'; |
| | | import { ElDialog , ElForm, ElFormItem, ElInput, ElButton, ElMessage ,ElSelect, ElOption} from 'element-plus'; |
| | | |
| | | import gridBody from './extend/outOrderDetail.vue' |
| | | let extension = { |
| | |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [ |
| | | { |
| | | /* { |
| | | name: 'åºåº', |
| | | type: 'primary', |
| | | value: 'åºåº', |
| | |
| | | createDate: selectedRows[0].createDate || new Date().toLocaleDateString() // åºåºæ¥æ |
| | | }); |
| | | } |
| | | }, */ |
| | | { |
| | | name: '空æçåºåº', |
| | | type: 'primary', |
| | | value: '空æçåºåº', |
| | | onClick: function () { |
| | | |
| | | |
| | | const platformOptions = Array.from({ length: 1 }, (_, i) => { |
| | | const num = 1; |
| | | return { label: `ç«å°${num}`, value: `1-2` }; |
| | | }); |
| | | |
| | | const mountNode = document.createElement('div'); |
| | | document.body.appendChild(mountNode); |
| | | |
| | | |
| | | const formData = reactive({ |
| | | palletCode: '', |
| | | selectedPlatform: platformOptions[0].value |
| | | }); |
| | | |
| | | const vnode = createVNode(ElDialog, { |
| | | title: '空æçåºåº', |
| | | width: '500px', |
| | | modelValue: true, |
| | | appendToBody: true, |
| | | 'onUpdate:modelValue': (isVisible) => { |
| | | if (!isVisible) { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } |
| | | }, |
| | | style: { |
| | | padding: '20px 0', |
| | | borderRadius: '8px' |
| | | } |
| | | }, { |
| | | default: () => h(ElForm, { |
| | | model: formData, |
| | | rules: { |
| | | palletCode: [ |
| | | { type: 'string', message: 'æç®±å·å¿
须为å符串', trigger: 'blur' } |
| | | ], |
| | | selectedPlatform: [ |
| | | { required: true, message: 'è¯·éæ©åºåºç«å°', trigger: 'change' } |
| | | ] |
| | | }, |
| | | ref: 'batchOutForm', |
| | | labelWidth: '100px', |
| | | style: { |
| | | padding: '0 30px', |
| | | } |
| | | }, [ |
| | | |
| | | h(ElFormItem, { |
| | | label: 'åºåºç«å°', |
| | | prop: 'selectedPlatform', |
| | | style: { |
| | | marginBottom: '24px' |
| | | } |
| | | }, [ |
| | | h(ElSelect, { |
| | | placeholder: 'è¯·éæ©åºåºç«å°', |
| | | modelValue: formData.selectedPlatform, |
| | | 'onUpdate:modelValue': (val) => { |
| | | formData.selectedPlatform = val; |
| | | }, |
| | | style: { |
| | | width: '100%', |
| | | height: '40px', |
| | | borderRadius: '4px', |
| | | borderColor: '#dcdfe6' |
| | | } |
| | | }, platformOptions.map(platform => |
| | | h(ElOption, { label: platform.label, value: platform.value }) |
| | | )) |
| | | ]), |
| | | |
| | | h(ElFormItem, { |
| | | label: 'æç®±å·', |
| | | prop: 'palletCode', |
| | | style: { |
| | | marginBottom: '16px' |
| | | } |
| | | }, [ |
| | | h(ElInput, { |
| | | type: 'text', |
| | | placeholder: 'å¯éè¾å
¥æç®±å·ï¼ä¸å¡«åèªå¨åé
空æç®±', |
| | | modelValue: formData.palletCode, |
| | | 'onUpdate:modelValue': (val) => { |
| | | formData.palletCode = val; |
| | | }, |
| | | style: { |
| | | width: '100%', |
| | | height: '40px', |
| | | borderRadius: '4px', |
| | | borderColor: '#dcdfe6' |
| | | }, |
| | | attrs: { |
| | | placeholderStyle: 'color: #909399;' |
| | | } |
| | | }) |
| | | ]), |
| | | |
| | | h('div', { |
| | | style: { |
| | | textAlign: 'right', |
| | | marginTop: '8px', |
| | | paddingRight: '4px' |
| | | } |
| | | }, [ |
| | | h(ElButton, { |
| | | type: 'text', |
| | | onClick: () => { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | ElMessage.info('åæ¶åºåºæä½'); |
| | | }, |
| | | style: { |
| | | marginRight: '8px', |
| | | color: '#606266' |
| | | } |
| | | }, 'åæ¶'), |
| | | h(ElButton, { |
| | | type: 'primary', |
| | | onClick: async () => { |
| | | const formRef = vnode.component.refs.batchOutForm; |
| | | try { |
| | | await formRef.validate(); |
| | | } catch (err) { |
| | | return; |
| | | } |
| | | |
| | | http.post('/api/Task/PalletOutboundTask?palletCode='+formData.palletCode+'&endStation='+formData.selectedPlatform, { |
| | | |
| | | }).then(({ data, status, message }) => { |
| | | if (status) { |
| | | |
| | | ElMessage.success(`åºåºæå`); |
| | | this.refresh(); |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } else { |
| | | ElMessage.error(message || data?.message || 'åºåºå¤±è´¥'); |
| | | } |
| | | }).catch(() => { |
| | | ElMessage.error('请æ±å¤±è´¥ï¼è¯·ç¨åéè¯'); |
| | | }); |
| | | }, |
| | | style: { |
| | | borderRadius: '4px', |
| | | padding: '8px 20px' |
| | | } |
| | | }, 'ç¡®å®') |
| | | ]) |
| | | ]) |
| | | }); |
| | | |
| | | vnode.appContext = this.$.appContext; |
| | | render(vnode, mountNode); |
| | | } |
| | | } |
| | | ], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |