属性配置-标准体系

This commit is contained in:
zyn
2023-10-10 14:58:22 +08:00
parent 6cbe9dc6e4
commit f1a9b2f5a3
6 changed files with 332 additions and 10 deletions
+51 -1
View File
@@ -558,7 +558,27 @@ export default {
})
},
_postData (url, param = {}, config = {}) {
_postData (url, params, config = {}) {
// 参数包含this
let _this = config._this || false
// 参数包含loading
let loading = config.loading || false
if (_this && loading) {
_this[loading] = true
}
return new Promise((resolve, reject)=>{
_axios.post(api() + url + '?_t=' + new Date().getTime(), params).then(res => {
resolve(res.data)
}).catch(err => {
reject(err)
}).finally(()=>{
if (_this && loading) { _this[loading] = false }
})
})
},
_post (url, param = {}, config = {}) {
return new Promise((resolve,reject) => {
var _formData = formData(param)
// 参数包含this
@@ -585,6 +605,36 @@ export default {
})
},
_deleteData (url, params = {}) {
return new Promise((resolve, reject)=>{
_axios.delete(api() + url + '?_t=' + new Date().getTime(), { params }).then(res => {
resolve(res.data)
}).catch(err => {
reject(err)
})
})
},
_putData (url, params = {}, config = {}) {
// 参数包含this
let _this = config._this || false
// 参数包含loading
let loading = config.loading || false
if (_this && loading) {
_this[loading] = true
}
return new Promise((resolve, reject)=>{
_axios.put(api() + url + '?_t=' + new Date().getTime(), params).then(res => {
resolve(res.data)
}).catch(err => {
reject(err)
}).finally(()=>{
if (_this && loading) { _this[loading] = false }
})
})
},
_downloadFile (url, params = {}, method = 'get', fileName = '导出文件') {
_axios({
method,
@@ -0,0 +1,259 @@
<template>
<div class="tree">
<el-tree
:data="data"
:props="defaultProps"
node-key="id"
:default-expanded-keys="['aaaaaaaaaaaaaaaaaaaaaa']"
highlight-current
:render-content="renderContent"></el-tree>
<el-drawer
:wrapperClosable="false"
:title="drawerTitle"
:visible.sync="drawerVisible"
size="800px"
:before-close="handleClose"
label-width="130px"
>
<div class="demo-drawer-content">
<el-form :model="addModel"
ref="addModelRef"
:rules="rules"
class="label-input-form"
label-width="130px">
<el-row>
<el-col>
<el-form-item label="菜单名称" prop="menuName" class="add-form-item">
<el-input v-model.trim="addModel.menuName" placeholder="请输入菜单名称" clearable></el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="排序号" prop="displaySeq" class="add-form-item">
<el-input v-model.number="addModel.displaySeq"
number
placeholder="请输入排序号"
:maxlength="4"
clearable></el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item v-if="this.drawerTitle === '编辑体系'" label="上级菜单" prop="parentIdsName" class="add-form-item">
<el-input v-model="addModel.parentIdsName" disabled
clearable></el-input>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="描述" prop="remarks" class="add-form-item">
<el-input v-model.trim="addModel.remarks"
placeholder="请输入描述"
clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="demo-drawer-footer">
<el-button
class="common-button-primary"
icon="el-icon-check"
type="primary"
@click="handleSubmit('productModelAdd')">提交</el-button>
<el-button
class="common-button-default"
icon="el-icon-close"
@click="handleClose">取消</el-button>
</div>
</el-drawer>
</div>
</template>
<script>
export default {
name: "standSystem",
data() {
const rules = {
menuName: [
{required: true, message: '一级菜单不能为空', trigger: 'blur'},
{type: 'string', max: 100, message: '最多输入100位', trigger: 'blur'}
],
displaySeq: [
{type: 'number', required: true, message: '排序号不能为空且为正整数', trigger: 'blur'},
{type: 'string', validator: this.verify.validStandNumInCompile2, trigger: 'blur'}
],
remarks: [
{type: 'string', max: 500, message: '最多输入500位', trigger: 'blur'}
],
}
return {
api: {
getListStandLimit: "lawss/sarMenuStandardLimit/getListStandLimit",
addMenuStandard: 'lawss/sarMenuStandardLimit/addMenuStandard',
updateMenuStandard: 'lawss/sarMenuStandardLimit/updateMenuStandard',
deleteMenuStandard: 'lawss/sarMenuStandardLimit/deleteMenuStandard',
getMenuStandardById: 'lawss/sarMenuStandardLimit/getMenuStandardById'
},
data: [],
defaultProps: {
children: 'children',
label: 'menuName'
},
drawerTitle: '',
drawerVisible: false,
addModel: {},
rules
};
},
created() {
this.getData()
},
methods: {
handleNodeClick(data) {
console.log(data);
},
async getData () {
const res = await this.$http._getData(this.api.getListStandLimit,{dicId:'9m4qqqaansxmox5e82zm'})
if (res.ok && res.data) {
this.data = res.data
}
},
// 树节点鼠标移入移出
mouseenter(data){
this.$set(data, 'show', true)
if(data.parentId !== null){
this.$set(data, 'showDel', true)
}
},
mouseleave(data){
this.$set(data, 'show', false)
this.$set(data, 'showDel', false)
},
renderContent(h, { node, data, store }) {
return (
<span class="custom-tree-node" onmouseenter={ () => this.mouseenter(data) } onmouseleave={ () => this.mouseleave(data) }>
<span>{node.label}</span>
<span style={{ marginLeft: '5px' }}>
<el-button
type="text"
size="mini"
v-btn-permission="92c9a9c20c53a93ff77210ac2188e2f9"
style={{display : data.show ? 'inline-block' : 'none'}}
onClick={(e) => this.append(data, e)}>
新增
</el-button>
<el-button
type="text"
size="mini"
v-btn-permission="2028947dc28aba8f26f6f8be65f140e6"
style={{display : data.show ? 'inline-block' : 'none'}}
onClick={ (e) => this.update(data, e) }>
编辑
</el-button>
<el-button
type="text"
size="mini"
v-btn-permission="f0cef51d31a227b0058c15bb1de8a4b2"
style={{display : data.showDel ? 'inline-block' : 'none'}}
onClick={(e) => this.remove(node, data, e)}>
删除
</el-button>
</span>
</span>);
},
append(data, e) {
e.stopPropagation()
this.drawerTitle = '新增体系'
this.addModel.parentId = data.id
this.drawerVisible = true
},
update(data, e) {
e.stopPropagation()
this.drawerTitle = '编辑体系'
this.addModel = data
this.getMenuStandardById(data)
this.drawerVisible = true
},
remove(node, data, e) {
e.stopPropagation()
this.$confirm('是否删除菜单?', '提示', {
confirmButtonText: '确定',
confirmButtonClass: 'common-button-primary',
cancelButtonText: '取消',
roundButton: true,
type: 'warning'
}).then(() => {
this.$http._deleteData(this.api.deleteMenuStandard,{menuId: data.id}).then(res => {
if(res.ok){
this.$message({
type: 'success',
message: "删除成功"
})
this.getData()
}else {
this.$message({
type: 'warning',
message: res.message
})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
async getMenuStandardById (data) {
const res = await this.$http._getData(this.api.getMenuStandardById, {menuId: data.id})
if(res.ok && res.data){
this.addModel = res.data
} else {
this.$message({
type: 'warning',
message: res.message
})
}
},
async handleSubmit () {
let res = {}
switch (this.drawerTitle) {
case '新增体系':
res = await this.$http._postData(this.api.addMenuStandard,this.addModel)
break
case '编辑体系':
res = await this.$http._putData(this.api.updateMenuStandard, this.addModel)
break
}
if(res.ok){
this.$message({
type: 'success',
message: this.drawerTitle === '新增体系' ? "添加成功" : '编辑成功'
})
this.handleClose()
await this.getData()
}else {
this.$message({
type: 'warning',
message: res.message
})
}
},
handleClose () {
this.$set(this, 'addModel', {})
this.$refs['addModelRef'].resetFields()
this.drawerVisible = false
},
}
}
</script>
<style scoped lang="less">
.tree{
/deep/ .custom-tree-node {
display: flex;
align-items: center;
width: 100%;
height: 100%
}
}
</style>
@@ -16,6 +16,11 @@
<buss v-if="tabValue === 'buss'" ></buss>
</div>
</el-tab-pane>
<el-tab-pane label="标准体系" name="standSystem" v-if="standSystem">
<div style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<standSystem v-if="tabValue === 'standSystem'" ></standSystem>
</div>
</el-tab-pane>
<!-- <el-tab-pane label="其他" name="other">
<div style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<other v-if="tabValue === 'other'"></other>
@@ -29,6 +34,7 @@
import Laws from './components/laws'
import Stand from './components/stand'
import Buss from './components/buss'
import standSystem from './components/standSystem'
/*import Other from './components/other'*/
export default {
name: 'index',
@@ -36,6 +42,7 @@ export default {
Laws,
Stand,
Buss,
standSystem
// Other
},
data () {
@@ -44,13 +51,14 @@ export default {
regulations: false,
policy: false,
library: false,
menuName: [ "国内外标准法规", "国内外政策", "企业标准库"]
standSystem: false,
menuName: [ "国内外标准法规", "国内外政策", "企业标准库", "标准体系"]
}
},
mounted() {
const menuList = this.$store.getters.getMenuList;
let menuData = [];
let menuID = ["ad3ef2b8b8487229e52a7fe93416c437", "efcbe65f90d3a23f0be5df5ad60d1dac", "7feeb73929c25a6f1fd67952704ec02b"];
let menuID = ["ad3ef2b8b8487229e52a7fe93416c437", "efcbe65f90d3a23f0be5df5ad60d1dac", "7feeb73929c25a6f1fd67952704ec02b", "d1aa1a49496b0c1409f4206eb2647f7d"];
this.menuName.forEach(item => {
for (let i = 0; i < menuList.length; i++) {
let entity = menuList[i];
@@ -63,6 +71,8 @@ export default {
this.policy = true
} else if (entity.id === "7feeb73929c25a6f1fd67952704ec02b") {
this.library = true
} else if (entity.id === "d1aa1a49496b0c1409f4206eb2647f7d") {
this.standSystem = true
}
}
}
@@ -70,11 +80,14 @@ export default {
if (this.regulations === true) {
this.activeName = "stand"
return;
} else if (this.skill === true) {
this.policy = "laws"
} else if (this.policy) {
this.activeName = "laws"
return;
}else if (this.skill === true) {
this.library = "buss"
}else if (this.library) {
this.activeName = "buss"
return;
}else if (this.standSystem) {
this.activeName = "standSystem"
return;
}
}
@@ -1995,7 +1995,7 @@ export default {
// this.submitGetData();
// }, e => {
// })
this.$http._postData('lawss/activiti/completeTask',{
this.$http._post('lawss/activiti/completeTask',{
taskIds: val.data,
userId : this.$store.getters.userInfo.userId,
json: JSON.stringify(res.data),
@@ -2546,7 +2546,7 @@
},
ifStandCodebyStandName(standCode,standName,taskIds,standNum){
return new Promise((resolve, reject)=>{
this.$http._postData('lawss/sarBussionessStand/ifStandCodebyStandName',{standCode,standName,taskIds,standNum})
this.$http._post('lawss/sarBussionessStand/ifStandCodebyStandName',{standCode,standName,taskIds,standNum})
.then(res => resolve(res))
.catch(e => {
throw new Error(e)
@@ -2659,7 +2659,7 @@
},
ifStandCodebyStandName(standCode,standName,taskIds,standNum){
return new Promise((resolve, reject)=>{
this.$http._postData('lawss/sarBussionessStand/ifStandCodebyStandName',{standCode,standName,taskIds,standNum})
this.$http._post('lawss/sarBussionessStand/ifStandCodebyStandName',{standCode,standName,taskIds,standNum})
.then(res => resolve(res))
.catch(e => {
throw new Error(e)