antdesign-vue框架form表单布局

article/2025/9/19 5:05:33

在这里插入图片描述

  • 下拉框赋默认值
 		  <a-form-item label="催单状态:"><a-selectv-decorator="['reminderStatus',{initialValue: $store.getters.enterpriseId ? '2' : '0'}]"style="width:100%;"allowClear><a-select-option value="0">待处理</a-select-option><a-select-option value="1">处理中</a-select-option><a-select-option value="2">处理完成</a-select-option></a-select></a-form-item>
<template>//<!-- 1、:footer="null" 去掉弹窗底部的确定取消按钮 --><a-modal v-model="visible" title="催单列表" @ok="handleOk" :width="1200" :footer="null"><a-card :bordered="false">//<!-- 搜索部分  --><a-form layout="horizontal" :form="form"><a-row :gutter="30"><a-col :span="8"><a-form-item label="订单信息:"><a-input v-decorator="['orderNo']" placeholder="订单号/原始单号" allowClear /></a-form-item></a-col><a-col :span="8"><a-form-item label="客户信息:"><a-input v-decorator="['clientNameOrPhone']" placeholder="客户姓名/电话" allowClear /></a-form-item></a-col><a-col :span="8"><a-form-item label="催单状态:"><a-select v-decorator="['reminderStatus']" style="width:100%;" allowClear><a-select-option value="0">待处理</a-select-option><a-select-option value="1">处理中</a-select-option><a-select-option value="2">处理完成</a-select-option></a-select></a-form-item></a-col></a-row><a-row :gutter="30"><a-col :span="8"><a-form-item label="申请时间:"><a-range-picker v-decorator="['time']" allowClear @change="onChange" /></a-form-item></a-col>//<!-- 2、带搜索的下拉框 show-search :filter-option --><a-col :span="8" v-if="!$store.getters.enterpriseId"><a-form-item label="企业名称:"><a-select v-decorator="['enterpriseId']" allowClear show-search :filter-option="filterOption"><a-select-option :value="item.enterpriseId" v-for="(item, i) in enterprise" :key="i">{{ item.enterpriseName }}</a-select-option></a-select></a-form-item></a-col><a-col :span="$store.getters.enterpriseId ? 16 : 8" style="text-align: right;"><a-button type="primary" html-type="submit" @click="search(1)"> 查询 </a-button></a-col></a-row></a-form>// <!-- 表格  --><a-spin :spinning="spinning" delay="500"><a-table@change="handleTableChange":pagination="false":columns="columns":data-source="data"borderedstyle="margin-top: 30px"><span slot="action" slot-scope="text"><a v-if="$store.getters.enterpriseId" @click="toDetail(text)">查看反馈</a><a-divider v-if="$store.getters.enterpriseId && text.reminderStatus == 2" type="vertical" /><a v-if="$store.getters.enterpriseId && text.reminderStatus == 2" @click="reminderOrder(text)">再次催单</a><a v-if="!$store.getters.enterpriseId && text.reminderStatus != 2" @click="toDetail(text, 1)">处理</a><a v-if="!$store.getters.enterpriseId && text.reminderStatus == 2" @click="toDetail(text)">查看</a></span></a-table></a-spin>// <!-- 分页 --><a-row type="flex" justify="end" style="margin-top: 50px"><a-paginationv-if="data.length != 0"show-quick-jumperv-model="page":total="pageTotal"@change="onChangePage":show-total="a => `总共 ${a} 条`"/></a-row></a-card><result ref="result" @update="search(1)"></result>// <!-- 催单弹窗 --><a-modal v-model="visibleCuidan" title="催单申请" ok-text="确认" cancel-text="取消" @ok="reminder"><div class="flex_l mb-20"><div style="width:80px;text-align:right">订单编号:</div><div>{{ orderNo }}</div></div><div class="flex_l flex-top"><div style="width:80px;text-align:right">添加备注:</div><a-input class="flex-1" v-model="cuidanRemark" rows="4" placeholder="填写备注..." type="textarea" /></div></a-modal></a-modal>
</template><script>
import { getSlectCombox } from '@/api/enterprise/accessory'
import { cuidanList, cuidan } from '@/api/order/orderList'
const columns = [{title: '序号',dataIndex: 'index',align: 'center'},{title: '订单号',dataIndex: 'orderNo',align: 'center'},{title: '订单状态',dataIndex: 'orderStatusName',align: 'center'},{title: '发起时间',dataIndex: 'createTime',align: 'center'},{title: '催单状态',dataIndex: 'reminderStatusName',align: 'center'},{title: '反馈结果',dataIndex: 'content',align: 'center',width: '20%'},{title: '操作',align: 'center',scopedSlots: { customRender: 'action' }}
]export default {data() {return {visible: false,form: this.$form.createForm(this, { name: 'advanced_search' }),enterprise: [],startTime: '', // 开始时间endTime: '', // 结束时间data: [],columns,page: 1,pageTotal: '',spinning: false,visibleCuidan: false, // 再次催单id: '',orderId: '',orderNo: '',cuidanRemark: ''}},components: {result: () => import('./cuidanResult')},methods: {init() {this.visible = true// 企业列表getSlectCombox().then(res => {this.enterprise = res.data})this.search()},filterOption(input, option) {return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0},// 3、日期选择器获取时间赋值给变量onChange(date, dateString) {console.log(date, dateString)this.startTime = dateString[0]this.endTime = dateString[1]},search(page) {if (page) {this.page = 1}this.spinning = truecuidanList(//  4、获取form表单的数据Object.assign(this.form.getFieldsValue(),this.$store.getters.enterpriseId? {pageNum: this.page,pageSize: 10,startTime: this.startTime,endTime: this.endTime,enterpriseId: this.$store.getters.enterpriseId}: {pageNum: this.page,pageSize: 10,startTime: this.startTime,endTime: this.endTime})).then(data => {this.spinning = falseif (data.code === 0) {this.pageTotal = data.totaldata.rows.forEach((item, i) => {this.$set(item, 'index', (this.page * 1 - 1) * 10 + i + 1)})this.data = data.rows} else {this.$message.error(data.msg)}})},onChangePage(pageNumber) {this.page = pageNumberthis.search()},toDetail(info, type) {this.$nextTick(() => {this.$refs.result.init(info, type)})},// 催单reminderOrder(record) {this.$nextTick(() => {this.visibleCuidan = truethis.orderId = record.orderIdthis.orderNo = record.orderNothis.id = record.id})},reminder() {cuidan({orderId: this.orderId,orderNo: this.orderNo,reminderRemark: this.cuidanRemark,id: this.id}).then(res => {this.$message.success('催单成功')this.visibleCuidan = falsethis.cuidanRemark = ''})}}
}
</script>
<style lang="less" scoped>
// 样式让form单在一行显示
/deep/.ant-form-item {display: flex !important;
}
/deep/.ant-form-item-control-wrapper {flex: 1 !important;width: 100% !important;
}
</style>

独立一行布局

![在这里插入图片描述](https://img-blog.csdnimg.cn/4706b7021b544e0d9378f5d0bf31cb9c.pn

<template><div><a-modal :title="id?'修改':'新增'" :visible="visible" @cancel="close" :footer="null" width="900px"><a-form :form="form" @submit="handleSubmit"><a-form-item label="标题" :labelCol="labelCol" :wrapperCol="wrapperCol"><a-input v-decorator="['title', { rules: [{ required: true, message: '请填写标题' }] }]" /></a-form-item><a-form-item label="封面" :labelCol="labelCol" :wrapperCol="wrapperCol"><a-upload :headers="headers" :action="uploadUrl" list-type="picture-card" :file-list="fileList"@preview="handlePreview" @change="handleChange"><div v-if="fileList.length < 1"><a-icon type="plus" /><div class="ant-upload-text">封面</div></div></a-upload><a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel"><img alt="example" style="width: 100%" :src="previewImage" /></a-modal></a-form-item><a-form-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol"><a-checkbox-group v-decorator="['type', { rules: [{ required: true, message: '请选择类型' }] }]"><a-checkbox v-for="item in trainType" :key="item.dictValue" :value="item.dictValue">{{ item.dictLabel }}</a-checkbox></a-checkbox-group></a-form-item><a-form-item label="关联品牌型号" :labelCol="labelCol" :wrapperCol="wrapperCol"><a-button type="primary" @click="link()">关联</a-button></a-form-item><a-form-item label="上传附件" :labelCol="labelCol" :wrapperCol="wrapperCol"><a-upload :action="uploadUrl" :headers="headers" :multiple="false" :file-list="imgList"@change="handleChange1" :before-upload="beforeUpload"><a-button><a-icon type="upload" /> 上传附件</a-button></a-upload><div style="color:red">支持上传视频和文档;支持扩展名:.doc .docx .pdf .xls .xlsx .ppt .pptx .jpg .png .mp4 .avi .wmv</div></a-form-item><a-form-item label="链接地址" :labelCol="labelCol" :wrapperCol="wrapperCol"><a-input v-decorator="['outurl']" /></a-form-item><editor id="tinymce" v-model="content" :init="init"></editor><a-form-item :wrapper-col="{ span: 12, offset: 4 }"><a-button type="primary" html-type="submit">保存</a-button></a-form-item></a-form></a-modal><!-- 关联 --><treelink :modelIds="modelIds" ref="treelink" @ok="linkOk"></treelink></div>
</template><script>
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getfinddictAll } from '@/api/order/orderList'
import treelink from './searchTree.vue'
import { imgUrl } from '@/utils/common'
import { trainEdit, getInfo, trainAdd } from '@/api/trainOverview/trainList'
import tinymce from 'tinymce/tinymce'
import Editor from '@tinymce/tinymce-vue'
import 'tinymce/themes/silver/theme'
import 'tinymce/plugins/image'
import 'tinymce/plugins/media'
import 'tinymce/icons/default'
export default {data() {return {form: this.$form.createForm(this, { name: 'coordinated' }),labelCol: {xs: { span: 24 },sm: { span: 4 }},wrapperCol: {xs: { span: 24 },sm: { span: 20 }},visible: false,id: '', // 修改的idrow: '', // 修改传过来的// 封面uploadUrl: process.env.VUE_APP_API_BASE_URL + '/dfs/upload?type=train',headers: {token: Vue.ls.get(ACCESS_TOKEN)},previewVisible: false,previewImage: '',fileList: [// {// uid: '-1',// name: 'image.png',// status: 'done',// url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',// },],trainType: [],  // 类型modelIds: [], // 品牌型号// 上传附件imgList: [// {//   uid: '-1',//   name: 'xxx.png',//   status: 'done',//   url: 'http://www.baidu.com/xxx.png',// },],// 富文本content: '',init: {language_url: '/tinymce/langs/zh_CN.js', //语言包的路径language: 'zh_CN', //语言skin_url: '/tinymce/skins/ui/oxide', //skin路径height: 300, //编辑器高度branding: false, //是否禁用“Powered by TinyMCE”menubar: false, //顶部菜单栏显示,automatic_uploads: true,paste_data_images: true,// plugins: 'advlist link image code textcolor paste textcolor colorpicker',file_picker_callback: function (callback, value, meta) {console.log('xxxxx: ' + value)},images_upload_handler: (blobInfo, success, failure) => {const img = 'data:image/jpeg;base64,' + blobInfo.base64()success(img)},video_template_callback: function (data) { },plugins:'advlist autolink lists link image charmap print preview anchor searchreplace visualblocks code fullscreen insertdatetime media table paste code help wordcount',toolbar:'undo redo | bold italic underline strikethrough | fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify bullist numlist outdent indent blockquote | image code removeformat'},}},components: {Editor,treelink},mounted() {let dictTypes = ['train_type']getfinddictAll({ dictTypes: dictTypes.join() }).then(res => {this.trainType = res.train_type})},methods: {// 点击新增add() {console.log(111)this.visible = true},// 点击修改edit(row) {console.log(222)this.id = row.trainIdthis.row = rowthis.visible = truegetInfo(this.id).then(res => {if (res.code == 0 && res.data) {setTimeout(() => {this.form.setFieldsValue({title: res.data.title,type: res.data.type.split(','),outurl: res.data.outurl});}, 0);if (res.data.imgurl) {this.fileList = [{uid: '-1',name: res.data.imgurl.split('/')[res.data.imgurl.split('/').length - 1],status: 'done',url: imgUrl + res.data.imgurl,url1: res.data.imgurl,}]}if (res.data.trainInfos.length) {this.imgList = res.data.trainInfos.map(item => {return {uid: '-1',name: item.matterUrl.split('/')[item.matterUrl.split('/').length - 1],status: 'done',url: imgUrl + item.matterUrl,url1: item.matterUrl,trainType: item.trainType,}})}this.modelIds = res.data.modelIds || []this.content = res.data.content || ''} else {this.$message.error(res.msg)}})},// 新增和修改保存handleSubmit(e) {e.preventDefault();this.form.validateFields((err, values) => {if (!err) {// console.log('Received values of form: ', values);// console.log(this.fileList);// console.log(this.modelIds);// console.log(11, this.imgList);values.type = values.type.join(',')let arr = this.imgList.filter(item => item.url)let trainInfos = arr.length ? arr.map(item => {return { matterUrl: item.url1, trainType: item.trainType }}) : []console.log(22, trainInfos);let query = Object.assign(values,{ modelIds: this.modelIds },{ imgurl: this.fileList.length ? this.fileList[0].url1 : '' },{ trainInfos: trainInfos },{ content: this.content });if (this.id) {query = Object.assign(query, {trainId: this.id,releaseStatus: this.row.releaseStatus})trainEdit(query).then(res => {if (res.code === 0) {this.$message.success('修改成功!')this.close()this.$emit('ok')} else {this.$message.error(res.msg)}})} else {trainAdd(query).then(res => {if (res.code === 0) {this.$message.success('新增成功!')this.close()this.$emit('ok')} else {this.$message.error(res.msg)}})}}});},close() {this.visible = falsethis.form.resetFields()this.fileList = []this.modelIds = []this.imgList = []// 复选框选中表单重置报错,加上这个好了this.form.setFieldsValue({type: []});this.content = ''},// 封面handleCancel() {this.previewVisible = false;},async handlePreview(file) {console.log(file)this.previewImage = file.url || file.preview;this.previewVisible = true;},handleChange({ fileList }) {fileList = fileList.map(file => {if (file.response) {file.url = imgUrl + file.response.url;file.url1 = file.response.url;}return file;});this.fileList = fileList;},// 关联品牌型号link() {this.$refs.treelink.init()},linkOk(list) {this.modelIds = list},// 上传附件beforeUpload(file) {let arr = ["doc", "docx", "pdf", "xls", "xlsx", "ppt", "pptx", "jpg", "png", "mp4", "avi", "wmv"]let type = file.name.split('.')[file.name.split('.').length - 1]if (!arr.includes(type)) {this.$message.error('不支持上传 .' + type + '格式');}return arr.includes(type);},handleChange1(info) {let fileList = [...info.fileList];let arr1 = ['mp4', "avi", "wmv"]fileList = fileList.map(file => {if (file.response) {file.url = imgUrl + file.response.url;file.url1 = file.response.url;file.trainType = arr1.includes(file.name.split('.')[file.name.split('.').length - 1]) ? 1 : 2}return file;});this.imgList = fileList;},},
}
</script>

http://chatgpt.dhexx.cn/article/W3GBIuhg.shtml

相关文章

Layui框架:layui的格栅布局规则

1、划分layui区域 layui-container&#xff1a;layui框架的容器&#xff0c;作用类似于flex布局的容器。 <div class"layui-container">// 在网页上划分一个区域&#xff0c;该区域专门使用layui的布局模块 </div> 在layui框架中&#xff0c;任何行上方…

layui框架学习(9:静态表格)

Layui中处理表格样式分为静态表格及数据表格&#xff0c;所谓静态表格是指数据固定的表格&#xff0c;而数据表格则是动态获取数据构建的表格&#xff0c;前者主要使用Layui的预设类及属性设置表格样式&#xff0c;而后者则主要调用table模块操作表格。本文主要学习Layui中与静…

关于layui框架的form表单布局

form表单的使用 在使用from表单的时候&#xff0c;必须先声明from模块&#xff0c;否则select、checkbox、radio等将无法显示&#xff0c;并且无法使用form相关功能&#xff0c;这是很多小白一开始经常犯的错误&#xff0c;虽然这很简单但也很基础&#xff0c;所以有必要在这里…

关于layui框架的form表单布局(小白向)

form表单的使用 在使用form表单的时候&#xff0c;必须先声明form模块&#xff0c;否则select、checkbox、radio等将无法显示&#xff0c;并且无法使用form相关功能&#xff0c;这是很多小白一开始经常犯的错误&#xff0c;虽然这很简单但也很基础&#xff0c;所以有必要在这里…

北斗/GPS差分定位技术有哪些?

普通的单点定位技术由于卫星信号在空间传播受到电离层、对流层等影响&#xff0c;信号传播发生了一定的折射&#xff0c;带来了伪据观测误差&#xff0c;使得定位精度在5到10米范围内。很显然这样的定位精度很难满足一些特定领域的需求。差分定位技术可以有效的提高定位精度&am…

5G+北斗:人员定位系统为化工厂定位赋能

人员定位系统是集计算机软硬件、信息采集处理、无线数据传输、网络数据通讯、自动控制等技术多学科综合应用为一体的自动识别信息技术产品&#xff0c;可以实现对不同人、物在不同状态下的智能识别。 物联网时代&#xff0c;人们以感知为目的实现人与人、人与物、物与物全面互联…

北斗与GPS有哪些区别?

北斗卫星建设是中国战略事业重要的一环。当然&#xff0c;国防安全是建设北斗最重要的原因。在地理信息如此重要的战场&#xff0c;必须握有自己的知识技术产权和产品。虽说GPS的民用在中国是免费的&#xff0c;但是如果战时美国关闭或者利用其“SA政策”对GPS“做手脚”&#…

常用的北斗高精度定位技术有哪些?

主要有&#xff1a;载波相位差分技术RTK、精密单点定位技术PPP、辅助北斗快速定位技术A-BDS、北斗地基增强系统、北斗星基增强系统这5项技术。 载波相位差分技术RTK 载波相位动态实时接收机RTK&#xff1a;Real - Time Kinematic&#xff0c;其原理是&#xff1a; 基准站和移…

什么是5G北斗RTK差分定位系统?它有哪些优势和应用领域?

5G技术的普及和应用&#xff0c;使得物联网和智能设备的使用越来越广泛。然而&#xff0c;在实际应用过程中&#xff0c;精准的定位数据是必不可少的。北斗差分定位系统作为一项定位技术&#xff0c;受到了市场的关注。本文将对5G北斗差分定位系统进行分析&#xff0c;并比较其…

北斗系统基础知识1(北斗系统定位原理说明“图文详述”)

需求说明&#xff1a;知识储备 内容 &#xff1a;北斗系统起源及工作原理 来自 &#xff1a;时间的诗 原文&#xff1a;http://www.bingdun.com/news/bingdun/3252.htm 从来没有那个事物像 GPS 那样改变了人类的生活&#xff0c;你能想象没有 GPS 的生活情境吗&am…

北斗通信模块 北斗gps模块 北斗通信终端DTU

计讯物联北斗通信模块DTU&#xff0c;支持北斗、三大运营商4G/3G/2G网络无线通信&#xff0c;采用高性能的工业级32位通信处理器&#xff0c;软件多级检测和硬件多重保护机制来提高设备稳定性。帮助用户快速接入高速互联网&#xff0c;实现安全可靠的数据传输&#xff0c;广泛应…

“北斗”知多少?

【日志】 2020/5/23 我想写一篇有关北斗的科普性的博客&#xff0c;将自己学到的东西做点小笔记&#xff0c;顺带分享给大家&#xff0c;嘿嘿。但是&#xff0c;一时间思潮翻涌&#xff0c;竟不知从何处开始写起。先开个草稿&#xff0c;之后萌生灵感再来填坑。 2020/6/23 今天…

ATK-S1216F8-BD GPS/北斗模块调试

手头上有这一模块。 1、模块通过串口与外部系统连接&#xff0c;串口波特率支持 4800、9600、19200、38400&#xff08;默认&#xff09;、57600、115200、230400 等不同速率&#xff0c; 2、兼容 5V/3.3V 单片机系统 3、 模块自带可充电后备电池&#xff0c;可以掉电保持星历…

【定位导航科普篇】北斗卫星导航技术介绍

1、中国北斗卫星导航系统-BDS 北斗卫星导航系统&#xff08;简称北斗系统&#xff09;是我国自主发展、独立运行的全球卫星导航系统&#xff0c;为全球用户提供全天候、全天时、高精度的定位、导航和授时服务&#xff0c;是继 GPS、GLONASS 之后&#xff0c;第三个成熟的卫星导…

北斗系统概述

目录 1 空间段 2 地面控制段 3 用户段 4 时间系统 我国制定了北斗卫星导航系统三步走战略&#xff1a;第一阶段&#xff0c;2000年年底&#xff0c;发射2颗北斗一号卫星&#xff0c;建成北斗一号系统&#xff0c;向中国提供服务&#xff1b;第二阶段&#xff0c;2007年-201…

室外定位:高精度北斗RTK定位技术

北斗RTK定位技术&#xff0c;也称北斗差分定位技术&#xff0c;利用我国自主研发的北斗卫星定位系统实现精确定位功能。定位精度可根据需要&#xff0c;通过选择不同精度的人员定位终端来实现。 在科技强国的战略驱动下&#xff0c;北斗RTK定位技术迎来了广阔的发展机遇&#x…

北斗定位模块是什么,有定位功能吗

我国北斗定位系统的组网完成&#xff0c;其衍生的应用技术和产业如雨后春笋&#xff0c;市场上也出现了越来越多的定位设备、定位模块等&#xff0c;显然这些设备的主要功能是定位&#xff0c;其他方面呢&#xff0c;究竟北斗定位模块是什么呢? 北斗定位模块 北斗定位模块&…

北斗三号卫星导航信号及接收策略

一、北斗三号卫星导航信号的特点 从上个世纪九十年代初北斗一号立项到现在&#xff0c;我国的北斗卫星导航系统已经走过了二十多年的发展历程。根据三步走的发展计划&#xff0c;先后经历了北斗一号和北斗二号两个阶段&#xff0c;目前正在向北斗三号发展。以用户的视角我们可…

单片机+北斗模块实现定位

本文原创&#xff0c;转载请注明出处。小编可能以后不会在简书简书地址上更新了&#xff0c;因为这里的markdown 编辑器太不好用了&#xff0c;没有CSDN 上面的好用&#xff0c;也希望粉丝们多多关注本人CSDN&#xff08;一样的昵称呦&#xff09;。 导航是继移动通信之后发展最…

北斗卫星导航系统介绍

北斗卫星导航系统 导言 2020年3月9日&#xff0c;我国在西昌卫星发射中心用长征三号乙运载火箭&#xff0c;成功发射北斗系统第五十四颗导航卫星。距离北斗三号系统建成&#xff0c;仅一步之遥。从双星导航定位到54颗北斗嵌满星空&#xff0c;中国北斗走过了28载问天路。作为…