contractListDialog.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <el-dialog
  3. title="选择合同"
  4. custom-class="ele-dialog-form long-dialog-form"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. top="5vh"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. width="80%"
  12. >
  13. <el-card shadow="never">
  14. <searchContract @search="reload"></searchContract>
  15. <ele-split-layout
  16. width="244px"
  17. allow-collapse
  18. :right-style="{ overflow: 'hidden' }"
  19. >
  20. <div class="ele-border-lighter split-layout-right-content">
  21. <AssetTree
  22. @handleNodeClick="handleNodeClick"
  23. id="20"
  24. :isFirstRefreshTable="false"
  25. ref="treeList"
  26. />
  27. </div>
  28. <!-- 表格 -->
  29. <template v-slot:content>
  30. <ele-pro-table
  31. ref="table"
  32. :columns="columns"
  33. :datasource="datasource"
  34. row-key="id"
  35. height="calc(100vh - 500px)"
  36. class="dict-table"
  37. @cell-click="cellClick"
  38. >
  39. <!-- 表头工具栏 -->
  40. <template v-slot:action="{ row }">
  41. <el-radio class="radio" v-model="radio" :label="row.id"
  42. ><i></i
  43. ></el-radio>
  44. </template>
  45. </ele-pro-table>
  46. </template>
  47. </ele-split-layout>
  48. </el-card>
  49. <div class="btns" slot="footer">
  50. <el-button type="primary" size="small" @click="selected">选择</el-button>
  51. <el-button size="small" @click="handleClose">关闭</el-button>
  52. </div>
  53. </el-dialog>
  54. </template>
  55. <script>
  56. import searchContract from './searchContract.vue';
  57. import { getTableList } from '@/api/bpm/components/contractManage/contractBook';
  58. import AssetTree from '@/components/AssetTree';
  59. export default {
  60. components: {
  61. AssetTree,
  62. searchContract
  63. },
  64. props: {
  65. type: {
  66. default: 1,
  67. type: Number,
  68. },
  69. hasGeneratedOrder:{
  70. default: 0,
  71. type: [Number,String]
  72. }
  73. },
  74. data() {
  75. return {
  76. visible: false,
  77. currentIndex: null,
  78. columns: [
  79. {
  80. columnKey: 'index',
  81. label: '序号',
  82. type: 'index',
  83. width: 55,
  84. align: 'center',
  85. showOverflowTooltip: true,
  86. fixed: 'left'
  87. },
  88. {
  89. action: 'action',
  90. slot: 'action',
  91. align: 'center',
  92. label: '选择'
  93. },
  94. {
  95. prop: 'contractName',
  96. label: '合同名称',
  97. align: 'center',
  98. showOverflowTooltip: true,
  99. minWidth: 200
  100. },
  101. {
  102. prop: 'typeName',
  103. label: '合同类型',
  104. align: 'center',
  105. showOverflowTooltip: true,
  106. minWidth: 140
  107. },
  108. {
  109. prop: 'partaName',
  110. label: '甲方名称',
  111. align: 'center',
  112. showOverflowTooltip: true,
  113. minWidth: 150
  114. },
  115. {
  116. prop: 'partaLinkName',
  117. label: '甲方联系人',
  118. align: 'center',
  119. showOverflowTooltip: true,
  120. minWidth: 130
  121. },
  122. {
  123. prop: 'partaTel',
  124. label: '甲方联系电话',
  125. align: 'center',
  126. showOverflowTooltip: true,
  127. minWidth: 130
  128. },
  129. {
  130. prop: 'partbName',
  131. label: '乙方名称',
  132. align: 'center',
  133. showOverflowTooltip: true,
  134. minWidth: 130
  135. },
  136. {
  137. prop: 'partbLinkName',
  138. label: '乙方联系人',
  139. align: 'center',
  140. showOverflowTooltip: true,
  141. minWidth: 130
  142. },
  143. {
  144. prop: 'partbTel',
  145. label: '乙方联系电话',
  146. align: 'center',
  147. showOverflowTooltip: true,
  148. minWidth: 130
  149. },
  150. {
  151. prop: 'contractNo',
  152. label: '编码',
  153. align: 'center',
  154. showOverflowTooltip: true,
  155. minWidth: 170
  156. },
  157. {
  158. prop: 'contractNumber',
  159. label: '编号',
  160. align: 'center',
  161. showOverflowTooltip: true,
  162. minWidth: 200
  163. },
  164. {
  165. prop: 'enabled',
  166. label: '是否可用',
  167. align: 'center',
  168. showOverflowTooltip: true,
  169. minWidth: 140,
  170. formatter: (_row, _column, cellValue) => {
  171. return _row.enabled ? '是' : '否';
  172. }
  173. },
  174. {
  175. prop: 'contractStartDate',
  176. label: '签订日期',
  177. align: 'center',
  178. showOverflowTooltip: true,
  179. minWidth: 140
  180. },
  181. {
  182. prop: 'contractEndDate',
  183. label: '结束日期',
  184. align: 'center',
  185. showOverflowTooltip: true,
  186. minWidth: 140
  187. },
  188. {
  189. prop: 'receiptPaymentType',
  190. label: '收付款类型',
  191. align: 'center',
  192. showOverflowTooltip: true,
  193. minWidth: 130,
  194. formatter: (_row, _column, cellValue) => {
  195. return _row.receiptPaymentType == 1 ? '固定' : '分期';
  196. }
  197. },
  198. {
  199. prop: 'totalPrice',
  200. label: '合同总金额',
  201. align: 'center',
  202. showOverflowTooltip: true,
  203. minWidth: 130
  204. },
  205. {
  206. prop: 'createTime',
  207. label: '创建时间',
  208. align: 'center',
  209. showOverflowTooltip: true,
  210. minWidth: 150
  211. }
  212. ],
  213. radio: null
  214. };
  215. },
  216. methods: {
  217. open(item, currentIndex) {
  218. this.currentIndex = currentIndex;
  219. if (item && item.id) {
  220. this.radio = item.id;
  221. }
  222. this.visible = true;
  223. },
  224. /* 表格数据源 */
  225. datasource({ page, limit, where, order }) {
  226. return getTableList({
  227. pageNum: page,
  228. size: limit,
  229. type:this.type,
  230. status:2,
  231. hasGeneratedOrder:this.hasGeneratedOrder,
  232. ...where
  233. });
  234. },
  235. /* 刷新表格 */
  236. reload(where) {
  237. this.$refs.table.reload({ pageNum: 1, where: where });
  238. },
  239. handleNodeClick(data, node) {
  240. this.reload({ categoryId: data.id });
  241. },
  242. // 单击获取id
  243. cellClick(row) {
  244. this.current = row;
  245. console.log(row);
  246. this.radio = row.id;
  247. },
  248. handleClose() {
  249. this.visible = false;
  250. this.current = null;
  251. this.radio = '';
  252. },
  253. selected() {
  254. if (!this.current) {
  255. return this.$message.warning('请至少选择一条数据');
  256. }
  257. this.$emit('changeParent', this.current, this.currentIndex);
  258. this.handleClose();
  259. }
  260. }
  261. };
  262. </script>
  263. <style lang="scss" scoped>
  264. .tree_col {
  265. border: 1px solid #eee;
  266. padding: 10px 0;
  267. box-sizing: border-box;
  268. height: 500px;
  269. overflow: auto;
  270. }
  271. .table_col {
  272. padding-left: 10px;
  273. ::v-deep .el-table th.el-table__cell {
  274. background: #f2f2f2;
  275. }
  276. }
  277. .pagination {
  278. text-align: right;
  279. padding: 10px 0;
  280. }
  281. .btns {
  282. text-align: center;
  283. padding: 10px 0;
  284. }
  285. .topsearch {
  286. margin-bottom: 15px;
  287. }
  288. </style>