Skip to content

Commit

Permalink
feat: create factory
Browse files Browse the repository at this point in the history
  • Loading branch information
xuxiaobo1010 committed Apr 21, 2022
1 parent 5a65626 commit 811ebc9
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 34 deletions.
Binary file added dist.rar
Binary file not shown.
57 changes: 57 additions & 0 deletions src/api/Modeling/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// <!--
// * @Author: h7ml
// * @Date: 2022-3-30 19:11:20
// * @LastEditors:
// * @LastEditTime: 2022-3-30 19:11:20
// * @Description: MetaData api
// * @FilePath: src\api\MetaData\index.js
// * @DocumentLink: https://docs.parseplatform.org/dotnet/guide/#push-MetaDatas
// -->

import request from '@/utils/request/request'
import {
create_object,
del_object,
get_object,
update_object,
query_object,
} from '@/api/Parse'

export async function queryRoleTree() {
return request({
url: `/roletree`,
method: 'get',
// params: params,
})
// return query_object('MetaData', params)
}
//iotapi/classes/Dict
export async function queryDictTemp(params) {
return request({
url: `/classes/Dict`,
method: 'get',
params: params,
})
// return query_object('MetaData', params)
}

// export async function getMetaData(ObjectId) {
// return get_object('MetaData', ObjectId)
// }

// export async function delMetaData(ObjectId) {
// return del_object('MetaData', ObjectId)
// }

// export async function putMetaData(ObjectId, params) {
// return update_object('MetaData', ObjectId, params)
// }

export async function postRole(params) {
return request({
url: `/role`,
method: 'post',
data: params,
})
// return create_object('role', params)
}
40 changes: 40 additions & 0 deletions src/views/CloudOc/Modeling/components/detail.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!--
* @Author: dgiot-fe <dgiot@foxmail.com>
* @Date: 2022-03-30 09:37:57
* @LastEditors: 9:37
* @LastEditTime: 2022-03-30 09:37:57
* @Description:
* @FilePath: src\views\CloudOc\Ftechnology\index.vue
* @DocumentLink: https://dev.iotn2n.com
* @github: https://github.com/dgiot/dgiot-dashboard.git
* @name: index
-->
<template>
<div class="detail-container">
<div class="detail">建模详情</div>
</div>
</template>

<script>
export default {
name: 'Detail',
components: {},
props: {},
data() {
return {}
},
computed: {},
watch: {},
created() {},
mounted() {},
destroyed() {},
methods: {},
}
</script>

<style lang="scss" scoped>
.detail-container {
width: 100%;
height: 100%;
}
</style>
121 changes: 87 additions & 34 deletions src/views/CloudOc/Modeling/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@
<div class="ct_top">
<img src="../../../../public/assets/images/plant/gc.png" />
<div class="top_right">
<div class="right_item right_title">{{ item.title }}</div>
<div class="right_item">编码:{{ item.id }}</div>
<div class="right_item right_title">{{ item.name }}</div>
<div class="right_item">编码:{{ item.objectId }}</div>
<div class="right_item">
描述:
<span v-if="item.description">{{ item.description }}</span>
<span v-if="item.desc">{{ item.desc }}</span>
<span v-else>--</span>
</div>
</div>
</div>
<div class="ct_btm">
<el-button class="btm_left">查看</el-button>
<div class="btm_right">更新时间:{{ item.datetime }}</div>
<el-button class="btm_left" @click.native="modelToDetail(item)">
查看
</el-button>
<div class="btm_right">组织类型:{{ item.org_type }}</div>
</div>
</div>
</div>
Expand All @@ -48,21 +50,24 @@
>
<div class="demo-drawer__content">
<el-form ref="ruleForm" :model="form" :rules="rules">
<el-form-item
label="工厂名称"
:label-width="formLabelWidth"
prop="name"
>
<el-form-item label="工厂名称" prop="name">
<el-input v-model="form.name" placeholder="请输入工厂名称" />
</el-form-item>
<el-form-item
label="工厂编号"
:label-width="formLabelWidth"
prop="objectid"
>
<el-input v-model="form.objectid" placeholder="请输入工厂编号" />
<el-form-item label="岗位" prop="tempname">
<el-select
v-model="form.tempname"
placeholder="请选择活动区域"
size="medium"
>
<el-option
v-for="item in dict"
:key="item.objectId"
:label="item.key"
:value="item.key"
/>
</el-select>
</el-form-item>
<el-form-item label="工厂描述" :label-width="formLabelWidth">
<el-form-item label="工厂描述">
<el-input
v-model="form.desc"
maxlength="500"
Expand All @@ -78,23 +83,14 @@
<el-button @click="openCreatePlant">取消</el-button>
</el-form-item>
</el-form>
<!-- <div class="demo-drawer__footer">
<el-button @click="cancelForm">取 消</el-button>
<el-button
:loading="loading"
type="primary"
@click="$refs.drawer.closeDrawer()"
>
{{ loading ? '提交中 ...' : '确 定' }}
</el-button>
</div> -->
</div>
</el-dialog>
</div>
</template>

<script>
import { getList } from '@/api/Mock/plant'
import { queryRoleTree, postRole, queryDictTemp } from '@/api/Modeling'
export default {
name: 'Index',
components: {},
Expand All @@ -103,11 +99,13 @@
return {
plantlist: [],
drawer: false,
parent: '', //当前部门id
direction: 'rtl',
dict: [],
wrapclose: false,
form: {
name: '',
objectid: '',
tempname: '',
desc: '',
},
rules: {
Expand All @@ -120,7 +118,7 @@
trigger: 'blur',
},
],
objectid: [
tempname: [
{ required: true, message: '请输入工厂编码', trigger: 'blur' },
{
min: 2,
Expand All @@ -136,24 +134,79 @@
watch: {},
created() {},
mounted() {
const res = getList()
console.log('list', res)
this.plantlist = res.data.List
this.fetchData()
this.getDict()
// const res = getList()
// console.log('list', res)
// this.plantlist = res.data.List
},
destroyed() {},
methods: {
async getDict() {
const params = {
where: {
type: 'roletemp',
},
}
const { results } = await queryDictTemp(params)
console.log('模板', results)
this.dict = results
},
async fetchData() {
// const params = {
// skip: this.queryForm.skip,
// limit: this.queryForm.limit,
// count: 'objectId',
// order: '-createdAt',
// excludeKeys: 'properties',
// where: {
// name: this.queryForm.name
// ? { $regex: this.queryForm.name }
// : { $ne: null },
// },
// }
// console.info(params)
// this.listLoading = true
const { results } = await queryRoleTree()
this.plantlist = results[0].children
this.parent = results[0].objectId
// this.total = count
// this.listLoading = false
},
modelToDetail(item) {
console.log(item)
// return
this.$router.push({
path: '/oc/Modeling/modeldetail',
query: {
objectid: item.objectId,
},
})
},
openCreatePlant() {
this.form = {
name: '',
objectid: '',
tempname: '',
desc: '',
}
this.drawer = !this.drawer
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!')
const params = {
depname: this.form.name,
desc: this.form.desc,
name: this.form.name,
parent: this.parent,
tempname: this.form.tempname,
}
console.log('部门', params)
postRole(params).then((res) => {
console.log('result', res)
this.fetchData()
this.drawer = !this.drawer
})
} else {
console.log('error submit!!')
return false
Expand Down

0 comments on commit 811ebc9

Please sign in to comment.