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