unit单位初始化

This commit is contained in:
DESKTOP-H2PAFLR\Administrator
2023-08-07 18:02:42 +08:00
parent a9dbcf1b5b
commit cd27784ac9
10 changed files with 317 additions and 8 deletions

View File

@@ -32,6 +32,8 @@ import DictTag from '@/components/DictTag'
import UploadImage from '@/components/UploadImage/index';
// 上传文件
import UploadFile from '@/components/FileUpload/index';
// 字典数据组件
import DictData from '@/components/DictData'
// 全局方法挂载
Vue.prototype.getDicts = getDicts
@@ -71,6 +73,7 @@ Vue.use(plugins)
Vue.use(Element, {
size: Cookies.get('size') || 'small' // set element-ui default size
})
DictData.install()
Vue.config.productionTip = false

View File

@@ -231,4 +231,20 @@ export async function blobValidate(data) {
} catch (error) {
return true;
}
}
}
// 数据合并
export function mergeRecursive(source, target) {
for (var p in target) {
try {
if (target[p].constructor == Object) {
source[p] = mergeRecursive(source[p], target[p]);
} else {
source[p] = target[p];
}
} catch (e) {
source[p] = target[p];
}
}
return source;
};

View File

@@ -1,15 +1,117 @@
<template>
<div>
unit
<div class="app-container">
<el-form ref="unit" :model="unit" label-width="80px" :inline="true" v-show="showSearch">
<el-form-item label="单位编码">
<el-input v-model="unit.code"></el-input>
</el-form-item>
<el-form-item label="单位名称">
<el-input v-model="unit.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="handleExport">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="unitList" @selection-change="handleSelectionChange">
<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" >
<template slot-scope="scope">
<dict-tag1 :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>
</template>
</el-table-column>
</el-table>
<pagination :v-show="true" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
</div>
</template>
<script>
export default {
import {
listUnitmeasure,
listPrimaryUnitmeasure,
getUnitmeasure,
delUnitmeasure,
addUnitmeasure,
updateUnitmeasure,
} from '@/api/basisManagement/unit.js'
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,
},
unit: {
code: '1',
name: 'name',
},
unitList: [],
}
},
created() {
this.getList()
},
methods: {
handleQuery() {},
resetQuery() {
this.unit.code = ''
this.unit.name = ''
},
handleAdd() {},
handleUpdate() {},
handleDelete() {},
handleExport() {},
// 获取list
getList() {
this.loading = true
listUnitmeasure(this.queryParams).then((response) => {
this.unitList = response.data.list
this.total = response.data.total
this.loading = false
})
},
//处理多选
handleSelectionChange() {},
},
}
</script>
<style>
</style>
<style lang="scss" scoped></style>