|
@@ -1,145 +1,140 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
- <el-input
|
|
|
|
|
- v-model="listQuery.query"
|
|
|
|
|
- placeholder="请输入检索词"
|
|
|
|
|
- style="width: 60%;"
|
|
|
|
|
- class="filter-item"
|
|
|
|
|
- @keyup.enter.native="fetchData()"
|
|
|
|
|
- />
|
|
|
|
|
- <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="fetchData">
|
|
|
|
|
- 检索
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-button
|
|
|
|
|
- class="filter-item"
|
|
|
|
|
- style="margin: 0 10px 20px 0; float: right;"
|
|
|
|
|
- type="success"
|
|
|
|
|
- icon="el-icon-circle-plus-outline"
|
|
|
|
|
- @click="handleCreateOrUpdate('CREATE')"
|
|
|
|
|
- >
|
|
|
|
|
- 新建
|
|
|
|
|
- </el-button>
|
|
|
|
|
|
|
+ <div class="filter-container">
|
|
|
|
|
+ <el-button class="filter-item" size="mini" type="success" style="margin-right:15px;" @click="create">新增</el-button>
|
|
|
|
|
|
|
|
- <el-table
|
|
|
|
|
- :data="list"
|
|
|
|
|
- border
|
|
|
|
|
- fit
|
|
|
|
|
- highlight-current-row
|
|
|
|
|
- style="width: 100%;"
|
|
|
|
|
- >
|
|
|
|
|
- <el-table-column label="自定义ID" align="center" fixed width="100">
|
|
|
|
|
|
|
+ <el-input v-model="list.main.query.category" class="filter-item" size="mini" placeholder="类别" style="width:150px;margin-right:5px;" clearable />
|
|
|
|
|
+ <el-input v-model="list.main.query.name" class="filter-item" size="mini" placeholder="名称" style="width:150px;margin-right:5px;" clearable />
|
|
|
|
|
+ <el-input v-model="list.main.query.code" class="filter-item" size="mini" placeholder="编码" style="width:150px;margin-right:5px;" clearable />
|
|
|
|
|
+ <el-input v-model="list.main.query.enName" class="filter-item" size="mini" placeholder="英文名称" style="width:150px;margin-right:5px;" clearable />
|
|
|
|
|
+ <el-select v-model="list.main.query.baseUnit" class="filter-item" size="mini" placeholder="是否基础单位" style="width:150px;margin-right:5px;" clearable>
|
|
|
|
|
+ <el-option label="是" :value="true" />
|
|
|
|
|
+ <el-option label="否" :value="false" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <el-select v-model="list.main.query.baseUnitId" class="filter-item" size="mini" placeholder="引用的基础单位" style="width:150px;margin-right:5px;" filterable clearable>
|
|
|
|
|
+ <el-option v-for="item in baseUnitOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <el-button class="filter-item" size="mini" type="primary" @click="M.list()">查询</el-button>
|
|
|
|
|
+ <el-button class="filter-item" size="mini" @click="() => {M.reset({ data: { page: 1, limit: list.main.query.limit } })}">重置</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-table v-loading="list.main.loading" :data="list.main.list" border fit highlight-current-row style="width:100%" :max-height="maxHeight">
|
|
|
|
|
+ <el-table-column width="100" header-align="center" label="类别">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
- <span>{{ row.id2 }}</span>
|
|
|
|
|
|
|
+ <span>{{ row.category }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="名称" align="center" fixed width="200">
|
|
|
|
|
|
|
+ <el-table-column width="150" header-align="center" label="名称">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
<span>{{ row.name }}</span>
|
|
<span>{{ row.name }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="英文名称" align="center" width="200">
|
|
|
|
|
- <template slot-scope="{row}">
|
|
|
|
|
- <span>{{ row.enName }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column label="编码" align="center" width="100">
|
|
|
|
|
|
|
+ <el-table-column width="150" header-align="center" label="编码">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
<span>{{ row.code }}</span>
|
|
<span>{{ row.code }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="是否为基础单位" align="center" width="100">
|
|
|
|
|
|
|
+ <el-table-column width="100" header-align="center" label="英文名称">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
- <span>{{ row.isBaseUnit | booleanFilter }}</span>
|
|
|
|
|
|
|
+ <span>{{ row.enName }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="基础单位" align="center" width="200">
|
|
|
|
|
|
|
+ <el-table-column width="100" align="center" label="是否基础单位">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
- <span>{{ row.baseUnit }}</span>
|
|
|
|
|
|
|
+ <span v-if="row.baseUnit" style="color:green;">是</span>
|
|
|
|
|
+ <span v-else style="color:gray;">否</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="转换关系(1 * unit = ratio * baseUnit)" align="center" width="100">
|
|
|
|
|
|
|
+ <el-table-column width="180" header-align="center" align="right" label="转换比例">
|
|
|
|
|
+ <span slot="header">
|
|
|
|
|
+ 转换关系
|
|
|
|
|
+ <el-tooltip effect="dark" content="1 * unit = ratio * baseUnit" placement="top">
|
|
|
|
|
+ <i class="el-icon-question" />
|
|
|
|
|
+ </el-tooltip>
|
|
|
|
|
+ </span>
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
- <span>{{ row.ratio }}</span>
|
|
|
|
|
|
|
+ <span v-if="row.baseUnit">-</span>
|
|
|
|
|
+ <span v-else>
|
|
|
|
|
+ <span style="color:blue;font-weight:700;">1</span>({{ row.name }})
|
|
|
|
|
+ <span style="color:red;font-weight:700;"> = </span>
|
|
|
|
|
+ <span style="color:purple;font-weight:700;">{{ row.ratio }}</span>
|
|
|
|
|
+ <span style="color:red;font-weight:700;">*</span>
|
|
|
|
|
+ <span style="color:green;font-weight:700;">1</span>{{ row.baseUnitName || '基础单位' }}
|
|
|
|
|
+ </span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="最小刻度" align="center" width="100">
|
|
|
|
|
|
|
+ <el-table-column label="最小刻度" header-align="center" align="right" width="100">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
- <span>{{ row.minScale }}</span>
|
|
|
|
|
|
|
+ <span>{{ row.minScale || '-' }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="最大刻度" align="center" width="100">
|
|
|
|
|
|
|
+ <el-table-column label="最大刻度" header-align="center" align="right" width="100">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
- <span>{{ row.maxScale }}</span>
|
|
|
|
|
|
|
+ <span>{{ row.maxScale || '-' }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="卡尺每格刻度" align="center" width="100">
|
|
|
|
|
|
|
+ <el-table-column label="卡尺每格刻度" header-align="center" align="right" width="100">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
- <span>{{ row.stepScale }}</span>
|
|
|
|
|
|
|
+ <span>{{ row.stepScale || '-' }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="90">
|
|
|
|
|
|
|
+ <el-table-column width="160" align="center" label="操作">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
- <el-dropdown @command="handleCommand">
|
|
|
|
|
- <el-button size="small" type="primary" @click.stop="{}">
|
|
|
|
|
- 操作<i class="el-icon-arrow-down el-icon--right" />
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-dropdown-menu slot="dropdown">
|
|
|
|
|
- <el-dropdown-item :command="{row: row, command: 'update'}">更新</el-dropdown-item>
|
|
|
|
|
- <el-dropdown-item :command="{row: row, command: 'moveUp'}">上移</el-dropdown-item>
|
|
|
|
|
- <el-dropdown-item :command="{row: row, command: 'moveDown'}">下移</el-dropdown-item>
|
|
|
|
|
- <el-dropdown-item :command="{row: row, command: 'moveTop'}">置顶</el-dropdown-item>
|
|
|
|
|
- <el-dropdown-item :command="{row: row, command: 'moveBottom'}">置底</el-dropdown-item>
|
|
|
|
|
- </el-dropdown-menu>
|
|
|
|
|
- </el-dropdown>
|
|
|
|
|
|
|
+ <i class="el-icon-edit" style="cursor:pointer;color:#999999;margin-right:5px;" @click="edit(row)"></i>
|
|
|
|
|
+
|
|
|
|
|
+ <i class="el-icon-delete" style="cursor:pointer;color:#999999;margin-right:5px;"></i>
|
|
|
|
|
+
|
|
|
|
|
+ <i class="el-icon-top" style="cursor:pointer;color:#999999;margin-right:5px;"></i>
|
|
|
|
|
+
|
|
|
|
|
+ <i class="el-icon-bottom" style="cursor:pointer;color:#999999;"></i>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
+ <pagination v-show="list.main.total>0" :total="list.main.total" :page.sync="list.main.query.page" :limit.sync="list.main.query.limit" @pagination="M.list()" />
|
|
|
|
|
|
|
|
- <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="fetchData" />
|
|
|
|
|
-
|
|
|
|
|
- <el-dialog :title="textMapping[dialogStatus]" :visible.sync="dialogFormVisible">
|
|
|
|
|
- <el-form ref="dataForm" :rules="rules" :model="params" label-position="left" label-width="150px" style="width: 400px; margin-left:50px;">
|
|
|
|
|
- <el-form-item label="自定义ID" prop="id2">
|
|
|
|
|
- <el-input v-model="params.id2" placeholder="请输入自定义ID" />
|
|
|
|
|
|
|
+ <el-dialog :title="dlg.form.title" :visible.sync="dlg.form.visible" width="500px">
|
|
|
|
|
+ <el-form ref="form" :rules="dlg.form.rules" :model="dlg.form.data" size="mini" label-position="right" label-width="100px">
|
|
|
|
|
+ <el-form-item label="类别" prop="category">
|
|
|
|
|
+ <el-input v-model="dlg.form.data.category" placeholder="请输入单位类别" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="名称" prop="name">
|
|
<el-form-item label="名称" prop="name">
|
|
|
- <el-input v-model="params.name" placeholder="请输入名称" :disabled="dialogStatus === 'UPDATE'" />
|
|
|
|
|
|
|
+ <el-input v-model="dlg.form.data.name" placeholder="请输入单位名称,不能重复" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="英文名称" prop="enName">
|
|
|
|
|
- <el-input v-model="params.enName" placeholder="请输入英文名称" />
|
|
|
|
|
|
|
+ <el-form-item label="编码">
|
|
|
|
|
+ <el-input v-model="dlg.form.data.code" placeholder="请输入单位编码,可为空,但不能重复" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="编码" prop="code">
|
|
|
|
|
- <el-input v-model="params.code" placeholder="请输入编码" />
|
|
|
|
|
|
|
+ <el-form-item label="英文名称">
|
|
|
|
|
+ <el-input v-model="dlg.form.data.enName" placeholder="请输入单位英文名称" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="是否为基础单位" prop="code">
|
|
|
|
|
- <el-radio v-model="params.isBaseUnit" :label="true" :disabled="dialogStatus === 'UPDATE'">是</el-radio>
|
|
|
|
|
- <el-radio v-model="params.isBaseUnit" :label="false" :disabled="dialogStatus === 'UPDATE'">否</el-radio>
|
|
|
|
|
|
|
+ <el-form-item label="是否基础单位">
|
|
|
|
|
+ <el-checkbox v-model="dlg.form.data.baseUnit" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="!params.isBaseUnit" label="基础单位" prop="code">
|
|
|
|
|
- <el-select v-model="params.baseUnitId" :disabled="dialogStatus === 'UPDATE'">
|
|
|
|
|
- <el-option v-for="item in baseUnits" :key="item.id" :value="item.id" :label="item.name" />
|
|
|
|
|
|
|
+ <el-form-item v-if="!dlg.form.data.baseUnit" label="基础单位" required>
|
|
|
|
|
+ <el-select v-model="dlg.form.data.baseUnitId" class="filter-item" size="mini" placeholder="基础单位" style="width:100%;" @change="baseUnitChange" filterable>
|
|
|
|
|
+ <el-option v-for="item in baseUnitOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="!params.isBaseUnit" label="转换关系(1 * unit = ratio * baseUnit)" prop="ratio">
|
|
|
|
|
- <el-input v-model="params.ratio" placeholder="请输入转换关系" :disabled="dialogStatus === 'UPDATE'" />
|
|
|
|
|
|
|
+ <el-form-item v-if="!dlg.form.data.baseUnit" label="转换关系" required>
|
|
|
|
|
+ <el-input v-model="dlg.form.data.ratio" placeholder="转换比例">
|
|
|
|
|
+ <span slot="prepend">1 {{ dlg.form.data.name }} = </span>
|
|
|
|
|
+ <span slot="append"> * {{ dlg.form.data.baseUnitName || '基础单位' }}</span>
|
|
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="最小刻度" prop="minScale">
|
|
|
|
|
- <el-input v-model="params.minScale" placeholder="请输入最小刻度" />
|
|
|
|
|
|
|
+ <el-form-item label="最小刻度">
|
|
|
|
|
+ <el-input v-model="dlg.form.data.minScale" placeholder="请输入卡尺最小刻度" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="最大刻度" prop="maxScale">
|
|
|
|
|
- <el-input v-model="params.maxScale" placeholder="请输入最大刻度" />
|
|
|
|
|
|
|
+ <el-form-item label="最大刻度">
|
|
|
|
|
+ <el-input v-model="dlg.form.data.maxScale" placeholder="请输入卡尺最大刻度" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="卡尺每格刻度" prop="stepScale">
|
|
|
|
|
- <el-input v-model="params.stepScale" placeholder="请输入卡尺每格刻度" />
|
|
|
|
|
|
|
+ <el-form-item label="卡尺每格刻度">
|
|
|
|
|
+ <el-input v-model="dlg.form.data.stepScale" placeholder="请输入卡尺每格刻度" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
-
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogFormVisible = false">
|
|
|
|
|
|
|
+ <el-button size="mini" @click="dlg.form.visible = false">
|
|
|
取消
|
|
取消
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-button type="primary" @click="createOrUpdateData">
|
|
|
|
|
- 提交
|
|
|
|
|
|
|
+ <el-button :loading="dlg.form.saveLoading" size="mini" type="primary" @click="M.save()">
|
|
|
|
|
+ 确认
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -147,110 +142,78 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { getList, updateSortOrder, getBaseUnits, createUnit, updateUnit } from '@/api/unit'
|
|
|
|
|
import Pagination from '@/components/Pagination'
|
|
import Pagination from '@/components/Pagination'
|
|
|
|
|
+import { fGet, fPost } from '@/api/rest'
|
|
|
|
|
+import { M } from '@/api/op'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
- name: 'UnitList',
|
|
|
|
|
components: { Pagination },
|
|
components: { Pagination },
|
|
|
- filters: {
|
|
|
|
|
- booleanFilter(value) {
|
|
|
|
|
- return value ? '是' : '否'
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- list: [],
|
|
|
|
|
- listLoading: false,
|
|
|
|
|
- listQuery: {
|
|
|
|
|
- query: '',
|
|
|
|
|
- pageNum: 1,
|
|
|
|
|
- pageSize: 50
|
|
|
|
|
- },
|
|
|
|
|
- total: 0,
|
|
|
|
|
- textMapping: { 'CREATE': '创建', 'UPDATE': '更新' },
|
|
|
|
|
- dialogStatus: '',
|
|
|
|
|
- dialogFormVisible: false,
|
|
|
|
|
- rules: {
|
|
|
|
|
- name: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
|
|
|
|
|
|
|
+ M: new M(this),
|
|
|
|
|
+ URI: '/api/units',
|
|
|
|
|
+ maxHeight: 600,
|
|
|
|
|
+ baseUnitOptions: [],
|
|
|
|
|
+ list: {
|
|
|
|
|
+ main: {
|
|
|
|
|
+ loading: true,
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ list: [],
|
|
|
|
|
+ render(row) {
|
|
|
|
|
+ return row
|
|
|
|
|
+ },
|
|
|
|
|
+ query: {
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ limit: 50
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
- params: {},
|
|
|
|
|
- baseUnits: []
|
|
|
|
|
|
|
+ dlg: {
|
|
|
|
|
+ form: {
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ title: '',
|
|
|
|
|
+ data: {},
|
|
|
|
|
+ saveLoading: false,
|
|
|
|
|
+ rules: {
|
|
|
|
|
+ category: [{ required: true, message: '类别不能为空', trigger: 'blur' }],
|
|
|
|
|
+ name: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- this.fetchData()
|
|
|
|
|
|
|
+ this.maxHeight = document.documentElement.clientHeight - 135
|
|
|
|
|
+ this.M.list()
|
|
|
|
|
+ this.loadBaseUnit()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- fetchData() {
|
|
|
|
|
- this.listLoading = true
|
|
|
|
|
- getList(this.listQuery).then(res => {
|
|
|
|
|
- this.list = res.data.list
|
|
|
|
|
- this.total = res.data.count
|
|
|
|
|
- this.listLoading = false
|
|
|
|
|
- }).catch(res => {
|
|
|
|
|
- this.$message('获取数据失败')
|
|
|
|
|
- this.listLoading = false
|
|
|
|
|
|
|
+ loadBaseUnit() {
|
|
|
|
|
+ fGet(this.URI, { baseUnit: true, size: 10000 }).then(res => {
|
|
|
|
|
+ this.baseUnitOptions = res.data.map(v => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ label: v.name,
|
|
|
|
|
+ value: v.id
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- handleCreateOrUpdate(dialogStatus, row) {
|
|
|
|
|
- if (this.baseUnits <= 0) {
|
|
|
|
|
- this.fetchBaseUnits()
|
|
|
|
|
- }
|
|
|
|
|
- this.dialogStatus = dialogStatus
|
|
|
|
|
- this.params = dialogStatus === 'CREATE' ? {} : Object.assign(row, {})
|
|
|
|
|
- this.dialogFormVisible = true
|
|
|
|
|
|
|
+ create() {
|
|
|
|
|
+ this.M.create({ form: 'form', title: '新增', data: {} })
|
|
|
},
|
|
},
|
|
|
- updateSort(row, type) {
|
|
|
|
|
- updateSortOrder(row.id, { type }).then(res => {
|
|
|
|
|
- this.fetchData()
|
|
|
|
|
- this.$notify.success('提交成功')
|
|
|
|
|
- }).catch(res => {
|
|
|
|
|
- this.fetchData()
|
|
|
|
|
- this.$message.error(res.data.message)
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- fetchBaseUnits() {
|
|
|
|
|
- getBaseUnits().then(res => {
|
|
|
|
|
- this.baseUnits = res.data.list
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ edit(row) {
|
|
|
|
|
+ this.M.edit({ form: 'form', title: 'name', row: row })
|
|
|
},
|
|
},
|
|
|
- createOrUpdateData() {
|
|
|
|
|
- const resultPromise = this.dialogStatus === 'CREATE' ? createUnit(this.params) : updateUnit(this.params.id,
|
|
|
|
|
- this.params)
|
|
|
|
|
- resultPromise.then(res => {
|
|
|
|
|
- this.fetchData()
|
|
|
|
|
- this.$notify.success('提交成功')
|
|
|
|
|
- this.dialogFormVisible = false
|
|
|
|
|
- }).catch(res => {
|
|
|
|
|
- this.fetchData()
|
|
|
|
|
- this.$message.error(res.data.message)
|
|
|
|
|
- this.dialogFormVisible = false
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- handleCommand(data) {
|
|
|
|
|
- switch (data.command) {
|
|
|
|
|
- case 'update':
|
|
|
|
|
- this.handleCreateOrUpdate('UPDATE', data.row)
|
|
|
|
|
- break
|
|
|
|
|
- case 'moveUp':
|
|
|
|
|
- this.updateSort(data.row, 0)
|
|
|
|
|
- break
|
|
|
|
|
- case 'moveDown':
|
|
|
|
|
- this.updateSort(data.row, 1)
|
|
|
|
|
- break
|
|
|
|
|
- case 'moveTop':
|
|
|
|
|
- this.updateSort(data.row, 2)
|
|
|
|
|
- break
|
|
|
|
|
- case 'moveBottom':
|
|
|
|
|
- this.updateSort(data.row, 3)
|
|
|
|
|
- break
|
|
|
|
|
|
|
+ baseUnitChange() {
|
|
|
|
|
+ if (!!this.dlg.form.data.baseUnitId) {
|
|
|
|
|
+ const baseUnit = this.baseUnitOptions.find(v => v.value == this.dlg.form.data.baseUnitId)
|
|
|
|
|
+ if (!!baseUnit) {
|
|
|
|
|
+ this.dlg.form.data.baseUnitName = baseUnit.label
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.dlg.form.data.baseUnitName = undefined
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
-
|
|
|
|
|
-<style scoped>
|
|
|
|
|
-
|
|
|
|
|
-</style>
|
|
|