dev_xds
姜玉琦 2024-07-02 00:20:13 +08:00
commit c6cef388aa
2 changed files with 71 additions and 41 deletions

View File

@ -66,7 +66,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-if="1==2" v-hasPermi="['project:projectStandard:edit']"></el-button> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)" v-hasPermi="['project:projectStandard:edit']"></el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['project:projectStandard:remove']">删除</el-button> v-hasPermi="['project:projectStandard:remove']">删除</el-button>
</template> </template>
@ -104,18 +104,20 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<standardDlg ref="dlg" @success="loadData"></standardDlg>
</div> </div>
</template> </template>
<script> <script>
import { listProjectStandard, getProjectStandard, delProjectStandard, addProjectStandard, updateProjectStandard } from "@/api/project/projectStandard"; import { listProjectStandard, getProjectStandard, delProjectStandard, addProjectStandard, updateProjectStandard } from "@/api/project/projectStandard";
import standardTypes from './standardType' import standardTypes from './standardType'
import standardDlg from './projectStandardDlg.vue'
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: "ProjectStandard", name: "ProjectStandard",
components: { components: {
Treeselect Treeselect,standardDlg
}, },
data() { data() {
return { return {
@ -209,12 +211,12 @@ export default {
}); });
}, },
doRowSelect(row,a){ doRowSelect(row,a){
setTimeout(()=>{ setTimeout(()=>{
if(a.children && a.children.length>0){ if(a.children && a.children.length>0){
row.standardType=row.oldStandardType; row.standardType=row.oldStandardType;
}else{ }else{
updateProjectStandard(row).then(d=>{ updateProjectStandard(row).then(d=>{
debugger; this.$modal.msgSuccess("更新成功");
}) })
} }
},400); },400);
@ -269,6 +271,10 @@ export default {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
handleEdit(row) {
let tmps = this.depts.filter(d => d.deptId == this.activeName);
this.$refs.dlg.showDialog(this.prj, tmps.length > 0 ? tmps[0] : {}, row);
},
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)

View File

@ -12,15 +12,16 @@
<el-tab-pane :label="'' + it.deptName" :name="'' + it.deptId" :key="idx" v-for="(it, idx) in depts"> <el-tab-pane :label="'' + it.deptName" :name="'' + it.deptId" :key="idx" v-for="(it, idx) in depts">
<div> <div>
<el-button type="primary" @click="doAdd"></el-button> <el-button type="primary" @click="doAdd"></el-button>
<el-button style="margin-right:12px;" type="danger" :disabled="multiple" @click="handleDelete"></el-button> <el-button style="margin-right:12px;" type="danger" :disabled="multiple"
@click="handleDelete">删除</el-button>
<div style="display: inline-block;width:200px;position: relative;top: 12px;"> <div style="display: inline-block;width:200px;position: relative;top: 12px;">
<treeselect v-model="standType" :options="options" :show-count="true" placeholder="请选择类型" /> <treeselect v-model="standType" :options="options" :show-count="true" placeholder="请选择类型" />
</div> </div>
<el-button type="success" style="margin-left:12px;" @click="doQuery"></el-button> <el-button type="success" style="margin-left:12px;" @click="doQuery"></el-button>
</div> </div>
<div class="div-data"> <div class="div-data">
<el-table v-loading="loading" :data="projectStandardList" @selection-change="handleSelectionChange" <el-table v-loading="loading" :data="projectStandardList"
stripe> @selection-change="handleSelectionChange" stripe>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="图片路径" align="center" prop="imageFile"> <el-table-column label="图片路径" align="center" prop="imageFile">
<template slot-scope="{row}"> <template slot-scope="{row}">
@ -38,12 +39,15 @@
</el-table-column> </el-table-column>
<el-table-column label="排序" align="center" prop="ord"> <el-table-column label="排序" align="center" prop="ord">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-input-number v-model="row.ord" controls-position="right" @change="doSave(row, false)" <el-input-number v-model="row.ord" controls-position="right"
:min="1" :max="10000"></el-input-number> @change="doSave(row, false)" :min="1" :max="10000"></el-input-number>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="类型" align="center" prop="standardType"> <el-table-column label="类型" align="center" prop="standardType" class-name="td-tree-select">
<template slot-scope="{row}">{{ getType(row) }}</template> <template slot-scope="{row}">
<treeselect v-model="row.standardType" :options="options" :show-count="true"
placeholder="请选择类型" @select="a => doRowSelect(row, a)" />
</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
@ -69,19 +73,19 @@
</template> </template>
<script> <script>
import { listProjectStandard, updateProjectStandard,delProjectStandard } from '@/api/project/projectStandard.js' import { listProjectStandard, updateProjectStandard, delProjectStandard } from '@/api/project/projectStandard.js'
import standardDlg from './projectStandardDlg.vue' import standardDlg from './projectStandardDlg.vue'
import standardTypes from './standardType' import standardTypes from './standardType'
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
components: { components: {
standardDlg,Treeselect standardDlg, Treeselect
}, },
data() { data() {
return { return {
elKey: 0, elKey: 0,
title:'', title: '',
isOpen: false, isOpen: false,
prj: null, prj: null,
// //
@ -106,19 +110,19 @@ export default {
standardType: null, standardType: null,
isDel: null, isDel: null,
}, },
treeOpts:[], treeOpts: [],
options: standardTypes options: standardTypes
}; };
}, },
mounted() { mounted() {
standardTypes.forEach(it=>{ standardTypes.forEach(it => {
this.treeOpts.push(it); this.treeOpts.push(it);
if(it.children){ if (it.children) {
it.children.forEach(it2=>{ it.children.forEach(it2 => {
this.treeOpts.push(it2); this.treeOpts.push(it2);
if(it2.children){ if (it2.children) {
it2.children.forEach(it3=>{ it2.children.forEach(it3 => {
this.treeOpts.push(it3); this.treeOpts.push(it3);
}) })
} }
@ -128,20 +132,31 @@ export default {
}, },
methods: { methods: {
doTabClick(){ doRowSelect(row, a) {
setTimeout(()=>{ setTimeout(() => {
if (a.children && a.children.length > 0) {
row.standardType = row.oldStandardType;
} else {
updateProjectStandard(row).then(d => {
this.$modal.msgSuccess("更新成功");
})
}
}, 400);
},
doTabClick() {
setTimeout(() => {
this.doQuery(); this.doQuery();
},400); }, 400);
}, },
handleDelete(row) { handleDelete(row) {
const ids = row?row.id || this.ids:this.ids; const ids = row ? row.id || this.ids : this.ids;
this.$modal.confirm('是否确认删除标准化管理编号为"' + ids + '"的数据项?') this.$modal.confirm('是否确认删除标准化管理编号为"' + ids + '"的数据项?')
.then(function () { .then(function () {
return delProjectStandard(ids); return delProjectStandard(ids);
}).then(() => { }).then(() => {
this.loadData(); this.loadData();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { }); }).catch(() => { });
}, },
doSaveDesc(row) { doSaveDesc(row) {
if (row.oldStandardDesc != row.standardDesc) { if (row.oldStandardDesc != row.standardDesc) {
@ -193,9 +208,9 @@ export default {
let tmps = this.depts.filter(d => d.deptId == this.activeName); let tmps = this.depts.filter(d => d.deptId == this.activeName);
this.$refs.dlg.showDialog(this.prj, tmps.length > 0 ? tmps[0] : {}); this.$refs.dlg.showDialog(this.prj, tmps.length > 0 ? tmps[0] : {});
}, },
handleEdit(row){ handleEdit(row) {
let tmps = this.depts.filter(d => d.deptId == this.activeName); let tmps = this.depts.filter(d => d.deptId == this.activeName);
this.$refs.dlg.showDialog(this.prj, tmps.length > 0 ? tmps[0] : {},row); this.$refs.dlg.showDialog(this.prj, tmps.length > 0 ? tmps[0] : {}, row);
}, },
loadDepts(cb) { loadDepts(cb) {
let tmps = this.$root.prjDept2 && this.$root.prjDept2[this.prj.id] ? this.$root.prjDept2[this.prj.id] || [] : []; let tmps = this.$root.prjDept2 && this.$root.prjDept2[this.prj.id] ? this.$root.prjDept2[this.prj.id] || [] : [];
@ -235,6 +250,7 @@ export default {
listProjectStandard(this.queryParams).then(response => { listProjectStandard(this.queryParams).then(response => {
this.projectStandardList = (response.rows || []).map(it => { this.projectStandardList = (response.rows || []).map(it => {
it.editDesc = false; it.editDesc = false;
it.oldStandardType=it.standardType;
return it; return it;
}); });
this.total = response.total; this.total = response.total;
@ -272,19 +288,27 @@ export default {
.row-desc { .row-desc {
cursor: pointer; cursor: pointer;
} }
} }
} }
}</style> }
</style>
<style lang="scss"> <style lang="scss">
.project-standar-drawer { .project-standar-drawer {
.el-tab-pane{ .el-tab-pane {
min-height: 800px; min-height: 800px;
} }
.vue-treeselect__menu-container{
.vue-treeselect__menu{ .vue-treeselect__menu-container {
max-height: 600px !important; .vue-treeselect__menu {
} max-height: 600px !important;
} }
}
.td-tree-select {
.cell {
overflow: visible;
}
}
} }
</style> </style>