carSqModal.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div id="carSqModal">
  3. <a-modal
  4. title=""
  5. v-model="carSqModVis"
  6. @cancel="handleCancel"
  7. width="80%"
  8. style="top:330px;left:100px;"
  9. >
  10. <!-- 増行 子表 -->
  11. <a-card :bordered="false" style="margin:10px 0">
  12. <!-- 子表 -->
  13. <a-form-model ref="formRef">
  14. <a-table
  15. v-if="carSqData"
  16. bordered
  17. rowKey="id"
  18. :columns="carSqColumns"
  19. :data-source="carSqData"
  20. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  21. :pagination="false"
  22. :scroll="{x:2100,y: 300}"
  23. >
  24. </a-table>
  25. </a-form-model>
  26. </a-card>
  27. <!-- 页面底部保存取消 -->
  28. <div
  29. :style="{
  30. position: 'absolute',
  31. right: 0,
  32. bottom: 0,
  33. width: '100%',
  34. borderTop: '1px solid #e9e9e9',
  35. padding: '10px 16px',
  36. background: '#fff',
  37. textAlign: 'right',
  38. zIndex: 1
  39. }"
  40. >
  41. <a-popconfirm title="确定放弃?" @confirm="close" okText="确定" cancelText="取消">
  42. <a-button :style="{ marginRight: '8px' }">返回</a-button>
  43. </a-popconfirm>
  44. <a-button type="primary" @click="addSave">
  45. 确认
  46. </a-button>
  47. </div>
  48. </a-modal>
  49. </div>
  50. </template>
  51. <script>
  52. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  53. import JEllipsis from '@/components/jeecg/JEllipsis'
  54. import moment from 'moment'
  55. import {getCar} from '@api/oa/cd-personnel-files'
  56. export default {
  57. name: 'CarSqModal', // 报关要素
  58. mixins: [JeecgListMixin],
  59. components: { JEllipsis, moment },
  60. data() {
  61. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  62. return {
  63. loading: false, // 表格加载
  64. pushState: false, //是否推送
  65. // 子表表头
  66. carSqColumns: [
  67. {
  68. title: '车牌号',
  69. dataIndex: 'number',
  70. width: 140,
  71. ellipsis: true,
  72. className: 'replacecolor'
  73. },
  74. {
  75. title: '车俩类型',
  76. dataIndex: 'carType',
  77. width: 130,
  78. ellipsis: true,
  79. className: 'replacecolor'
  80. },
  81. {
  82. title: '能源类型',
  83. dataIndex: 'energyType',
  84. width: 130,
  85. ellipsis: true,
  86. className: 'replacecolor'
  87. },
  88. {
  89. title: '座位数量',
  90. dataIndex: 'seat',
  91. width: 130,
  92. ellipsis: true,
  93. className: 'replacecolor'
  94. },
  95. {
  96. title: '购买价格',
  97. dataIndex: 'price',
  98. width: 120,
  99. ellipsis: true,
  100. className: 'replacecolor'
  101. },
  102. {
  103. title: '购置日期',
  104. dataIndex: 'purchaseDate',
  105. width: 120,
  106. ellipsis: true,
  107. className: 'replacecolor'
  108. },
  109. {
  110. title: '发动机号码',
  111. dataIndex: 'engineNum',
  112. ellipsis: true,
  113. width: 180,
  114. className: 'replacecolor'
  115. },
  116. {
  117. title: '车架号',
  118. dataIndex: 'vin',
  119. width: 120,
  120. ellipsis: true,
  121. className: 'replacecolor'
  122. }
  123. ],
  124. carSqData: [ ], // 子表信息
  125. carSqModVis: false,
  126. selectedRowKeys:[],
  127. selectedRows:[],
  128. }
  129. },
  130. // 接收父组件 方法
  131. props: {},
  132. created() {
  133. },
  134. methods: {
  135. personLists(){
  136. getCar().then(res => {
  137. if (res.success) {
  138. this.carSqData = res.result
  139. }else{
  140. this.$message.error(res.message);
  141. }
  142. })
  143. },
  144. close() {
  145. this.$emit('close-declare')
  146. this.carSqModVis = false
  147. this.declareElements = {}
  148. this.declareElementsData = []
  149. this.selectedRowKeys = []
  150. },
  151. handleCancel() {
  152. this.close()
  153. },
  154. onSelectChange(keys,rows){
  155. this.selectedRowKeys = keys;
  156. this.selectedRows = rows;
  157. },
  158. addSave(){
  159. if(this.selectedRowKeys.length == 0){
  160. this.$message.error('请勾选数据');
  161. }else if(this.selectedRowKeys.length >1){
  162. this.$message.error('一次只可勾选一行数据');
  163. }else{
  164. var data ={
  165. car_arrange : this.selectedRows[0].number,
  166. }
  167. this.$emit('close',data)
  168. this.close()
  169. }
  170. }
  171. },
  172. computed: {}
  173. }
  174. </script>
  175. <style lang="less" scoped>
  176. /deep/ .ant-table-thead > tr > th {
  177. text-align: center;
  178. // font-weight: 700;
  179. }
  180. /deep/ .ant-table-tbody {
  181. text-align: center;
  182. }
  183. // th.replacecolor {
  184. // background-color: #ccc;
  185. // }
  186. // 对话框里的card样式
  187. /deep/ .ant-modal-content {
  188. background-color: #f0f2f5;
  189. }
  190. /deep/ .ant-modal-body {
  191. padding: 10px;
  192. }
  193. /deep/.ant-form-item{
  194. margin-bottom: 0px !important;
  195. }
  196. /deep/.ant-table-scroll {
  197. word-break: break-all;
  198. }
  199. </style>