123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770 |
- <template>
- <div class="my-container">
- <transition-group name="fade" style="position: relative;width: 100%;display: flex;">
- <div class="bill-main" v-show="isShow==='ckb'" key="item">
- <module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
- @resert="getDataList" @detail="openEdit" @onRefresh="onRefresh">
- </module-view>
- <!-- 注册/编辑弹窗 -->
- <el-dialog :title="popTitle+'仓库'" :visible.sync="dialogFormVisible" width="30%">
- <by-form :propConfig="addConfig" ref="addFormId"></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>
- <div class="bill-main" v-show="isShow==='cwb'" key="item2">
- <module-view :propConfig="config2" ref="moduleView2" @clickHandle="clickHandle2" @detail="openEdit2"
- @pagination="getDataList2" @search="getDataList2" @resert="getDataList2" @onRefresh="onRefresh2">
- </module-view>
- <!-- 注册/编辑弹窗 -->
- <el-dialog :title="popTitle+'仓位'" :visible.sync="dialogFormVisible2" width="30%">
- <by-form :propConfig="addConfig2" ref="addFormId2">
- <template v-slot:organizationName="{value}">
- <el-input placeholder="请选择所属机构名称" size="small" v-model="value.organizationName"
- class="input-organizationName" :readonly="true">
- <el-button slot="append" icon="el-icon-more" @click="handleSupplier"></el-button>
- </el-input>
- </template>
- <template v-slot:stock="{value}">
- <vxe-input v-if="isAdd" v-model="value.stock" style="width: 100%;" size="small" type="text"></vxe-input>
- <span v-else>{{ value.stock }}</span>
- </template>
- </by-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible2 = false">取 消</el-button>
- <el-button type="primary" @click="confirm2">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </transition-group>
- <supplier-modal ref="supplierModal" @confirm="confirmSupplier" :zIndex="9999" />
- </div>
- </template>
- <script lang="ts">
- import { Component, Prop, Vue, Watch } from "vue-property-decorator";
- import api from "@/api/currency";
- @Component
- export default class Depots extends Vue {
- isShow : any = 'ckb'
- timeNum = 0;
- timer : any = null
- timeNum2 = 0;
- timer2 : any = null
- popTitle : any = ''
- tableData : any = {}
- dialogFormVisible : boolean = false
- dialogFormVisible2 : boolean = false
- isAdd : any = false
- config : any = {
- attr:{
- calculateH:true
- },
- search: {
- attr: {
- size: 'mini'
- },
- columns: [
- [{
- span: 6,
- label: '仓库名称',
- prop: 'name',
- component: 'by-input',
- labelWidth: '70px',
- compConfig: {
- attr: {
- placeholder: '请输入名称',
- clearable: true
- },
- },
- }, {
- span: 6,
- label: '地址',
- prop: 'address',
- component: 'by-input',
- labelWidth: '70px',
- compConfig: {
- attr: {
- placeholder: '请输入地址',
- clearable: true
- }
- }
- },
- ]
- ]
- },
- tool: {
- tools: {
- search: true,
- refresh: true
- },
- customTools: [
- {
- name: '注册', icon: 'el-icon-plus', audit: [''], event: {
- click: () => {
- (this as any).onAdd();
- }
- }
- }
- ]
- },
- table: {
- attr: {
- size: 'mini',
- align: 'left',
- },
- columns: [{
- title: '名称',
- field: 'name',
- isDetail: true,
- },
- {
- title: '第三方系统名称',
- field: 'financeType',
- },
- {
- title: '第三方仓库编码',
- field: 'financeStorehouseNo',
- },
- {
- title: '第三方仓库名称',
- field: 'financeStorehouseName',
- },
- {
- title: '地址',
- field: 'address',
- },
- {
- width: 100,
- title: '仓位',
- action: true,
- plugins: [{
- icon: 'el-icon-edit',
- name: '查看',
- audit: '',
- event: {
- click: (item : any) => {
- (this as any).changeTab(item)
- }
- }
- }]
- }, {
- width: 120,
- 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, 'maindataStorehouse')
- }
- }]
- }]
- },
- }
- config2 : any = {
- attr:{
- calculateH:true
- },
- search: {
- attr: {
- size: 'mini'
- },
- columns: [
- [
- {
- span: 6,
- label: '名称',
- prop: 'name',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入名称',
- clearable: true
- },
- },
- },
- {
- span: 6,
- label: '所属机构名称',
- prop: 'organizationName',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入所属机构名称',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '库存',
- prop: 'stock',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入库存',
- clearable: true
- },
- },
- },
- {
- span: 6,
- label: '库存体积',
- prop: 'stockVolume',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入库存体积',
- clearable: true
- },
- },
- },
- ],
- [
- {
- span: 6,
- label: '库存上限数量',
- prop: 'maxStockNumber',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入库存上限数量',
- clearable: true
- }
- }
- },
- {
- span: 6,
- label: '库存体积上限',
- prop: 'maxStockVolume',
- component: 'by-input',
- compConfig: {
- attr: {
- placeholder: '请输入库存体积上限',
- clearable: true
- }
- }
- },
- ]
- ]
- },
- tool: {
- tools: {
- return: true,
- search: true,
- refresh: true
- },
- customTools: [
- {
- name: '注册', icon: 'el-icon-plus', audit: [''], event: {
- click: () => {
- (this as any).onAdd2();
- }
- }
- },
- {
- name: '删除', icon: 'el-icon-delete', audit: [''], event: {
- click: () => {
- (this as any).onDelete('moduleView2', 'maindataStoringLocation')
- }
- }
- },
- ]
- },
- table: {
- attr: {
- size: 'mini',
- seq: true,
- align: 'left',
- checkbox: true,
- },
- columns: [{
- width: 300,
- title: '仓位名称',
- field: 'name',
- isDetail: true,
- },
- {
- width: 250,
- title: '仓库名称',
- field: 'ckName',
- },
- {
- width: 200,
- title: '所属机构名称',
- field: 'organizationName',
- },
- {
- width: 150,
- title: '库存',
- field: 'stock'
- },
- {
- width: 150,
- title: '库存体积',
- field: 'stockVolume'
- },
- {
- width: 150,
- title: '库存数量上限',
- field: 'maxStockNumber'
- },
- {
- width: 150,
- title: '库存体积上限',
- field: 'maxStockVolume'
- }, {
- width: 120,
- title: '操作',
- action: true,
- plugins: [{
- icon: 'el-icon-edit',
- name: '编辑',
- audit: '',
- event: {
- click: (item : any) => {
- (this as any).openEdit2(item)
- }
- }
- }, {
- name: '删除',
- event: {
- click: (item : any) => (this as any).doDelete3(item, 'maindataStoringLocation')
- }
- }]
- }]
- },
- }
- addConfig = {
- attr: {
- size: 'small',
- rules: {
- name: [{
- required: true, message: '请输入名称', trigger: 'blur'
- }],
- address: [{
- required: true, message: '请输入地址', trigger: 'blur'
- }]
- }
- },
- columns: [
- [
- {
- span: 23,
- labelWidth: '110px',
- label: '名称',
- prop: 'name',
- component: 'by-input',
- },
- {
- span: 23,
- labelWidth: '110px',
- label: '第三方系统名称',
- prop: 'financeType',
- component: 'by-input',
- },
- {
- span: 23,
- labelWidth: '110px',
- label: '第三方仓库编码',
- prop: 'financeStorehouseNo',
- component: 'by-input',
- },
- {
- span: 23,
- labelWidth: '110px',
- label: '第三方仓库名称',
- prop: 'financeStorehouseName',
- component: 'by-input',
- },
- {
- span: 23,
- labelWidth: '110px',
- label: '地址',
- prop: 'address',
- component: 'by-input',
- },
- ]
- ]
- }
- addConfig2 = {
- attr: {
- size: 'small',
- rules: {
- name: [{
- required: true, message: '请输入名称', trigger: 'blur'
- }],
- organizationName: [{
- required: true, message: '请输入所属机构名称', trigger: 'blur'
- }],
- stock: [{
- required: true, message: '请输入库存', trigger: 'blur'
- }]
- }
- },
- columns: [
- [
- {
- labelWidth: '110px',
- span: 23,
- label: '名称',
- prop: 'name',
- component: 'by-input',
- },
- {
- labelWidth: '110px',
- span: 23,
- label: '所属机构名称',
- prop: 'organizationName',
- slot: true,
- },
- {
- labelWidth: '110px',
- span: 23,
- label: '库存',
- prop: 'stock',
- slot: true
- },
- {
- labelWidth: '110px',
- span: 23,
- label: '库存体积',
- prop: 'stockVolume',
- component: 'by-input',
- },
- {
- labelWidth: '110px',
- span: 23,
- label: '库存数量上限',
- prop: 'maxStockNumber',
- component: 'by-input',
- },
- {
- labelWidth: '110px',
- span: 23,
- label: '库存体积上限',
- prop: 'maxStockVolume',
- component: 'by-input',
- },
- ]
- ]
- }
- created() {
- this.timer = setInterval(() => {
- this.getDataList()
- }, 500)
- }
- // 仓库确认注册/编辑
- confirm() {
- (this as any).$refs.addFormId.validate().then(() => {
- let query = (this as any).$refs.addFormId.getValue();
- this.dialogFormVisible = false;
- if (this.popTitle === '注册') {
- let loading = this.$loading({ target: '.main-container' });
- api.saveList(query, 'maindataStorehouse').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success(this.popTitle + '成功');
- this.getDataList();
- this.$confirm('是否注册仓位', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- }).then(() => {
- api.single({ id: res.data }, 'maindataStorehouse').then((data : any) => {
- this.changeTab(data.data);
- this.onAdd2();
- })
- }).catch(() => { });
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- } else if (this.popTitle === '编辑') {
- let loading = this.$loading({ target: '.main-container' });
- api.updateList(query, 'maindataStorehouse').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success(this.popTitle + '成功');
- this.getDataList();
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }
- })
- }
- // 仓位确认注册/编辑
- confirm2() {
- (this as any).$refs.addFormId2.validate().then(() => {
- let query = (this as any).$refs.addFormId2.getValue();
- console.log('表单参数 ==> ', query);
- query.storehouseId = this.tableData.id;
- query.idDelete = 0;
- this.dialogFormVisible2 = false;
- if (this.popTitle === '注册') {
- let loading = this.$loading({ target: '.main-container' });
- api.saveList(query, 'maindataStoringLocation').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success(this.popTitle + '成功');
- this.getOneself(query.storehouseId);
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- } else if (this.popTitle === '编辑') {
- let loading = this.$loading({ target: '.main-container' });
- api.updateList(query, 'maindataStoringLocation').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success(this.popTitle + '成功');
- this.getOneself(query.storehouseId);
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }
- })
- }
- // 通过id拿到当条数据
- getOneself(e : any) {
- api.single({ id: e }, 'maindataStorehouse').then((res : any) => {
- if (res.code === 200) {
- this.tableData = res.data;
- this.tableData.subList.map((v : any) => {
- v.ckName = this.tableData.name;
- });
- (this.$refs.moduleView2 as any).setTableValue(this.tableData.subList);
- }
- })
- }
- // 获取仓库列表数据
- 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();
- let loading = this.$loading({ target: '.main-container' });
- api.pageList(query, 'maindataStorehouse').then((res : any) => {
- loading.close();
- 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.$message.error(res.msg)
- }).catch(() => loading.close());
- }
- // 获取仓位列表数据
- getDataList2() {
- if (!this.$refs.moduleView2) {
- if (this.timeNum2 > 5) {
- clearInterval(this.timer2)
- }
- this.timeNum2++;
- return
- }
- clearInterval(this.timer2)
- let query = (this.$refs.moduleView2 as any).getQuery();
- console.log(query);
- query.storehouseId = this.tableData.id;
- let loading = this.$loading({ target: '.main-container' });
- api.pageList(query, 'maindataStoringLocation').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- res.data.records.map((v : any) => {
- v.ckName = this.tableData.name;
- });
- (this.$refs.moduleView2 as any).setTableValue(res.data.records);
- let page = {
- pageNo: res.data.current, //当前页
- pageSize: res.data.size, //每页条数
- total: res.data.total //总条数
- };
- (this.$refs.moduleView2 as any).setPage(page)
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }
- // 工具栏方法
- clickHandle2(e : any) {
- if (e === 'onAdd') this.onAdd2();
- if (e === 'onReturn') this.isShow = 'ckb';
- }
- // 打开注册
- onAdd() {
- this.popTitle = '注册'
- this.dialogFormVisible = true;
- setTimeout(() => {
- if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
- }, 0)
- }
- // 打开编辑
- openEdit(e : any) {
- this.popTitle = '编辑'
- this.dialogFormVisible = true;
- setTimeout(() => {
- if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
- }, 0)
- }
- // 打开注册
- onAdd2() {
- this.popTitle = '注册'
- this.dialogFormVisible2 = true;
- this.isAdd = true;
- setTimeout(() => {
- if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue({});
- }, 0)
- }
- // 打开编辑
- openEdit2(e : any) {
- this.popTitle = '编辑'
- this.dialogFormVisible2 = true;
- this.isAdd = false;
- console.log(e);
- setTimeout(() => {
- if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue(e);
- }, 0)
- }
- // 打开机构选择
- handleSupplier() {
- (this.$refs.supplierModal as any).setShow(true);
- }
- // 确定机构选择
- confirmSupplier(e : any) {
- if (e.length == 0) return this.$message.warning('请选择供应商!');
- let value : any = (this.$refs.addFormId2 as any).getValue();
- value.organizationName = e[0].name;
- value.organizationId = e[0].id;
- (this.$refs.addFormId2 as any).setValue(value);
- }
- // 查看仓位
- changeTab(item : any) {
- api.single({id:item.id},'maindataStorehouse').then((res:any) => {
- if(res.code===200){
- this.tableData = res.data;
- res.data.subList.map((v : any) => {
- v.ckName = res.data.name;
- })
- console.log('仓库表数据 ==> ', res.data);
- (this.$refs.moduleView2 as any).setTableValue(res.data.subList);
- this.isShow = 'cwb';
- }
- })
- }
- // 刷新仓库
- onRefresh() {
- (this as any).$refs.moduleView.clearSearch();
- this.getDataList();
- }
- // 刷新仓位
- onRefresh2() {
- (this as any).$refs.moduleView2.clearSearch();
- this.getDataList2();
- }
- // 仓库操作删除
- doDelete2(item : any, url : any) {
- this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- if (item.subList.length > 0) {
- this.$message.warning('此仓库下有仓位,不可删除!');
- } else {
- let loading = this.$loading({ target: '.main-container' });
- api.deleteList({ ids: item.id }, url).then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.getDataList();
- this.$message.success('删除成功');
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 仓位工具栏删除
- onDelete(moduleView : any, url : any) {
- 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.warning('请选择删除数据');
- ids = ids.slice(0, ids.length - 1);
- this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let loading = this.$loading({ target: '.main-container' });
- api.deleteList({ ids: ids }, url).then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.getDataList2();
- this.$message.success('删除成功');
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }).catch(() => this.$message.info('已取消删除'));
- }
- // 仓位操作删除
- doDelete3(item : any, url : any) {
- console.log('仓位操作删除:', item, url);
- this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let loading = this.$loading({ target: '.main-container' });
- api.deleteList({ ids: item.id }, url).then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.getDataList2();
- this.$message.success('删除成功');
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }).catch(() => this.$message.info('已取消删除'));
- }
- }
- </script>
- <style lang="scss" scoped>
- .my-container {
- width: 100%;
- box-sizing: border-box;
- display: flex;
- padding: 0 16px;
- height: 100%;
- .search-btn {
- width: 100%;
- display: flex;
- justify-content: flex-end;
- margin-bottom: 20px;
- }
- .bill-main {
- width: calc(100% - 16px);
- box-sizing: border-box;
- margin-left: 16px;
- height: 100%;
- }
- @media screen and (min-width: 1500px) {
- .bill-main {
- min-width: 1610px;
- }
- }
- }
- </style>
|