update code
parent
e97597db8e
commit
48041fecbb
|
@ -8,7 +8,7 @@
|
||||||
{{ dept.deptName }}
|
{{ dept.deptName }}
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="类型:" prop="standardType" style="margin-bottom: 16px;">
|
<el-form-item label="类型:" prop="standardType" style="margin-bottom: 16px;">
|
||||||
<treeselect v-model="form.standardType" :options="treeOpts" :show-count="true" placeholder="请选择类型" @select="doTypeSelect" />
|
<treeselect v-model="form.standardType" :options="treeOpts" ref="treeSel" :show-count="true" placeholder="请选择类型" @select="doTypeSelect" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<div v-if="form.standardType" class="div-tip">
|
<div v-if="form.standardType" class="div-tip">
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {addProjectStandard} from '@/api/project/projectStandard.js'
|
import {addProjectStandard,updateProjectStandard} from '@/api/project/projectStandard.js'
|
||||||
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";
|
||||||
import standardTypes from './standardType'
|
import standardTypes from './standardType'
|
||||||
|
@ -73,7 +73,8 @@ export default {
|
||||||
{ label: '文明施工标准化', value: 5 },
|
{ label: '文明施工标准化', value: 5 },
|
||||||
{ label: '环境保护标准化', value: 6 },
|
{ label: '环境保护标准化', value: 6 },
|
||||||
],
|
],
|
||||||
treeOpts:standardTypes
|
treeOpts:standardTypes,
|
||||||
|
oldData:null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -92,11 +93,32 @@ export default {
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs.form.validate(v => {
|
this.$refs.form.validate(v => {
|
||||||
if(v){
|
if(v){
|
||||||
this.doSave();
|
if(this.oldData){
|
||||||
|
this.doUpdate();
|
||||||
|
}else{
|
||||||
|
this.doSave();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
doSave(){
|
doUpdate(){
|
||||||
|
|
||||||
|
this.oldData.imageFile=this.form.imageFile.map(d=>d.url).filter(d=>d).join(",")
|
||||||
|
this.oldData.standardDesc=this.form.desc;
|
||||||
|
this.oldData.standardType=this.form.standardType;
|
||||||
|
updateProjectStandard(this.oldData).then(d => {
|
||||||
|
if (d.code == 200) {
|
||||||
|
|
||||||
|
this.$message({
|
||||||
|
message: '修改成功',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
this.$emit("success");
|
||||||
|
this.open=false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
doSave(){
|
||||||
let postData={
|
let postData={
|
||||||
projectId:this.prj.id,
|
projectId:this.prj.id,
|
||||||
deptId:this.dept.deptId,
|
deptId:this.dept.deptId,
|
||||||
|
@ -118,15 +140,42 @@ export default {
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
},
|
},
|
||||||
showDialog(prj, dept) {
|
showDialog(prj, dept,oldData) {
|
||||||
this.prj = prj || {};
|
this.prj = prj || {};
|
||||||
this.dept = dept || {};
|
this.dept = dept || {};
|
||||||
this.form.standardType=1;
|
this.form.standardType=1;
|
||||||
this.form.desc='';
|
this.form.desc='';
|
||||||
this.imageFile=[];
|
this.imageFile=[];
|
||||||
this.open = true;
|
this.open = true;
|
||||||
|
if(oldData){
|
||||||
|
this.oldData=JSON.parse(JSON.stringify(oldData));
|
||||||
|
this.form.desc=this.oldData.standardDesc;
|
||||||
|
this.form.standardType=+this.oldData.standardType;
|
||||||
|
let imgs=(this.oldData.imageFile||"").split(",").filter(d=>d).map(d=>{
|
||||||
|
return {
|
||||||
|
url:d,
|
||||||
|
name:d
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.form.imageFile=imgs;
|
||||||
|
}
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.$refs.fu1.fileList=[];
|
if(this.oldData){
|
||||||
|
setTimeout(()=>{
|
||||||
|
let node=this.$refs.treeSel.getNode( this.form.standardType);
|
||||||
|
this.$refs.treeSel.select(node);
|
||||||
|
this.doTypeSelect(node.raw);
|
||||||
|
const func=p=>{
|
||||||
|
p.isExpanded=true;
|
||||||
|
if(p.parentNode){
|
||||||
|
func(p.parentNode);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
func(node);
|
||||||
|
},400);
|
||||||
|
}else{
|
||||||
|
this.$refs.fu1.fileList=[];
|
||||||
|
}
|
||||||
},400);
|
},400);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
</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="handleEdit(scope.row)"
|
||||||
|
v-hasPermi="['project:projectStandard:remove']">修改</el-button>
|
||||||
<el-button size="mini" type="text" icon="el-icon-delete"
|
<el-button size="mini" type="text" icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['project:projectStandard:remove']">删除</el-button>
|
v-hasPermi="['project:projectStandard:remove']">删除</el-button>
|
||||||
|
@ -190,6 +193,10 @@ 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){
|
||||||
|
let tmps = this.depts.filter(d => d.deptId == this.activeName);
|
||||||
|
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] || [] : [];
|
||||||
if (tmps.length > 0) {
|
if (tmps.length > 0) {
|
||||||
|
|
|
@ -66,8 +66,8 @@
|
||||||
><i class="el-icon-picture-outline"></i>整改图片</template
|
><i class="el-icon-picture-outline"></i>整改图片</template
|
||||||
>
|
>
|
||||||
<el-image
|
<el-image
|
||||||
ref="preview"
|
ref="preview" :key="idx"
|
||||||
v-for="img in item.fileUrls.split(',')"
|
v-for="(img,idx) in item.fileUrls.split(',')"
|
||||||
:src="img + '.min.jpg'"
|
:src="img + '.min.jpg'"
|
||||||
style="width: 50px; height: 50px; margin-right: 10px"
|
style="width: 50px; height: 50px; margin-right: 10px"
|
||||||
@click="onPreview(img)"
|
@click="onPreview(img)"
|
||||||
|
@ -102,8 +102,8 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="隐患图片">
|
<el-form-item label="隐患图片">
|
||||||
<el-image
|
<el-image
|
||||||
ref="preview"
|
ref="preview" :key="idx"
|
||||||
v-for="img in dataInfo.smarkUrl.split(',')"
|
v-for="(img,idx) in dataInfo.smarkUrl.split(',')"
|
||||||
:src="getImageUrl(img)"
|
:src="getImageUrl(img)"
|
||||||
style="width: 60px; height: 60px; margin-right: 8px"
|
style="width: 60px; height: 60px; margin-right: 8px"
|
||||||
@click="onPreview(img)"
|
@click="onPreview(img)"
|
||||||
|
|
Loading…
Reference in New Issue