| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <template>
- <div>
- <el-dialog
- title="出口价格库"
- class="el-dialogDeep"
- :visible.sync="visible"
- top="5vh"
- width="80%"
- append-to-body
- @closed="closed"
- :close-on-click-modal="false"
- v-dialog-drag
- >
- <span>
- <el-row>
- <el-col :span="4">
- <avue-tree
- :option="treeOption"
- @node-click="nodeClick"
- style="height:74vh"
- />
- </el-col>
- <el-col :span="20">
- <avue-crud
- ref="crud"
- :data="data"
- :option="tableOption"
- :page.sync="page"
- :search.sync="search"
- @search-change="searchChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="getList"
- @saveColumn="saveColumn"
- @selection-change="selectionChange"
- :cell-style="cellStyle"
- :table-loading="loading"
- >
- <template slot="cnameSearch">
- <goods-select
- v-model="search.cname"
- :configuration="goodsConfiguration"
- />
- </template>
- <template slot="corpCodeSearch">
- <crop-select
- v-model="search.corpId"
- gysType="CK"
- corpType="GYS"
- ></crop-select>
- </template>
- </avue-crud>
- </el-col>
- </el-row>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="visible = false">取 消</el-button>
- <el-button
- type="primary"
- @click="importData"
- :disabled="selectionList.length == 0"
- >导 入</el-button
- >
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import option from "./configuration/mainList.json";
- import {
- getPricebank,
- getGoodstype,
- getDeptLazyTree
- } from "@/api/basicData/customerInquiry";
- import { dateFormat } from "@/util/date";
- import _ from "lodash";
- export default {
- data() {
- return {
- treeForm: {},
- treeOption: {
- nodeKey: "id",
- lazy: true,
- treeLoad: function(node, resolve) {
- const parentId = node.level === 0 ? 0 : node.data.id;
- getDeptLazyTree(parentId).then(res => {
- resolve(
- res.data.data.map(item => {
- return {
- ...item,
- leaf: !item.hasChildren
- };
- })
- );
- });
- },
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- label: "title",
- value: "value",
- children: "children"
- }
- },
- visible: false,
- loading: true,
- data: [],
- search: {},
- tableOption: option,
- height: window.innerHeight - 500,
- page: {
- currentPage: 1,
- total: 0,
- pageSize: 10
- },
- selectionList: [],
- goodsConfiguration: {
- multipleChoices: false,
- multiple: false,
- collapseTags: false,
- placeholder: "请点击右边按钮选择",
- dicData: [],
- clearable: true
- },
- partType: false,
- partreData: false
- };
- },
- props: {},
- filters: {},
- created() {
- getGoodstype(1, 500).then(res => {
- this.findObject(this.tableOption.column, "goodsTypeName").dicData =
- res.data.data.records;
- // this.treeData = res.data.data.records;
- });
- if (localStorage.getItem("roleName").indexOf('贸易') == -1 && localStorage.getItem("roleName").indexOf('运营') == -1) {
- this.findObject(this.tableOption.column, "purchaseAmount").hide = false;
- this.findObject(this.tableOption.column, "purchaseAmount").showColumn = true;
- this.findObject(this.tableOption.column, "taxRate").hide = false;
- this.findObject(this.tableOption.column, "taxRate").showColumn = true;
- this.findObject(this.tableOption.column, "price").hide = false;
- this.findObject(this.tableOption.column, "price").showColumn = true;
- }else {
- this.findObject(this.tableOption.column, "purchaseAmount").hide = true;
- this.findObject(this.tableOption.column, "purchaseAmount").showColumn = false;
- this.findObject(this.tableOption.column, "taxRate").hide = true;
- this.findObject(this.tableOption.column, "taxRate").showColumn = false;
- this.findObject(this.tableOption.column, "price").hide = true;
- this.findObject(this.tableOption.column, "price").showColumn = false;
- }
- },
- methods: {
- init(status, partreData) {
- this.partType = status;
- this.partreData = partreData;
- this.visible = true;
- this.getList(this.page, this.search);
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- nodeClick(data) {
- console.log(data);
- this.search.goodTypeId = data.value;
- this.getList(this.page, this.search);
- },
- importData() {
- if (this.partreData) {
- if (this.selectionList.length != 1) {
- return this.$message.error("重新选择的时候只能选择一条数据");
- }
- }
- this.visible = false;
- if (this.partType) {
- this.$emit("librayToPart", this.selectionList, this.partreData);
- } else {
- this.$emit("importLibray", this.selectionList);
- }
- },
- currentChange(val) {
- this.page.currentPage = val;
- },
- sizeChange(val) {
- this.page.currentPage = 1;
- this.page.pageSize = val;
- },
- //点击搜索按钮触发
- searchChange(params, done) {
- this.search = this.deepClone(params);
- this.getList(this.page, params);
- done();
- },
- refreshChange() {
- this.getList(this.page, this.search);
- },
- getList(page, params) {
- let data = {
- ...params,
- billType: "CG",
- statusTime: dateFormat(new Date(), "yyyy-MM-dd")
- };
- let obj = Object.assign(data, this.search);
- this.loading = true;
- getPricebank(page.currentPage, page.pageSize, obj)
- .then(res => {
- this.data = res.data.data.records ? res.data.data.records : [];
- this.page.total = res.data.data.total;
- if (this.page.total > 0) {
- this.tableOption.height = window.innerHeight - 350;
- }
- })
- .finally(() => {
- this.loading = false;
- });
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- closed() {
- this.partreData = null;
- this.$refs.crud.toggleSelection();
- }
- }
- };
- </script>
- <style scoped lang="scss"></style>
|