contract.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <div class="app-container zap-main">
  3. <el-row class="zap-table-search">
  4. <div class="zap-padding-end">
  5. <right-toolbar class="zap-right-toolbar" :showSearch.sync="showSearch" @queryTable="getList">收起</right-toolbar>
  6. <span class="zap-padding-start zap-font-title">所选条件:</span>
  7. <div style="float: right;margin-right:1%">
  8. <el-button type="cyan" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  9. <el-button icon="el-icon-refresh" @click="resetQuery" style="float: ;margin-right: 20px;">重置</el-button>
  10. <column-setting class="zap-column-setting"  :checkList="checkList"  :tableList="tableList"  :selfDom="selfDom"  :tableId="tableId"></column-setting>
  11. </div>
  12. </div>
  13. <hr style="margin-top: 16px;">
  14. <el-form class="zap-table-search__form" :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  15. <el-form-item label="资金方" prop="scyName">
  16. <el-input v-model="queryParams.scyName" placeholder="请输入资金方" clearable size="small" maxlength="30" @keyup.enter.native="handleQuery" />
  17. </el-form-item>
  18. <el-form-item label="合同模板名称" prop="zfcName">
  19. <el-input v-model="queryParams.zfcName" placeholder="请输入模板名称" clearable size="small" maxlength="20" />
  20. </el-form-item>
  21. <el-form-item label="合同模板状态" prop="zfcStatus">
  22. <el-select v-model="queryParams.zfcStatus" placeholder="请选择合同模板状态" clearable size="small">
  23. <el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
  24. </el-select>
  25. </el-form-item>
  26. </el-form>
  27. </el-row>
  28. <div class="zap-content zap-margin-top">
  29. <el-button type="primary" icon="el-icon-plus" @click="handleAdd" v-hasPermi="['service:contract:add']">新增</el-button>
  30. </div>
  31. <el-table v-loading="loading" :data="contractList" class="zap-table" @selection-change="handleSelectionChange" stripe>
  32. <el-table-column label="序号" type="index" width="50" align="center">
  33. <template slot-scope="scope">
  34. <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="资金方" align="center" prop="scyName" :show-overflow-tooltip="true" v-if="uncheckList.scyName" />
  38. <el-table-column label="合同模板名称" align="center" prop="zfcName" :show-overflow-tooltip="true" v-if="uncheckList.zfcName" />
  39. <el-table-column label="合同模板状态" align="center" prop="zfcStatus" width='120px' :formatter="statusFormat" :show-overflow-tooltip="true" v-if="uncheckList.zfcStatus" />
  40. <el-table-column label="签署节点" align="center" prop="zfcNode" :formatter="nodeFormat" :show-overflow-tooltip="true" v-if="uncheckList.zfcNode" />
  41. <!-- <el-table-column label="签署方" align="center" prop="zfcSubject" :formatter="subjectFormat" :show-overflow-tooltip="true" v-if="uncheckList.zfcSubject"/> -->
  42. <el-table-column label="创建人" align="center" prop="nickName" :show-overflow-tooltip="true" v-if="uncheckList.nickName" />
  43. <el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true" v-if="uncheckList.createTime" />
  44. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='200px'>
  45. <template slot-scope="scope">
  46. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-if="scope.row.zfcStatus == '01'" v-hasPermi="['service:contract:edit']">修改</el-button>
  47. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleChange(scope.row)" v-if="scope.row.zfcStatus == '00'" v-hasPermi="['service:contract:change']">停用</el-button>
  48. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleChange(scope.row)" v-if="scope.row.zfcStatus == '01'" v-hasPermi="['service:contract:change']">启用</el-button>
  49. <el-button size="mini" type="text" icon="el-icon-view" @click="handleInfo(scope.row)" v-hasPermi="['service:contract:query']">详情</el-button>
  50. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDel(scope.row)" v-if="scope.row.zfcStatus == '01'" v-hasPermi="['service:contract:delete']">删除</el-button>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  55. </div>
  56. </template>
  57. <script>
  58. import {
  59. listContract,
  60. changeState,
  61. delContract
  62. } from "@/api/service/contract/contract";
  63. import ColumnSetting from "../../../components/Table/columnSetting.vue";
  64. import {
  65. columnQuery,
  66. columnfilter
  67. } from "@/api/common/columnSetting";
  68. import Cookies from 'js-cookie'
  69. export default {
  70. name: "contract",
  71. components: {
  72. ColumnSetting
  73. },
  74. data() {
  75. return {
  76. // 遮罩层
  77. loading: true,
  78. // 选中数组
  79. ids: [],
  80. // 非单个禁用
  81. single: true,
  82. // 非多个禁用
  83. multiple: true,
  84. // 显示搜索条件
  85. showSearch: true,
  86. contractList: [],
  87. statusOptions: [],
  88. // 总条数
  89. total: 0,
  90. // 弹出层标题
  91. title: "",
  92. // 是否显示弹出层
  93. open: false,
  94. // 查询参数
  95. queryParams: {
  96. pageNum: 1,
  97. pageSize: 10,
  98. zfcName: null,
  99. scyName: null,
  100. zfcStatus: null,
  101. },
  102. // 表单参数
  103. form: {},
  104. // 表单校验
  105. rules: {
  106. // pptName:[
  107. // { required: true, message: "项目类型不能为空", trigger: "blur" },
  108. // ]
  109. },
  110. tableList: [{
  111. label: "scyName",
  112. value: "资金渠道"
  113. },
  114. {
  115. label: "zfcName",
  116. value: "合同模板名称"
  117. },
  118. {
  119. label: "zfcStatus",
  120. value: "合同模板状态"
  121. },
  122. {
  123. label: "zfcNode",
  124. value: "签署节点"
  125. },
  126. // {
  127. //           label: "zfcSubject",
  128. //           value: "签署方"
  129. //         },
  130. {
  131. label: "nickName",
  132. value: "创建人"
  133. },
  134. {
  135. label: "createTime",
  136. value: "创建时间"
  137. },
  138. ],
  139. checkList: [], //筛选列选中的数据列表--显示隐藏列用
  140. uncheckList: {}, //控制筛选列显示隐藏--显示隐藏列用
  141. selfDom: this,
  142. tableId: "/service/contract/list",
  143. };
  144. },
  145. created() {
  146. this.getList();
  147. this.getDicts("zc_zfc_status").then((response) => {
  148. this.statusOptions = response.data;
  149. });
  150. this.getDicts("zc_zfc_node").then((response) => {
  151. this.nodeOptions = response.data;
  152. });
  153. this.getDicts("zc_zfc_subject").then((response) => {
  154. this.subjectOptions = response.data;
  155. });
  156. },
  157. activated() {
  158. this.getList();
  159. },
  160. mounted() {
  161. this.columnQuery();
  162. },
  163. methods: {
  164. /** 查询合同列表 */
  165. getList() {
  166. this.loading = true;
  167. listContract(this.queryParams).then(response => {
  168. this.contractList = response.data.records;
  169. this.total = response.data.total;
  170. this.loading = false;
  171. });
  172. },
  173. // 取消按钮
  174. cancel() {
  175. this.open = false;
  176. this.reset();
  177. },
  178. // 表单重置
  179. reset() {
  180. this.form = {
  181. };
  182. this.resetForm("form");
  183. },
  184. /** 搜索按钮操作 */
  185. handleQuery() {
  186. this.queryParams.pageNum = 1;
  187. this.getList();
  188. },
  189. /** 重置按钮操作 */
  190. resetQuery() {
  191. this.resetForm("queryForm");
  192. this.handleQuery();
  193. },
  194. // 多选框选中数据
  195. handleSelectionChange(selection) {
  196. /* this.ids = selection.map(item => item.ptcId)
  197. this.single = selection.length!==1
  198. this.multiple = !selection.length */
  199. },
  200. /** 新增按钮操作 */
  201. handleAdd() {
  202. this.reset();
  203. this.resetForm("queryForm");
  204. Cookies.set("/contract/addContract/", this.$route.fullPath);
  205. this.$router.push({
  206. path: "/contract/addContract/"
  207. });
  208. },
  209. /** 修改按钮操作 */
  210. handleUpdate(row) {
  211. const zfcId = row.zfcId
  212. this.resetForm("queryForm");
  213. Cookies.set("/contract/editContract/" + zfcId + "/", this.$route.fullPath);
  214. this.$router.push({
  215. path: "/contract/editContract/" + zfcId + "/"
  216. });
  217. },
  218. /** 详情按钮操作 */
  219. handleInfo(row) {
  220. const zfcId = row.zfcId
  221. this.resetForm("queryForm");
  222. Cookies.set("/contract/detailContract/" + zfcId + "/", this.$route.fullPath);
  223. this.$router.push({
  224. path: "/contract/detailContract/" + zfcId + "/"
  225. });
  226. },
  227. /** 删除按钮操作 */
  228. handleDel(row) {
  229. const zfcId = row.zfcId
  230. const zfcName = row.zfcName
  231. this.$confirm(
  232. '是否确认删除合同模板名为"' + zfcName + '"的数据项?',
  233. "警告", {
  234. confirmButtonText: "确定",
  235. cancelButtonText: "取消",
  236. type: "warning",
  237. }
  238. )
  239. .then(function () {
  240. return delContract(zfcId);
  241. })
  242. .then(() => {
  243. this.getList();
  244. this.msgSuccess("删除成功");
  245. })
  246. .catch(() => {
  247. this.$message({
  248. type: "warning",
  249. message: "已取消删除",
  250. });
  251. });
  252. },
  253. /** 启用按钮操作 */
  254. handleChange(row) {
  255. let text = row.zfcStatus === "01" ? "启用合同" : "停用合同";
  256. this.$confirm(
  257. "确认要" + text + '"' + row.zfcName + '"吗?',
  258. "警告", {
  259. confirmButtonText: "确定",
  260. cancelButtonText: "取消",
  261. type: "warning",
  262. }
  263. )
  264. .then(function () {
  265. return changeState(row.zfcId);
  266. })
  267. .then(() => {
  268. this.getList();
  269. this.msgSuccess(text + '"' + row.zfcName + '"' + "成功");
  270. })
  271. .catch(function () {
  272. });
  273. },
  274. //合同模板状态字典反显
  275. statusFormat(row, column) {
  276. return this.selectDictLabel(this.statusOptions, row.zfcStatus);
  277. },
  278. //签署节点字典反显
  279. nodeFormat(row, column) {
  280. var zfcNodes = row.zfcNode.split(",");
  281. var zfcNodeList = '';
  282. for (var i = 0; i < zfcNodes.length; i++) {
  283. zfcNodeList += this.selectDictLabel(this.nodeOptions, zfcNodes[i]);
  284. if (i < zfcNodes.length - 1) {
  285. zfcNodeList += ",";
  286. }
  287. }
  288. return zfcNodeList;
  289. },
  290. //签署节点字典反显
  291. subjectFormat(row, column) {
  292. return this.selectDictLabel(this.subjectOptions, row.zfcSubject);
  293. },
  294. //获取当前客户是否之前设置过列展示隐藏
  295. columnQuery() {
  296. //获取页面路径
  297. var psfPagePath = window.location.pathname;
  298. //用请求后台的url作为唯一标识
  299. var psfTableName = this.tableId;
  300. var columnForm = {};
  301. columnForm.psfPagePath = psfPagePath;
  302. columnForm.psfTableName = psfTableName;
  303. columnQuery(columnForm).then(response => {
  304. if (response.data && response.data.psfShowData) {
  305. this.checkList = response.data.psfShowData;
  306. }
  307. this.filter();
  308. });
  309. },
  310. //控制隐藏显示的函数
  311. filter(checkList) {
  312. if (!!checkList) {
  313. this.checkList = checkList;
  314. }
  315. columnfilter(this.selfDom);
  316. },
  317. /** 导出按钮操作 */
  318. handleExport() {
  319. /* this.download('base/taxCode/export', {
  320. ...this.queryParams
  321. }, `base_taxCode.xlsx`) */
  322. }
  323. }
  324. };
  325. </script>