| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493 | <template>    <div>        <basic-container v-if="isShow">            <avue-crud :option="option"                       :table-loading="loading"                       :data="data"                       :page.sync="page"                       :permission="permissionList"                       id="out-table"                       :header-cell-class-name="headerClassName"                       :before-open="beforeOpen"                       v-model="form"                       ref="crud"                       @row-update="rowUpdate"                       @row-save="rowSave"                       @row-del="rowDel"                       @search-change="searchChange"                       @search-reset="searchReset"                       @selection-change="selectionChange"                       @current-change="currentChange"                       @size-change="sizeChange"                       @refresh-change="refreshChange"                       @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 307)"                       @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 307)"                       @on-load="onLoad">                      <template slot="billNo" slot-scope="scope">                        <avue-text-ellipsis :text="scope.row.billNo" :height="30" use-tooltip placement="top">                          <small slot="more">...</small>                        </avue-text-ellipsis>                      </template>                      <template slot="agreementNo" slot-scope="scope">                        <avue-text-ellipsis :text="scope.row.agreementNo" :height="30" use-tooltip placement="top">                          <small slot="more">...</small>                        </avue-text-ellipsis>                      </template>                      <template slot="corpCnName" slot-scope="scope">                        <avue-text-ellipsis :text="scope.row.corpCnName" :height="30" use-tooltip placement="top">                          <small slot="more">...</small>                        </avue-text-ellipsis>                      </template>                      <template slot="corpEnName" slot-scope="scope">                        <avue-text-ellipsis :text="scope.row.corpEnName" :height="30" use-tooltip placement="top">                          <small slot="more">...</small>                        </avue-text-ellipsis>                      </template>                <template slot="menuLeft">                    <el-button type="primary"                               size="small"                               icon="el-icon-plus"                               @click="addbtnfun()">新建费用模板                    </el-button>                    <el-button type="danger"                               size="small"                               icon="el-icon-delete"                               plain                               @click="handleDelete">删 除                    </el-button>                </template>                <template slot-scope="scope" slot="menu">                    <el-button :type="scope.type" :size="scope.size" icon="el-icon-edit"                               @click.stop="rowCellfun(scope.row, scope.index)">编辑                    </el-button>                    <el-button :type="scope.type" :size="scope.size" icon="el-icon-delete"                               @click.stop="rowDel(scope.row, scope.index)">删除                    </el-button>                </template>            </avue-crud>        </basic-container>        <agreementpriceitems ref="agreementpriceitems" v-if="!isShow" :detailData="detailData" @goBack="goBack"></agreementpriceitems>    </div></template><script>  import {agreementpriceList, agreementpriceDetail, agreementpriceSubmit, agreementpriceRemove} from "@/api/iosBasicData/agreementprice";  import {mapGetters} from "vuex";  import agreementpriceitems from "@/views/financialManagementF/agreementprice/agreementpriceitems.vue";  export default {      components: {agreementpriceitems},    data() {      return {          // 详情传递的数据          detailData:{},          isShow:true,        form: {},        query: {},        loading: true,        page: {          pageSize: 10,          currentPage: 1,          total: 0        },        selectionList: [],        option:{},        optionBack: {            addBtn:false,          height:'auto',          calcHeight: 30,          tip: false,          searchShow: true,          searchMenuSpan: 6,          border: true,          index: true,          viewBtn: true,          selection: true,          dialogClickModal: false,          column: [            {              label: "单据编码",              prop: "billNo",              width: "180",                search: true,              rules: [{                required: true,                message: "请输入单位编码",                trigger: "blur"              }]            },            {              label: "单位编码",              prop: "agreementNo",              width: "180",                search: true,              rules: [{                required: true,                message: "请输入单位编码",                trigger: "blur"              }]            },            // {            //   label: "客户 Id",            //   prop: "corpId",            //     hide:true,            //     display:false,            // },            {              label: "客户名称",              prop: "corpCnName",              width: "180",                search: true,              rules: [{                required: true,                message: "请输入客户中文名称",                trigger: "blur"              }]            },            {              label: "客户英文名称",              prop: "corpEnName",                width:180,              rules: [{                required: true,                message: "请输入客户英文名称",                trigger: "blur"              }]            },            {              label: "授信等级",              prop: "creditLevel",              // rules: [{              //   required: true,              //   message: "请输入授信等级,A=A级,B=B级,B+=B+级,B-=B-级,C=C级,D=黑名单",              //   trigger: "blur"              // }]            },            {              label: "协议生效日期",              prop: "effectiveDate",                width:160,            },            {              label: "协议失效日期",              prop: "expiringDate",                width:160,            },            {              label: "人民币协议金额",              prop: "amountCny",                width:120,            },            {              label: "美元协议金额",              prop: "amountUsd",                width:120,            },            // {            //   label: "协议签订人 Id",            //   prop: "signedId",            //            // },            {              label: "协议签订人姓名",              prop: "signedName",                width:120,            },            {              label: "账期备注",              prop: "accountPeriodRemarks",                span:24,                type: 'textarea',                width: "180",                slot: true,                minRows: 3,            },              {                  label: "备注",                  prop: "remarks",                  span:24,                  type: 'textarea',                  width: "180",                  slot: true,                  minRows: 3,              },            {              label: "状态",              prop: "status",                type:'select',                dicData:[{                    label:'启用',                    value:0                },{                    label:'停用',                    value:1                }],            },            {              label: "是否已删除(0 否 1是)",              prop: "isDeleted",                hide:true,                display:false,            },              {                  label: "创建人",                  prop: "createUserName",                  display:false,              },              {                  label: "创建部门",                  prop: "createDeptName",                  display:false,              },              {                  label: "创建时间",                  prop: "createTime",                  width:160,                  display:false,              },              {                  label: "修改人",                  prop: "updateUserName",                  display:false,              },              {                  label: "修改时间",                  prop: "updateTime",                  display:false,              },          ]        },        data: []      };    },    computed: {      ...mapGetters(["permission"]),      permissionList() {        return {          addBtn: this.vaildData(this.permission.agreementprice_add, false),          viewBtn: this.vaildData(this.permission.agreementprice_view, false),          delBtn: this.vaildData(this.permission.agreementprice_delete, false),          editBtn: this.vaildData(this.permission.agreementprice_edit, false)        };      },      ids() {        let ids = [];        this.selectionList.forEach(ele => {          ids.push(ele.id);        });        return ids.join(",");      }    },      async created() {          this.option = await this.getColumnData(this.getColumnName(307), this.optionBack);      },      methods: {          // 添加弹窗开启          addbtnfun(){              this.detailData.seeDisabled = false              this.isShow = false          },          // 编辑详情打开          rowCellfun(row, index) {              this.detailData = {                  seeDisabled:true,                  id:row.id              }              this.isShow = false              this.$nextTick(() => {                  this.$refs.agreementpriceitems.agreementpriceDetailfun(row.id)              })          },          // 详情的返回列表          goBack(){              // 初始化数据              // this.detailData = this.$options.data().detailData;              if (JSON.stringify(this.$route.query) != "{}") {                  this.$router.$avueRouter.closeTag();                  this.$router.push({                      path: "/iosBasicData/losbfeestemplate/index"                  });              }              this.isShow = true;              this.onLoad(this.page, this.search);          },      rowSave(row, done, loading) {        agreementpriceSubmit(row).then(() => {          this.onLoad(this.page);          this.$message({            type: "success",            message: "操作成功!"          });          done();        }, error => {          loading();          window.console.log(error);        });      },      rowUpdate(row, index, done, loading) {        agreementpriceSubmit(row).then(() => {          this.onLoad(this.page);          this.$message({            type: "success",            message: "操作成功!"          });          done();        }, error => {          loading();          console.log(error);        });      },      rowDel(row) {      if (row.status === 1) {        this.$confirm("确定将选择数据删除?", {          confirmButtonText: "确定",          cancelButtonText: "取消",          type: "warning"        })          .then(() => {            return agreementpriceRemove(row.id);          })          .then(() => {            this.onLoad(this.page);            this.$message({              type: "success",              message: "操作成功!"            });          });      } else {        this.$message({          message: '非禁用状态无法删除',          type: 'warning'        });      }      },      handleDelete() {        if (this.selectionList.length === 0) {          this.$message.warning("请选择至少一条数据");          return;        }        for (const selection of this.selectionList) {          if (selection.status == 0) {            this.$message.warning("选中的数据中有启用数据,启用数据不可删除!");            return;          }        }        this.$confirm("确定将选择数据删除?", {          confirmButtonText: "确定",          cancelButtonText: "取消",          type: "warning"        })          .then(() => {            return agreementpriceRemove(this.ids);          })          .then(() => {            this.onLoad(this.page);            this.$message({              type: "success",              message: "操作成功!"            });            this.$refs.crud.toggleSelection();          });      },      beforeOpen(done, type) {        if (["edit", "view"].includes(type)) {          agreementpriceDetail(this.form.id).then(res => {            this.form = res.data.data;          });        }        done();      },      searchReset() {        this.query = {};        this.onLoad(this.page);      },      searchChange(params, done) {        this.query = params;        this.page.currentPage = 1;        this.onLoad(this.page, params);        done();      },      selectionChange(list) {        this.selectionList = list;      },      selectionClear() {        this.selectionList = [];        this.$refs.crud.toggleSelection();      },      currentChange(currentPage){        this.page.currentPage = currentPage;      },      sizeChange(pageSize){        this.page.pageSize = pageSize;      },      refreshChange() {        this.onLoad(this.page, this.query);      },      onLoad(page, params = {}) {        this.loading = true;        agreementpriceList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {          const data = res.data.data;          this.page.total = data.total;          this.data = data.records;          this.loading = false;          this.selectionClear();        });      },        //自定义列保存        async saveColumnTwo(ref, option, optionBack, code) {            /**             * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)             * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名             * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码             */            const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);            if (inSave) {                this.$message.success("保存成功");                //关闭窗口                this.$refs[ref].$refs.dialogColumn.columnBox = false;            }        },        //自定义列重置        async resetColumnTwo(ref, option, optionBack, code) {            this[option] = this[optionBack];            const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);            if (inSave) {                this.$message.success("重置成功");                this.$refs[ref].$refs.dialogColumn.columnBox = false;            }        },        // 更改表格颜色        headerClassName(tab){            //颜色间隔            let back = ""            if (tab.columnIndex >= 0 && tab.column.level === 1) {                if (tab.columnIndex % 2 === 0) {                    back = "back-one"                } else if (tab.columnIndex % 2 === 1) {                    back = "back-two"                }            }            return back;        },    }  };</script><style scoped>::v-deep#out-table .back-one {    background: #ecf5ff !important;}::v-deep#out-table .back-two {    background: #ecf5ff !important;}</style>
 |