123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768 |
- <template>
- <div class="relation pagePadding">
- <!--新建 编辑 详情 审核 -->
- <add-view
- :id="modelId"
- :showModel="showModel"
- :is-detail="isDetail"
- :newTime="newTime"
- @refresh="(showModel = false), searchList()"
- @cancel="showModel = false"
- />
- <ex-table
- v-loading="loading"
- v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
- :table="table"
- :data="tableData"
- :columns="columns"
- :page="pageInfo"
- :size="size"
- @page-curr-change="handlePageChange"
- @page-size-change="handleSizeChange"
- @screen-reset="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- @screen-submit="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- >
- <template #table-header="{ selection }">
- <div style="width: 100%">
- <el-row :gutter="10" style="padding: 0 0 10px 80px">
- <el-col :span="7" style="width: 180px">
- <el-select
- style="width: 100%"
- :size="searchSize"
- v-model="parmValue.type"
- clearable
- @change="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- placeholder="关联类型"
- >
- <el-option
- v-for="item in RQList"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- >
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="7" style="width: 170px">
- <el-select
- style="width: 100%"
- :size="searchSize"
- v-model="parmValue.status"
- clearable
- @change="
- pageInfo.curr = 1;
- parmValue.page = 1;
- searchList();
- "
- placeholder="关联状态"
- >
- <el-option
- v-for="item in relationType"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- >
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="6" style="width: 320px">
- <period-date-picker
- :start="parmValue.start"
- :end="parmValue.end"
- :type="1"
- :width="'144px'"
- :size="searchSize"
- @timeReturned="timeReturned($event)"
- />
- </el-col>
- <el-col :span="4" style="width: 66px" class="fr">
- <el-button
- v-if="powers.some((item) => item == '002')"
- :size="searchSize"
- type="primary"
- class="fr"
- @click="searchList"
- >
- 刷新
- </el-button>
- </el-col>
- <el-col :span="4" style="width: 66px" class="fr">
- <el-button
- type="warning"
- v-if="powers.some((item) => item == '024')"
- :size="searchSize"
- @click="restSearch"
- >
- 重置
- </el-button>
- </el-col>
- <el-col :span="4" style="width: 56px" class="fr">
- <el-button
- :size="searchSize"
- type="primary"
- icon="el-icon-search"
- @click="searchList"
- />
- </el-col>
- </el-row>
- <el-row :gutter="10">
- <el-col :span="6" style="width: 430px">
- <el-select
- v-model="code"
- multiple
- filterable
- :size="searchSize"
- remote
- style="width: 100%"
- :multiple-limit="1"
- reserve-keyword
- placeholder="请输入公司名称"
- :remote-method="remoteMethod"
- :loading="selectLoading"
- class="setWidth"
- >
- <el-option
- v-for="item in activeOptions"
- :key="item.companyNo"
- :label="item.companyName"
- :value="item.companyNo"
- />
- </el-select>
- </el-col>
- <el-col :span="4" style="width: 330px">
- <el-input
- placeholder="请输入编号"
- v-model="parmValue.codeNo"
- :size="searchSize"
- class="input-with-select"
- >
- <el-select
- style="width: 105px"
- :size="searchSize"
- v-model="parmValue.codeType"
- slot="prepend"
- >
- <el-option
- v-for="(item, index) in selectList"
- :key="item.code + index"
- :label="item.name"
- :value="item.code"
- ></el-option>
- </el-select>
- </el-input>
- </el-col>
- <el-col :span="4" style="width: 88px; float: right">
- <el-button
- type="primary"
- class="fr"
- :size="searchSize"
- :disabled="loading"
- @click="batchExport(selection)"
- >
- 页面导出
- </el-button>
- </el-col>
- <el-col :span="4" style="width: 66px" class="fr">
- <el-button
- v-if="powers.some((item) => item == '003')"
- type="success"
- class="fr"
- style="margin-left: 0px"
- :size="searchSize"
- @click="openModal('add', '003')"
- >
- 添加
- </el-button>
- </el-col>
- </el-row>
- </div>
- </template>
- <template #orderNo="{ scope }">
- <el-popover
- placement="top"
- width="180"
- v-if="scope.row.orderNo_length > 1"
- trigger="hover"
- >
- <ul class="my-tag-ul-main" style="list-style-type: disc">
- <li
- style="
- font-size: 12px;
- line-height: 20px;
- list-style-type: disc;
- list-style-position: inside;
- display: list-item;
- "
- v-for="(key1, ki1) in scope.row.orderNo_showMain"
- :key="ki1 + scope.row.orderNo + key1"
- >
- {{ key1 }}
- </li>
- </ul>
- <p
- slot="reference"
- style="display: inline-block; vertical-align: top; cursor: pointer"
- >
- <span style="display: inline-block; vertical-align: top">{{
- scope.row.orderNo
- }}</span
- ><span style="display: inline-block; vertical-align: top; padding: 0 0 0 2px"
- ><i
- class="el-icon-more"
- style="
- font-size: 12px;
- height: 23px;
- display: inline-block;
- line-height: 30px;
- "
- ></i>
- </span>
- <!-- {{ scope.row.orderNo }} -->
- </p>
- </el-popover>
- <p v-else>{{ scope.row.orderNo }}</p>
- </template>
- <template #traNo="{ scope }">
- <el-popover
- placement="top"
- width="200"
- v-if="scope.row.traNo_length > 1"
- trigger="hover"
- >
- <ul style="list-style-type: disc; list-style-position: inside">
- <li
- style="
- font-size: 12px;
- line-height: 20px;
- list-style-type: disc;
- list-style-position: inside;
- display: list-item;
- "
- v-for="(key1, ki1) in scope.row.traNo_showMain"
- :key="ki1 + scope.row.traNo + key1"
- >
- {{ key1 }}
- </li>
- </ul>
- <p
- slot="reference"
- style="display: inline-block; vertical-align: top; cursor: pointer"
- >
- <span style="display: inline-block; vertical-align: top">{{
- scope.row.traNo
- }}</span
- ><span style="display: inline-block; vertical-align: top; padding: 0 0 0 2px"
- ><i
- class="el-icon-more"
- style="
- font-size: 12px;
- height: 23px;
- display: inline-block;
- line-height: 30px;
- "
- ></i>
- </span>
- </p>
- </el-popover>
- <p v-else>{{ scope.row.traNo }}</p>
- </template>
- <template #invNo="{ scope }">
- <el-popover
- placement="top"
- width="200"
- v-if="scope.row.invNo_length > 1"
- trigger="hover"
- >
- <ul style="list-style-type: disc; list-style-position: inside">
- <li
- style="
- font-size: 12px;
- line-height: 20px;
- list-style-type: disc;
- list-style-position: inside;
- display: list-item;
- "
- v-for="(key1, ki1) in scope.row.invNo_showMain"
- :key="ki1 + scope.row.invNo + key1"
- >
- {{ key1 }}
- </li>
- </ul>
- <p
- slot="reference"
- style="display: inline-block; vertical-align: top; cursor: pointer"
- >
- <span style="display: inline-block; vertical-align: top">{{
- scope.row.invNo
- }}</span
- ><span style="display: inline-block; vertical-align: top; padding: 0 0 0 2px"
- ><i
- class="el-icon-more"
- style="
- font-size: 12px;
- height: 23px;
- display: inline-block;
- line-height: 28px;
- "
- ></i>
- </span>
- </p>
- </el-popover>
- <p v-else>{{ scope.row.invNo }}</p>
- </template>
- <template #rela_form="{ scope }">
- <el-tag
- size="mini"
- :type="''"
- v-text="
- (RQList.find((item) => item.code == scope.row.rela_form) || {}).name || '--'
- "
- ></el-tag>
- </template>
- <template #status="{ scope }">
- <el-tag
- size="mini"
- :type="
- scope.row.status == '3' ? 'success' : scope.row.status == '2' ? 'warning' : ''
- "
- v-text="
- (relationType.find((item) => item.code == scope.row.status) || {}).name ||
- '--'
- "
- ></el-tag>
- </template>
- <template #operation="{ scope }">
- <el-tooltip
- v-if="
- (powers.some((item) => item == '007') && scope.row.rela_form === '2') ||
- (powers.some((item) => item == '007') && scope.row.rela_form === '3')
- "
- effect="dark"
- content="详情"
- placement="top"
- >
- <i class="el-icon-view tb-icon" @click="openModal(scope.row.id, '007')"></i>
- </el-tooltip>
- <el-tooltip
- v-if="
- (powers.some((item) => item == '027') &&
- scope.row.status !== '3' &&
- scope.row.rela_form === '2') ||
- (powers.some((item) => item == '027') &&
- scope.row.status !== '3' &&
- scope.row.rela_form === '3')
- "
- effect="dark"
- content="申请取消"
- placement="top"
- >
- <i class="el-icon-video-pause tb-icon" @click="changeStatus(scope.row.id)"></i>
- </el-tooltip>
- <el-tooltip
- v-if="
- (powers.some((item) => item == '029') &&
- scope.row.status === '1' &&
- scope.row.rela_form === '2') ||
- (powers.some((item) => item == '029') &&
- scope.row.status === '1' &&
- scope.row.rela_form === '3')
- "
- effect="dark"
- content="财务审核"
- placement="top"
- >
- <i class="el-icon-s-check tb-icon" @click="openModal(scope.row.id, '029')"></i>
- </el-tooltip>
- </template>
- </ex-table>
- <no-auth v-else></no-auth>
- </div>
- </template>
- <script>
- import ExTable from "@/components/ExTableNew.vue";
- import addView from "./addView";
- import asyncRequest from "@/apis/service/InvoiceSales/relation";
- import mixinPage from "@/mixins/elPaginationHandle";
- import { mapGetters } from "vuex";
- import { relationType, RQList } from "@/assets/js/linkType";
- import PeriodDatePicker from "@/components/PeriodDatePicker";
- import resToken from "@/mixins/resToken";
- import { formatJson } from "@/utils/publicMethods";
- export default {
- name: "relation",
- mixins: [mixinPage, resToken],
- components: {
- ExTable,
- addView,
- PeriodDatePicker,
- },
- computed: {
- //组件SIZE设置
- ...mapGetters(["tablebtnSize", "searchSize", "size"]),
- powers() {
- let tran =
- this.$store.getters.btnList.find((item) => item.menu_route == "relation") || {};
- if (tran && tran.action && tran.action.length > 0) {
- return tran.action;
- } else {
- return [];
- }
- },
- },
- data() {
- return {
- selectList: [
- {
- code: "1",
- name: "确认单号",
- },
- {
- code: "2",
- name: "发票单号",
- },
- {
- code: "3",
- name: "资金单号",
- },
- ],
- newTime: 0,
- code: [],
- relationType,
- RQList: RQList,
- selectLoading: false,
- activeOptions: [],
- name: "",
- contector: "",
- loading: true,
- showModel: false,
- isDetail: false,
- modelId: 0,
- parmValue: {
- companyNo: "",
- type: "",
- status: "",
- start: "",
- end: "",
- codeType: "1",
- codeNo: "",
- page: 1, // 页码
- size: 15, // 每页显示条数
- },
- // 表格 - 数据
- tableData: [],
- // 表格 - 参数
- table: {
- stripe: true,
- border: true,
- _defaultHeader_: ["setcol"],
- },
- // 表格 - 分页
- pageInfo: {
- size: 15,
- curr: 1,
- total: 0,
- },
- // 表格 - 列参数
- columns: [
- { type: "selection", fixed: "left", _noset_: true },
- {
- prop: "id",
- label: "ID",
- fixed: "left",
- width: "70px",
- },
- {
- prop: "companyNo",
- label: "公司编码",
- width: "130px",
- },
- {
- prop: "companyName",
- label: "公司名称",
- "min-width": "230px",
- },
- {
- prop: "cancel_total",
- label: "核销额度",
- width: "120px",
- },
- {
- prop: "rela_form",
- label: "关联类型",
- _slot_: "rela_form",
- width: "120px",
- },
- {
- prop: "orderNo",
- label: "订单编号",
- width: "180px",
- _slot_: "orderNo",
- },
- {
- prop: "traNo",
- label: "资金编号",
- width: "250px",
- _slot_: "traNo",
- },
- {
- prop: "invNo",
- label: "发票编号",
- width: "200px",
- _slot_: "invNo",
- },
- {
- prop: "status",
- label: "状态",
- _slot_: "status",
- width: "110px",
- },
- {
- prop: "addtime",
- label: "创建时间",
- sortable: true,
- width: "145px",
- },
- {
- prop: "",
- label: "操作",
- width: "120px",
- fixed: "right",
- _noset_: true,
- _slot_: "operation",
- },
- ],
- };
- },
- mounted() {
- this.showModel = false;
- this.searchList();
- },
- methods: {
- restSearch() {
- // 表格 - 分页
- this.pageInfo = {
- size: 15,
- curr: 1,
- total: 0,
- };
- this.parmValue = {
- companyNo: "",
- type: "",
- status: "",
- start: "",
- end: "",
- codeType: "1",
- codeNo: "",
- page: 1, // 页码
- size: 15, // 每页显示条数
- };
- this.searchList();
- },
- // 新建/编辑/详情
- openModal(id, isDetail) {
- this.showModel = true;
- this.changea();
- this.modelId = id;
- this.isDetail = isDetail;
- },
- /**
- * 启用/禁用
- * @param {String} id id
- */
- async changeStatus(id) {
- await this.$confirm(`确定要取消申请?`, {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(async () => {
- const res = await asyncRequest.delete({ id: id });
- if (res && res.code === 0) {
- this.$notify.success({
- title: "取消申请成功",
- message: "",
- });
- this.searchList();
- } else if (res && res.code >= 100 && res.code <= 104) {
- await this.logout();
- } else {
- this.$message.warning(res.message);
- }
- })
- .catch(() => {
- console.log("取消");
- });
- },
- async timeReturned(e) {
- if (e.startTime !== "") {
- this.parmValue.start = e.startTime;
- } else {
- this.parmValue.start = "";
- }
- if (e.endTime !== "") {
- this.parmValue.end = e.endTime;
- } else {
- this.parmValue.end = "";
- }
- if (this.parmValue.start !== "" && this.parmValue.end !== "") {
- this.parmValue.page = 1;
- await this.searchList();
- }
- },
- // 刷新表格
- async searchList() {
- this.loading = true;
- this.parmValue.companyNo = this.code.join(",");
- let obj = JSON.parse(JSON.stringify(this.parmValue));
- const res = await asyncRequest.list(obj);
- if (res && res.code === 0 && res.data) {
- this.tableData = res.data.list;
- this.tableData.map((v1) => {
- let arr1 = v1.orderNo.split(",");
- v1.orderNo = arr1[0];
- v1.orderNo_length = arr1.length;
- // v1.orderNo_show = false;
- v1.orderNo_showMain = arr1;
- let arr2 = v1.traNo.split(",");
- v1.traNo = arr2[0];
- v1.traNo_length = arr2.length;
- // v1.traNo_show = false;
- v1.traNo_showMain = arr2;
- let arr3 = v1.invNo.split(",");
- v1.invNo = arr3[0];
- v1.invNo_length = arr3.length;
- // v1.invNo_show = false;
- v1.invNo_showMain = arr3;
- return v1;
- });
- console.log(this.tableData);
- this.pageInfo.total = Number(res.data.count);
- } else if (res && res.code >= 100 && res.code <= 104) {
- await this.logout();
- } else {
- this.tableData = [];
- this.pageInfo.total = 0;
- }
- this.loading = false;
- },
- /**
- * 批量导出
- * @param {Array} selection 当前选择项
- */
- batchExport(selection) {
- if (!this.loading) {
- if (selection.length == 0) {
- this.$message.warning("请至少选择一条数据!");
- return;
- }
- this.loading = true;
- let data = [].concat(...selection);
- let list = [];
- data.forEach((item) => {
- let model = Object.assign({}, item);
- model.orderNo = model.orderNo_showMain.toString();
- model.traNo = model.traNo_showMain.toString();
- model.invNo = model.invNo_showMain.toString();
- model.rela_form =
- (this.RQList.find((v) => v.code == item.rela_form) || {}).name || "--";
- model.status =
- (this.relationType.find((v) => v.code == item.status) || {}).name || "--";
- list.push(model);
- });
- const xlsName = `单款票确认数据批量导出`;
- import("@/vendor/Export2Excel").then((excel) => {
- const tHeader = [
- "ID",
- "公司编码",
- "公司名称",
- "核销额度",
- "关联类型",
- "订单编号",
- "资金编号",
- "发票编号",
- "状态",
- "创建时间",
- ];
- const filterVal = [
- "id",
- "companyNo",
- "companyName",
- "cancel_total",
- "rela_form",
- "orderNo",
- "traNo",
- "invNo",
- "status",
- "addtime",
- ];
- const data = formatJson(filterVal, list);
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: `${xlsName}`,
- });
- this.$message.success("单款票确认数据导出成功!");
- setTimeout(() => {
- this.loading = false;
- }, 500);
- });
- }
- },
- async remoteMethod(query) {
- this.selectLoading = true;
- if (query !== "") {
- this.activeOptions = [];
- const res = await asyncRequest.clist({
- page: 1,
- size: 100,
- company: query,
- });
- if (res && res.code === 0 && res.data && res.data.list) {
- this.activeOptions = res.data.list;
- } else if (res && res.code >= 100 && res.code <= 104) {
- await this.logout();
- } else {
- this.$message.warning(res.message);
- }
- } else {
- this.activeOptions = [];
- }
- this.selectLoading = false;
- },
- changea() {
- this.newTime = new Date().valueOf();
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .relation {
- position: absolute;
- width: 100%;
- height: calc(100% - 84px);
- box-sizing: border-box;
- overflow: scroll;
- }
- </style>
|