作者 雷海东

合同统计

  1 +<template>
  2 + <div class="app-container">
  3 + <el-form
  4 + :model="queryParams"
  5 + ref="queryForm"
  6 + size="small"
  7 + :inline="true"
  8 + v-show="showSearch"
  9 + label-width="68px"
  10 + >
  11 + <el-form-item label="合同编号" prop="contractno">
  12 + <el-input
  13 + v-model="queryParams.contractno"
  14 + placeholder="请输入合同编号"
  15 + clearable
  16 + @keyup.enter.native="handleQuery"
  17 + />
  18 + </el-form-item>
  19 + <el-form-item label="合同名称" prop="contractName">
  20 + <el-input
  21 + v-model="queryParams.contractName"
  22 + placeholder="请输入合同名称"
  23 + clearable
  24 + @keyup.enter.native="handleQuery"
  25 + />
  26 + </el-form-item>
  27 + <el-form-item>
  28 + <el-button
  29 + type="primary"
  30 + icon="el-icon-search"
  31 + size="mini"
  32 + @click="handleQuery"
  33 + >搜索</el-button
  34 + >
  35 + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  36 + >重置</el-button
  37 + >
  38 + </el-form-item>
  39 + </el-form>
  40 +
  41 + <el-row :gutter="10" class="mb8">
  42 + <!--<el-col :span="1.5">
  43 + <el-button
  44 + type="primary"
  45 + plain
  46 + icon="el-icon-plus"
  47 + size="mini"
  48 + @click="handleAdd"
  49 + v-hasPermi="['system:contract:add']"
  50 + >新增</el-button>
  51 + </el-col>-->
  52 + <!-- <el-col :span="1.5">
  53 + <el-button
  54 + type="success"
  55 + plain
  56 + icon="el-icon-edit"
  57 + size="mini"
  58 + :disabled="single"
  59 + @click="handleUpdate"
  60 + v-hasPermi="['system:contract:edit']"
  61 + >修改</el-button>
  62 + </el-col> -->
  63 + <!-- <el-col :span="1.5">
  64 + <el-button
  65 + type="danger"
  66 + plain
  67 + icon="el-icon-delete"
  68 + size="mini"
  69 + :disabled="multiple"
  70 + @click="handleDelete"
  71 + v-hasPermi="['system:contract:remove']"
  72 + >删除</el-button
  73 + >
  74 + </el-col> -->
  75 + <el-col :span="1.5">
  76 + <el-button
  77 + type="warning"
  78 + plain
  79 + icon="el-icon-download"
  80 + size="mini"
  81 + @click="handleExport"
  82 + v-hasPermi="['system:contract:export']"
  83 + >导出</el-button
  84 + >
  85 + </el-col>
  86 + <right-toolbar
  87 + :showSearch.sync="showSearch"
  88 + @queryTable="getList"
  89 + ></right-toolbar>
  90 + </el-row>
  91 +
  92 + <el-table
  93 + v-loading="loading"
  94 + :data="contractList"
  95 + @selection-change="handleSelectionChange"
  96 + width="100%"
  97 + >
  98 + <el-table-column type="selection" width="50px" align="center" />
  99 + <el-table-column label="单位编号" align="center" prop="orgcode" />
  100 + <el-table-column label="单位名称" align="center" prop="orgname" />
  101 + <el-table-column label="进行中合同" align="center" prop="tocontract" />
  102 + <el-table-column label="已完成合同" align="center" prop="okcontract" />
  103 + <el-table-column label="已解除合同" align="center" prop="stopcontract" />
  104 + <el-table-column label="应付金额" align="center" prop="copePrice" />
  105 + <el-table-column label="已付金额" align="center" prop="paidPrice" />
  106 + </el-table>
  107 +
  108 + <pagination
  109 + v-show="total > 0"
  110 + :total="total"
  111 + :page.sync="queryParams.pageNum"
  112 + :limit.sync="queryParams.pageSize"
  113 + @pagination="contractList"
  114 + />
  115 + <el-dialog
  116 + title="合同预览"
  117 + :visible.sync="dialogVisibleContract"
  118 + width="50%"
  119 + center
  120 + :before-close="handleClose"
  121 + >
  122 + <vue-pdf
  123 + :src="pdfUrl"
  124 + type="application/pdf"
  125 + width="100%"
  126 + height="800px"
  127 + />
  128 + </el-dialog>
  129 + </div>
  130 +</template>
  131 +
  132 +<script>
  133 +import {
  134 + listContract,
  135 + getContract,
  136 + delContract,
  137 + addContract,
  138 + updateContract,
  139 +} from "@/api/compliancemanagement/contract";
  140 +import { startProcess, stopProcess } from "@/api/workflow/process";
  141 +import VuePdf from "vue-pdf";
  142 +export default {
  143 + name: "Contract",
  144 + components: {
  145 + VuePdf,
  146 + },
  147 + data() {
  148 + return {
  149 + switchValue: true,
  150 + pdfUrl: "",
  151 + dialogVisibleContract: false,
  152 + baseUrl: process.env.VUE_APP_BASE_API + "/",
  153 + // 按钮loading
  154 + buttonLoading: false,
  155 + // 遮罩层
  156 + loading: true,
  157 + // 选中数组
  158 + ids: [],
  159 + // 非单个禁用
  160 + single: true,
  161 + // 非多个禁用
  162 + multiple: true,
  163 + // 显示搜索条件
  164 + showSearch: true,
  165 + // 总条数
  166 + total: 6,
  167 + // 【请填写功能名称】表格数据
  168 + contractList: [
  169 + {
  170 + orgcode: "001",
  171 + orgname: "山西人民出版社",
  172 + tocontract: 5,
  173 + okcontract: 2,
  174 + stopcontract: 1,
  175 + copePrice: 1000000,
  176 + paidPrice: 800000,
  177 + },
  178 + {
  179 + orgcode: "002",
  180 + orgname: "山西教育出版社",
  181 + tocontract: 6,
  182 + okcontract: 1,
  183 + stopcontract: 1,
  184 + copePrice: 900000,
  185 + paidPrice: 700000,
  186 + },
  187 + {
  188 + orgcode: "003",
  189 + orgname: "希望出版社",
  190 + tocontract: 3,
  191 + okcontract: 2,
  192 + stopcontract: 0,
  193 + copePrice: 4561234,
  194 + paidPrice: 4561234,
  195 + },
  196 + {
  197 + orgcode: "004",
  198 + orgname: "北岳文艺出版社",
  199 + tocontract: 8,
  200 + okcontract: 4,
  201 + stopcontract: 0,
  202 + copePrice: 98765432,
  203 + paidPrice: 98765432,
  204 + },
  205 + {
  206 + orgcode: "005",
  207 + orgname: "山西科学技术出版社",
  208 + tocontract: 9,
  209 + okcontract: 4,
  210 + stopcontract: 1,
  211 + copePrice: 85296374,
  212 + paidPrice: 85296374,
  213 + },
  214 + {
  215 + orgcode: "006",
  216 + orgname: "山西经济出版社",
  217 + tocontract: 4,
  218 + okcontract: 1,
  219 + stopcontract: 0,
  220 + copePrice: 74185296,
  221 + paidPrice: 74185296,
  222 + },
  223 + ],
  224 + // 弹出层标题
  225 + title: "",
  226 + // 是否显示弹出层
  227 + open: false,
  228 + // 查询参数
  229 + queryParams: {
  230 + pageNum: 1,
  231 + pageSize: 10,
  232 + contractno: undefined,
  233 + contractName: undefined,
  234 + contractType: undefined,
  235 + contractAmount: undefined,
  236 + effectiveDate: undefined,
  237 + expirationDate: undefined,
  238 + partyA: undefined,
  239 + partyB: undefined,
  240 + paymentMethod: undefined,
  241 + signingDate: undefined,
  242 + subjectInformation: undefined,
  243 + attachments: undefined,
  244 + },
  245 + // 表单参数
  246 + form: {},
  247 + biangeng: [],
  248 +
  249 + // 表单校验
  250 + rules: {
  251 + contractno: [
  252 + { required: true, message: "合同编号不能为空", trigger: "blur" },
  253 + ],
  254 + contractName: [
  255 + { required: true, message: "合同名称不能为空", trigger: "blur" },
  256 + ],
  257 + contractType: [
  258 + { required: true, message: "合同类型不能为空", trigger: "change" },
  259 + ],
  260 + contractAmount: [
  261 + { required: true, message: "合同金额不能为空", trigger: "blur" },
  262 + ],
  263 + effectiveDate: [
  264 + { required: true, message: "生效日期不能为空", trigger: "blur" },
  265 + ],
  266 + expirationDate: [
  267 + { required: true, message: "到期日期不能为空", trigger: "blur" },
  268 + ],
  269 + partyA: [{ required: true, message: "甲方不能为空", trigger: "blur" }],
  270 + partyB: [{ required: true, message: "乙方不能为空", trigger: "blur" }],
  271 + paymentMethod: [
  272 + { required: true, message: "付款方式不能为空", trigger: "blur" },
  273 + ],
  274 + signingDate: [
  275 + { required: true, message: "签订日期不能为空", trigger: "blur" },
  276 + ],
  277 + subjectInformation: [
  278 + { required: true, message: "标的物信息不能为空", trigger: "blur" },
  279 + ],
  280 + attachments: [
  281 + { required: true, message: "附件不能为空", trigger: "blur" },
  282 + ],
  283 + reasonChange: [
  284 + { required: true, message: "变更原因不能为空", trigger: "blur" },
  285 + ],
  286 + reasonText: [
  287 + { required: true, message: "变更内容不能为空", trigger: "blur" },
  288 + ],
  289 + id: [{ required: true, message: "不能为空", trigger: "blur" }],
  290 + },
  291 + };
  292 + },
  293 + created() {
  294 + // this.getList();
  295 + this.contractList = [
  296 + {
  297 + orgcode: "001",
  298 + orgname: "山西人民出版社",
  299 + tocontract: 5,
  300 + okcontract: 2,
  301 + stopcontract: 1,
  302 + copePrice: 1000000,
  303 + paidPrice: 800000,
  304 + },
  305 + {
  306 + orgcode: "002",
  307 + orgname: "山西教育出版社",
  308 + tocontract: 6,
  309 + okcontract: 1,
  310 + stopcontract: 1,
  311 + copePrice: 900000,
  312 + paidPrice: 700000,
  313 + },
  314 + {
  315 + orgcode: "003",
  316 + orgname: "希望出版社",
  317 + tocontract: 3,
  318 + okcontract: 2,
  319 + stopcontract: 0,
  320 + copePrice: 4561234,
  321 + paidPrice: 4561234,
  322 + },
  323 + {
  324 + orgcode: "004",
  325 + orgname: "北岳文艺出版社",
  326 + tocontract: 8,
  327 + okcontract: 4,
  328 + stopcontract: 0,
  329 + copePrice: 98765432,
  330 + paidPrice: 98765432,
  331 + },
  332 + {
  333 + orgcode: "005",
  334 + orgname: "山西科学技术出版社",
  335 + tocontract: 9,
  336 + okcontract: 4,
  337 + stopcontract: 1,
  338 + copePrice: 85296374,
  339 + paidPrice: 85296374,
  340 + },
  341 + {
  342 + orgcode: "006",
  343 + orgname: "山西经济出版社",
  344 + tocontract: 4,
  345 + okcontract: 1,
  346 + stopcontract: 0,
  347 + copePrice: 74185296,
  348 + paidPrice: 74185296,
  349 + },
  350 + ];
  351 + this.loading = false;
  352 + },
  353 + methods: {
  354 + /** 查询【请填写功能名称】列表 */
  355 + getList() {
  356 + this.loading = true;
  357 + listContract(this.queryParams).then((response) => {
  358 + this.contractList = response.rows;
  359 + this.total = response.total;
  360 + this.loading = false;
  361 + console.log(this.contractList);
  362 + });
  363 + },
  364 + // 取消按钮
  365 + cancel() {
  366 + this.open = false;
  367 + this.reset();
  368 + },
  369 + //合同附件预览
  370 + preview(contract) {
  371 + this.dialogVisibleContract = true;
  372 + console.log("contract:", contract);
  373 + this.pdfUrl = this.baseUrl + contract;
  374 + },
  375 + handleClose() {
  376 + this.pdfUrl = "";
  377 + this.dialogVisibleContract = false;
  378 + },
  379 + // 表单重置
  380 + reset() {
  381 + this.form = {
  382 + contractno: undefined,
  383 + contractName: undefined,
  384 + contractType: undefined,
  385 + contractAmount: undefined,
  386 + effectiveDate: undefined,
  387 + expirationDate: undefined,
  388 + partyA: undefined,
  389 + partyB: undefined,
  390 + paymentMethod: undefined,
  391 + signingDate: undefined,
  392 + subjectInformation: undefined,
  393 + attachments: undefined,
  394 + reasonChange: undefined,
  395 + reasonText: undefined,
  396 + id: undefined,
  397 + };
  398 + this.resetForm("form");
  399 + },
  400 + /** 搜索按钮操作 */
  401 + handleQuery() {
  402 + this.queryParams.pageNum = 1;
  403 + // this.getList();
  404 + },
  405 + /** 重置按钮操作 */
  406 + resetQuery() {
  407 + this.resetForm("queryForm");
  408 + this.handleQuery();
  409 + },
  410 + // 多选框选中数据
  411 + handleSelectionChange(selection) {
  412 + this.ids = selection.map((item) => item.id);
  413 + this.single = selection.length !== 1;
  414 + this.multiple = !selection.length;
  415 + },
  416 + /** 新增按钮操作 */
  417 + // handleAdd() {
  418 + // this.reset();
  419 + // this.open = true;
  420 + // this.title = "添加";
  421 + // },
  422 +
  423 + /** 删除按钮操作 */
  424 + handleDelete(row) {
  425 + const ids = row.id || this.ids;
  426 + this.$modal
  427 + .confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?')
  428 + .then(() => {
  429 + this.loading = true;
  430 + return delContract(ids);
  431 + })
  432 + .then(() => {
  433 + this.loading = false;
  434 + // this.getList();
  435 + this.$modal.msgSuccess("删除成功");
  436 + })
  437 + .catch(() => {})
  438 + .finally(() => {
  439 + this.loading = false;
  440 + });
  441 + },
  442 + /** 导出按钮操作 */
  443 + handleExport() {
  444 + this.download(
  445 + "system/contract/export",
  446 + {
  447 + ...this.queryParams,
  448 + },
  449 + `contract_${new Date().getTime()}.xlsx`
  450 + );
  451 + },
  452 + },
  453 +};
  454 +</script>
  455 +<style>
  456 +/* switch按钮样式 */
  457 +.switch .el-switch__label {
  458 + position: absolute;
  459 + display: none;
  460 + color: #fff !important;
  461 +}
  462 +/*打开时文字位置设置*/
  463 +.switch .el-switch__label--right {
  464 + z-index: 1;
  465 +}
  466 +/* 调整打开时文字的显示位子 */
  467 +.switch .el-switch__label--right span {
  468 + margin-right: 9px;
  469 +}
  470 +/*关闭时文字位置设置*/
  471 +.switch .el-switch__label--left {
  472 + z-index: 1;
  473 +}
  474 +/* 调整关闭时文字的显示位子 */
  475 +.switch .el-switch__label--left span {
  476 + margin-left: 9px;
  477 +}
  478 +/*显示文字*/
  479 +.switch .el-switch__label.is-active {
  480 + display: block;
  481 +}
  482 +/* 调整按钮的宽度 */
  483 +.switch.el-switch .el-switch__core,
  484 +.el-switch .el-switch__label {
  485 + width: 70px !important;
  486 + margin: 0;
  487 +}
  488 +</style>