|
@@ -3,44 +3,57 @@
|
|
|
<el-row v-if="isShow">
|
|
|
<el-col :span="5">
|
|
|
<basic-container>
|
|
|
- <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
|
|
|
+ <avue-tree
|
|
|
+ :option="treeOption"
|
|
|
+ :data="treeData"
|
|
|
+ @node-click="nodeClick"
|
|
|
+ />
|
|
|
</basic-container>
|
|
|
</el-col>
|
|
|
<el-col :span="19">
|
|
|
<basic-container>
|
|
|
- <avue-crud :option="option"
|
|
|
- :search.sync="search"
|
|
|
- :table-loading="loading"
|
|
|
- :data="data"
|
|
|
- ref="crud"
|
|
|
- v-model="form"
|
|
|
- @row-del="rowDel"
|
|
|
- @row-update="rowUpdate"
|
|
|
- @row-save="rowSave"
|
|
|
- :before-open="beforeOpenE"
|
|
|
- :page.sync="page"
|
|
|
- @search-change="searchChange"
|
|
|
- @search-reset="searchReset"
|
|
|
- @selection-change="selectionChange"
|
|
|
- @current-change="currentChange"
|
|
|
- @size-change="sizeChange"
|
|
|
- @refresh-change="refreshChange"
|
|
|
- @on-load="onLoad">
|
|
|
+ <avue-crud
|
|
|
+ :option="option"
|
|
|
+ :search.sync="search"
|
|
|
+ :table-loading="loading"
|
|
|
+ :data="data"
|
|
|
+ ref="crud"
|
|
|
+ v-model="form"
|
|
|
+ @row-del="rowDel"
|
|
|
+ @row-update="rowUpdate"
|
|
|
+ @row-save="rowSave"
|
|
|
+ :before-open="beforeOpenE"
|
|
|
+ :page.sync="page"
|
|
|
+ @search-change="searchChange"
|
|
|
+ @search-reset="searchReset"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ @current-change="currentChange"
|
|
|
+ @size-change="sizeChange"
|
|
|
+ @refresh-change="refreshChange"
|
|
|
+ @on-load="onLoad"
|
|
|
+ >
|
|
|
<template slot="menuLeft">
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
size="small"
|
|
|
icon="el-icon-bottom"
|
|
|
@click="excelBox = true"
|
|
|
- >导入
|
|
|
+ >导入
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-printer"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click.stop="openReport()"
|
|
|
+ >报表打印
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
type="warning"
|
|
|
size="small"
|
|
|
- :disabled="selectionList.length==0"
|
|
|
+ :disabled="selectionList.length == 0"
|
|
|
icon="el-icon-delete"
|
|
|
@click="batchDelete"
|
|
|
- >批量删除
|
|
|
+ >批量删除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
<template slot-scope="scope" slot="corpId">
|
|
@@ -59,14 +72,14 @@
|
|
|
icon="el-icon-edit"
|
|
|
size="small"
|
|
|
@click.stop="editOpen(scope.row, scope.index)"
|
|
|
- >编辑
|
|
|
+ >编辑
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
size="small"
|
|
|
@click.stop="rowDel(scope.row, scope.index)"
|
|
|
- >删除
|
|
|
+ >删除
|
|
|
</el-button>
|
|
|
<!-- <el-button-->
|
|
|
<!-- type="text"-->
|
|
@@ -83,22 +96,34 @@
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
- <el-dialog title="导入产品"
|
|
|
- append-to-body
|
|
|
- :visible.sync="excelBox"
|
|
|
- :close-on-click-modal="false"
|
|
|
- width="555px">
|
|
|
- <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
|
|
|
+ <el-dialog
|
|
|
+ title="导入产品"
|
|
|
+ append-to-body
|
|
|
+ :visible.sync="excelBox"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ width="555px"
|
|
|
+ >
|
|
|
+ <avue-form
|
|
|
+ :option="excelOption"
|
|
|
+ v-model="excelForm"
|
|
|
+ :upload-after="uploadAfter"
|
|
|
+ >
|
|
|
<template slot="excelTemplate">
|
|
|
<el-button type="primary" @click="derivation">
|
|
|
点击下载<i class="el-icon-download el-icon--right"></i>
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</avue-form>
|
|
|
- <p style="text-align: center;color: #DC0505">温馨提示 第一次导入时请先下载模板</p>
|
|
|
+ <p style="text-align: center;color: #DC0505">
|
|
|
+ 温馨提示 第一次导入时请先下载模板
|
|
|
+ </p>
|
|
|
</el-dialog>
|
|
|
</basic-container>
|
|
|
</el-col>
|
|
|
+ <report-dialog
|
|
|
+ :switchDialog="switchDialog"
|
|
|
+ @onClose="onClose()"
|
|
|
+ ></report-dialog>
|
|
|
</el-row>
|
|
|
|
|
|
<detail-page
|
|
@@ -110,22 +135,34 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import {getList, getUser, getUserPlatform, remove, updatePlatform, add, grant, getDeptLazyTree, getDeptTree} from "@/api/basicData/commodityType";
|
|
|
-import {getRoleTree} from "@/api/system/role";
|
|
|
-import {mapGetters} from "vuex";
|
|
|
-import website from '@/config/website';
|
|
|
-import {getToken} from '@/util/auth';
|
|
|
+import {
|
|
|
+ getList,
|
|
|
+ getUser,
|
|
|
+ getUserPlatform,
|
|
|
+ remove,
|
|
|
+ updatePlatform,
|
|
|
+ add,
|
|
|
+ grant,
|
|
|
+ getDeptLazyTree,
|
|
|
+ getDeptTree
|
|
|
+} from "@/api/basicData/commodityType";
|
|
|
+import { getRoleTree } from "@/api/system/role";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import website from "@/config/website";
|
|
|
+import { getToken } from "@/util/auth";
|
|
|
import option from "./configuration/mainList.json";
|
|
|
import detailPage from "./detailsPageEdit";
|
|
|
-
|
|
|
+import reportDialog from "@/components/report-dialog/main";
|
|
|
export default {
|
|
|
components: {
|
|
|
+ reportDialog,
|
|
|
detailPage
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
form: {},
|
|
|
- search:{},
|
|
|
+ search: {},
|
|
|
+ switchDialog: false,
|
|
|
roleBox: false,
|
|
|
excelBox: false,
|
|
|
platformBox: false,
|
|
@@ -146,7 +183,7 @@ export default {
|
|
|
},
|
|
|
init: {
|
|
|
roleTree: [],
|
|
|
- deptTree: [],
|
|
|
+ deptTree: []
|
|
|
},
|
|
|
props: {
|
|
|
label: "title",
|
|
@@ -154,30 +191,32 @@ export default {
|
|
|
},
|
|
|
roleGrantList: [],
|
|
|
roleTreeObj: [],
|
|
|
- treeDeptId: '',
|
|
|
+ treeDeptId: "",
|
|
|
treeData: [],
|
|
|
treeOption: {
|
|
|
- nodeKey: 'id',
|
|
|
+ nodeKey: "id",
|
|
|
lazy: true,
|
|
|
- treeLoad: function (node, resolve) {
|
|
|
- const parentId = (node.level === 0) ? 0 : node.data.id;
|
|
|
+ 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
|
|
|
- }
|
|
|
- }))
|
|
|
+ resolve(
|
|
|
+ res.data.data.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ leaf: !item.hasChildren
|
|
|
+ };
|
|
|
+ })
|
|
|
+ );
|
|
|
});
|
|
|
},
|
|
|
addBtn: false,
|
|
|
menu: false,
|
|
|
- size: 'small',
|
|
|
+ size: "small",
|
|
|
props: {
|
|
|
- labelText: '标题',
|
|
|
- label: 'title',
|
|
|
- value: 'value',
|
|
|
- children: 'children'
|
|
|
+ labelText: "标题",
|
|
|
+ label: "title",
|
|
|
+ value: "value",
|
|
|
+ children: "children"
|
|
|
}
|
|
|
},
|
|
|
option: option,
|
|
@@ -192,36 +231,40 @@ export default {
|
|
|
emptyBtn: false,
|
|
|
column: [
|
|
|
{
|
|
|
- label: '模板下载',
|
|
|
- prop: 'excelTemplate',
|
|
|
+ label: "模板下载",
|
|
|
+ prop: "excelTemplate",
|
|
|
formslot: true,
|
|
|
- span: 24,
|
|
|
+ span: 24
|
|
|
},
|
|
|
{
|
|
|
- label: '模板上传',
|
|
|
- prop: 'excelFile',
|
|
|
- type: 'upload',
|
|
|
+ label: "模板上传",
|
|
|
+ prop: "excelFile",
|
|
|
+ type: "upload",
|
|
|
drag: true,
|
|
|
- loadText: '模板上传中,请稍等',
|
|
|
+ loadText: "模板上传中,请稍等",
|
|
|
span: 24,
|
|
|
propsHttp: {
|
|
|
- res: 'data',
|
|
|
+ res: "data"
|
|
|
},
|
|
|
- tip: '请上传 .xls,.xlsx 标准格式文件',
|
|
|
- action: "/api/blade-client/goodsdesc/import-desc-info",
|
|
|
- },
|
|
|
+ tip: "请上传 .xls,.xlsx 标准格式文件",
|
|
|
+ action: "/api/blade-client/goodsdesc/import-desc-info"
|
|
|
+ }
|
|
|
]
|
|
|
},
|
|
|
isShow: true,
|
|
|
- detailData: {},
|
|
|
+ detailData: {}
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- option.height = window.innerHeight - 255 ;
|
|
|
+ option.height = window.innerHeight - 255;
|
|
|
},
|
|
|
methods: {
|
|
|
derivation() {
|
|
|
- window.open(`/api/blade-client/goodsdesc/export-template-info?${this.website.tokenHeader}=${getToken()}`);
|
|
|
+ window.open(
|
|
|
+ `/api/blade-client/goodsdesc/export-template-info?${
|
|
|
+ this.website.tokenHeader
|
|
|
+ }=${getToken()}`
|
|
|
+ );
|
|
|
},
|
|
|
uploadAfter(res, done, loading, column) {
|
|
|
window.console.log(column);
|
|
@@ -253,72 +296,77 @@ export default {
|
|
|
},
|
|
|
rowSave(row, done, loading) {
|
|
|
row.goodsTypeId = row.goodsTypeId.join(",");
|
|
|
- add(row).then(() => {
|
|
|
- this.initFlag = false;
|
|
|
- this.onLoad(this.page);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!"
|
|
|
- });
|
|
|
- done();
|
|
|
- }, error => {
|
|
|
- window.console.log(error);
|
|
|
- loading();
|
|
|
- });
|
|
|
+ add(row).then(
|
|
|
+ () => {
|
|
|
+ this.initFlag = false;
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ window.console.log(error);
|
|
|
+ loading();
|
|
|
+ }
|
|
|
+ );
|
|
|
},
|
|
|
rowUpdate(row, index, done, loading) {
|
|
|
row.goodsTypeId = row.goodsTypeId.join(",");
|
|
|
- add(row).then(() => {
|
|
|
- this.initFlag = false;
|
|
|
- this.onLoad(this.page);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!"
|
|
|
- });
|
|
|
- done();
|
|
|
- }, error => {
|
|
|
- window.console.log(error);
|
|
|
- loading();
|
|
|
- });
|
|
|
+ add(row).then(
|
|
|
+ () => {
|
|
|
+ this.initFlag = false;
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ window.console.log(error);
|
|
|
+ loading();
|
|
|
+ }
|
|
|
+ );
|
|
|
},
|
|
|
//批量删除
|
|
|
- batchDelete(){
|
|
|
+ batchDelete() {
|
|
|
this.$confirm("确定批量删除数据?", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
- }).then(()=>{
|
|
|
- let batchDeleteList = this.selectionList.map(item =>{
|
|
|
- return item.id
|
|
|
- })
|
|
|
- remove(batchDeleteList.join(",")).then(res =>{
|
|
|
- if(res.data.success){
|
|
|
- this.$message.success("删除成功!")
|
|
|
- this.refreshChange()
|
|
|
+ }).then(() => {
|
|
|
+ let batchDeleteList = this.selectionList.map(item => {
|
|
|
+ return item.id;
|
|
|
+ });
|
|
|
+ remove(batchDeleteList.join(",")).then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.refreshChange();
|
|
|
}
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
//查看跳转页面
|
|
|
beforeOpenPage(row, index) {
|
|
|
this.detailData = {
|
|
|
id: row.id,
|
|
|
- seeDisabled: true,
|
|
|
+ seeDisabled: true
|
|
|
};
|
|
|
this.isShow = false;
|
|
|
},
|
|
|
//新增跳转页面
|
|
|
beforeOpenE(row, index) {
|
|
|
this.detailData = {
|
|
|
- goodsTypeId: this.treeDeptId,
|
|
|
+ goodsTypeId: this.treeDeptId
|
|
|
};
|
|
|
this.isShow = false;
|
|
|
},
|
|
|
//编辑跳转页面
|
|
|
editOpen(row, index) {
|
|
|
this.detailData = {
|
|
|
- id: row.id,
|
|
|
+ id: row.id
|
|
|
};
|
|
|
this.isShow = false;
|
|
|
},
|
|
@@ -329,21 +377,21 @@ export default {
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- return remove(row.id);
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.onLoad(this.page);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!"
|
|
|
- });
|
|
|
- done()
|
|
|
+ .then(() => {
|
|
|
+ return remove(row.id);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
});
|
|
|
+ done();
|
|
|
+ });
|
|
|
},
|
|
|
searchReset() {
|
|
|
this.query = {};
|
|
|
- this.treeDeptId = '';
|
|
|
+ this.treeDeptId = "";
|
|
|
this.onLoad(this.page);
|
|
|
},
|
|
|
searchChange(params, done) {
|
|
@@ -380,23 +428,27 @@ export default {
|
|
|
this.excelBox = true;
|
|
|
},
|
|
|
handleTemplate() {
|
|
|
- window.open(`/api/blade-user/export-template?${this.website.tokenHeader}=${getToken()}`);
|
|
|
+ window.open(
|
|
|
+ `/api/blade-user/export-template?${
|
|
|
+ this.website.tokenHeader
|
|
|
+ }=${getToken()}`
|
|
|
+ );
|
|
|
},
|
|
|
//新增编辑查看触发
|
|
|
async beforeOpen(done, type) {
|
|
|
if (["add"].includes(type)) {
|
|
|
- this.option.column.forEach(e=>{
|
|
|
- if(e.prop=='goodsTypeId'){
|
|
|
- this.$set(this.option.column,2,{...e,value:this.treeDeptId})
|
|
|
+ this.option.column.forEach(e => {
|
|
|
+ if (e.prop == "goodsTypeId") {
|
|
|
+ this.$set(this.option.column, 2, { ...e, value: this.treeDeptId });
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
if (["edit", "view"].includes(type)) {
|
|
|
await getUser(this.form.id).then(res => {
|
|
|
this.form = res.data.data;
|
|
|
// this.form.goodsTypeId = [this.form.goodsTypeId.replace(/\"/g,"")]
|
|
|
- console.log(this.form.hasOwnProperty("goodsTypeId"))
|
|
|
- if(this.form.hasOwnProperty("goodsTypeId")){
|
|
|
+ console.log(this.form.hasOwnProperty("goodsTypeId"));
|
|
|
+ if (this.form.hasOwnProperty("goodsTypeId")) {
|
|
|
this.form.goodsTypeId = this.form.goodsTypeId.split(",");
|
|
|
}
|
|
|
});
|
|
@@ -418,26 +470,40 @@ export default {
|
|
|
},
|
|
|
onLoad(page, params = {}) {
|
|
|
this.loading = true;
|
|
|
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
|
|
|
+ getList(
|
|
|
+ page.currentPage,
|
|
|
+ page.pageSize,
|
|
|
+ Object.assign(params, this.query),
|
|
|
+ this.treeDeptId
|
|
|
+ ).then(res => {
|
|
|
const data = res.data.data;
|
|
|
this.data = data.records;
|
|
|
- this.page.total = res.data.data.total
|
|
|
+ this.page.total = res.data.data.total;
|
|
|
this.loading = false;
|
|
|
this.selectionClear();
|
|
|
});
|
|
|
},
|
|
|
platformRowUpdate(row, index, done, loading) {
|
|
|
- updatePlatform(row.id, row.userType, row.userExt).then(() => {
|
|
|
- this.platformOnLoad(this.platformPage);
|
|
|
- this.$message({
|
|
|
- type: "success",
|
|
|
- message: "操作成功!"
|
|
|
- });
|
|
|
- done();
|
|
|
- }, error => {
|
|
|
- window.console.log(error);
|
|
|
- loading();
|
|
|
- });
|
|
|
+ updatePlatform(row.id, row.userType, row.userExt).then(
|
|
|
+ () => {
|
|
|
+ this.platformOnLoad(this.platformPage);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ window.console.log(error);
|
|
|
+ loading();
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ openReport() {
|
|
|
+ this.switchDialog = !this.switchDialog;
|
|
|
+ },
|
|
|
+ onClose(val) {
|
|
|
+ this.switchDialog = val;
|
|
|
},
|
|
|
platformBeforeOpen(done, type) {
|
|
|
if (["edit", "view"].includes(type)) {
|
|
@@ -475,7 +541,12 @@ export default {
|
|
|
},
|
|
|
platformOnLoad(page, params = {}) {
|
|
|
this.platformLoading = true;
|
|
|
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
|
|
|
+ getList(
|
|
|
+ page.currentPage,
|
|
|
+ page.pageSize,
|
|
|
+ Object.assign(params, this.query),
|
|
|
+ this.treeDeptId
|
|
|
+ ).then(res => {
|
|
|
const data = res.data.data;
|
|
|
this.platformPage.total = data.total;
|
|
|
this.platformData = data.records;
|
|
@@ -484,9 +555,9 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
goBack() {
|
|
|
- this.detailData=this.$options.data().detailData
|
|
|
+ this.detailData = this.$options.data().detailData;
|
|
|
this.isShow = true;
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|