123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <div id="carSqModal">
- <a-modal
- title=""
- v-model="carSqModVis"
- @cancel="handleCancel"
- width="80%"
- style="top:330px;left:100px;"
- >
- <!-- 増行 子表 -->
- <a-card :bordered="false" style="margin:10px 0">
- <!-- 子表 -->
- <a-form-model ref="formRef">
- <a-table
- v-if="carSqData"
- bordered
- rowKey="id"
- :columns="carSqColumns"
- :data-source="carSqData"
- :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
- :pagination="false"
- :scroll="{x:2100,y: 300}"
- >
-
- </a-table>
- </a-form-model>
- </a-card>
- <!-- 页面底部保存取消 -->
- <div
- :style="{
- position: 'absolute',
- right: 0,
- bottom: 0,
- width: '100%',
- borderTop: '1px solid #e9e9e9',
- padding: '10px 16px',
- background: '#fff',
- textAlign: 'right',
- zIndex: 1
- }"
- >
- <a-popconfirm title="确定放弃?" @confirm="close" okText="确定" cancelText="取消">
- <a-button :style="{ marginRight: '8px' }">返回</a-button>
- </a-popconfirm>
- <a-button type="primary" @click="addSave">
- 确认
- </a-button>
- </div>
- </a-modal>
- </div>
- </template>
- <script>
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import JEllipsis from '@/components/jeecg/JEllipsis'
- import moment from 'moment'
- import {getCar} from '@api/oa/cd-personnel-files'
- export default {
- name: 'CarSqModal', // 报关要素
- mixins: [JeecgListMixin],
- components: { JEllipsis, moment },
- data() {
- let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
- return {
- loading: false, // 表格加载
- pushState: false, //是否推送
- // 子表表头
- carSqColumns: [
- {
- title: '车牌号',
- dataIndex: 'number',
- width: 140,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '车俩类型',
- dataIndex: 'carType',
- width: 130,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '能源类型',
- dataIndex: 'energyType',
- width: 130,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '座位数量',
- dataIndex: 'seat',
- width: 130,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '购买价格',
- dataIndex: 'price',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '购置日期',
- dataIndex: 'purchaseDate',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- },
- {
- title: '发动机号码',
- dataIndex: 'engineNum',
- ellipsis: true,
- width: 180,
- className: 'replacecolor'
- },
- {
- title: '车架号',
- dataIndex: 'vin',
- width: 120,
- ellipsis: true,
- className: 'replacecolor'
- }
- ],
- carSqData: [ ], // 子表信息
- carSqModVis: false,
- selectedRowKeys:[],
- selectedRows:[],
- }
- },
- // 接收父组件 方法
- props: {},
- created() {
- },
- methods: {
- personLists(){
- getCar().then(res => {
- if (res.success) {
- this.carSqData = res.result
- }else{
- this.$message.error(res.message);
- }
- })
- },
- close() {
- this.$emit('close-declare')
- this.carSqModVis = false
- this.declareElements = {}
- this.declareElementsData = []
- this.selectedRowKeys = []
- },
- handleCancel() {
- this.close()
- },
- onSelectChange(keys,rows){
- this.selectedRowKeys = keys;
- this.selectedRows = rows;
- },
- addSave(){
- if(this.selectedRowKeys.length == 0){
- this.$message.error('请勾选数据');
- }else if(this.selectedRowKeys.length >1){
- this.$message.error('一次只可勾选一行数据');
- }else{
- var data ={
- car_arrange : this.selectedRows[0].number,
- }
- this.$emit('close',data)
- this.close()
- }
- }
- },
- computed: {}
- }
- </script>
- <style lang="less" scoped>
- /deep/ .ant-table-thead > tr > th {
- text-align: center;
- // font-weight: 700;
- }
- /deep/ .ant-table-tbody {
- text-align: center;
- }
- // th.replacecolor {
- // background-color: #ccc;
- // }
- // 对话框里的card样式
- /deep/ .ant-modal-content {
- background-color: #f0f2f5;
- }
- /deep/ .ant-modal-body {
- padding: 10px;
- }
- /deep/.ant-form-item{
- margin-bottom: 0px !important;
- }
- /deep/.ant-table-scroll {
- word-break: break-all;
- }
- </style>
|