companyList.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <div>
  3. <el-form ref="form" >
  4. <!-- 数据表格 -->
  5. <ele-pro-table
  6. ref="table"
  7. :columns="columns"
  8. :datasource="tableList"
  9. :needPage="false"
  10. :minHeight="100"
  11. tool-class="ele-toolbar-form"
  12. cache-key="eomContactPageTable"
  13. :summary-method="getSummaries"
  14. show-summary
  15. >
  16. <!-- 表头工具栏 -->
  17. <template v-slot:toolbar>
  18. <div class="listToolbar">
  19. <el-button
  20. v-if="dialogType !== 'view'"
  21. size="small"
  22. type="primary"
  23. icon="el-icon-plus"
  24. class="ele-btn-icon"
  25. @click="handleAddInfo"
  26. >
  27. 新增
  28. </el-button>
  29. </div>
  30. </template>
  31. <template v-slot:action="{ row, $index }" v-if="dialogType !== 'view'">
  32. <el-popconfirm
  33. class="ele-action"
  34. title="确定要删除此信息吗?"
  35. @confirm="handleDelInfo($index)"
  36. >
  37. <template v-slot:reference>
  38. <el-link type="danger" :underline="false" icon="el-icon-delete">
  39. 删除
  40. </el-link>
  41. </template>
  42. </el-popconfirm>
  43. </template>
  44. <template v-slot:dataTime="{ row, $index }" v-if="dialogType !== 'view'">
  45. <el-form-item :prop="'tableList.' + $index + '.dataTime'">
  46. <el-date-picker
  47. v-model="row.dataTime"
  48. type="date"
  49. placeholder="选择日期"
  50. value-format="yyyy-MM-dd"
  51. >
  52. </el-date-picker>
  53. </el-form-item>
  54. </template>
  55. <template v-slot:cost="{ row, $index }" v-if="dialogType !== 'view'">
  56. <el-form-item :prop="'datasource.' + $index + '.cost'">
  57. <el-input type="number" v-model="row.cost"></el-input>
  58. </el-form-item>
  59. </template>
  60. <template
  61. v-slot:personal="{ row, $index }"
  62. v-if="dialogType !== 'view'"
  63. >
  64. <el-form-item :prop="'datasource.' + $index + '.personal'">
  65. <el-input type="number" v-model="row.personal"></el-input>
  66. </el-form-item>
  67. </template>
  68. <template v-slot:place="{ row, $index }" v-if="dialogType !== 'view'">
  69. <el-form-item :prop="'datasource.' + $index + '.place'">
  70. <el-input v-model="row.place"></el-input>
  71. </el-form-item>
  72. </template>
  73. <template v-slot:text="{ row, $index }" v-if="dialogType !== 'view'">
  74. <el-form-item :prop="'datasource.' + $index + '.text'">
  75. <el-input v-model="row.text"></el-input>
  76. </el-form-item>
  77. </template>
  78. <template v-slot:remark="{ row, $index }" v-if="dialogType !== 'view'">
  79. <el-form-item :prop="'datasource.' + $index + '.remark'">
  80. <el-input type="textarea" v-model="row.remark"></el-input>
  81. </el-form-item>
  82. </template>
  83. </ele-pro-table>
  84. </el-form>
  85. <productList
  86. :currentIndex="-1"
  87. @changeParent="changeParent"
  88. ref="productListRef"
  89. ></productList>
  90. </div>
  91. </template>
  92. <script>
  93. import { getSummaries } from '@/utils/util.js';
  94. import productList from '@/BIZComponents/product-list.vue';
  95. export default {
  96. name: 'relatedInfoTable',
  97. props: {
  98. dialogType: '',
  99. organizationList: {
  100. type: Array,
  101. default: () => {
  102. return [];
  103. }
  104. }
  105. },
  106. components: { productList },
  107. data() {
  108. return {
  109. tableList: [],
  110. currentIndex: '',
  111. defaultProps: {
  112. multiple: false,
  113. checkStrictly: true,
  114. emitPath: false,
  115. children: 'children',
  116. value: 'id',
  117. label: 'name'
  118. }
  119. };
  120. },
  121. computed: {
  122. columns() {
  123. return [
  124. {
  125. columnKey: 'index',
  126. label: '序号',
  127. type: 'index',
  128. width: 55,
  129. align: 'center',
  130. showOverflowTooltip: true,
  131. fixed: 'left'
  132. },
  133. {
  134. prop: 'dataTime',
  135. label: '日期',
  136. align: 'center',
  137. showOverflowTooltip: true,
  138. minWidth: 150,
  139. slot: 'dataTime'
  140. },
  141. {
  142. prop: 'personal',
  143. label: '人数',
  144. align: 'center',
  145. showOverflowTooltip: true,
  146. width: 80,
  147. slot: 'personal'
  148. },
  149. {
  150. prop: 'place',
  151. label: '地点',
  152. align: 'center',
  153. showOverflowTooltip: true,
  154. minWidth: 220,
  155. slot: 'place'
  156. },
  157. {
  158. prop: 'text',
  159. label: '参观行程',
  160. align: 'center',
  161. showOverflowTooltip: true,
  162. minWidth: 200,
  163. slot: 'text'
  164. },
  165. {
  166. prop: 'cost',
  167. label: '预计费用',
  168. align: 'center',
  169. showOverflowTooltip: true,
  170. minWidth: 120,
  171. slot: 'cost'
  172. },
  173. {
  174. prop: 'remark',
  175. label: '备注',
  176. minWidth: 200,
  177. align: 'center',
  178. showOverflowTooltip: true,
  179. slot: 'remark'
  180. },
  181. {
  182. columnKey: 'action',
  183. slot: 'action',
  184. label: '操作',
  185. resizable: false,
  186. width: 80,
  187. align: 'center',
  188. showOverflowTooltip: true,
  189. fixed: 'right'
  190. }
  191. ];
  192. }
  193. },
  194. mounted() {},
  195. methods: {
  196. getSummaries(param) {
  197. return getSummaries(param, 'cost');
  198. },
  199. //删除任务信息数据
  200. handleDelInfo(index) {
  201. this.tableList.splice(index, 1);
  202. },
  203. //修改回显
  204. putTableValue(data) {
  205. this.tableList = data || [];
  206. },
  207. getTableValue() {
  208. return this.tableList;
  209. },
  210. materialOpen(row, index) {
  211. this.currentIndex = index;
  212. this.$refs.productListRef.open(row, index);
  213. },
  214. changeParent(list) {
  215. if (list.length > 0) {
  216. this.$set(
  217. this.tableList[this.currentIndex],
  218. 'materialName',
  219. list[0].name
  220. );
  221. this.$set(this.tableList[this.currentIndex], 'materialId', list[0].id);
  222. }
  223. },
  224. ownershipChange(index) {
  225. this.$nextTick(()=>{
  226. const data =this.$refs.deptRef.getCheckedNodes()
  227. this.$set(this.tableList[index], 'ownershipName', data[0].label);
  228. })
  229. },
  230. handleAddInfo() {
  231. this.tableList.push({
  232. dataTime: '',
  233. personal: '',
  234. place: '',
  235. materialName: '',
  236. materialId: '',
  237. materialNum: '',
  238. ownershipId: '',
  239. ownershipName: '',
  240. remark: '',
  241. cost: ''
  242. });
  243. }
  244. }
  245. };
  246. </script>
  247. <style scoped lang="scss">
  248. :deep(.el-form-item) {
  249. margin-bottom: 0;
  250. }
  251. .listToolbar {
  252. display: flex;
  253. justify-content: space-between;
  254. align-items: center;
  255. }
  256. </style>