产品定义
This commit is contained in:
38
ZR.Vue/src/api/basisManagement/productEfinition.js
Normal file
38
ZR.Vue/src/api/basisManagement/productEfinition.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
|
||||
export function listproductEfinition(query) {
|
||||
return request({
|
||||
url: '/mes/md/product/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//根据名称查询单条unit
|
||||
export function getUnitmeasure(query) {
|
||||
return request({
|
||||
url: '/mes/md/product/getUnit/'+query,
|
||||
method: 'get',
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
export function updateUnitmeasure(data) {
|
||||
return request({
|
||||
url: '/mes/md/unit/updateUnit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function addUnitmeasure(data) {
|
||||
return request({
|
||||
url: '/mes/md/unit/addUnit',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
// 查询单位列表
|
||||
export function listUnitmeasure(query) {
|
||||
return request({
|
||||
@@ -6,4 +7,46 @@ export function listUnitmeasure(query) {
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//根据主键查询单条unit
|
||||
export function getUnitmeasure(query) {
|
||||
return request({
|
||||
url: '/mes/md/unit/getUnit/'+query,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function updateUnitmeasure(data) {
|
||||
return request({
|
||||
url: '/mes/md/unit/updateUnit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function addUnitmeasure(data) {
|
||||
return request({
|
||||
url: '/mes/md/unit/addUnit',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function delUnitmeasure(id) {
|
||||
return request({
|
||||
url: '/mes/md/unit/delUnit/'+id,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 导出单位
|
||||
export async function exportUnit(query) {
|
||||
|
||||
await downFile('/mes/md/unit/exportUnit/', { ...query })
|
||||
|
||||
}
|
||||
|
||||
@@ -73,6 +73,9 @@ Vue.use(plugins)
|
||||
Vue.use(Element, {
|
||||
size: Cookies.get('size') || 'small' // set element-ui default size
|
||||
})
|
||||
|
||||
|
||||
|
||||
DictData.install()
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
@@ -167,7 +167,6 @@ export async function downFile(url, params, config) {
|
||||
var result = patt.exec(contentDisposition)
|
||||
var fileName = result[1]
|
||||
fileName = fileName.replace(/\"/g, '')
|
||||
|
||||
const blob = new Blob([data])
|
||||
saveAs(blob, fileName)
|
||||
} else {
|
||||
|
||||
353
ZR.Vue/src/views/basisManagement/productEfinition.vue
Normal file
353
ZR.Vue/src/views/basisManagement/productEfinition.vue
Normal file
@@ -0,0 +1,353 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="unit" :model="queryParams" label-width="80px" :inline="true" v-show="showSearch">
|
||||
<el-form-item label="产品编号">
|
||||
<el-input v-model="queryParams.code"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品名称">
|
||||
<el-input v-model="queryParams.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExcel_export">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="产品编码" align="center" prop="productCode" />
|
||||
<el-table-column label="产品名称" align="center" prop="productName" />
|
||||
<el-table-column label="单位" align="center" prop="productUnitName" />
|
||||
<el-table-column label="工艺路线" align="center" prop="processrouteName" />
|
||||
</el-table>
|
||||
<pagination :v-show="true" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改单位对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="dmlform" :model="dmlform" :rules="rules" label-width="150px">
|
||||
<el-form-item label="产品编码" prop="productCode">
|
||||
<el-input v-model="dmlform.productCode" placeholder="请输入产品编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品名称" prop="productName">
|
||||
<el-input v-model="dmlform.productName" placeholder="请输入产品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="measureName">
|
||||
<el-autocomplete
|
||||
v-model="dmlform.measureName"
|
||||
:fetch-suggestions="querymeasureNameAsync"
|
||||
placeholder="请输入单位名称"
|
||||
@select="handlemeasureNamSelect"
|
||||
></el-autocomplete>
|
||||
</el-form-item>
|
||||
<el-form-item label="工艺路线" prop="processrouteName">
|
||||
<el-autocomplete
|
||||
v-model="dmlform.processrouteName"
|
||||
:fetch-suggestions="queryprocessrouteNameAsync"
|
||||
placeholder="请输入工艺路线"
|
||||
@select="handleProcessrouteNameSelect"
|
||||
></el-autocomplete>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导出excel筛选 -->
|
||||
<el-dialog title="导出excel筛选" :visible.sync="exportopen" width="600px" append-to-body>
|
||||
<el-form ref="exportExcel" :model="exportExcel" label-width="150px" label-position="left">
|
||||
<el-form-item label="查询时间" prop="excelTime">
|
||||
<el-date-picker
|
||||
v-model="exportExcel.excelTime"
|
||||
type="datetimerange"
|
||||
:picker-options="pickerOptions"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
align="center"
|
||||
/></el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitExcelForm">导出</el-button>
|
||||
<el-button @click="exportopen = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listproductEfinition,
|
||||
listPrimaryUnitmeasure,
|
||||
getUnitmeasure,
|
||||
delUnitmeasure,
|
||||
addUnitmeasure,
|
||||
updateUnitmeasure,
|
||||
exportUnit,
|
||||
} from '@/api/basisManagement/productEfinition.js'
|
||||
import { debounce } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'unit',
|
||||
dicts: ['sys_yes_no'],
|
||||
data() {
|
||||
return {
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
multiple: false,
|
||||
total: 1,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
code: null,
|
||||
name: null,
|
||||
},
|
||||
//产品列表
|
||||
productList: [],
|
||||
//模态框名称
|
||||
title: '新增',
|
||||
open: false,
|
||||
exportopen: false,
|
||||
dmlform: {
|
||||
measureCode: '',
|
||||
productName: '',
|
||||
measureName: '',
|
||||
processrouteName: '',
|
||||
measureId: '',
|
||||
ProcessrouteId:""
|
||||
},
|
||||
rules: {
|
||||
measureCode: [{ required: true, message: '单位编码不能为空', trigger: 'blur' }],
|
||||
measureName: [{ required: true, message: '单位名称不能为空', trigger: 'blur' }],
|
||||
enableFlag: [{ required: true, message: '是否启用不能为空', trigger: 'blur' }],
|
||||
},
|
||||
ids: [],
|
||||
idsName: [],
|
||||
exportExcel: {
|
||||
excelTime: [],
|
||||
measureCode: '',
|
||||
measureName: '',
|
||||
enableFlag: '',
|
||||
},
|
||||
|
||||
pickerOptions: {
|
||||
shortcuts: [
|
||||
{
|
||||
text: '最近一周',
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
||||
picker.$emit('pick', [start, end])
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '最近一个月',
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
||||
picker.$emit('pick', [start, end])
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '最近三个月',
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
||||
picker.$emit('pick', [start, end])
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
resetQuery() {
|
||||
this.queryParams.code = null
|
||||
this.queryParams.name = null
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.title = '新增'
|
||||
this.open = true
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '修改'
|
||||
const measureId = row.measureId || this.ids
|
||||
getUnitmeasure(measureId).then((response) => {
|
||||
this.dmlform = response.data
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
const measureIds = row.measureId || this.ids
|
||||
const idsName = row.measureName || this.idsName
|
||||
this.$modal
|
||||
.confirm('是否确认删除单位编号为"' + idsName + '"的数据项?')
|
||||
.then(function () {
|
||||
return delUnitmeasure(measureIds)
|
||||
})
|
||||
.then((response) => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
// 获取list
|
||||
getList() {
|
||||
this.loading = true
|
||||
listproductEfinition(this.queryParams).then((response) => {
|
||||
this.productList = response.data.list
|
||||
this.total = response.data.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.measureId)
|
||||
this.idsName = selection.map((item) => item.measureName)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
submitForm() {
|
||||
this.$refs['dmlform'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.dmlform.measureId != null || this.dmlform.measureId == '') {
|
||||
updateUnitmeasure(this.dmlform).then((response) => {
|
||||
if (response.data == 1) {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
addUnitmeasure(this.dmlform).then((response) => {
|
||||
if (response.data == 1) {
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
measureId: null,
|
||||
measureCode: null,
|
||||
measureName: null,
|
||||
enableFlag: 'Y',
|
||||
remark: null,
|
||||
}
|
||||
this.resetForm('dmlform')
|
||||
},
|
||||
|
||||
//excel导出
|
||||
handleExcel_export() {
|
||||
this.exportopen = true
|
||||
},
|
||||
|
||||
async submitExcelForm() {
|
||||
this.exportExcel.starttime = this.exportExcel.excelTime[0]
|
||||
this.exportExcel.endtime = this.exportExcel.excelTime[1]
|
||||
await exportUnit(this.exportExcel)
|
||||
this.exportopen = false
|
||||
},
|
||||
|
||||
// 远程搜索单位
|
||||
querymeasureNameAsync(queryString, cb) {
|
||||
getUnitmeasure(queryString).then((res) => {
|
||||
const data = []
|
||||
for (let i of res.data) {
|
||||
data.push({
|
||||
unitid: i.measureId,
|
||||
value: i.measureName,
|
||||
})
|
||||
}
|
||||
//键值对
|
||||
cb(data)
|
||||
})
|
||||
},
|
||||
//处理单位选择
|
||||
handlemeasureNamSelect(row) {
|
||||
this.dmlform.measureId = row.unitid
|
||||
},
|
||||
//搜索远程工艺路线
|
||||
queryprocessrouteNameAsync(queryString, cb) {
|
||||
getUnitmeasure(queryString).then((res) => {
|
||||
const data = []
|
||||
for (let i of res.data) {
|
||||
data.push({
|
||||
unitid: i.measureId,
|
||||
value: i.measureName,
|
||||
})
|
||||
}
|
||||
//键值对
|
||||
cb(data)
|
||||
})
|
||||
},
|
||||
|
||||
handleProcessrouteNameSelect(row){
|
||||
this.dmlform.Processroute = row.unitid
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.delred {
|
||||
::v-deep .el-icon-delete {
|
||||
color: #f56c6c;
|
||||
}
|
||||
::v-deep span {
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="unit" :model="unit" label-width="80px" :inline="true" v-show="showSearch">
|
||||
<el-form ref="unit" :model="queryParams" label-width="80px" :inline="true" v-show="showSearch">
|
||||
<el-form-item label="单位编码">
|
||||
<el-input v-model="unit.code"></el-input>
|
||||
<el-input v-model="queryParams.code"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位名称">
|
||||
<el-input v-model="unit.name"></el-input>
|
||||
<el-input v-model="queryParams.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
@@ -24,7 +24,7 @@
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExcel_export">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@@ -33,21 +33,77 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="单位编码" align="center" prop="measureCode" />
|
||||
<el-table-column label="单位名称" align="center" prop="measureName" />
|
||||
<el-table-column label="是否启用" align="center" prop="enableFlag" >
|
||||
<el-table-column label="是否启用" align="center" prop="enableFlag">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" class="delred">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination :v-show="true" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改单位对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<el-form ref="dmlform" :model="dmlform" :rules="rules" label-width="150px">
|
||||
<el-form-item label="单位编码" prop="measureCode">
|
||||
<el-input v-model="dmlform.measureCode" placeholder="请输入单位编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位名称" prop="measureName">
|
||||
<el-input v-model="dmlform.measureName" placeholder="请输入单位名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="enableFlag">
|
||||
<el-radio-group v-model="dmlform.enableFlag">
|
||||
<el-radio v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="dmlform.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导出excel筛选 -->
|
||||
<el-dialog title="导出excel筛选" :visible.sync="exportopen" width="600px" append-to-body>
|
||||
<el-form ref="exportExcel" :model="exportExcel" label-width="150px" label-position="left">
|
||||
<el-form-item label="查询时间" prop="excelTime">
|
||||
<el-date-picker
|
||||
v-model="exportExcel.excelTime"
|
||||
type="datetimerange"
|
||||
:picker-options="pickerOptions"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
align="center"
|
||||
/></el-form-item>
|
||||
|
||||
<el-form-item label="单位编码" prop="measureCode">
|
||||
<el-input v-model="exportExcel.measureCode" placeholder="请输入单位编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位名称" prop="measureName">
|
||||
<el-input v-model="exportExcel.measureName" placeholder="请输入单位名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="enableFlag">
|
||||
<el-radio-group v-model="exportExcel.enableFlag">
|
||||
<el-radio v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitExcelForm">导出</el-button>
|
||||
<el-button @click="exportopen = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -59,7 +115,9 @@ import {
|
||||
delUnitmeasure,
|
||||
addUnitmeasure,
|
||||
updateUnitmeasure,
|
||||
exportUnit,
|
||||
} from '@/api/basisManagement/unit.js'
|
||||
import { debounce } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'unit',
|
||||
@@ -77,28 +135,111 @@ export default {
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
code: null,
|
||||
name: null,
|
||||
},
|
||||
|
||||
unit: {
|
||||
code: '1',
|
||||
name: 'name',
|
||||
},
|
||||
unitList: [],
|
||||
//模态框名称
|
||||
title: '新增',
|
||||
open: false,
|
||||
exportopen: false,
|
||||
dmlform: {
|
||||
measureCode: '',
|
||||
measureName: '',
|
||||
enableFlag: '',
|
||||
remark: '',
|
||||
},
|
||||
rules: {
|
||||
measureCode: [{ required: true, message: '单位编码不能为空', trigger: 'blur' }],
|
||||
measureName: [{ required: true, message: '单位名称不能为空', trigger: 'blur' }],
|
||||
enableFlag: [{ required: true, message: '是否启用不能为空', trigger: 'blur' }],
|
||||
},
|
||||
ids: [],
|
||||
idsName: [],
|
||||
exportExcel: {
|
||||
excelTime: [],
|
||||
measureCode: '',
|
||||
measureName: '',
|
||||
enableFlag: '',
|
||||
},
|
||||
|
||||
pickerOptions: {
|
||||
shortcuts: [
|
||||
{
|
||||
text: '最近一周',
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
||||
picker.$emit('pick', [start, end])
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '最近一个月',
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
||||
picker.$emit('pick', [start, end])
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '最近三个月',
|
||||
onClick(picker) {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
||||
picker.$emit('pick', [start, end])
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleQuery() {},
|
||||
resetQuery() {
|
||||
this.unit.code = ''
|
||||
this.unit.name = ''
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
handleAdd() {},
|
||||
handleUpdate() {},
|
||||
handleDelete() {},
|
||||
handleExport() {},
|
||||
resetQuery() {
|
||||
this.queryParams.code = null
|
||||
this.queryParams.name = null
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.title = '新增'
|
||||
this.open = true
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '修改'
|
||||
const measureId = row.measureId || this.ids
|
||||
getUnitmeasure(measureId).then((response) => {
|
||||
this.dmlform = response.data
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
const measureIds = row.measureId || this.ids
|
||||
const idsName = row.measureName || this.idsName
|
||||
this.$modal
|
||||
.confirm('是否确认删除单位编号为"' + idsName + '"的数据项?')
|
||||
.then(function () {
|
||||
return delUnitmeasure(measureIds)
|
||||
})
|
||||
.then((response) => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
// 获取list
|
||||
getList() {
|
||||
this.loading = true
|
||||
@@ -108,10 +249,77 @@ export default {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
//处理多选
|
||||
handleSelectionChange() {},
|
||||
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.measureId)
|
||||
this.idsName = selection.map((item) => item.measureName)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
||||
submitForm() {
|
||||
this.$refs['dmlform'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.dmlform.measureId != null || this.dmlform.measureId == '') {
|
||||
updateUnitmeasure(this.dmlform).then((response) => {
|
||||
if (response.data == 1) {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
addUnitmeasure(this.dmlform).then((response) => {
|
||||
if (response.data == 1) {
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
measureId: null,
|
||||
measureCode: null,
|
||||
measureName: null,
|
||||
enableFlag: 'Y',
|
||||
remark: null,
|
||||
}
|
||||
this.resetForm('dmlform')
|
||||
},
|
||||
|
||||
//excel导出
|
||||
handleExcel_export() {
|
||||
this.exportopen = true
|
||||
},
|
||||
|
||||
async submitExcelForm() {
|
||||
this.exportExcel.starttime=this.exportExcel.excelTime[0];
|
||||
this.exportExcel.endtime=this.exportExcel.excelTime[1];
|
||||
await exportUnit(this.exportExcel)
|
||||
this.exportopen=false;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss" scoped>
|
||||
.delred {
|
||||
::v-deep .el-icon-delete {
|
||||
color: #f56c6c;
|
||||
}
|
||||
::v-deep span {
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user