departmentModal.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div id="departmentModal">
  3. <a-modal
  4. title=""
  5. v-model="departmentModVis"
  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="departMentata"
  16. bordered
  17. rowKey="id"
  18. :columns="departmentColumns"
  19. :data-source="departMentata"
  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 {getClass} from '@api/oa/cd-personnel-files'
  56. export default {
  57. name: 'DepartmentModal', // 报关要素
  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. departmentColumns: [
  67. {
  68. title: '机构/部门名称',
  69. dataIndex: 'departName',
  70. width: 140,
  71. ellipsis: true,
  72. className: 'replacecolor'
  73. },
  74. {
  75. title: '英文名',
  76. dataIndex: 'departNameEn',
  77. width: 140,
  78. ellipsis: true,
  79. className: 'replacecolor'
  80. },
  81. {
  82. title: '缩写',
  83. dataIndex: 'departNameAbbr',
  84. width: 130,
  85. ellipsis: true,
  86. className: 'replacecolor'
  87. },
  88. {
  89. title: '描述',
  90. dataIndex: 'description',
  91. width: 130,
  92. ellipsis: true,
  93. className: 'replacecolor'
  94. },
  95. {
  96. title: '机构类别',
  97. dataIndex: 'orgCategory',
  98. width: 120,
  99. ellipsis: true,
  100. className: 'replacecolor'
  101. },
  102. {
  103. title: '机构类型',
  104. dataIndex: 'orgType',
  105. width: 120,
  106. ellipsis: true,
  107. className: 'replacecolor'
  108. },
  109. {
  110. title: '机构编码',
  111. dataIndex: 'orgCode',
  112. ellipsis: true,
  113. width: 180,
  114. className: 'replacecolor'
  115. },
  116. {
  117. title: '手机号',
  118. dataIndex: 'mobile',
  119. width: 120,
  120. ellipsis: true,
  121. className: 'replacecolor'
  122. },
  123. ,
  124. {
  125. title: '状态',
  126. dataIndex: 'status',
  127. width: 130,
  128. ellipsis: true,
  129. className: 'replacecolor'
  130. },
  131. ],
  132. departMentata: [ ], // 子表信息
  133. departmentModVis: false,
  134. selectedRowKeys:[],
  135. selectedRows:[],
  136. }
  137. },
  138. // 接收父组件 方法
  139. props: {},
  140. created() {
  141. },
  142. methods: {
  143. personLists(){
  144. getClass().then(res => {
  145. debugger
  146. if (res.success) {
  147. debugger
  148. this.departMentata = res.result
  149. }else{
  150. this.$message.error(res.message);
  151. }
  152. })
  153. },
  154. close() {
  155. this.$emit('close-declare')
  156. this.departmentModVis = false
  157. this.departMentata = []
  158. this.selectedRowKeys = []
  159. },
  160. handleCancel() {
  161. this.close()
  162. },
  163. onSelectChange(keys,rows){
  164. this.selectedRowKeys = keys;
  165. this.selectedRows = rows;
  166. },
  167. addSave(){
  168. if(this.selectedRowKeys.length == 0){
  169. this.$message.error('请勾选数据');
  170. }else if(this.selectedRowKeys.length >1){
  171. this.$message.error('一次只可勾选一行数据');
  172. }else{
  173. var data ={
  174. car_arrange : this.selectedRows[0].number,
  175. }
  176. this.$emit('close',data)
  177. this.close()
  178. }
  179. }
  180. },
  181. computed: {}
  182. }
  183. </script>
  184. <style lang="less" scoped>
  185. /deep/ .ant-table-thead > tr > th {
  186. text-align: center;
  187. // font-weight: 700;
  188. }
  189. /deep/ .ant-table-tbody {
  190. text-align: center;
  191. }
  192. // th.replacecolor {
  193. // background-color: #ccc;
  194. // }
  195. // 对话框里的card样式
  196. /deep/ .ant-modal-content {
  197. background-color: #f0f2f5;
  198. }
  199. /deep/ .ant-modal-body {
  200. padding: 10px;
  201. }
  202. /deep/.ant-form-item{
  203. margin-bottom: 0px !important;
  204. }
  205. /deep/.ant-table-scroll {
  206. word-break: break-all;
  207. }
  208. </style>