chem_mes/jnpf-java-boot/jnpf-web/src/views/example/storearea/index.vue

160 lines
4.9 KiB
Vue
Raw Normal View History

<template>
<div class="JNPF-common-layout storearea_data">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="14">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="状态">
<JnpfSelect v-model="query.enabledStatus" placeholder="请选择" clearable :options="enabledStatusOptions"
:props="enabledStatusProps">
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="btn">
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">新建</el-button>
</div>
<div class="JNPF-common-head-right"></div>
</div>
<JNPF-table v-loading="listLoading" :data="list">
<el-table-column prop="storeAreCd" label="库区编码" align="center"/>
<el-table-column prop="storeAreaName" label="库区名称" align="center"/>
<el-table-column prop="storeHouseName" label="仓储名称" align="center"/>
<el-table-column prop="enabledStatus" label="状态" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.enabledStatus == 1 ? 'success' : 'info'" size="small">
{{ scope.row.enabledStatus == 1 ? '启用' : scope.row.enabledStatus == 2 ? '未启用' : scope.row.enabledStatus }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" align="center"/>
<el-table-column prop="creatorTime" label="创建时间" align="center" :formatter="jnpf.tableDateFormat1"/>
<el-table-column label="操作" fixed="right" align="center" width="100">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)">编辑</el-button>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
@pagination="initData" />
</div>
</div>
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh" />
</div>
</template>
<script>
import request from "@/utils/request";
import { mapGetters } from "vuex";
import JNPFForm from "./form";
import jnpf from "@/utils/jnpf";
export default {
name: "storearea",
components: {
JNPFForm,
},
data() {
return {
keyword: "",
query: {
storeAreCd: undefined,
storeAreaName: undefined,
enabledStatus: undefined,
storeHouseId: undefined,
},
defListQuery: {
sort: "desc",
sidx: "",
},
list: [],
listLoading: false,
multipleSelection: [],
total: 0,
listQuery: {
currentPage: 1,
pageSize: 20,
sort: "",
sidx: "",
},
formVisible: false,
enabledStatusOptions: [
{ fullName: "启用", id: 1 },
{ fullName: "未启用", id: 2 },
],
enabledStatusProps: { label: "fullName", value: "id" },
};
},
computed: {
jnpf() {
return jnpf
},
...mapGetters(["userInfo"]),
menuId() {
return this.$route.meta.modelId || "";
},
},
created() {
this.initData();
},
methods: {
initData() {
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
dataType: 0,
};
request({
url: `/api/example/storearea/getList`,
method: "post",
data: _query,
}).then((res) => {
var _list = [];
for (let i = 0; i < res.data.list.length; i++) {
let _data = res.data.list[i];
_list.push(_data);
}
this.list = _list;
this.total = res.data.pagination.total;
this.listLoading = false;
});
},
addOrUpdateHandle(row) {
let id = row ? row.id : "";
this.formVisible = true;
this.$nextTick(() => {
this.$refs.JNPFForm.init(id);
});
},
search() {
this.listQuery.currentPage = 1;
this.listQuery.pageSize = 20;
this.initData();
},
refresh(isrRefresh) {
this.formVisible = false;
if (isrRefresh) this.search();
},
reset() {
this.query = {
storeAreCd: undefined,
storeAreaName: undefined,
enabledStatus: undefined,
storeHouseId: undefined,
};
this.search();
},
},
};
</script>