123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- <template>
- <div class="app-container">
- <div class="filter-container">
- <span>
- <span>
- {{ $t("btOrder.orderMemberName") }}:
- </span>
- <span>
- <el-input
- class="filter-item search-item"
- v-model="queryParams.model.orderMemberName"
- />
- </span>
- <span>
- {{ $t("btOrder.id") }}:
- <el-input
- class="filter-item search-item"
- v-model="queryParams.model.id"
- />
- </span>
- <span>
- <el-date-picker
- v-model="queryParams.timeRange"
- type="datetimerange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </span>
- <span>
- {{ $t("btOrder.orderStatus") }}:
- <el-select v-model="queryParams.model.orderStatus">
- <el-option
- v-for="item in statusOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </span>
- </span>
- <!--操作按钮-->
- <span>
- <el-button @click="search" class="filter-item" plain type="primary">
- {{ $t("table.search") }}
- </el-button>
- <el-button @click="reset" class="filter-item" plain type="warning">
- {{ $t("table.reset") }}
- </el-button>
- </span>
- </div>
- <!-- 表格-->
- <el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick"
- @filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange"
- border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading" height="400">
- <el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/>
- <el-table-column :label="$t('btOrder.id')" :show-overflow-tooltip="true" align="center"
- prop="id"
- width="">
- <template slot-scope="scope">
- <span>{{ scope.row.id }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('btOrder.orderGoodsName')" :show-overflow-tooltip="true" align="center"
- prop="orderGoodsName"
- width="">
- <template slot-scope="scope">
- <span>{{ scope.row.orderGoodsName }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('btOrder.orderGoodsPic')" :show-overflow-tooltip="true" align="center"
- prop="orderGoodsPic"
- width="">
- <template slot-scope="scope">
- <img :src="scope.row.orderGoodsPic" min-width="70" height="70"/>
- </template>
- </el-table-column>
- <el-table-column :label="$t('btOrder.equ')" :show-overflow-tooltip="true" align="center"
- prop="orderGoodsId"
- width="">
- <template slot-scope="scope">
- <span>{{ scope.row.deviceName }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('btOrder.orderMemberName')" :show-overflow-tooltip="true" align="center"
- prop="orderMemberName"
- width="">
- <template slot-scope="scope">
- <span>{{ scope.row.orderMemberName }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('btOrder.orderUnitPrice')" :show-overflow-tooltip="true" align="center"
- prop="orderCompanyId"
- width="">
- <template slot-scope="scope">
- <span>{{ scope.row.orderUnitPrice }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('btOrder.orderGoodsAmount')" :show-overflow-tooltip="true" align="center"
- prop="orderSpecs"
- width="">
- <template slot-scope="scope">
- <span>{{ scope.row.orderGoodsAmount }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('btOrder.orderAmount')" :show-overflow-tooltip="true" align="center"
- prop="orderUnitPrice"
- width="">
- <template slot-scope="scope">
- <span>{{ scope.row.orderUnitPrice }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('btOrder.orderCreateTime')" :show-overflow-tooltip="true" align="center"
- prop="orderCreateTime"
- width="">
- <template slot-scope="scope">
- <span>{{ scope.row.createTime }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('btOrder.orderStatus')" :show-overflow-tooltip="true" align="center"
- prop="goodsCateStatus" width="80px">
- <template slot-scope="scope">
- {{ scope.row.orderStatus === '0' ? $t("btOrder.status.wzf") : '' }}
- {{ scope.row.orderStatus === '1' ? $t("btOrder.status.yzf") : '' }}
- {{ scope.row.orderStatus === '2' ? $t("btOrder.status.yqx") : '' }}
- {{ scope.row.orderStatus === '3' ? $t("btOrder.status.scwc") : '' }}
- {{ scope.row.orderStatus === '4' ? $t("btOrder.status.yc") : '' }}
- {{ scope.row.orderStatus === '5' ? $t("btOrder.status.zrtk") : '' }}
- {{ scope.row.orderStatus === '6' ? $t("btOrder.status.qbwc") : '' }}
- </template>
- </el-table-column>
- <el-table-column
- :label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width"
- width="100px">
- <template slot-scope="{ row }">
- <i @click="orderDetail(row)" class="el-icon-view table-operation" :title="$t('btOrder.detail')"
- style="color: #2db7f5;"/>
- </template>
- </el-table-column>
- </el-table>
- <pagination :limit.sync="queryParams.size" :page.sync="queryParams.current"
- :total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/>
- <order-detail
- :dialog-visible="detailDialog.isVisible"
- :type="detailDialog.type"
- @close="orderDetailClose"
- @success="editSuccess"
- ref="orderDetail"/>
- </div>
- </template>
- <script>
- import Pagination from "@/components/Pagination";
- import elDragDialog from '@/directive/el-drag-dialog'
- import OrderEdit from "./components/Edit";
- import orderDetail from "./orderDetail";
- import orderApi from "@/api/Order.js";
- import OrderImport from "@/components/zuihou/Import"
- import {convertEnum} from '@/utils/utils'
- import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons'
- export default {
- name: "OrderManage",
- directives: {elDragDialog},
- components: {Pagination, OrderEdit, OrderImport, orderDetail},
- filters: {},
- data() {
- return {
- statusFilter: [{text: '未支付', value: '0'}, {text: '已支付', value: '1'}, {text: '已取消', value: '2'}, {
- text: '生产完成',
- value: '3'
- }, {
- text: '异常', value: '4'
- }, {text: '转入退款', value: '5'}],
- // :filters="[{ text: $t('common.status.valid'), value: '1' },{ text: $t('common.status.invalid'), value: '0' }]"
- // 编辑
- dialog: {
- isVisible: false,
- type: "add"
- },
- detailDialog: {
- isVisible: false,
- type: "orderDetail"
- },
- statusOptions: [{
- value: '0',
- label: '未支付'
- }, {
- value: '1',
- label: '已支付'
- }, {
- value: '2',
- label: '已取消'
- }, {
- value: '3',
- label: '生产完成'
- }, {
- value: '4',
- label: '异常'
- }, {
- value: '5',
- label: '转入退款'
- }],
- // 预览
- preview: {
- isVisible: false,
- context: ''
- },
- // 导入
- fileImport: {
- isVisible: false,
- type: "import",
- action: `${process.env.VUE_APP_BASE_API}/order/order/import`
- },
- tableKey: 0,
- queryParams: initQueryParams(),
- selection: [],
- loading: false,
- tableData: {
- total: 0
- },
- // 枚举
- enums: {},
- // 字典
- dicts: {}
- };
- },
- computed: {},
- watch: {},
- mounted() {
- this.fetch();
- // 初始化字典和枚举
- const enumList = [];
- const dictList = [];
- loadEnums(enumList, this.enums, 'order');
- initDicts(dictList, this.dicts);
- },
- methods: {
- editClose() {
- this.dialog.isVisible = false;
- },
- orderDetailClose() {
- this.detailDialog.isVisible = false;
- },
- editSuccess() {
- this.search();
- },
- onSelectChange(selection) {
- this.selection = selection;
- },
- search() {
- this.fetch({
- ...this.queryParams
- });
- },
- reset() {
- this.queryParams = initQueryParams();
- this.$refs.table.clearSort();
- this.$refs.table.clearFilter();
- this.search();
- },
- exportExcelPreview() {
- if (this.queryParams.timeRange) {
- this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
- this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
- }
- this.queryParams.map.fileName = '导出数据';
- orderApi.preview(this.queryParams).then(response => {
- const res = response.data;
- this.preview.isVisible = true;
- this.preview.context = res.data;
- });
- },
- exportExcel() {
- if (this.queryParams.timeRange) {
- this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
- this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
- }
- this.queryParams.map.fileName = '导出数据';
- orderApi.export(this.queryParams).then(response => {
- downloadFile(response);
- });
- },
- importExcel() {
- this.fileImport.type = "upload";
- this.fileImport.isVisible = true;
- this.$refs.import.setModel(false);
- },
- importSuccess() {
- this.search();
- },
- importClose() {
- this.fileImport.isVisible = false;
- },
- singleDelete(row) {
- this.$refs.table.clearSelection()
- this.$refs.table.toggleRowSelection(row, true);
- this.batchDelete();
- },
- batchDelete() {
- if (!this.selection.length) {
- this.$message({
- message: this.$t("tips.noDataSelected"),
- type: "warning"
- });
- return;
- }
- this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), {
- confirmButtonText: this.$t("common.confirm"),
- cancelButtonText: this.$t("common.cancel"),
- type: "warning"
- })
- .then(() => {
- const ids = this.selection.map(u => u.id);
- this.delete(ids);
- })
- .catch(() => {
- this.clearSelections();
- });
- },
- clearSelections() {
- this.$refs.table.clearSelection();
- },
- delete(ids) {
- orderApi.delete({ids: ids}).then(response => {
- const res = response.data;
- if (res.isSuccess) {
- this.$message({
- message: this.$t("tips.deleteSuccess"),
- type: "success"
- });
- this.search();
- }
- });
- },
- add() {
- this.dialog.type = "add";
- this.dialog.isVisible = true;
- this.$refs.edit.setOrder({enums: this.enums, dicts: this.dicts});
- },
- orderDetail(row) {
- this.detailDialog.type = "orderDetail";
- this.detailDialog.isVisible = true;
- this.$refs.orderDetail.orderDetail(row['id']);
- },
- copy(row) {
- this.$refs.edit.setOrder({row, enums: this.enums, dicts: this.dicts});
- this.dialog.type = "copy";
- this.dialog.isVisible = true;
- },
- edit(row) {
- this.$refs.edit.setOrder({row, enums: this.enums, dicts: this.dicts});
- this.dialog.type = "edit";
- this.dialog.isVisible = true;
- },
- fetch(params = {}) {
- this.loading = true;
- if (this.queryParams.timeRange) {
- this.queryParams.map.createTime_st = this.queryParams.timeRange[0];
- this.queryParams.map.createTime_ed = this.queryParams.timeRange[1];
- }
- this.queryParams.current = params.current ? params.current : this.queryParams.current;
- this.queryParams.size = params.size ? params.size : this.queryParams.size;
- orderApi.page(this.queryParams).then(response => {
- const res = response.data;
- if (res.isSuccess) {
- this.tableData = res.data;
- }
- }).finally(() => this.loading = false);
- },
- sortChange(val) {
- this.queryParams.sort = val.prop;
- this.queryParams.order = val.order;
- if (this.queryParams.sort) {
- this.search();
- }
- },
- filterChange(filters) {
- for (const key in filters) {
- if (key.includes('.')) {
- const val = {};
- val[key.split('.')[1]] = filters[key][0];
- this.queryParams.model[key.split('.')[0]] = val;
- } else {
- this.queryParams.model[key] = filters[key][0]
- }
- }
- this.search()
- },
- cellClick(row, column) {
- if (column['columnKey'] === "operation") {
- return;
- }
- let flag = false;
- this.selection.forEach((item) => {
- if (item.id === row.id) {
- flag = true;
- this.$refs.table.toggleRowSelection(row);
- }
- })
- if (!flag) {
- this.$refs.table.toggleRowSelection(row, true);
- }
- },
- }
- };
- </script>
- <style lang="scss" scoped></style>
|