materialSlModal.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <div id="materialSlModal">
  3. <a-modal
  4. title=""
  5. v-model="materialSlModVis"
  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="materialSlData"
  16. bordered
  17. rowKey="id"
  18. :columns="materialSlColumns"
  19. :data-source="materialSlData"
  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 {getGoods} from '@api/oa/cd-personnel-files'
  56. export default {
  57. name: 'MaterialSlModal', // 报关要素
  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. materialSlColumns: [
  67. {
  68. title: '所属部门',
  69. dataIndex: 'sysOrgCode',
  70. width: 140,
  71. ellipsis: true,
  72. className: 'replacecolor'
  73. },
  74. {
  75. title: '物料编号',
  76. dataIndex: 'materialNumber',
  77. width: 140,
  78. ellipsis: true,
  79. className: 'replacecolor'
  80. },
  81. {
  82. title: '录入人账号',
  83. dataIndex: 'inputAccount',
  84. width: 130,
  85. ellipsis: true,
  86. className: 'replacecolor'
  87. },
  88. {
  89. title: '部门',
  90. dataIndex: 'department',
  91. width: 130,
  92. ellipsis: true,
  93. className: 'replacecolor'
  94. },
  95. {
  96. title: '品名',
  97. dataIndex: 'tradeName',
  98. width: 130,
  99. ellipsis: true,
  100. className: 'replacecolor'
  101. },
  102. {
  103. title: '品牌',
  104. dataIndex: 'brand',
  105. width: 120,
  106. ellipsis: true,
  107. className: 'replacecolor'
  108. },
  109. {
  110. title: '类别',
  111. dataIndex: 'category',
  112. width: 120,
  113. ellipsis: true,
  114. className: 'replacecolor'
  115. },
  116. {
  117. title: '规格型号',
  118. dataIndex: 'specificationsModels',
  119. ellipsis: true,
  120. width: 180,
  121. className: 'replacecolor'
  122. },
  123. {
  124. title: '数量',
  125. dataIndex: 'amount',
  126. width: 120,
  127. ellipsis: true,
  128. className: 'replacecolor'
  129. },
  130. {
  131. title: '单位',
  132. dataIndex: 'unit',
  133. width: 120,
  134. ellipsis: true,
  135. className: 'replacecolor'
  136. },
  137. {
  138. title: '单价(元)',
  139. dataIndex: 'unitPrice',
  140. width: 120,
  141. ellipsis: true,
  142. className: 'replacecolor'
  143. },
  144. {
  145. title: '金额',
  146. dataIndex: 'money',
  147. width: 90,
  148. className: 'replacecolor',
  149. },
  150. {
  151. title: '入库日期',
  152. dataIndex: 'inputWarehouseDate',
  153. width: 90,
  154. className: 'replacecolor',
  155. },
  156. ],
  157. materialSlData: [ ], // 子表信息
  158. materialSlModVis: false,
  159. selectedRowKeys:[],
  160. selectedRows:[],
  161. }
  162. },
  163. // 接收父组件 方法
  164. props: {},
  165. created() {
  166. },
  167. methods: {
  168. personLists(value){
  169. getGoods({tableName:'material_apply'}).then(res => {
  170. if (res.success) {
  171. debugger
  172. this.materialSlData = res.result
  173. }else{
  174. this.$message.error(res.message);
  175. }
  176. })
  177. },
  178. close() {
  179. this.$emit('close-declare')
  180. this.materialSlModVis = false
  181. this.declareElements = {}
  182. this.declareElementsData = []
  183. this.selectedRowKeys = []
  184. },
  185. handleCancel() {
  186. this.close()
  187. },
  188. onSelectChange(keys,rows){
  189. this.selectedRowKeys = keys;
  190. this.selectedRows = rows;
  191. },
  192. addSave(){
  193. if(this.selectedRowKeys.length == 0){
  194. this.$message.error('请勾选数据');
  195. }else if(this.selectedRowKeys.length >1){
  196. this.$message.error('一次只可勾选一行数据');
  197. }else{
  198. var data ={
  199. trade_name : this.selectedRows[0].tradeName,
  200. brand:this.selectedRows[0].brand,
  201. category:this.selectedRows[0].category,
  202. specifications_models:this.selectedRows[0].specificationsModels,
  203. unit:this.selectedRows[0].unit,
  204. unit_price:this.selectedRows[0].unitPrice,
  205. }
  206. this.$emit('close',data)
  207. this.close()
  208. }
  209. }
  210. },
  211. computed: {}
  212. }
  213. </script>
  214. <style lang="less" scoped>
  215. /deep/ .ant-table-thead > tr > th {
  216. text-align: center;
  217. // font-weight: 700;
  218. }
  219. /deep/ .ant-table-tbody {
  220. text-align: center;
  221. }
  222. // th.replacecolor {
  223. // background-color: #ccc;
  224. // }
  225. // 对话框里的card样式
  226. /deep/ .ant-modal-content {
  227. background-color: #f0f2f5;
  228. }
  229. /deep/ .ant-modal-body {
  230. padding: 10px;
  231. }
  232. /deep/.ant-form-item{
  233. margin-bottom: 0px !important;
  234. }
  235. /deep/.ant-table-scroll {
  236. word-break: break-all;
  237. }
  238. </style>