index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <el-card shadow="hover">
  3. <el-form v-model="params" class="full-width" label-width="120px">
  4. <div class="flex flex-center">
  5. <div class="flex flex-center mt-15 mr-10">
  6. <el-form-item label="关键字" class="full-width">
  7. <el-input
  8. v-model="params.name"
  9. placeholder="输入合同关键字"
  10. prefix-icon="Search"
  11. clearable
  12. />
  13. </el-form-item>
  14. <el-form-item label="业务联系人" class="full-width">
  15. <el-input
  16. v-model="params.contacts"
  17. placeholder="输入业务联系人"
  18. prefix-icon="Search"
  19. clearable
  20. />
  21. </el-form-item>
  22. <el-form-item class="full-width" label="合同状态">
  23. <el-select v-model="params.status" clearable>
  24. <el-option
  25. v-for="item in dicList"
  26. :key="item.dictKey"
  27. :label="item.dictValue"
  28. :value="item.dictKey"
  29. />
  30. </el-select>
  31. </el-form-item>
  32. </div>
  33. <div class="flex flex-justify-end ml-20">
  34. <base-button type="0" title="重置" icon="Refresh" @click="clearUp" />
  35. <base-button class="ml-20" @click="onLoad" />
  36. </div>
  37. </div>
  38. </el-form>
  39. <avue-crud
  40. :option="option"
  41. :data="data"
  42. ref="crud"
  43. v-model="form"
  44. v-model:page="page"
  45. :before-open="beforeOpen"
  46. @row-del="rowDel"
  47. @current-change="currentChange"
  48. @size-change="sizeChange"
  49. @refresh-change="refreshChange"
  50. >
  51. <template #title="{ row }">
  52. <div>{{ row.fileFolder.title }}</div>
  53. </template>
  54. <template #menu-left>
  55. <div class="flex flex-center">
  56. <div class="main-color ml-10 mr-20 bold font-15">金额单位:万元</div>
  57. <filepicker
  58. btn-text="新增合同"
  59. :project-id="projectId"
  60. @submit="selection"
  61. />
  62. </div>
  63. </template>
  64. </avue-crud>
  65. </el-card>
  66. </template>
  67. <route>
  68. {
  69. name: '合同管理',
  70. meta: { layout: 'empty','path':'/resource','title':'资料管理','showMsg' :
  71. "请先通过资料管理,在对应的相关合同类别下上传合同文件,系统将自动识别所有相关文件并展示在以下列表中。"}
  72. }
  73. </route>
  74. <script>
  75. import BaseButton from '@/components/base-button.vue'
  76. import filepicker from '@/components/filepicker/index.vue'
  77. export default {
  78. components: { BaseButton, filepicker },
  79. data() {
  80. return {
  81. projectId: '',
  82. form: {},
  83. data: [],
  84. option: {
  85. align: 'center',
  86. menuAlign: 'center',
  87. menuWidth: 100,
  88. size: 'mini',
  89. addBtn: false,
  90. editBtn: false,
  91. viewBtn: true,
  92. delBtn: true,
  93. columnBtn: false,
  94. labelWidth: 140,
  95. border: true,
  96. column: [
  97. {
  98. label: '合同名称',
  99. prop: 'title',
  100. slot: true,
  101. width: 180,
  102. fixed: true
  103. },
  104. {
  105. label: '合同编号',
  106. prop: 'number'
  107. },
  108. {
  109. label: '合同金额',
  110. prop: 'amount'
  111. },
  112. {
  113. label: '已付金额',
  114. prop: 'paymentAmount'
  115. },
  116. {
  117. label: '未付金额',
  118. prop: 'notPaymentAmount'
  119. },
  120. {
  121. label: '业务联系人',
  122. prop: 'contacts',
  123. width: 100
  124. },
  125. {
  126. label: '签订乙方',
  127. prop: 'partyB',
  128. width: 180
  129. },
  130. {
  131. label: '签订日期',
  132. prop: 'signTime',
  133. width: 110
  134. },
  135. {
  136. label: '合同状态',
  137. prop: 'contractsStatus',
  138. width: 90,
  139. dicUrl:
  140. '/api/blade-system/dict-biz/dictionary?code=contract-status',
  141. props: {
  142. label: 'dictValue',
  143. value: 'dictKey'
  144. }
  145. },
  146. {
  147. label: '到期日期',
  148. prop: 'expireTime',
  149. width: 110
  150. }
  151. ]
  152. },
  153. page: {
  154. size: 10,
  155. current: 1
  156. },
  157. dicList: [],
  158. typelist: [],
  159. params: {
  160. name: '',
  161. status: '',
  162. type: ''
  163. }
  164. }
  165. },
  166. created() {
  167. this.projectId = this.$route.query.id
  168. this.getDic('contract-status')
  169. this.getDic('contract-type')
  170. this.onLoad()
  171. },
  172. methods: {
  173. getDic(code) {
  174. this.$api.common.dicList({ code }).then(res => {
  175. if (res.code === 200) {
  176. if (code === 'contract-status') {
  177. this.dicList = res.data
  178. } else if (code === 'contract-type') {
  179. this.typelist = res.data
  180. }
  181. }
  182. })
  183. },
  184. onLoad() {
  185. this.loading = true
  186. const data = Object.assign(this.params, { projectId: this.projectId })
  187. this.$api.contract
  188. .contractList(Object.assign(this.page, data))
  189. .then(res => {
  190. this.data = res.data.records.map(ele => {
  191. if (ele.contractsStatus === -1) {
  192. ele.contractsStatus = ''
  193. }
  194. if (ele.type === -1) {
  195. ele.type = ''
  196. }
  197. return ele
  198. })
  199. this.page.total = res.data.total
  200. })
  201. .finally(() => {
  202. this.loading = false
  203. })
  204. },
  205. clearUp() {
  206. this.params.name = ''
  207. this.params.status = ''
  208. this.params.type = ''
  209. this.onLoad()
  210. },
  211. beforeOpen(done, type) {
  212. if (type === 'view') {
  213. const data = this.$router.resolve({
  214. path: '/contract/detail',
  215. query: { id: this.form.id }
  216. })
  217. window.open(data.href, '_blank')
  218. }
  219. },
  220. rowDel(row, index, done) {
  221. this.$confirm('确定将选择数据删除?', {
  222. type: 'warning'
  223. }).then(res => {
  224. console.log(res)
  225. if (res === 'confirm') {
  226. this.$api.contract.contractRemove({ ids: row.id }).then(res => {
  227. if (res.code === 200) {
  228. this.$message.success(res.msg)
  229. this.onLoad()
  230. } else {
  231. this.$message.error(res.msg)
  232. }
  233. })
  234. }
  235. })
  236. },
  237. currentChange(currentPage) {
  238. this.page.current = currentPage
  239. },
  240. sizeChange(pageSize) {
  241. this.page.size = pageSize
  242. },
  243. refreshChange() {
  244. this.onLoad()
  245. },
  246. selection(list) {
  247. const tmps = list.map(ele => {
  248. return {
  249. fileId: ele.id,
  250. projectId: ele.projectId,
  251. title: ele.title
  252. }
  253. })
  254. this.$api.contract.linkContract(tmps).then(res => {
  255. if (res.code === 200) {
  256. this.refreshChange()
  257. }
  258. })
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="scss" scoped></style>