|
@@ -1,447 +1,448 @@
|
|
|
-<template>
|
|
|
- <div class="app-container">
|
|
|
- <el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type"
|
|
|
- :visible.sync="isVisible" width="75%" top="50px" v-el-drag-dialog>
|
|
|
- <!-- 添加修改删除-->
|
|
|
- <el-row class="filter-container">
|
|
|
- <el-col>
|
|
|
- <span>
|
|
|
- <el-button @click="add" class="filter-item" plain type="primary">
|
|
|
- 添加
|
|
|
- </el-button>
|
|
|
-
|
|
|
- <el-button @click="onSale" class="filter-item" plain type="primary">
|
|
|
- 上架
|
|
|
- </el-button>
|
|
|
-
|
|
|
- <el-button @click="outSale" class="filter-item" plain type="primary">
|
|
|
- 下架
|
|
|
- </el-button>
|
|
|
-
|
|
|
- <el-button @click="batchDelete" class="filter-item" plain type="primary">
|
|
|
- 删除
|
|
|
- </el-button>
|
|
|
- </span>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
-
|
|
|
- <el-table
|
|
|
- :data="tableData"
|
|
|
- :key="tableKey"
|
|
|
- @selection-change="onSelectChange"
|
|
|
- @cell-click="cellClick"
|
|
|
- border fit row-key="id"
|
|
|
- ref="table"
|
|
|
- style="width: 100%;"
|
|
|
- v-loading="loading">
|
|
|
- <el-table-column :label="$t('bt.table.cateNo')" :show-overflow-tooltip="true" align="center" prop="key"
|
|
|
- width="50">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div>
|
|
|
- {{ scope.$index + (queryParams.current - 1) * queryParams.size + 1 }}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" type="selection" width="50px" :reserve-selection="true"/>
|
|
|
- <el-table-column :label="$t('bt.table.goodsName')" :show-overflow-tooltip="true" align="center"
|
|
|
- prop="goodsName" width="">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.goodsName }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('bt.table.goodsPic')" :show-overflow-tooltip="true" align="center"
|
|
|
- prop="goodsPic" width="">
|
|
|
- <template slot-scope="scope">
|
|
|
- <img :src="scope.row.goodsPic" min-width="70" height="70"/>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('bt.table.goodsCode')" :show-overflow-tooltip="true" align="center"
|
|
|
- prop="goodsCode" width="">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.goodsCode }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('bt.table.goodsUnit')" :show-overflow-tooltip="true" align="center"
|
|
|
- prop="goodsUnit" width="">
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ scope.row.goodsUnit === '1' ? $t('bt.unit.bei') : '' }}
|
|
|
- {{ scope.row.goodsUnit === '2' ? $t('bt.unit.jian') : '' }}
|
|
|
- {{ scope.row.goodsUnit === '3' ? $t('bt.unit.ge') : '' }}
|
|
|
- {{ scope.row.goodsUnit === '4' ? $t('bt.unit.bao') : '' }}
|
|
|
- {{ scope.row.goodsUnit === '5' ? $t('bt.unit.fen') : '' }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('bt.table.goodsCateId')" :show-overflow-tooltip="true" align="center"
|
|
|
- prop="goodsCateName" width="">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.goodsCateName }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :label="$t('bt.table.goodsTag')" :show-overflow-tooltip="true" align="center"
|
|
|
- prop="goodsTag" width="">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.goodsTag }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column :label="$t('bt.table.goodsSpec')" :show-overflow-tooltip="true" align="center"
|
|
|
- prop="speList" width="">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-for="item in scope.row.speList" :key="item.id">{{ item.specName }}  , </span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column :label="$t('bt.table.goodsStatus')" :show-overflow-tooltip="true" align="center"
|
|
|
- prop="udStatus" width="">
|
|
|
-
|
|
|
- <template slot-scope="scope">
|
|
|
- {{ scope.row.udStatus === '1' ? $t("productionResource.goods.onSale") : '' }}
|
|
|
- {{ scope.row.udStatus === '0' ? $t("productionResource.goods.underSale") : '' }}
|
|
|
- </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"/>-->
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <add-equ-goods
|
|
|
- :dialog-visible="addGoodsDialog.isVisible"
|
|
|
- :type="addGoodsDialog.type"
|
|
|
- @close="addGoodsClose"
|
|
|
- @success="addGoodsSuccess"
|
|
|
- ref="addEquGoods"/>
|
|
|
-
|
|
|
-
|
|
|
- <!-- <el-dialog-->
|
|
|
- <!-- :close-on-click-modal="false"-->
|
|
|
- <!-- :close-on-press-escape="true"-->
|
|
|
- <!-- title="预览"-->
|
|
|
- <!-- width="80%"-->
|
|
|
- <!-- top="50px"-->
|
|
|
- <!-- :visible.sync="preview.isVisible"-->
|
|
|
- <!-- v-el-drag-dialog>-->
|
|
|
- <!-- <el-scrollbar>-->
|
|
|
- <!-- <div v-html="preview.context"></div>-->
|
|
|
- <!-- </el-scrollbar>-->
|
|
|
- <!-- </el-dialog>-->
|
|
|
- </div>
|
|
|
-
|
|
|
-
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import Pagination from "@/components/Pagination";
|
|
|
-import ParameterEdit from "../../goods/goodsManage/Index";
|
|
|
-import parameterApi from "@/api/Parameter.js";
|
|
|
-import ResourceBusinessApi from "@/api/ResourceBusiness.js";
|
|
|
-import ProductionresourceApi from "@/api/resourceProductMgr/productionResourcesMgr";
|
|
|
-import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
-import {downloadFile, initDicts, initEnums, initQueryParams} from '@/utils/commons'
|
|
|
-import qs from 'qs'
|
|
|
-import addEquGoods from "@/views/zuihou/productionresource/components/addEquGoods";
|
|
|
-
|
|
|
-export default {
|
|
|
- name: "productMgr",
|
|
|
- directives: {elDragDialog},
|
|
|
- components: {Pagination, ParameterEdit, addEquGoods},
|
|
|
- props: {
|
|
|
- dialogVisible: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
- },
|
|
|
- type: {
|
|
|
- type: String,
|
|
|
- default: "add"
|
|
|
- },
|
|
|
- },
|
|
|
- filters: {},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- statusOptions: [{
|
|
|
- value: '0',
|
|
|
- label: '冻结'
|
|
|
- }, {
|
|
|
- value: '1',
|
|
|
- label: '启用'
|
|
|
- }],
|
|
|
- dialog: {
|
|
|
- isVisible: false,
|
|
|
- type: "addEquGoods"
|
|
|
- },
|
|
|
-
|
|
|
- addGoodsDialog: {
|
|
|
- isVisible: false,
|
|
|
- type: "addEquGoods"
|
|
|
- },
|
|
|
-
|
|
|
- preview: {
|
|
|
- isVisible: false,
|
|
|
- context: ''
|
|
|
- },
|
|
|
- fileImport: {
|
|
|
- isVisible: false,
|
|
|
- type: "import",
|
|
|
- action: `${process.env.VUE_APP_BASE_API}/authority/parameter/import`
|
|
|
- },
|
|
|
- tableKey: 0,
|
|
|
- queryParams: initQueryParams({
|
|
|
- model: {}
|
|
|
- }),
|
|
|
- selection: [],
|
|
|
- loading: false,
|
|
|
- tableData: [],
|
|
|
- goodsIds: [],
|
|
|
- equId: '',
|
|
|
- uploadIds: []
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {
|
|
|
- isVisible: {
|
|
|
- get() {
|
|
|
- return this.dialogVisible;
|
|
|
- },
|
|
|
- set() {
|
|
|
- this.close();
|
|
|
- this.reset();
|
|
|
- }
|
|
|
- },
|
|
|
- title() {
|
|
|
- return '设备销售产品管理';
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {},
|
|
|
- mounted() {
|
|
|
- },
|
|
|
- methods: {
|
|
|
- initWidth() {
|
|
|
- this.screenWidth = document.body.clientWidth;
|
|
|
- if (this.screenWidth < 991) {
|
|
|
- return "90%";
|
|
|
- } else if (this.screenWidth < 1400) {
|
|
|
- return "45%";
|
|
|
- } else {
|
|
|
- return "800px";
|
|
|
- }
|
|
|
- },
|
|
|
- editClose() {
|
|
|
- this.dialog.isVisible = false;
|
|
|
- },
|
|
|
- addGoodsClose() {
|
|
|
- this.addGoodsDialog.isVisible = false;
|
|
|
- },
|
|
|
- addGoodsSuccess() {
|
|
|
- this.getEquGoods(this.equId)
|
|
|
- },
|
|
|
- onSelectChange(selection) {
|
|
|
- this.selection = selection;
|
|
|
- },
|
|
|
- search() {
|
|
|
- this.getEquGoods(this.equId);
|
|
|
- },
|
|
|
- add() {
|
|
|
- console.log("准备添加商品了")
|
|
|
- this.addGoodsDialog.type = "addEquGoods";
|
|
|
- this.addGoodsDialog.isVisible = true;
|
|
|
- this.$refs.addEquGoods.getAllGoods({
|
|
|
- 'equId': this.equId,
|
|
|
- enums: this.enums,
|
|
|
- dicts: this.dicts,
|
|
|
- goodsIds: this.goodsIds
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- close() {
|
|
|
- this.$emit("close");
|
|
|
- },
|
|
|
- reset() {
|
|
|
- this.queryParams = initQueryParams({});
|
|
|
- this.$refs.table.clearSort();
|
|
|
- this.$refs.table.clearFilter();
|
|
|
- this.equId = "";
|
|
|
- this.goodsIds = [];
|
|
|
- this.uploadIds = [];
|
|
|
- this.$refs.table.clearSelection();
|
|
|
- this.search();
|
|
|
- },
|
|
|
-
|
|
|
- equGoodsMgr(equId) {
|
|
|
- this.equId = equId;
|
|
|
- console.log("变没变" + this.equId)
|
|
|
- this.getEquGoods(equId);
|
|
|
- },
|
|
|
- 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();
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- onSale() {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.noDataSelected"),
|
|
|
- type: "warning"
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$confirm(this.$t("bt.common.onSale"), this.$t("common.tips"), {
|
|
|
- confirmButtonText: this.$t("common.confirm"),
|
|
|
- cancelButtonText: this.$t("common.cancel"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.selection.map(u => {
|
|
|
- this.uploadIds.push({"id": u.id, "udStatus": "1"})
|
|
|
- })
|
|
|
- this.uploadStatus(this.uploadIds)
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.clearSelections();
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- outSale() {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.noDataSelected"),
|
|
|
- type: "warning"
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$confirm(this.$t("bt.common.outSale"), this.$t("common.tips"), {
|
|
|
- confirmButtonText: this.$t("common.confirm"),
|
|
|
- cancelButtonText: this.$t("common.cancel"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.selection.map(u => {
|
|
|
- this.uploadIds.push({"id": u.id, "udStatus": "0"})
|
|
|
-
|
|
|
- })
|
|
|
- this.uploadStatus(this.uploadIds)
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.clearSelections();
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- clearSelections() {
|
|
|
- this.$refs.table.clearSelection();
|
|
|
- },
|
|
|
- delete(ids) {
|
|
|
- ProductionresourceApi.deleteEquGoods(ids).then(response => {
|
|
|
- const res = response.data;
|
|
|
- if (res.isSuccess) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.deleteSuccess"),
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- }
|
|
|
- this.getEquGoods(this.equId);
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- uploadStatus(data) {
|
|
|
- ProductionresourceApi.updateGoodsStu(data).then(response => {
|
|
|
- const res = response.data;
|
|
|
- if (res.isSuccess) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.updateSuccess"),
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- }
|
|
|
- this.getEquGoods(this.equId);
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- editOne() {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.unSelected"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- if (this.selection.length > 1) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.mustOne"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- this.edit(this.selection[0]);
|
|
|
- },
|
|
|
- choose() {
|
|
|
- this.dialog.type = "choose";
|
|
|
- this.dialog.isVisible = true;
|
|
|
- },
|
|
|
- edit(row) {
|
|
|
- this.$refs.edit.setProductionresource(row)
|
|
|
- this.dialog.type = "edit";
|
|
|
- this.dialog.isVisible = true;
|
|
|
- },
|
|
|
-
|
|
|
- getEquGoods(equId) {
|
|
|
- this.loading = true;
|
|
|
- ResourceBusinessApi.getEquGoods({'equId': equId}).then(response => {
|
|
|
- let res = response.data
|
|
|
- if (res.isSuccess) {
|
|
|
- this.tableData = res.data;
|
|
|
- this.goodsIds = [];
|
|
|
- this.tableData.forEach(item => {
|
|
|
- this.goodsIds.push(item.goodsId)
|
|
|
- })
|
|
|
- }
|
|
|
- }).finally(() => this.loading = false);
|
|
|
- },
|
|
|
-
|
|
|
- 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>
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type"
|
|
|
+ :visible.sync="isVisible" width="75%" top="50px" v-el-drag-dialog>
|
|
|
+ <!-- 添加修改删除-->
|
|
|
+ <el-row class="filter-container">
|
|
|
+ <el-col>
|
|
|
+ <span>
|
|
|
+ <el-button @click="add" class="filter-item" plain type="primary">
|
|
|
+ 添加
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-button @click="onSale" class="filter-item" plain type="primary">
|
|
|
+ 上架
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-button @click="outSale" class="filter-item" plain type="primary">
|
|
|
+ 下架
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-button @click="batchDelete" class="filter-item" plain type="primary">
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </span>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ :data="tableData"
|
|
|
+ :key="tableKey"
|
|
|
+ @selection-change="onSelectChange"
|
|
|
+ @cell-click="cellClick"
|
|
|
+ border fit row-key="id"
|
|
|
+ ref="table"
|
|
|
+ style="width: 100%;"
|
|
|
+ v-loading="loading">
|
|
|
+ <el-table-column :label="$t('bt.table.cateNo')" :show-overflow-tooltip="true" align="center" prop="key"
|
|
|
+ width="50">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ {{ scope.$index + (queryParams.current - 1) * queryParams.size + 1 }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" type="selection" width="50px" :reserve-selection="true"/>
|
|
|
+ <el-table-column :label="$t('bt.table.goodsName')" :show-overflow-tooltip="true" align="center"
|
|
|
+ prop="goodsName" width="">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.goodsName }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('bt.table.goodsPic')" :show-overflow-tooltip="true" align="center"
|
|
|
+ prop="goodsPic" width="">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <img :src="scope.row.goodsPic" min-width="70" height="70"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('bt.table.goodsCode')" :show-overflow-tooltip="true" align="center"
|
|
|
+ prop="goodsCode" width="">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.goodsCode }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('bt.table.goodsUnit')" :show-overflow-tooltip="true" align="center"
|
|
|
+ prop="goodsUnit" width="">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.goodsUnit === '1' ? $t('bt.unit.bei') : '' }}
|
|
|
+ {{ scope.row.goodsUnit === '2' ? $t('bt.unit.jian') : '' }}
|
|
|
+ {{ scope.row.goodsUnit === '3' ? $t('bt.unit.ge') : '' }}
|
|
|
+ {{ scope.row.goodsUnit === '4' ? $t('bt.unit.bao') : '' }}
|
|
|
+ {{ scope.row.goodsUnit === '5' ? $t('bt.unit.fen') : '' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('bt.table.goodsCateId')" :show-overflow-tooltip="true" align="center"
|
|
|
+ prop="goodsCateName" width="">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.goodsCateName }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('bt.table.goodsTag')" :show-overflow-tooltip="true" align="center"
|
|
|
+ prop="goodsTag" width="">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.goodsTag }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column :label="$t('bt.table.goodsSpec')" :show-overflow-tooltip="true" align="center"
|
|
|
+ prop="speList" width="">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-for="item in scope.row.speList" :key="item.id">{{ item.specName }}  , </span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column :label="$t('bt.table.goodsStatus')" :show-overflow-tooltip="true" align="center"
|
|
|
+ prop="udStatus" width="">
|
|
|
+
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.udStatus === '1' ? $t("productionResource.goods.onSale") : '' }}
|
|
|
+ {{ scope.row.udStatus === '0' ? $t("productionResource.goods.underSale") : '' }}
|
|
|
+ </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"/>-->
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <add-equ-goods
|
|
|
+ :dialog-visible="addGoodsDialog.isVisible"
|
|
|
+ :type="addGoodsDialog.type"
|
|
|
+ @close="addGoodsClose"
|
|
|
+ @success="addGoodsSuccess"
|
|
|
+ ref="addEquGoods"/>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- <el-dialog-->
|
|
|
+ <!-- :close-on-click-modal="false"-->
|
|
|
+ <!-- :close-on-press-escape="true"-->
|
|
|
+ <!-- title="预览"-->
|
|
|
+ <!-- width="80%"-->
|
|
|
+ <!-- top="50px"-->
|
|
|
+ <!-- :visible.sync="preview.isVisible"-->
|
|
|
+ <!-- v-el-drag-dialog>-->
|
|
|
+ <!-- <el-scrollbar>-->
|
|
|
+ <!-- <div v-html="preview.context"></div>-->
|
|
|
+ <!-- </el-scrollbar>-->
|
|
|
+ <!-- </el-dialog>-->
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import Pagination from "@/components/Pagination";
|
|
|
+import ParameterEdit from "../../goods/goodsManage/Index";
|
|
|
+import parameterApi from "@/api/Parameter.js";
|
|
|
+import ResourceBusinessApi from "@/api/ResourceBusiness.js";
|
|
|
+import ProductionresourceApi from "@/api/resourceProductMgr/productionResourcesMgr";
|
|
|
+import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
+import {downloadFile, initDicts, initEnums, initQueryParams} from '@/utils/commons'
|
|
|
+import qs from 'qs'
|
|
|
+import addEquGoods from "@/views/zuihou/productionresource/components/addEquGoods";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "productMgr",
|
|
|
+ directives: {elDragDialog},
|
|
|
+ components: {Pagination, ParameterEdit, addEquGoods},
|
|
|
+ props: {
|
|
|
+ dialogVisible: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ type: {
|
|
|
+ type: String,
|
|
|
+ default: "add"
|
|
|
+ },
|
|
|
+ },
|
|
|
+ filters: {},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ statusOptions: [{
|
|
|
+ value: '0',
|
|
|
+ label: '冻结'
|
|
|
+ }, {
|
|
|
+ value: '1',
|
|
|
+ label: '启用'
|
|
|
+ }],
|
|
|
+ dialog: {
|
|
|
+ isVisible: false,
|
|
|
+ type: "addEquGoods"
|
|
|
+ },
|
|
|
+
|
|
|
+ addGoodsDialog: {
|
|
|
+ isVisible: false,
|
|
|
+ type: "addEquGoods"
|
|
|
+ },
|
|
|
+
|
|
|
+ preview: {
|
|
|
+ isVisible: false,
|
|
|
+ context: ''
|
|
|
+ },
|
|
|
+ fileImport: {
|
|
|
+ isVisible: false,
|
|
|
+ type: "import",
|
|
|
+ action: `${process.env.VUE_APP_BASE_API}/authority/parameter/import`
|
|
|
+ },
|
|
|
+ tableKey: 0,
|
|
|
+ queryParams: initQueryParams({
|
|
|
+ model: {}
|
|
|
+ }),
|
|
|
+ selection: [],
|
|
|
+ loading: false,
|
|
|
+ tableData: [],
|
|
|
+ goodsIds: [],
|
|
|
+ equId: '',
|
|
|
+ uploadIds: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ isVisible: {
|
|
|
+ get() {
|
|
|
+ return this.dialogVisible;
|
|
|
+ },
|
|
|
+ set() {
|
|
|
+ this.close();
|
|
|
+ this.reset();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ title() {
|
|
|
+ return '设备销售产品管理';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
+ mounted() {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ initWidth() {
|
|
|
+ this.screenWidth = document.body.clientWidth;
|
|
|
+ if (this.screenWidth < 991) {
|
|
|
+ return "90%";
|
|
|
+ } else if (this.screenWidth < 1400) {
|
|
|
+ return "45%";
|
|
|
+ } else {
|
|
|
+ return "800px";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ editClose() {
|
|
|
+ this.dialog.isVisible = false;
|
|
|
+ },
|
|
|
+ addGoodsClose() {
|
|
|
+ this.addGoodsDialog.isVisible = false;
|
|
|
+ },
|
|
|
+ addGoodsSuccess() {
|
|
|
+ this.getEquGoods(this.equId)
|
|
|
+ },
|
|
|
+ onSelectChange(selection) {
|
|
|
+ this.selection = selection;
|
|
|
+ },
|
|
|
+ search() {
|
|
|
+ this.getEquGoods(this.equId);
|
|
|
+ },
|
|
|
+ add() {
|
|
|
+ console.log("准备添加商品了")
|
|
|
+ this.addGoodsDialog.type = "addEquGoods";
|
|
|
+ this.addGoodsDialog.isVisible = true;
|
|
|
+ // this.$refs.addEquGoods.getAllGoods({
|
|
|
+ this.$refs.addEquGoods.setInitData({
|
|
|
+ equId: this.equId,
|
|
|
+ enums: this.enums,
|
|
|
+ dicts: this.dicts,
|
|
|
+ goodsIds: this.goodsIds
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ close() {
|
|
|
+ this.$emit("close");
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ this.queryParams = initQueryParams({});
|
|
|
+ this.$refs.table.clearSort();
|
|
|
+ this.$refs.table.clearFilter();
|
|
|
+ this.equId = "";
|
|
|
+ this.goodsIds = [];
|
|
|
+ this.uploadIds = [];
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+
|
|
|
+ equGoodsMgr(equId) {
|
|
|
+ this.equId = equId;
|
|
|
+ console.log("变没变" + this.equId)
|
|
|
+ this.getEquGoods(equId);
|
|
|
+ },
|
|
|
+ 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();
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ onSale() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.noDataSelected"),
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$confirm(this.$t("bt.common.onSale"), this.$t("common.tips"), {
|
|
|
+ confirmButtonText: this.$t("common.confirm"),
|
|
|
+ cancelButtonText: this.$t("common.cancel"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.selection.map(u => {
|
|
|
+ this.uploadIds.push({"id": u.id, "udStatus": "1"})
|
|
|
+ })
|
|
|
+ this.uploadStatus(this.uploadIds)
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.clearSelections();
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ outSale() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.noDataSelected"),
|
|
|
+ type: "warning"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$confirm(this.$t("bt.common.outSale"), this.$t("common.tips"), {
|
|
|
+ confirmButtonText: this.$t("common.confirm"),
|
|
|
+ cancelButtonText: this.$t("common.cancel"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.selection.map(u => {
|
|
|
+ this.uploadIds.push({"id": u.id, "udStatus": "0"})
|
|
|
+
|
|
|
+ })
|
|
|
+ this.uploadStatus(this.uploadIds)
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.clearSelections();
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ clearSelections() {
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
+ },
|
|
|
+ delete(ids) {
|
|
|
+ ProductionresourceApi.deleteEquGoods(ids).then(response => {
|
|
|
+ const res = response.data;
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.deleteSuccess"),
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.getEquGoods(this.equId);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ uploadStatus(data) {
|
|
|
+ ProductionresourceApi.updateGoodsStu(data).then(response => {
|
|
|
+ const res = response.data;
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.updateSuccess"),
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.getEquGoods(this.equId);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ editOne() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.unSelected"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.selection.length > 1) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.mustOne"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.edit(this.selection[0]);
|
|
|
+ },
|
|
|
+ choose() {
|
|
|
+ this.dialog.type = "choose";
|
|
|
+ this.dialog.isVisible = true;
|
|
|
+ },
|
|
|
+ edit(row) {
|
|
|
+ this.$refs.edit.setProductionresource(row)
|
|
|
+ this.dialog.type = "edit";
|
|
|
+ this.dialog.isVisible = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ getEquGoods(equId) {
|
|
|
+ this.loading = true;
|
|
|
+ ResourceBusinessApi.getEquGoods({'equId': equId}).then(response => {
|
|
|
+ let res = response.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.tableData = res.data;
|
|
|
+ this.goodsIds = [];
|
|
|
+ this.tableData.forEach(item => {
|
|
|
+ this.goodsIds.push(item.goodsId)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).finally(() => this.loading = false);
|
|
|
+ },
|
|
|
+
|
|
|
+ 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>
|