|
@@ -7,138 +7,153 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="bill-main">
|
|
|
- <div v-show="!hideSearch">
|
|
|
- <by-form :propConfig="formConfig" ref="formId" />
|
|
|
- <div class="search-btn">
|
|
|
- <el-button type="primary" size="mini" icon="el-icon-search" @click="searchHandle">搜索</el-button>
|
|
|
- <el-button size="mini" icon="el-icon-refresh" @click="resertHandle">重置</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <by-tool :propConfig="toolConfig" ref="toolId" @clickHandle="clickHandle" />
|
|
|
- <el-table :data="tableData" v-loading="loading" style="width: 100%;margin: 20px 0;" :show-overflow-tooltip="true"
|
|
|
- row-key="id" ref="tableId" :tree-props="{children: 'children'}" @cell-click="doClick">
|
|
|
- <el-table-column prop="name" label="名称" width="300" @click="clickMy" />
|
|
|
- <el-table-column prop="shortName" label="简称" width="300" />
|
|
|
- <el-table-column prop="status" label="状态">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-tag size='mini' :type="scope.row.status===0?'primary':'danger'"
|
|
|
- disable-transitions>{{scope.row.status===0?'正常':'禁用'}}</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="remark" label="备注" />
|
|
|
- <el-table-column label="操作" width="100" style="text-align: center;">
|
|
|
- <template>
|
|
|
- <el-button type="text" size="small" icon="el-icon-edit" @click="dialogEdit">编辑</el-button>
|
|
|
- <el-button type="text" size="small" @click="doDelete">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <!-- 新增/编辑弹窗 -->
|
|
|
- <el-dialog :title="title+'商品分类'" :visible.sync="dialogFormVisible" width="30%">
|
|
|
- <by-form :propConfig="addConfig" ref="addFormId">
|
|
|
- <template v-slot:status class="clearfix">
|
|
|
- <el-radio class="fl" style="margin-top: 8px;" v-model="radio" label="0">正常</el-radio>
|
|
|
- <el-radio class="fl" style="margin-top: 8px;" v-model="radio" label="1">禁用</el-radio>
|
|
|
- </template>
|
|
|
- <template v-slot:category>
|
|
|
- <el-cascader style="width: 100%;" v-model="cascaderValue" :options="options" :props="props"
|
|
|
- :show-all-levels="false" clearable @change="getChange" />
|
|
|
- </template>
|
|
|
- </by-form>
|
|
|
-
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogFormVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="confirm">确 定</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
+ <module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
|
|
|
+ @resert="getDataList" @clickHandle="clickHandle" @detail="openEdit">
|
|
|
+ </module-view>
|
|
|
</div>
|
|
|
+ <!-- 新增/编辑弹窗 -->
|
|
|
+ <el-dialog :title="popTitle+'商品分类'" :visible.sync="dialogFormVisible" width="30%">
|
|
|
+ <by-form :propConfig="addConfig" ref="addFormId">
|
|
|
+ <template v-slot:status class="clearfix">
|
|
|
+ <el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
|
|
|
+ <el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="1">禁用</el-radio>
|
|
|
+ </template>
|
|
|
+ </by-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogFormVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="confirm">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
|
- import api from "@/api/materialClass";
|
|
|
- @Component({})
|
|
|
+ import api from "@/api/currency";
|
|
|
+ import Assembly from "@/benyun/components/Assembly/material.vue";
|
|
|
+ @Component
|
|
|
export default class ProductClassification extends Vue {
|
|
|
- hideSearch = false
|
|
|
- title = '新增'
|
|
|
- loading : boolean = true
|
|
|
- dialogFormVisible : boolean = false
|
|
|
- cellsData : any = ''
|
|
|
- cascaderValue : any = ''
|
|
|
- radio = '0'
|
|
|
+ // 左边
|
|
|
data : any = []
|
|
|
props = {
|
|
|
label: 'name',
|
|
|
- value: 'id',
|
|
|
- children: 'children',
|
|
|
- checkStrictly: true
|
|
|
+ children: 'children'
|
|
|
}
|
|
|
- options : Array<any> = []
|
|
|
- tableData : Array<any> = []
|
|
|
- toolConfig = {
|
|
|
- tools: {
|
|
|
- add: true,
|
|
|
- export: true,
|
|
|
- search: true,
|
|
|
- refresh: true
|
|
|
- },
|
|
|
- audit: {
|
|
|
- add: 'audit:collaborationLog:add',
|
|
|
- export: 'audit:collaborationLog:export'
|
|
|
- }
|
|
|
- }
|
|
|
- formConfig = {
|
|
|
- attr: {
|
|
|
- size: 'small',
|
|
|
- },
|
|
|
- columns: [
|
|
|
- [{
|
|
|
- span: 6,
|
|
|
- label: '名称',
|
|
|
- prop: 'name',
|
|
|
- component: 'by-input',
|
|
|
- labelWidth: '70px',
|
|
|
- compConfig: {
|
|
|
- attr: {
|
|
|
- placeholder: '请输入名称',
|
|
|
- clearable: true
|
|
|
+ // 右边
|
|
|
+ baseURL : any = process.env.VUE_APP_BASE_API
|
|
|
+ timeNum = 0;
|
|
|
+ timer : any = null
|
|
|
+ popTitle : any = ''
|
|
|
+ radio : any = 0
|
|
|
+ dialogFormVisible : boolean = false
|
|
|
+ config : any = {
|
|
|
+ search: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini'
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [{
|
|
|
+ span: 6,
|
|
|
+ label: '名称',
|
|
|
+ prop: 'name',
|
|
|
+ component: 'by-input',
|
|
|
+ labelWidth: '70px',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入名称',
|
|
|
+ clearable: true
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '简称',
|
|
|
+ prop: 'shortName',
|
|
|
+ component: 'by-input',
|
|
|
+ labelWidth: '70px',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入简称',
|
|
|
+ clearable: true
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '状态',
|
|
|
+ prop: 'status',
|
|
|
+ component: 'by-select',
|
|
|
+ labelWidth: '70px',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请选择数据',
|
|
|
+ clearable: true,
|
|
|
+ data: [{
|
|
|
+ value: 1,
|
|
|
+ label: '正常'
|
|
|
+ }, {
|
|
|
+ value: 0,
|
|
|
+ label: '禁用'
|
|
|
+ }]
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ tool: {
|
|
|
+ tools: {
|
|
|
+ add: true,
|
|
|
+ export: true,
|
|
|
+ delete: true,
|
|
|
+ search: true,
|
|
|
+ refresh: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ seq: true,
|
|
|
+ align: 'center',
|
|
|
+ checkbox: true,
|
|
|
+ height: 600
|
|
|
+ },
|
|
|
+ columns: [{
|
|
|
+ width: 300,
|
|
|
+ title: '名称',
|
|
|
+ field: 'name',
|
|
|
+ isDetail: true,
|
|
|
}, {
|
|
|
- span: 6,
|
|
|
- label: '简称',
|
|
|
- prop: 'shortName',
|
|
|
- component: 'by-input',
|
|
|
- labelWidth: '70px',
|
|
|
- compConfig: {
|
|
|
- attr: {
|
|
|
- placeholder: '请输入简称',
|
|
|
- clearable: true
|
|
|
- }
|
|
|
- }
|
|
|
+ title: '简称',
|
|
|
+ field: 'shortName'
|
|
|
+ }, {
|
|
|
+ width: 80,
|
|
|
+ title: '状态',
|
|
|
+ field: 'status',
|
|
|
+ component: Assembly,
|
|
|
},
|
|
|
{
|
|
|
- span: 6,
|
|
|
- label: '状态',
|
|
|
- prop: 'status',
|
|
|
- labelWidth: '70px',
|
|
|
- component: 'by-select',
|
|
|
- compConfig: {
|
|
|
- attr: {
|
|
|
- placeholder: '请选择状态',
|
|
|
- clearable: true,
|
|
|
- data: [{
|
|
|
- value: 0,
|
|
|
- label: '正常'
|
|
|
- }, {
|
|
|
- value: 1,
|
|
|
- label: '禁用'
|
|
|
- }]
|
|
|
+ title: '备注',
|
|
|
+ field: 'remark',
|
|
|
+ }, {
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ icon: 'el-icon-edit',
|
|
|
+ name: '编辑',
|
|
|
+ audit: '',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => {
|
|
|
+ (this as any).openEdit(item)
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- },
|
|
|
- ]
|
|
|
- ]
|
|
|
+ }, {
|
|
|
+ name: '删除',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => (this as any).doDelete2(item)
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }]
|
|
|
+ },
|
|
|
}
|
|
|
addConfig = {
|
|
|
attr: {
|
|
@@ -147,159 +162,80 @@
|
|
|
name: [{
|
|
|
required: true, message: '请输入名称', trigger: 'blur'
|
|
|
}],
|
|
|
- shortName: [{
|
|
|
- required: true, message: '请输入简称', trigger: 'blur'
|
|
|
- }]
|
|
|
}
|
|
|
},
|
|
|
columns: [
|
|
|
[
|
|
|
{
|
|
|
- labelWidth: '80px',
|
|
|
- span: 24,
|
|
|
- label: '上级分类',
|
|
|
- prop: 'category',
|
|
|
- component:'select-tree',
|
|
|
- compConfig:{
|
|
|
- attr:{
|
|
|
- width:400,
|
|
|
- label:'name',
|
|
|
- clearable:true,
|
|
|
- retConfig:{
|
|
|
- treeName:'name',
|
|
|
- treeId:'id'
|
|
|
- }
|
|
|
- },
|
|
|
- request:{
|
|
|
- url:'/maindata/maindataMaterialCategory/treeList'
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- span: 24,
|
|
|
+ span: 23,
|
|
|
+ labelWidth: '70px',
|
|
|
label: '名称',
|
|
|
prop: 'name',
|
|
|
component: 'by-input',
|
|
|
- labelWidth: '80px',
|
|
|
},
|
|
|
{
|
|
|
- span: 24,
|
|
|
+ span: 23,
|
|
|
+ labelWidth: '70px',
|
|
|
label: '简称',
|
|
|
+ slot: true,
|
|
|
prop: 'shortName',
|
|
|
component: 'by-input',
|
|
|
- labelWidth: '80px',
|
|
|
},
|
|
|
{
|
|
|
- span: 24,
|
|
|
+ span: 23,
|
|
|
+ labelWidth: '70px',
|
|
|
label: '状态',
|
|
|
slot: true,
|
|
|
prop: 'status',
|
|
|
- labelWidth: '80px',
|
|
|
},
|
|
|
{
|
|
|
- span: 24,
|
|
|
+ span: 23,
|
|
|
+ labelWidth: '70px',
|
|
|
label: '备注',
|
|
|
+ slot: true,
|
|
|
prop: 'remark',
|
|
|
component: 'by-input',
|
|
|
- labelWidth: '80px',
|
|
|
- },]
|
|
|
+ },
|
|
|
+ ],
|
|
|
]
|
|
|
}
|
|
|
created() {
|
|
|
- this.getDataList()
|
|
|
- }
|
|
|
- clickMy(e : any) {
|
|
|
- console.log(e);
|
|
|
+ this.getTreeList()
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ this.getDataList()
|
|
|
+ }, 500)
|
|
|
}
|
|
|
- // 获取列表数据
|
|
|
- getDataList() {
|
|
|
- api.treeList().then((res : any) => {
|
|
|
+ // 获取树型导航数据
|
|
|
+ getTreeList() {
|
|
|
+ api.treeList('maindataMaterialCategory').then((res : any) => {
|
|
|
// console.log(res.data[0]);
|
|
|
if (res.code === 200) {
|
|
|
- this.tableData = res.data;
|
|
|
- this.data = res.data;
|
|
|
- let arr : any = [{
|
|
|
- name: '顶级',
|
|
|
- id: 0,
|
|
|
- children: res.data
|
|
|
- }]
|
|
|
- this.options = arr;
|
|
|
- this.loading = false;
|
|
|
+ this.data = res.data[0].children;
|
|
|
} else this.failHandle(res)
|
|
|
})
|
|
|
}
|
|
|
- // 工具栏方法
|
|
|
- clickHandle(e : any) {
|
|
|
- console.log('工具栏方法 ==> ', e);
|
|
|
- if (e === 'toggleSearch') this.toggleSearch();
|
|
|
- if (e === 'onRefresh') this.onRefresh();
|
|
|
- if (e === 'onExport') this.onExport();
|
|
|
- if (e === 'onAdd') this.onAdd();
|
|
|
- }
|
|
|
- // 单元格点击
|
|
|
- doClick(e : any) {
|
|
|
- console.log('单元格点击 ==> ', e);
|
|
|
- this.cellsData = e;
|
|
|
- this.radio = e.status.toString();
|
|
|
- if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
|
|
|
- }
|
|
|
- // 新增
|
|
|
- onAdd() {
|
|
|
- this.title = '新增';
|
|
|
- this.radio = '0';
|
|
|
- this.cascaderValue = [0];
|
|
|
- this.dialogFormVisible = true;
|
|
|
- setTimeout(() => {
|
|
|
- if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
|
|
|
- }, 0)
|
|
|
- }
|
|
|
- // 编辑
|
|
|
- dialogEdit() {
|
|
|
- this.title = '编辑';
|
|
|
- this.cascaderValue = [0];
|
|
|
- this.dialogFormVisible = true;
|
|
|
- }
|
|
|
- // 获取选择节点
|
|
|
- getChange(e : any) {
|
|
|
- console.log('获取选择节点 ==> ', e);
|
|
|
- // this.cascaderValue = e;
|
|
|
- }
|
|
|
// 确认新增/编辑
|
|
|
confirm() {
|
|
|
(this as any).$refs.addFormId.validate().then(() => {
|
|
|
let query = (this as any).$refs.addFormId.getValue();
|
|
|
- let pareteId : any = this.cascaderValue[this.cascaderValue.length - 1];
|
|
|
- // console.log(pareteId, this.radio);
|
|
|
+ query.status = this.radio;
|
|
|
this.dialogFormVisible = false;
|
|
|
- if (this.title === '新增') {
|
|
|
- api.saveCategory({
|
|
|
- name: query.name,
|
|
|
- shortName: query.shortName,
|
|
|
- status: this.radio,
|
|
|
- remark: query.remark,
|
|
|
- parentId: pareteId// 父级id
|
|
|
- }).then((res : any) => {
|
|
|
+ if (this.popTitle === '新增') {
|
|
|
+ api.saveList(query, 'maindataMaterialCategory').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
- message: this.title + '成功!'
|
|
|
+ message: this.popTitle + '成功!'
|
|
|
});
|
|
|
this.getDataList();
|
|
|
} else this.failHandle(res)
|
|
|
})
|
|
|
- } else if (this.title === '编辑') {
|
|
|
- api.updateCategory({
|
|
|
- id: this.cellsData.id,
|
|
|
- name: query.name,
|
|
|
- shortName: query.shortName,
|
|
|
- status: this.radio,
|
|
|
- remark: query.remark,
|
|
|
- parentId: pareteId // 父级id
|
|
|
- }).then((res : any) => {
|
|
|
+ } else if (this.popTitle === '编辑') {
|
|
|
+ api.updateList(query, 'maindataMaterialCategory').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
- message: this.title + '成功!'
|
|
|
+ message: this.popTitle + '成功!'
|
|
|
});
|
|
|
this.getDataList();
|
|
|
} else this.failHandle(res)
|
|
@@ -307,132 +243,141 @@
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- // 删除
|
|
|
- doDelete() {
|
|
|
+ // 获取列表数据
|
|
|
+ getDataList() {
|
|
|
+ if (!this.$refs.moduleView) {
|
|
|
+ if (this.timeNum > 5) {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ }
|
|
|
+ this.timeNum++;
|
|
|
+ return
|
|
|
+ }
|
|
|
+ clearInterval(this.timer)
|
|
|
+ let query = (this.$refs.moduleView as any).getQuery();
|
|
|
+ console.log('表单字段 ==> ', query);
|
|
|
+ api.pageList(query, 'maindataMaterialCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ (this.$refs.moduleView as any).setTableValue(res.data.records);
|
|
|
+ let page = {
|
|
|
+ pageNo: res.data.current, //当前页
|
|
|
+ pageSize: res.data.size, //每页条数
|
|
|
+ total: res.data.total //总条数
|
|
|
+ };
|
|
|
+ (this.$refs.moduleView as any).setPage(page)
|
|
|
+ } else this.failHandle(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 工具栏方法
|
|
|
+ clickHandle(e : any) {
|
|
|
+ if (e === 'onRefresh') (this.$refs.moduleView as any).resert();
|
|
|
+ if (e === 'onAdd') this.onAdd();
|
|
|
+ if (e === 'onDelete') this.onDelete();
|
|
|
+ if (e === 'onExport') this.onExport();
|
|
|
+ }
|
|
|
+ // 打开新增
|
|
|
+ onAdd() {
|
|
|
+ this.popTitle = '新增'
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ this.radio = 0
|
|
|
setTimeout(() => {
|
|
|
- if (this.cellsData.children.length > 0) return this.$message({
|
|
|
- type: 'error',
|
|
|
- message: '此节点还有子集,不能做此操作'
|
|
|
+ if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
+ // 打开编辑
|
|
|
+ openEdit(e : any) {
|
|
|
+ this.popTitle = '编辑'
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ this.radio = e.status
|
|
|
+ setTimeout(() => {
|
|
|
+ if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
+ // 工具栏删除
|
|
|
+ onDelete() {
|
|
|
+ let selectData = (this.$refs.moduleView as any).getSelectData()
|
|
|
+ let ids = '';
|
|
|
+ if (selectData.length > 0) {
|
|
|
+ selectData.map((v : any) => {
|
|
|
+ ids += v.id + ','
|
|
|
+ })
|
|
|
+ } else return this.$message({ type: 'warning', message: '请选择删除数据' })
|
|
|
+ ids = ids.slice(0, ids.length - 1);
|
|
|
+ this.$confirm('确定删除吗,此操作不能撤销!', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ api.deleteList({ ids: ids }, 'maindataMaterialCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.getDataList();
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ });
|
|
|
+ } else this.failHandle(res)
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
});
|
|
|
- this.$confirm('确定删除吗,此操作不能撤销!', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- center: true
|
|
|
- }).then(() => {
|
|
|
- api.classDelete({
|
|
|
- ids: this.cellsData.id
|
|
|
- }).then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.getDataList();
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '删除成功!'
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 操作删除
|
|
|
+ doDelete2(item : any) {
|
|
|
+ this.$confirm('确定删除吗,此操作不能撤销!', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ api.deleteList({ ids: item.id }, 'maindataMaterialCategory').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.getDataList();
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ });
|
|
|
+ } else this.failHandle(res)
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
});
|
|
|
- }, 0)
|
|
|
+ });
|
|
|
}
|
|
|
// 导航切换
|
|
|
handleNodeClick(e : any) {
|
|
|
- // console.log('导航切换id ==> ', e.id);
|
|
|
- this.loading = true;
|
|
|
- api.childrenTreeList(e.id).then((res : any) => {
|
|
|
+ api.childrenTreeList({ id: e.id },'maindataMaterialCategory').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
- this.tableData = res.data;
|
|
|
- this.loading = false;
|
|
|
+ (this.$refs.moduleView as any).setTableValue(res.data);
|
|
|
+ let page = {
|
|
|
+ pageNo: res.data.current, //当前页
|
|
|
+ pageSize: res.data.size, //每页条数
|
|
|
+ total: res.data.total //总条数
|
|
|
+ };
|
|
|
+ (this.$refs.moduleView as any).setPage(page)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- //重置
|
|
|
- resertHandle() {
|
|
|
- this.loading = true;
|
|
|
- (this.$refs.formId as any).setValue({});
|
|
|
- // (this.$refs.tableId as any).setPage({ pageNo: 1, total: 0 });
|
|
|
- this.getDataList();
|
|
|
- }
|
|
|
- //刷新
|
|
|
- onRefresh() {
|
|
|
- this.loading = true;
|
|
|
- // (this.$refs.formId as any).setValue({});
|
|
|
- // (this.$refs.tableId as any).setPage({ pageNo: 1, total: 0 });
|
|
|
- this.getDataList();
|
|
|
- }
|
|
|
- // 搜索
|
|
|
- searchHandle() {
|
|
|
- this.loading = true;
|
|
|
- let query : any = (this.$refs.formId as any).getValue();
|
|
|
- console.log(query);
|
|
|
- if (!query) return this.getDataList();
|
|
|
- api.searchTreeList(query).then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.tableData = [];
|
|
|
- this.tableData = res.data.records;
|
|
|
- this.loading = false;
|
|
|
- };
|
|
|
- })
|
|
|
- }
|
|
|
- //获取查询值
|
|
|
- getQuery() {
|
|
|
- let query : any = (this.$refs.formId as any).getValue();
|
|
|
- // const page:any = (this.$refs.tableId as any).getPage();
|
|
|
- // query.pageNum = page.pageNo;
|
|
|
- // query.pageSize = page.pageSize;
|
|
|
- return query;
|
|
|
- }
|
|
|
//导出
|
|
|
onExport() {
|
|
|
- let urlArr = '/maindata/maindataMaterialOrganizationCategory';
|
|
|
- let query = this.getQuery();
|
|
|
+ let urlArr = '/maindata/maindataMaterial';
|
|
|
+ let query = (this.$refs.moduleView as any).getQuery();
|
|
|
(this as any).$download(urlArr + '/export', {
|
|
|
...query
|
|
|
}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
|
|
|
-
|
|
|
- }
|
|
|
- //显示/隐藏搜索
|
|
|
- toggleSearch() {
|
|
|
- this.hideSearch = !this.hideSearch
|
|
|
}
|
|
|
// 运行错误
|
|
|
failHandle(err : any) {
|
|
|
let msg = err.msg ? err.msg : '运行错误!';
|
|
|
this.$message.error(msg)
|
|
|
}
|
|
|
- }
|
|
|
-</script>
|
|
|
-<style lang="scss">
|
|
|
- .my-container {
|
|
|
- .el-form-item__label {
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
-
|
|
|
- .el-form-item__content {
|
|
|
- margin-right: 20px;
|
|
|
- }
|
|
|
-
|
|
|
- .has-gutter .is-leaf.el-table__cell:nth-of-type(5) {
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
-
|
|
|
- .form-row.el-row>div {
|
|
|
- margin-bottom: 10px;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .el-dialog:not(.is-fullscreen) {
|
|
|
- margin-top: 15vh !important;
|
|
|
- }
|
|
|
|
|
|
- .el-message-box {
|
|
|
- vertical-align: baseline;
|
|
|
}
|
|
|
-</style>
|
|
|
+</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.my-container {
|
|
|
width: 100%;
|
|
@@ -440,6 +385,13 @@
|
|
|
display: flex;
|
|
|
padding: 16px;
|
|
|
|
|
|
+ .search-btn {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
.bill-left {
|
|
|
position: relative;
|
|
|
border-right: solid #EEE 1px;
|
|
@@ -502,29 +454,6 @@
|
|
|
margin-left: 16px;
|
|
|
position: relative;
|
|
|
|
|
|
- .upload-img {
|
|
|
- width: 150px;
|
|
|
- height: 150px;
|
|
|
- line-height: 150px;
|
|
|
- text-align: center;
|
|
|
- border-radius: 5px;
|
|
|
- background-color: #fbfdff;
|
|
|
- color: #8c939d;
|
|
|
- border: 1px dashed #c0ccda;
|
|
|
- font-size: 28px;
|
|
|
- }
|
|
|
-
|
|
|
- .upload-img:hover {
|
|
|
- border-color: #1890ff;
|
|
|
- }
|
|
|
-
|
|
|
- .search-btn {
|
|
|
- width: 100%;
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
- margin-bottom: 20px;
|
|
|
- }
|
|
|
-
|
|
|
.bill-box {
|
|
|
width: 100%;
|
|
|
position: absolute;
|