| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <template>
- <div id="stocktakingPlan_index">
- <el-card shadow="never" v-loading="loading">
- <plan-search ref="inventorySearch" @search="reload"> </plan-search>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- height="calc(100vh-300px)"
- :pageSize="20"
- :datasource="datasource"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="openEdit()"
- >
- 新建临时计划
- </el-button>
- </template>
- <template v-slot:code="{ row }">
- <el-link type="primary" @click="goDetail(row)">
- {{ row.code }}
- </el-link>
- </template>
- <template v-slot:action="{ row }">
- <el-link
- v-if="row.planStatus == 0"
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="assign(row)"
- >
- 派单
- </el-link>
- <el-link
- v-if="row.planStatus == 0"
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openEdit(row)"
- >
- 修改
- </el-link>
- <el-link
- v-if="row.planStatus == 0"
- type="danger"
- :underline="false"
- icon="el-icon-delete"
- @click="deleteRow(row)"
- >
- 删除
- </el-link>
- <el-link
- v-if="row.planStatus == 1"
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="revocationRow(row)"
- >
- 撤回
- </el-link>
- </template>
- </ele-pro-table>
- </el-card>
- <!-- 新建或编辑弹窗 -->
- <AddInventoryDialog
- ref="addInventoryDialogRef"
- :dialogTile="dialogTitle"
- :id="inventoryId"
- @refreshList="resetForm"
- :isBindPlan="isBindPlan"
- />
- <!-- 派单 -->
- <AssignDialog
- :visibleDialog.sync="visibleDialog"
- :planId="planId"
- @flushed="reload"
- ></AssignDialog>
- </div>
- </template>
- <script>
- import PlanSearch from './components/plan-search.vue';
- import AddInventoryDialog from './components/addInventoryDialog.vue';
- import AssignDialog from './components/assignDialog.vue';
- import {
- deleteInventoryPlan,
- getInventoryPlanList,
- revocationInventoryPlan
- } from '@/api/inventory';
- export default {
- components: {
- PlanSearch,
- AddInventoryDialog,
- AssignDialog
- },
- data() {
- return {
- // 表格列配置
- columns: [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- slot: 'code',
- prop: 'code',
- label: '计划单号',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'name',
- label: '计划名称',
- align: 'center',
- showOverflowTooltip: true,
- slot: 'enable',
- minWidth: 110
- },
- {
- prop: 'warehouseName',
- label: '盘点仓库',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'ruleName',
- label: '计划规则',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'planStatus',
- label: '状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (row, column) => {
- return this.statusList.filter(
- (item) => item.value == row.planStatus
- )[0].label;
- }
- },
- {
- prop: 'createUserName',
- label: '创建人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'createTime',
- label: '生成时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 250,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- // 加载状态
- loading: false,
- dialogTitle: '',
- isBindPlan: false,
- inventoryId: '',
- planId: '',
- // 0未派单;1已派单;2已完成;3已撤回;
- statusList: [
- { label: '未派单', value: 0 },
- { label: '已派单', value: 1 },
- { label: '已完成', value: 2 },
- { label: '已撤回', value: 3 }
- ],
- visibleDialog: false
- };
- },
- methods: {
- assign(row) {
- this.planId = row.id;
- this.visibleDialog = true;
- },
- // 重置
- resetForm() {
- this.$refs.inventorySearch.reset();
- },
- /* 表格数据源 */
- async datasource({ page, limit, where, order }) {
- return await getInventoryPlanList({
- pageNum: page,
- size: limit,
- ...where
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where });
- },
- openEdit(row) {
- if (row) {
- this.dialogTitle = '修改临时盘点计划';
- this.inventoryId = row.id;
- } else {
- this.dialogTitle = '新增临时盘点计划';
- this.inventoryId = '';
- }
- this.isBindPlan = false;
- this.$refs.addInventoryDialogRef.dialogVisible = true;
- },
- // goDetail(row) {
- // this.dialogTitle = '临时盘点计划详情';
- // this.inventoryId = row.id;
- // this.isBindPlan = true;
- // this.$refs.addInventoryDialogRef.dialogVisible = true;
- // },
- goDetail(row) {
- this.$router.push({
- path: '/warehouseManagement/stocktaking/plan/details',
- query: {
- id: row.id
- }
- });
- },
- // 删除未派单计划
- deleteRow(row) {
- this.$confirm('是否确定删除该盘点计划?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(async () => {
- await deleteInventoryPlan([row.id]);
- this.$message.success('删除成功!');
- this.$refs.table.reload();
- })
- .catch(() => {});
- },
- // 撤回
- revocationRow(row) {
- this.$confirm('是否确定撤回?', '提示', {
- type: 'warning'
- })
- .then(() => {
- revocationInventoryPlan({ id: row.id }).then((data) => {
- console.log(data);
- this.$message.success('撤回成功!');
- this.reload();
- });
- })
- .catch(() => {});
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- #stocktakingPlan_index {
- height: calc(100vh - 96px);
- width: 100%;
- padding: 10px;
- box-sizing: border-box;
- // element-ui样式穿透
- :deep(.el-card) {
- height: 100%;
- .el-card__body {
- height: 100%;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- .ele-pro-table {
- flex: 1;
- display: flex;
- flex-direction: column;
- .el-table {
- flex: 1;
- // display: flex;
- // flex-direction: column;
- // .el-table__body-wrapper {
- // flex: 1;
- // }
- }
- }
- }
- .el-form-item {
- margin-bottom: 5px !important;
- }
- }
- }
- </style>
|