123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- <!-- -->
- <template>
- <div class="m-container">
- <h2>
- <div class="squrt"></div>
- 乐器置换
- </h2>
- <div class="m-core">
- <div class="btnList">
- <!-- v-permission="'export/practiceGroup'" -->
- <div
- class="newBand"
- @click="makeUrl"
- style="max-width: 150px; margin-right: 10px"
- v-if="permission('replacementInstrumentCooperation/add')"
- >
- 生成链接
- </div>
- <!-- <div class="newBand" @click="onExport" style="max-width: 150px">
- 导出
- </div> -->
- </div>
- <save-form
- :inline="true"
- ref='searchForm'
- :model="searchForm"
- @submit="search"
- @reset="onReSet"
- >
- <el-form-item prop="search">
- <el-input
- v-model.trim="searchForm.search"
- clearable
- @keyup.enter.native="search"
- placeholder="学校名称或编号"
- ></el-input>
- </el-form-item>
- <el-form-item prop="organId">
- <el-select
- v-model.trim="searchForm.organId"
- filterable
- clearable
- placeholder="请选择分部"
- >
- <el-option
- v-for="(item, index) in selects.branchs"
- :key="index"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item prop="openPay">
- <el-select
- class="multiple"
- v-model.trim="searchForm.openPay"
- filterable
- clearable
- placeholder="是否开启缴费"
- >
- <el-option label="是" value="YES"></el-option>
- <el-option label="否" value="NO"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button native-type="submit" type="primary">搜索</el-button>
- <el-button native-type="reset" type="danger">重置</el-button>
- </el-form-item>
- </save-form>
- <div class="tableWrap">
- <el-table
- style="width: 100%"
- :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
- :data="tableList"
- >
- <el-table-column
- align="center"
- prop="organName"
- label="分部"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="cooperationOrganName"
- label="合作单位"
- >
- <template slot-scope="scope">
- <div>
- {{ scope.row.cooperationOrganName }}
- (<copy-text> {{ scope.row.cooperationOrganId }} </copy-text>)
- </div>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- prop="activeNum"
- label="调查人数"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="replaceNum"
- label="置换人数"
- ></el-table-column>
- <el-table-column align="center" prop="replaceScale" label="置换率">
- <template slot-scope="scope">
- <div>{{ scope.row.replaceScale }}%</div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="openPay" label="是否开启缴费">
- <template slot-scope="scope">
- <div>{{ scope.row.openPay ? "是" : "否" }}</div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="studentId" label="操作">
- <template slot-scope="scope">
- <div>
- <!-- <el-button type="text" @click="lookDetail(scope.row)"
- >详情</el-button
- > -->
- <el-button
- type="text"
- @click="onCreateQRCode(scope.row, '调查链接')"
- >调查链接</el-button
- >
- <el-button
- type="text"
- @click="onCreateQRCode(scope.row, '统计链接')"
- >统计链接</el-button
- >
- <el-button
- type="text"
- @click="openPay(scope.row)"
- v-if="!scope.row.openPay&&permission('replacementInstrumentCooperation/openPay')"
- >开启缴费</el-button
- >
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- sync
- :total.sync="rules.total"
- :page.sync="rules.page"
- :limit.sync="rules.limit"
- :page-sizes="rules.page_size"
- @pagination="getList"
- />
- </div>
- </div>
- <el-dialog
- title="生成链接"
- :visible.sync="makeUrlVisible"
- width="500px"
- v-if="makeUrlVisible"
- >
- <addUrl ref="addUrl" @close="close" @getList="getList" />
- <div slot="footer">
- <el-button @click="makeUrlVisible = false">取 消</el-button>
- <el-button type="primary" @click="addurl">生成链接</el-button>
- </div>
- </el-dialog>
- <el-dialog
- title="详情"
- :visible.sync="detailVisible"
- width="1000px"
- v-if="detailVisible"
- >
- <detail ref="detail" @close="close" />
- <div slot="footer">
- <el-button type="primary" @click="detailVisible = false"
- >确定</el-button
- >
- </div>
- </el-dialog>
- <qr-code v-model="qrcodeStatus"
- :title="qrcodeName"
- :codeUrl="codeUrl" />
- <!-- <el-dialog :title="qrcodeName" :visible.sync="qrcodeStatus" width="300px">
- <div class="left-code">
- <div id="qrcode" class="qrcode code" ref="qrCodeUrl"></div>
- <p class="code-url" v-if="codeUrl">
- <copy-text>
- {{ codeUrl }}
- </copy-text>
- </p>
- </div>
- </el-dialog> -->
- </div>
- </template>
- <script>
- import axios from "axios";
- import { getToken } from "@/utils/auth";
- import { permission } from "@/utils/directivePage";
- import { vaildStudentUrl, vaildTeachingUrl } from "@/utils/validate";
- import pagination from "@/components/Pagination/index";
- import addUrl from "./modals/addUrl";
- import detail from "./modals/detail";
- import load from "@/utils/loading";
- import { getReplacementList, openPayReplacement } from "./api";
- import QrCode from "@/components/QrCode/index";
- export default {
- components: { pagination, addUrl, detail, QrCode, },
- data() {
- return {
- searchForm: {
- search: null,
- organId: "",
- openPay: "",
- },
- tableList: [],
- rules: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50], // 选择限制显示条数
- },
- makeUrlVisible: false,
- detailVisible: false,
- codeUrl: "",
- qrcodes: true,
- qrcodeStatus: false,
- qrcodeName: "调查链接",
- };
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- // 获取分部
- this.init();
- },
- methods: {
- permission(str, parent) {
- return permission(str, parent);
- },
- init() {
- this.$store.dispatch("setBranchs");
- this.getList();
- },
- async getList() {
- try {
- const res = await getReplacementList({
- ...this.searchForm,
- page: this.rules.page,
- rows: this.rules.limit,
- });
- this.rules.total = res.data.total;
- this.tableList = res.data.rows;
- } catch (e) {
- console.log(e);
- }
- },
- search() {
- this.rules.page = 1;
- this.getList();
- },
- onReSet() {
- this.$refs.searchForm.resetFields()
- this.search()
- },
- makeUrl() {
- this.makeUrlVisible = true;
- },
- addurl() {
- this.$refs.addUrl.submit();
- },
- close() {
- this.makeUrlVisible = false;
- this.detailVisible = false;
- },
- onExport() {},
- lookDetail(row) {
- this.detailVisible = true;
- },
- onCreateQRCode(row, name) {
- // 生成链接
- this.qrcodeName = name;
- this.qrcodeStatus = true;
- let id = this.$route.query.id;
- if (this.qrcodes) {
- this.qrcodes = false;
- // setTimeout(() => {
- // document.getElementById("qrcode").innerHTML = "";
- // this.qrcode = new QRCode("qrcode", {
- // width: 260,
- // height: 260,
- // colorDark: "#000000",
- // colorLight: "#ffffff",
- // correctLevel: QRCode.CorrectLevel.H,
- // });
- let str;
- if (name == "调查链接") {
- let returnUrl = vaildStudentUrl()+`/#/questionnaire?o=${row.organId}&c=${row.cooperationOrganId}`;
- // console.log(returnUrl)
- let tempUrl = vaildStudentUrl()+`/#/transfer?returnUrl=${encodeURIComponent(returnUrl)}`
- str = tempUrl
- } else if (name == "统计链接") {
- str = vaildTeachingUrl()+`/#/questionStatistics?o=${row.organId}&c=${row.cooperationOrganId}`;
- }
- // vaildTeachingUrl
- // this.qrcode.makeCode(
- // str +
- // `/#/questionnaireInfo?o=${row.organId}&c=${row.cooperationOrganId}`
- // );
- this.codeUrl =str;
- this.qrcodes = true;
- // }, 100);
- }
- },
- openPay(row) {
- this.$confirm("确定开启缴费?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(async () => {
- try {
- const res = await openPayReplacement({ id: row.id });
- this.$message.success("开启缴费成功");
- this.getList();
- } catch (e) {
- console.log(e);
- }
- })
- .catch(() => {});
- },
- },
- };
- </script>
- <style lang='scss' scoped>
- .btnList {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- .code-url {
- margin-top: 10px;
- }
- </style>
|