|
@@ -1,62 +1,88 @@
|
|
<template>
|
|
<template>
|
|
<basic-container>
|
|
<basic-container>
|
|
- <avue-crud :option="option"
|
|
|
|
- :data="dataList"
|
|
|
|
- ref="crud"
|
|
|
|
- v-model="form"
|
|
|
|
- :page.sync="page"
|
|
|
|
- @row-del="rowDel"
|
|
|
|
- @row-update="rowUpdate"
|
|
|
|
- :before-open="beforeOpen"
|
|
|
|
- :before-close="beforeClose"
|
|
|
|
- @row-save="rowSave"
|
|
|
|
- @search-change="searchChange"
|
|
|
|
- @search-reset="searchReset"
|
|
|
|
- @selection-change="selectionChange"
|
|
|
|
- @current-change="currentChange"
|
|
|
|
- @size-change="sizeChange"
|
|
|
|
- @refresh-change="refreshChange"
|
|
|
|
- @on-load="onLoad"
|
|
|
|
- @tree-load="treeLoad">
|
|
|
|
- <template slot-scope="scope" slot="menu">
|
|
|
|
|
|
+ <avue-crud
|
|
|
|
+ ref="crud"
|
|
|
|
+ :option="option"
|
|
|
|
+ :data="data"
|
|
|
|
+ :page.sync="page"
|
|
|
|
+ @search-change="searchChange"
|
|
|
|
+ @on-load="onLoad"
|
|
|
|
+ @row-update="rowUpdate">
|
|
|
|
+ <template slot-scope="{row,index}" slot="menu">
|
|
<el-button
|
|
<el-button
|
|
type="text"
|
|
type="text"
|
|
- icon="el-icon-view"
|
|
|
|
size="small"
|
|
size="small"
|
|
- @click.stop="beforeOpenPage(scope.row,scope.index)"
|
|
|
|
- >查看
|
|
|
|
|
|
+ @click="rowCell(row,index)"
|
|
|
|
+ >{{ row.$cellEdit ? '保存' : '修改' }}
|
|
</el-button>
|
|
</el-button>
|
|
<el-button
|
|
<el-button
|
|
type="text"
|
|
type="text"
|
|
- icon="el-icon-edit"
|
|
|
|
size="small"
|
|
size="small"
|
|
- @click.stop="editOpen(scope.row,scope.index)"
|
|
|
|
- >编辑
|
|
|
|
|
|
+ @click="deletePrice(row,index)"
|
|
|
|
+ >删除
|
|
</el-button>
|
|
</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ <template slot="menuLeft">
|
|
<el-button
|
|
<el-button
|
|
- type="text"
|
|
|
|
- icon="el-icon-delete"
|
|
|
|
|
|
+ type="primary"
|
|
size="small"
|
|
size="small"
|
|
- @click.stop="rowDel(scope.row,scope.index)"
|
|
|
|
- >删除
|
|
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
+ @click="excelBox = !excelBox"
|
|
|
|
+ >导入
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ type="success"
|
|
|
|
+ icon="el-icon-upload2"
|
|
|
|
+ size="small"
|
|
|
|
+ @click="derivation()"
|
|
|
|
+ >下载模板
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ type="info"
|
|
|
|
+ icon="el-icon-printer"
|
|
|
|
+ size="small"
|
|
|
|
+ >报 表
|
|
</el-button>
|
|
</el-button>
|
|
</template>
|
|
</template>
|
|
</avue-crud>
|
|
</avue-crud>
|
|
|
|
+ <el-dialog title="导入价格"
|
|
|
|
+ append-to-body
|
|
|
|
+ :visible.sync="excelBox"
|
|
|
|
+ width="555px">
|
|
|
|
+ <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"/>
|
|
|
|
+ </el-dialog>
|
|
</basic-container>
|
|
</basic-container>
|
|
</template>
|
|
</template>
|
|
-
|
|
|
|
<script>
|
|
<script>
|
|
-import option from "./configuration/mainList.json";
|
|
|
|
-import {customerList, typeSave, deleteDetails} from "@/api/maintenance/priceManagement"
|
|
|
|
-
|
|
|
|
|
|
+import option from "./configuration/mainList.json"
|
|
|
|
+import {deleteTemplate,customerList,typeSave} from "@/api/maintenance/priceManagement"
|
|
|
|
+import {getToken} from "@/util/auth";
|
|
export default {
|
|
export default {
|
|
- name: "customerInformation",
|
|
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- form: {},
|
|
|
|
|
|
+ data: [],
|
|
|
|
+ excelForm: {},
|
|
|
|
+ excelOption: {
|
|
|
|
+ submitBtn: false,
|
|
|
|
+ emptyBtn: false,
|
|
|
|
+ column: [
|
|
|
|
+ {
|
|
|
|
+ label: '导入数据',
|
|
|
|
+ prop: 'excelFile',
|
|
|
|
+ type: 'upload',
|
|
|
|
+ drag: true,
|
|
|
|
+ loadText: '导入数据中,请稍等',
|
|
|
|
+ span: 24,
|
|
|
|
+ propsHttp: {
|
|
|
|
+ res: 'data'
|
|
|
|
+ },
|
|
|
|
+ tip: '请上传 .xls,.xlsx 标准格式文件',
|
|
|
|
+ action: "/api/blade-mocha-item/priceitem/import-price"
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ excelBox: false,
|
|
option: option,
|
|
option: option,
|
|
- parentId: 0,
|
|
|
|
- dataList: [],
|
|
|
|
page: {
|
|
page: {
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
pagerCount: 5,
|
|
pagerCount: 5,
|
|
@@ -64,94 +90,45 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- created() {
|
|
|
|
- console.log('wangbadan')
|
|
|
|
- // this.onLoad()
|
|
|
|
- },
|
|
|
|
methods: {
|
|
methods: {
|
|
- //删除列表后面的删除按钮触发触发(row, index, done)
|
|
|
|
- rowDel(row, index, done) {
|
|
|
|
- this.$confirm("确定将选择数据删除?", {
|
|
|
|
|
|
+ derivation() {
|
|
|
|
+ this.$confirm("是否下载模板?", "提示", {
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
type: "warning"
|
|
}).then(() => {
|
|
}).then(() => {
|
|
- return deleteDetails(row.id);
|
|
|
|
- }).then(() => {
|
|
|
|
- this.$message({
|
|
|
|
- type: "success",
|
|
|
|
- message: "操作成功!"
|
|
|
|
- });
|
|
|
|
- this.page.currentPage = 1;
|
|
|
|
- this.onLoad(this.page, {parentId: 0});
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- //修改时的修改按钮点击触发
|
|
|
|
- rowUpdate(row, index, done, loading) {
|
|
|
|
- typeSave(row).then(() => {
|
|
|
|
- this.$message({
|
|
|
|
- type: "success",
|
|
|
|
- message: "操作成功!"
|
|
|
|
- });
|
|
|
|
- // 数据回调进行刷新
|
|
|
|
- done(row);
|
|
|
|
- }, error => {
|
|
|
|
- window.console.log(error);
|
|
|
|
- loading();
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- //新增修改时保存触发
|
|
|
|
- rowSave(row, done, loading) {
|
|
|
|
- typeSave(row).then(res => {
|
|
|
|
- console.log(res)
|
|
|
|
- done()
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- //查询全部
|
|
|
|
- initData() {
|
|
|
|
- customerList().then(res => {
|
|
|
|
- console.log(this.form);
|
|
|
|
- const column = this.findObject(this.option.column, "parentId");
|
|
|
|
- column.dicData = res.data.data.records;
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- //新增子项触发
|
|
|
|
- handleAdd(row) {
|
|
|
|
- this.parentId = row.id;
|
|
|
|
- const column = this.findObject(this.option.column, "parentId");
|
|
|
|
- column.value = row.id;
|
|
|
|
- column.addDisabled = true;
|
|
|
|
- this.$refs.crud.rowAdd();
|
|
|
|
- },
|
|
|
|
- //查看跳转页面
|
|
|
|
- beforeOpenPage(row, index) {
|
|
|
|
- this.$router.push({
|
|
|
|
- path: "/priceManagement_detailsPageEdit",
|
|
|
|
- query: {id: JSON.stringify(row.id)},
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- //新增跳转页面
|
|
|
|
- beforeOpen(row, index) {
|
|
|
|
- console.log(row)
|
|
|
|
- this.$router.push({
|
|
|
|
- path: "/priceManagement_detailsPageEdit",
|
|
|
|
- query: {id: JSON.stringify(row.id)},
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- editOpen(row, index) {
|
|
|
|
- this.$router.push({
|
|
|
|
- path: "/priceManagement_detailsPageEdit",
|
|
|
|
- query: {id: JSON.stringify(row.id)},
|
|
|
|
|
|
+ window.open(`/api/blade-mocha-item/priceitem/export-template?${this.website.tokenHeader}=${getToken()}`);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- //点击新增时触发
|
|
|
|
- beforeClose(done) {
|
|
|
|
- this.parentId = "";
|
|
|
|
- const column = this.findObject(this.option.column, "parentId");
|
|
|
|
- column.value = "";
|
|
|
|
- column.addDisabled = false;
|
|
|
|
|
|
+ uploadAfter(res, done, loading, column) {
|
|
|
|
+ window.console.log(column);
|
|
|
|
+ this.excelBox = false;
|
|
|
|
+ this.page.currentPage = 1;
|
|
|
|
+ this.onLoad(this.page);
|
|
|
|
+ loading()
|
|
done();
|
|
done();
|
|
},
|
|
},
|
|
|
|
+ rowCell(row, index) {
|
|
|
|
+ this.$refs.crud.rowCell(row, index)
|
|
|
|
+ },
|
|
|
|
+ deletePrice(row,index){
|
|
|
|
+ if (row.id){
|
|
|
|
+ this.$confirm("确定将选择数据删除?", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).then(() => {
|
|
|
|
+ return deleteTemplate(row.id);
|
|
|
|
+ }).then(() => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "操作成功!"
|
|
|
|
+ });
|
|
|
|
+ this.page.currentPage = 1;
|
|
|
|
+ this.onLoad(this.page);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
//点击搜索按钮触发
|
|
//点击搜索按钮触发
|
|
searchChange(params, done) {
|
|
searchChange(params, done) {
|
|
console.log(params)
|
|
console.log(params)
|
|
@@ -159,42 +136,27 @@ export default {
|
|
this.onLoad(this.page, params);
|
|
this.onLoad(this.page, params);
|
|
done()
|
|
done()
|
|
},
|
|
},
|
|
- searchReset() {
|
|
|
|
- console.log('1')
|
|
|
|
- },
|
|
|
|
- selectionChange() {
|
|
|
|
- console.log('1')
|
|
|
|
- },
|
|
|
|
- currentChange() {
|
|
|
|
- console.log('1')
|
|
|
|
- },
|
|
|
|
- sizeChange() {
|
|
|
|
- console.log('1')
|
|
|
|
- },
|
|
|
|
- refreshChange() {
|
|
|
|
- console.log('1')
|
|
|
|
- },
|
|
|
|
- onLoad(page, params = {parentId: 0}) {
|
|
|
|
|
|
+ onLoad(page, params = {}) {
|
|
let queryParams = Object.assign({}, params, {
|
|
let queryParams = Object.assign({}, params, {
|
|
size: page.pageSize,
|
|
size: page.pageSize,
|
|
current: page.currentPage,
|
|
current: page.currentPage,
|
|
})
|
|
})
|
|
customerList(queryParams).then(res => {
|
|
customerList(queryParams).then(res => {
|
|
- this.dataList = res.data.data.records
|
|
|
|
|
|
+ this.data = res.data.data.records
|
|
this.page.total = res.data.data.total
|
|
this.page.total = res.data.data.total
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- //树桩列点击展开触发
|
|
|
|
- treeLoad(tree, treeNode, resolve) {
|
|
|
|
- const parentId = tree.id;
|
|
|
|
- customerList({parentId: parentId}).then(res => {
|
|
|
|
- resolve(res.data.data.records);
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+ rowUpdate(form, index, done) {
|
|
|
|
+ console.log(form)
|
|
|
|
+ typeSave(form).then(res => {
|
|
|
|
+ this.$message({type: "success", message: form.id ? "修改成功!" : "新增成功!"});
|
|
|
|
+ // this.page.currentPage = 1;
|
|
|
|
+ // this.onLoad(this.page);
|
|
|
|
+ //成功关闭此页面回到列表页
|
|
|
|
+ // this.backToList()
|
|
|
|
+ })
|
|
|
|
+ done()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
-
|
|
|
|
-<style scoped>
|
|
|
|
-
|
|
|
|
-</style>
|
|
|