| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- <template>
- <div id="ActivityList">
- <search-box-new
- ref="searchBox"
- :formData="formData"
- :formList="formList"
- @search="search"
- @init="init"
- />
- <table-list
- rowKey="tpId"
- ref="tableList"
- :tableSets="tableSet"
- :tableData="tableData"
- :navText="navText"
- @sortChange="sortChange"
- :loading="loading"
- >
- <template slot="customize">
- <el-button type="primary" @click="handelClick(0)"> 新增 </el-button>
- <el-button @click="batchDel" type="warning"> 批量删除 </el-button>
- </template>
- <template slot="status" slot-scope="props">
- <el-checkbox
- :true-label="1"
- :false-label="0"
- @change="(val) => changeStatus(props.scope.row, val)"
- v-model="props.scope.row.defaultStatus"
- >
- </el-checkbox>
- </template>
- <template slot="btn" slot-scope="props">
- <el-button type="text" @click="handelClick(2, props.scope.row.tpId)"
- >复制</el-button
- >
- <el-button type="text" @click="handelClick(1, props.scope.row.tpId)"
- >修改</el-button
- >
- <el-button
- style="color: #ffba00"
- type="text"
- @click="handelDel(props.scope.row.tpId)"
- >删除</el-button
- >
- </template>
- </table-list>
- <pagination
- :total="total"
- :pageSize.sync="formData.pageSize"
- :currentPage.sync="formData.pageNum"
- @search="search"
- />
- <dislog-set
- :dialogVisible.sync="dialogVisible"
- :tpId="tpId"
- :type="type"
- :tenantList="institutionList"
- @search="search"
- ></dislog-set>
- </div>
- </template>
- <script>
- import dislogSet from "./dislogSupplierSet.vue";
- import searchBoxNew from "@/components/searchBoxNew";
- import tableList from "@/components/tableList";
- import pagination from "@/components/pagination";
- import {
- supplierList,
- institutionList,
- instDefaultStatus,
- editInstCost,
- supplierBatchCost,
- } from "@/api/financed/index";
- export default {
- name: "Cost",
- components: { searchBoxNew, tableList, pagination, dislogSet },
- data() {
- return {
- loading: false,
- navText: {
- title: "供应成本",
- index: 0,
- ch: "条",
- num: true,
- choice: true,
- addHide: true,
- openCheckMore: true,
- custom: false,
- changeWidth: "300px",
- },
- formList: [
- {
- prop: "instId",
- placeholder: "关联供应商",
- scope: "select",
- selectLabel: "instName",
- selectValue: "instId",
- options: [],
- },
- {
- prop: "tpName",
- placeholder: "模板搜索",
- },
- ],
- formData: {},
- tableSet: [
- {
- label: "模板名称",
- prop: "tpName",
- hidden: true,
- },
- {
- label: "关联供应商",
- prop: "instName",
- hidden: true,
- // sort: "custom",
- },
- {
- label: "默认",
- prop: "startTime",
- hidden: true,
- scope: "slot",
- slotName: "status",
- },
- ],
- tableData: [],
- total: 0,
- dialogVisible: !true,
- tpId: "",
- type: 0,
- institutionList: [],
- };
- },
- created() {
- this.search(2);
- this.getInstitutionList();
- },
- methods: {
- getInstitutionList() {
- institutionList({
- pageSize: 999,
- pageNum: 1,
- status:1
- }).then((res) => {
- this.institutionList = res.rows;
- this.formList[0].options = this.institutionList;
- });
- },
- handelClick(type, tpId) {
- this.dialogVisible = true;
- this.type = type;
- this.tpId = tpId;
- },
- changeStatus({ tpId, instId }, defaultStatus) {
- instDefaultStatus({ tpId, instId, defaultStatus }).then((res) => {
- this.$message.success("状态修改成功");
- this.search();
- });
- },
- batchDel() {
- const ids = this.$refs.tableList.allCheckData.map((item) => item.tpId);
- if (!ids.length) {
- return this.$message.warning("请先勾选模板");
- }
- this.handelDel(ids, 1);
- },
- handelDel(tpId, type = 0) {
- this.$confirm(
- `此操作将删除${type ? "批量" : "该"}模板, 是否继续?`,
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- )
- .then(() => {
- if (type) {
- supplierBatchCost({ ids: tpId }).then((res) => {
- this.$message.success("删除成功");
- this.$refs.tableList.clearMoreActive();
- this.search();
- });
- } else {
- editInstCost({ tpId, status: -1 }).then((res) => {
- this.$message.success("删除成功");
- this.$refs.tableList.clearMoreActive();
- this.search();
- });
- }
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "已取消删除",
- });
- });
- },
- search(v) {
- this.loading = true;
- if (v === 2) {
- this.formData = {
- pageSize: 10,
- pageNum: 1,
- statusList: "0,1",
- tenantSort: undefined,
- };
- this.$nextTick(() => {
- this.$refs.tableList.clearMoreActive();
- });
- }
- supplierList(this.formData)
- .then((res) => {
- this.tableData = res.rows;
- this.total = res.total;
- this.navText.index = res.total;
- })
- .finally(() => {
- this.loading = false;
- });
- },
- sortChange(data) {
- this.formData.tenantSort = data.order
- ? data.order == "ascending"
- ? 1
- : 0
- : undefined;
- this.formData.pageNum = 1;
- this.search();
- },
- init() {
- this.search(2);
- },
- },
- };
- </script>
- <style lang="scss" scoped></style>
|