123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466 |
- <template>
- <div>
- <basic-container v-show="show" class="page-crad">
- <avue-crud
- ref="crud"
- :option="option"
- :data="dataList"
- v-model="form"
- :page.sync="page"
- :search.sync="search"
- :key="key"
- @search-change="searchChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- :table-loading="loading"
- @saveColumn="saveColumn"
- @resetColumn="resetColumn"
- :summary-method="summaryMethod"
- :cell-style="cellStyle"
- @selection-change="selectionChange"
- @expand-change="expandChange"
- @search-criteria-switch="searchCriteriaSwitch"
- >
- <template slot-scope="{ row }" slot="expand">
- <avue-crud
- :data="row.itemData"
- :option="itemOption"
- :table-loading="row.itemLoading"
- :cell-style="cellStyle"
- class="itemTable"
- ></avue-crud>
- </template>
- <template slot-scope="{ row }" slot="salesCompany">
- <span>{{ row.salesCompanyName }}</span>
- </template>
- <template slot-scope="{ row }" slot="totalQuantity">
- <span>{{ row.totalQuantity | IntegerFormat }}</span>
- </template>
- <template slot-scope="{ row }" slot="storageId">
- <span>{{ row.storageName }}</span>
- </template>
- <template slot-scope="{ row }" slot="createUser">
- <span>{{ row.createUserName }}</span>
- </template>
- <template slot-scope="scope" slot="corpId">
- <span
- style="color: #409EFF;cursor: pointer"
- @click.stop="editOpen(scope.row, 1)"
- >{{ scope.row.corpsName }}
- </span>
- </template>
- <template slot-scope="scope" slot="orgOrderNo">
- <span
- style="color: #409EFF;cursor: pointer"
- @click.stop="editOpen(scope.row, 1)"
- >{{ scope.row.orgOrderNo }}
- </span>
- </template>
- <template slot="createTimeSearch">
- <el-date-picker
- v-model="search.createTime"
- type="daterange"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd HH:mm:ss"
- :default-time="['00:00:00', '23:59:59']"
- >
- </el-date-picker>
- </template>
- <template slot="portOfLoadSearch">
- <port-info v-model="search.portOfLoad" />
- </template>
- <template slot-scope="{ row }" slot="deliveryStatus">
- <span v-for="item in $refs.crud.DIC.deliveryStatus" :style="{color: item.colour}" v-if="item.dictValue == row.deliveryStatus">{{row.deliveryStatus}}</span>
- </template>
- <template slot="portOfDestinationSearch">
- <port-info v-model="search.portOfDestination" />
- </template>
- <template slot="menuLeft">
- <!-- <el-button-->
- <!-- type="primary"-->
- <!-- icon="el-icon-plus"-->
- <!-- size="small"-->
- <!-- @click.stop="newAdd()"-->
- <!-- >创建单据-->
- <!-- </el-button>-->
- <!-- <el-button-->
- <!-- type="success"-->
- <!-- size="small"-->
- <!-- @click.stop="copyDoc()"-->
- <!-- :disabled="selectionList.length != 1"-->
- <!-- >复制单据</el-button-->
- <!-- >-->
- <el-button type="info" size="small">报表打印</el-button>
- </template>
- <template slot="corpIdSearch">
- <crop-select v-model="search.corpId" corpType="KH"></crop-select>
- </template>
- <template slot-scope="scope" slot="menu">
- <!-- <el-button-->
- <!-- type="text"-->
- <!-- icon="el-icon-delete"-->
- <!-- size="small"-->
- <!-- @click.stop="rowDel(scope.row, scope.index)"-->
- <!-- >删除-->
- <!-- </el-button>-->
- <el-button type="text" icon="el-icon-view" size="small" @click.stop="editOpen(scope.row, 1)">查看</el-button>
- </template>
- </avue-crud>
- </basic-container>
- <detail-page
- @goBack="goBack"
- @copyOrder="copyOrder"
- :detailData="detailData"
- v-if="!show"
- ></detail-page>
- </div>
- </template>
- <script>
- import option from "./config/mainList.json";
- import { getList, remove, gainUser,getGoodsInfo} from "@/api/basicData/invoice";
- import detailPage from "./detailsPage.vue";
- import { micrometerFormat, IntegerFormat } from "@/util/validate";
- import { defaultDate } from "@/util/date";
- import _ from "lodash";
- export default {
- name: "customerInformation",
- data() {
- return {
- configuration2: {
- multipleChoices: false,
- multiple: false,
- collapseTags: false,
- placeholder: "请点击右边按钮选择",
- dicData: []
- },
- key:0,
- search: {
- businessDate: defaultDate()
- },
- itemOption: {
- align: "center",
- header: false,
- border: true,
- menu: false,
- column: [
- {
- label: "产品类别",
- prop: "priceCategory",
- width: 140,
- overHidden: true
- },
- {
- label: "产品名称",
- prop: "cname",
- width: 240,
- overHidden: true
- },
- {
- label: "产品描述",
- prop: "itemDescription",
- width: 240,
- overHidden: true
- },
- {
- label: "配件描述",
- prop: "partsDescribe",
- width: 240,
- overHidden: true
- },
- {
- label: "配件价格描述",
- prop: "partsPriceDescribe",
- width: 240,
- overHidden: true
- },
- {
- label: "数量",
- prop: "orderQuantity",
- width: 100,
- overHidden: true
- },
- {
- label: "单价",
- prop: "price",
- width: 100,
- overHidden: true
- },
- {
- label: "金额",
- prop: "amount",
- width: 100,
- overHidden: true
- }
- ]
- },
- form: {},
- option: {},
- parentId: 0,
- dataList: [],
- page: {
- pageSize: 20,
- currentPage: 1,
- total: 0,
- pageSizes: [10,20,30,40,50, 100, 200, 300, 400, 500]
- },
- show: true,
- detailData: {},
- loading: false,
- selectionList: []
- };
- },
- components: { detailPage },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(8), option);
- if (this.$route.query.pageType == "Generate") {
- this.newAdd();
- }
- gainUser().then(res => {
- this.findObject(this.option.column, "createUser").dicData = res.data.data;
- });
- this.option.height = window.innerHeight - 210;
- this.key++
- },
- activated() {
- //当页面已打开并无法重新渲染时,用activated重新激活keepalive组件
- // if (!this.$store.getters.outStatus && !this.show) {
- // this.show = true;
- // }
- setTimeout(() => {
- if (this.$route.query.pageType == "Generate" && this.show) {
- this.newAdd();
- }
- }, 100);
- },
- filters: {
- IntegerFormat(num) {
- return IntegerFormat(num);
- }
- },
- methods: {
- searchCriteriaSwitch(type) {
- if (type) {
- this.option.height = this.option.height - 191;
- } else {
- this.option.height = this.option.height + 191;
- }
- this.$refs.crud.getTableHeight();
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- //删除列表后面的删除按钮触发触发(row, index, done)
- rowDel(row, index, done) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- remove(row.id).then(res => {
- if (res.data.code == 200) {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.onLoad(this.page, this.search);
- }
- });
- });
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- editOpen(row, status) {
- this.detailData = {
- id: row.id,
- status: status
- };
- this.show = false;
- // this.$store.commit("OUT_IN__DETAIL");
- },
- copyDoc() {
- this.selectionList.forEach(e => {
- this.detailData = {
- id: e.id,
- status: "copy"
- };
- this.show = false;
- });
- },
- copyOrder(id) {
- this.show = true;
- this.detailData = {
- id: id,
- status: "copy"
- };
- this.$nextTick(() => {
- this.show = false;
- });
- },
- //点击搜索按钮触发
- searchChange(params, done) {
- if (params.businessDate) {
- params.businessStartDate = params.businessDate[0];
- params.businessEndDate = params.businessDate[1];
- }
- if (params.createTime) {
- params.createStartTime = params.createTime[0];
- params.createEndTime = params.createTime[1];
- }
- delete params.businessDate;
- delete params.createTime;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- currentChange(val) {
- this.page.currentPage = val;
- },
- sizeChange(val) {
- this.page.currentPage = 1;
- this.page.pageSize = val;
- },
- onLoad(page, params) {
- if (this.search.businessDate && this.search.businessDate.length > 0) {
- params = {
- ...params,
- orderStartDate: this.search.businessDate[0],
- orderEndDate: this.search.businessDate[1]
- };
- delete params.businessDate;
- }
- this.loading = true;
- this.dataList.forEach(item => {
- this.$refs.crud.toggleRowExpansion(item, false);
- });
- getList(page.currentPage, page.pageSize, params)
- .then(res => {
- if (res.data.data.records) {
- res.data.data.records.forEach(e => {
- e.itemLoading = true;
- });
- }
- this.dataList = res.data.data.records ? res.data.data.records : [];
- this.page.total = res.data.data.total;
- })
- .finally(() => {
- this.loading = false;
- });
- },
- refreshChange() {
- this.onLoad(this.page, this.search);
- },
- newAdd() {
- this.show = false;
- this.$store.commit("OUT_IN__DETAIL");
- },
- goBack() {
- if (this.$route.query.pageType == "Generate") {
- this.$router.$avueRouter.closeTag();
- this.$router.push({
- path: "/exportTrade/invoice/index"
- });
- }
- this.detailData = this.$options.data().detailData;
- this.show = true;
- this.$store.commit("OUT_OUT_DETAIL");
- this.onLoad(this.page, this.search);
- },
- summaryMethod({ columns, data }) {
- const sums = [];
- if (columns.length > 0) {
- columns.forEach((item, index) => {
- sums[0] = "合计";
- if (
- item.property == "totalQuantity" ||
- item.property == "deliveryAmount" ||
- item.property == "totalCost"
- ) {
- let qtySum = 0;
- let instoreSum = 0;
- let totalSum = 0;
- data.forEach(e => {
- qtySum = _.add(qtySum, Number(e.totalQuantity));
- instoreSum = _.add(instoreSum, Number(e.deliveryAmount));
- totalSum = _.add(totalSum, Number(e.totalCost));
- });
- //数量总计
- if (item.property == "totalQuantity") {
- sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
- }
- //入库金额总计
- if (item.property == "deliveryAmount") {
- sums[index] = micrometerFormat(instoreSum);
- }
- //金额总计
- if (item.property == "totalCost") {
- sums[index] = micrometerFormat(totalSum);
- }
- }
- });
- }
- return sums;
- },
- expandChange(row) {
- if (!row.itemData) {
- getGoodsInfo({ id: row.id, tradeType: "CK" })
- .then(res => {
- this.dataList[row.$index].itemData = res.data.data;
- })
- .finally(() => {
- this.dataList[row.$index].itemLoading = false;
- });
- }
- },
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(8),
- this.option
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout()
- })
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- this.option = option;
- const inSave = await this.delColumnData(this.getColumnName(8), option);
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout()
- })
- this.$message.success("重置成功");
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- }
- },
- watch: {
- option: function() {
- this.search.businessDate = defaultDate();
- }
- }
- };
- </script>
- <style scoped>
- ::v-deep .select-component {
- display: flex;
- }
- .page-crad ::v-deep .basic-container__card {
- height: 94.2vh;
- }
- .itemTable ::v-deep .el-table {
- margin-left: 50px;
- width: 100%;
- }
- </style>
|