contractListDialog.vue 9.1 KB

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