contract.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <!-- 采购合同管理 -->
  2. <template>
  3. <div class="sale">
  4. <template v-if="!detailVisible && !addOrUpdateVisible && !changeFormVisible &&!changeAttachVisible && !attachVisible && !noticeChangeAttachVisible">
  5. <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
  6. <el-form-item label="名称" prop="supplierName">
  7. <el-input v-model="dataForm.supplierName" placeholder="供应商名称" clearable/>
  8. </el-form-item>
  9. <el-form-item label="申请日期">
  10. <el-date-picker
  11. v-model="dataForm.date"
  12. value-format="yyyy-MM-dd"
  13. type="daterange"
  14. range-separator="至"
  15. start-placeholder="开始日期"
  16. end-placeholder="结束日期">
  17. </el-date-picker>
  18. </el-form-item>
  19. <el-form-item>
  20. <el-button @click="search()">查询</el-button>
  21. <el-button v-if="isAuth('pur:purchaseContract:save')" type="primary" @click="addOrUpdateHandle(0)">录入</el-button>
  22. <!-- 导出缺后端接口 -->
  23. <el-button type="primary" @click="exportHandle()">导出</el-button>
  24. <el-button v-if="isAuth('pur:purchaseContract:noteChangeConfig')" type="primary" @click="setNoticeChangeHandle()">合同更改通知人设置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-table
  28. :data="dataList"
  29. border
  30. v-loading="dataListLoading"
  31. style="width: 100%;">
  32. <el-table-column
  33. label="序号"
  34. type="index"
  35. width="50"
  36. align="center">
  37. </el-table-column>
  38. <el-table-column
  39. prop="contractCode"
  40. header-align="center"
  41. align="center"
  42. min-width="120"
  43. :show-tooltip-when-overflow="true"
  44. label="合同编码">
  45. </el-table-column>
  46. <el-table-column
  47. prop="supplierName"
  48. header-align="center"
  49. align="center"
  50. min-width="140"
  51. :show-tooltip-when-overflow="true"
  52. label="供应商名称">
  53. </el-table-column>
  54. <el-table-column
  55. prop="contractNumber"
  56. header-align="center"
  57. align="center"
  58. min-width="120"
  59. :show-tooltip-when-overflow="true"
  60. label="合同号">
  61. </el-table-column>
  62. <el-table-column
  63. prop="deliveryTime"
  64. header-align="center"
  65. align="center"
  66. width="160"
  67. :show-tooltip-when-overflow="true"
  68. label="合同交期">
  69. </el-table-column>
  70. <el-table-column
  71. prop="totalAmount"
  72. header-align="center"
  73. align="center"
  74. min-width="100"
  75. label="合同总金额">
  76. </el-table-column>
  77. <el-table-column
  78. prop="isChange"
  79. header-align="center"
  80. align="center"
  81. label="是否进行合同更改">
  82. <template slot-scope="scope">
  83. <span>{{!scope.row.isChange?'':(Number(scope.row.isChange) === 1?'是':'否')}}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column
  87. prop="changeContentDesc"
  88. header-align="center"
  89. align="center"
  90. min-width="160"
  91. :show-tooltip-when-overflow="true"
  92. label="更改内容简述">
  93. </el-table-column>
  94. <el-table-column
  95. header-align="center"
  96. align="center"
  97. label="合同附件">
  98. <template slot-scope="scope">
  99. <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
  100. </template>
  101. </el-table-column>
  102. <el-table-column
  103. header-align="center"
  104. align="center"
  105. label="合同更改通知单附件">
  106. <template slot-scope="scope">
  107. <el-button :disabled="!scope.row.noticeAttachList || scope.row.noticeAttachList.length === 0" type="text" size="small" @click="changeDetails(scope.row)">查看</el-button>
  108. </template>
  109. </el-table-column>
  110. <el-table-column
  111. prop="notes"
  112. header-align="center"
  113. align="center"
  114. min-width="180"
  115. :show-overflow-tooltip="true"
  116. label="备注">
  117. </el-table-column>
  118. <el-table-column
  119. fixed="right"
  120. header-align="center"
  121. align="center"
  122. width="150"
  123. label="操作">
  124. <template slot-scope="scope">
  125. <el-button v-if="isAuth('pur:purchaseContract:info')" type="text" size="small" @click="detailHandle(scope.row.contractId)">查看</el-button>
  126. <el-button v-if="isAuth('pur:purchaseContract:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.contractId, false)">编辑</el-button>
  127. <el-button v-if="isAuth('pur:purchaseContract:changeContract')" type="text" size="small" @click="changeHandle(scope.row.contractId)">变更</el-button>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. <el-pagination
  132. @size-change="sizeChangeHandle"
  133. @current-change="currentChangeHandle"
  134. :current-page="pageIndex"
  135. :page-sizes="[10, 20, 50, 100]"
  136. :page-size="pageSize"
  137. :total="totalPage"
  138. layout="total, sizes, prev, pager, next, jumper">
  139. </el-pagination>
  140. </template>
  141. <!-- 弹窗, 新增 / 修改 -->
  142. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
  143. <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
  144. <attach-detail v-if="changeAttachVisible" ref="changeDetail" @onChose="onChose"/>
  145. <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
  146. <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose"/>
  147. <change-form v-if="changeFormVisible" ref="changeForm" @refreshDataList="getDataList" @onChose="onChose"/>
  148. </div>
  149. </template>
  150. <script>
  151. import AddOrUpdate from './contract-add-or-update'
  152. import Detail from './contract-detail'
  153. import { getContractList } from '@/api/sale'
  154. import AttachDetail from '../common/attach-detail'
  155. import NoticeChangeSetting from './contract-notice-change-setting'
  156. import ChangeForm from './contract-change'
  157. export default {
  158. name: 'contract',
  159. components: {
  160. AttachDetail,
  161. AddOrUpdate,
  162. Detail,
  163. NoticeChangeSetting,
  164. ChangeForm
  165. },
  166. data () {
  167. return {
  168. addOrUpdateVisible: false,
  169. detailVisible: false,
  170. attachVisible: false,
  171. changeAttachVisible: false,
  172. noticeChangeAttachVisible: false,
  173. changeFormVisible: false,
  174. dataForm: {},
  175. dataList: [],
  176. pageIndex: 1,
  177. pageSize: 10,
  178. totalPage: 0,
  179. dataListLoading: false,
  180. dataListSelections: []
  181. }
  182. },
  183. created () {
  184. this.getDataList()
  185. },
  186. methods: {
  187. onChose () {
  188. this.addOrUpdateVisible = false
  189. this.attachVisible = false
  190. this.detailVisible = false
  191. this.noticeChangeAttachVisible = false
  192. this.changeFormVisible = false
  193. this.changeAttachVisible = false
  194. },
  195. // 查询
  196. search () {
  197. this.pageIndex = 1
  198. this.getDataList()
  199. },
  200. // 获取数据列表
  201. getDataList () {
  202. this.dataListLoading = true
  203. let params = {
  204. 'current': this.pageIndex,
  205. 'size': this.pageSize,
  206. 'supplierName': this.dataForm.supplierName ? this.dataForm.supplierName : null,
  207. 'startTime': this.dataForm.date ? this.dataForm.date[0] : null,
  208. 'endTime': this.dataForm.date ? this.dataForm.date[1] : null
  209. }
  210. getContractList(params).then(({data}) => {
  211. if (data && data.code === '200') {
  212. this.dataList = data.data.records
  213. this.totalPage = Number(data.data.total)
  214. } else {
  215. this.dataList = []
  216. this.totalPage = 0
  217. }
  218. this.dataListLoading = false
  219. })
  220. },
  221. deleteHandle (id) {
  222. if (!id) return
  223. let ids = []
  224. ids.push(id)
  225. this.$confirm(`确定删除?`, '提示', {
  226. confirmButtonText: '确定',
  227. cancelButtonText: '取消',
  228. type: 'warning'
  229. }).then(() => {
  230. this.$http({
  231. url: this.$http.adornUrl(`/biz-service/cusContractBook/delete`),
  232. method: 'DELETE',
  233. data: ids
  234. }).then(({data}) => {
  235. if (data && data.code === '200') {
  236. this.$message({
  237. message: '操作成功',
  238. type: 'success',
  239. duration: 1500,
  240. onClose: () => {
  241. this.getDataList()
  242. }
  243. })
  244. } else {
  245. this.$message.error(data.msg)
  246. }
  247. })
  248. }).catch(() => {})
  249. },
  250. // 每页数
  251. sizeChangeHandle (val) {
  252. this.pageSize = val
  253. this.pageIndex = 1
  254. this.getDataList()
  255. },
  256. // 当前页
  257. currentChangeHandle (val) {
  258. this.pageIndex = val
  259. this.getDataList()
  260. },
  261. // 多选
  262. selectionChangeHandle (val) {
  263. this.dataListSelections = val
  264. },
  265. // 新增 / 修改
  266. addOrUpdateHandle (id) {
  267. this.addOrUpdateVisible = true
  268. this.$nextTick(() => {
  269. this.$refs.addOrUpdate.init(id)
  270. })
  271. },
  272. // 变更
  273. changeHandle (id) {
  274. this.changeFormVisible = true
  275. this.$nextTick(() => {
  276. this.$refs.changeForm.init(id)
  277. })
  278. },
  279. // 详情
  280. detailHandle (id) {
  281. this.detailVisible = true
  282. this.$nextTick(() => {
  283. this.$refs.detail.init(id)
  284. })
  285. },
  286. // 变更通知人设置
  287. setNoticeChangeHandle () {
  288. this.noticeChangeAttachVisible = true
  289. this.$nextTick(() => {
  290. this.$refs.noticeChangeSetting.init()
  291. })
  292. },
  293. // 物料更改通知单
  294. changeDetails (row) {
  295. this.changeAttachVisible = true
  296. this.$nextTick(() => {
  297. this.$refs.changeDetail.init(row.noticeAttachList)
  298. })
  299. },
  300. // 附件
  301. attachDetails (row) {
  302. this.attachVisible = true
  303. this.$nextTick(() => {
  304. this.$refs.attachDetail.init(row.attachList)
  305. })
  306. },
  307. // 导出
  308. exportHandle () {
  309. this.$message.warning('功能暂未实现!')
  310. }
  311. }
  312. }
  313. </script>
  314. <style scoped>
  315. </style>