vue-json-edit

This commit is contained in:
shijing 2023-11-14 11:18:57 +08:00
parent 6eee28c91d
commit bb40ee35e3
2 changed files with 41 additions and 14 deletions

View File

@ -31,7 +31,8 @@
</el-col> </el-col>
<el-col :md="24" :sm="24" :xs="24"> <el-col :md="24" :sm="24" :xs="24">
<el-form-item label="默认参数"> <el-form-item label="默认参数">
<el-input v-model="form.default_param" clearable type="textarea" :rows="8"></el-input> <JsonEditorVue class="vueJsonEditor" v-model="form.default_param" @blur="validate" />
<!-- <el-input v-model="form.default_param" clearable type="textarea" :rows="8"></el-input> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -46,7 +47,9 @@
</template> </template>
<script> <script>
import JsonEditorVue from 'json-editor-vue3';
export default { export default {
components: { JsonEditorVue },
emits: ["success", "closed"], emits: ["success", "closed"],
data() { data() {
return { return {
@ -63,6 +66,7 @@ export default {
}, },
visible: false, visible: false,
isSaveing: false, isSaveing: false,
default_param:{},
selectionFilters: [], selectionFilters: [],
setFiltersVisible: false, setFiltersVisible: false,
belong_dept_options: [] belong_dept_options: []
@ -79,6 +83,7 @@ export default {
}, },
// //
submit() { submit() {
console.log(this.form)
this.$refs.dialogForm.validate(async (valid) => { this.$refs.dialogForm.validate(async (valid) => {
if (valid) { if (valid) {
this.isSaveing = true; this.isSaveing = true;
@ -127,4 +132,7 @@ export default {
}; };
</script> </script>
<style></style> <style>
.vueJsonEditor{
width: 100%;
}</style>

View File

@ -78,6 +78,7 @@
stripe stripe
:height="topHeight" :height="topHeight"
:params="paramsUtask7" :params="paramsUtask7"
@row-click="rowclick"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="40" /> <el-table-column type="selection" width="40" />
@ -139,6 +140,7 @@
stripe stripe
:height="topHeight" :height="topHeight"
:params="paramsUtask10" :params="paramsUtask10"
@row-click="rowclick"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="40" /> <el-table-column type="selection" width="40" />
@ -241,12 +243,12 @@
</el-table-column> </el-table-column>
<el-table-column label="计划完工时间" prop="end_date" width="100" fixed="left"> <el-table-column label="计划完工时间" prop="end_date" width="100" fixed="left">
</el-table-column> </el-table-column>
<el-table-column v-for="item in columList" :label="item" :key="item"> <el-table-column v-for="item in columList" :label="item.data" :key="item">
<template #default="scope"> <template #default="scope">
<div :class="bindClass(scope.row)"> <div :class="bindClass(item)">
<div v-if="activeName=='10车间'">{{ scope.row.count01 }}</div> <div v-if="activeName=='10车间'">{{ scope.row.count01 }}</div>
<div>{{ scope.row.count02 }}</div> <div>{{ item.count_ok }}</div>
<div>{{ scope.row.count03 }}</div> <div>{{ item.count_real }}</div>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -375,23 +377,22 @@ export default {
let endDate = year+'-'+month+'-'+day; let endDate = year+'-'+month+'-'+day;
this.query.date = [startDate,endDate]; this.query.date = [startDate,endDate];
let heights = document.getElementById('topContainer').clientHeight; let heights = document.getElementById('topContainer').clientHeight;
console.log('heights',heights)
this.topHeight = (heights-45)+'px'; this.topHeight = (heights-45)+'px';
this.bottomHeight = (heights-65)+'px'; this.bottomHeight = (heights-65)+'px';
}, },
methods: { methods: {
// Class // Class
bindClass(row){ bindClass(row){
let count01 = row.count01; let count = row.count;
let count02 = row.count02; let countok = row.count_ok;
let count03 = row.count03; let countreal = row.count_real;
let classInfo = {countBlock:true, redColor: false, greenColor: false, orangeColor:false }; let classInfo = {countBlock:true, redColor: false, greenColor: false, orangeColor:false };
if(count01+count02<count03){ if(countok>=count){
classInfo.redColor = true;
}else if(count01+count02==count03){
classInfo.greenColor = true; classInfo.greenColor = true;
}else if(count01+count02>count03){ }else if(countreal>=count){
classInfo.orangeColor = true; classInfo.orangeColor = true;
}else{
classInfo.redColor = true;
} }
return classInfo return classInfo
}, },
@ -523,6 +524,24 @@ export default {
this.apiObj = this.$API.pm.mtask.list; this.apiObj = this.$API.pm.mtask.list;
this.visibleRecord = true; this.visibleRecord = true;
}, },
rowclick(val){
let that = this;
console.log(val);
let utask = val.id;
that.dataList.push(val)
this.$API.pm.mtask.list.req({utask:utask,page:0}).then(res=>{
res.forEach(item=>{
console.log(item)
let obj = {};
obj.data = item.start_date;
obj.count = item.count;
obj.count_ok = item.count_ok;
obj.count_real = item.count_real;
obj.count_notok = item.count_notok;
that.columList.push(obj);
})
})
},
}, },
}; };
</script> </script>