|
|
@@ -13,13 +13,14 @@
|
|
|
<div class="drawer__panel" style="margin-bottom: 0">
|
|
|
<div style="display: flex;justify-content: space-between">
|
|
|
<div>{{$t(`方案编制`)}}</div>
|
|
|
- <el-button type="primary" size="small" @click="addRow">{{$t(`添加行`)}}</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="addRow" v-if="!isAdd">{{$t(`添加行`)}}</el-button>
|
|
|
</div>
|
|
|
<table-detail :layout="tablecols" :data="list" :opwidth="200" :custom="true" style="margin-top: 10px">
|
|
|
<template v-slot:customcol="scope">
|
|
|
<div v-if="scope.column.columnname == 'title'">
|
|
|
<div v-if="nowRow == scope.column.data.rowindex">
|
|
|
- <el-input size="small" v-model="scope.column.data[scope.column.columnname]" placeholder="请输入任务名称"></el-input>
|
|
|
+ <el-input size="small" v-model="scope.column.data[scope.column.columnname]" placeholder="请输入任务名称" @blur="setError(scope.column.data)"></el-input>
|
|
|
+ <div style="color: #e13333;font-size: 12px" v-if="titleError">{{titleError}}</div>
|
|
|
</div>
|
|
|
<div v-else>{{scope.column.data[scope.column.columnname]}}</div>
|
|
|
</div>
|
|
|
@@ -27,18 +28,77 @@
|
|
|
<div v-if="nowRow == scope.column.data.rowindex">
|
|
|
<el-date-picker
|
|
|
v-model="scope.column.data[scope.column.columnname]"
|
|
|
+ @change="setError(scope.column.data)"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
+ style="width: 100%"
|
|
|
size="small"
|
|
|
type="date"
|
|
|
placeholder="选择日期">
|
|
|
</el-date-picker>
|
|
|
+ <div style="color: #e13333;font-size: 12px" v-if="begdateError">{{begdateError}}</div>
|
|
|
+ </div>
|
|
|
+ <div v-else>{{scope.column.data[scope.column.columnname]}}</div>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="scope.column.columnname == 'enddate'">
|
|
|
+ <div v-if="nowRow == scope.column.data.rowindex">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="scope.column.data[scope.column.columnname]"
|
|
|
+ @change="setError(scope.column.data)"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ style="width: 100%"
|
|
|
+ size="small"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择日期">
|
|
|
+ </el-date-picker>
|
|
|
+ <div style="color: #e13333;font-size: 12px" v-if="enddateError">{{enddateError}}</div>
|
|
|
+ </div>
|
|
|
+ <div v-else>{{scope.column.data[scope.column.columnname]}}</div>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="scope.column.columnname == 'measure'">
|
|
|
+ <div v-if="nowRow == scope.column.data.rowindex">
|
|
|
+ <el-input size="small" v-model="scope.column.data[scope.column.columnname]" placeholder="请输入措施" @blur="setError(scope.column.data)"></el-input>
|
|
|
+ <div style="color: #e13333;font-size: 12px" v-if="measureError">{{measureError}}</div>
|
|
|
+ </div>
|
|
|
+ <div v-else>{{scope.column.data[scope.column.columnname]}}</div>
|
|
|
+ </div>
|
|
|
+ <div v-else-if="scope.column.columnname == 'name'">
|
|
|
+ <div v-if="nowRow == scope.column.data.rowindex">
|
|
|
+ <el-select v-model="scope.column.data[scope.column.columnname]" filterable size="small" placeholder="请选择" @change="changeName(scope.column.data)">
|
|
|
+ <el-option
|
|
|
+ v-for="item in personOpt"
|
|
|
+ :key="item.userid"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.userid">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <div style="color: #e13333;font-size: 12px" v-if="useridError">{{useridError}}</div>
|
|
|
</div>
|
|
|
<div v-else>{{scope.column.data[scope.column.columnname]}}</div>
|
|
|
</div>
|
|
|
<div v-else>{{scope.column.data[scope.column.columnname]}}</div>
|
|
|
</template>
|
|
|
+ <template v-slot:opreation="scope">
|
|
|
+ <el-button type="text" size="mini" class="inline-16" v-if="nowRow != scope.data.rowindex" @click="editClick(scope.data)">{{$t(`编辑`)}}</el-button>
|
|
|
+ <el-button type="text" size="mini" class="inline-16" v-if="isSave && nowRow == scope.data.rowindex" style="color: #e6a23c" @click="onSave(scope.data)">{{$t(`保存`)}}</el-button>
|
|
|
+ <el-button type="text" size="mini" class="inline-16" @click="delClick(scope.data)">{{$t(`删除`)}}</el-button>
|
|
|
+ </template>
|
|
|
</table-detail>
|
|
|
</div>
|
|
|
+ <div class="fixed__btn__panel">
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ @click="drawerVisible = false"
|
|
|
+ class="normal-btn-width inline-16"
|
|
|
+ >{{ $t("取 消") }}</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click="drawerVisible = false"
|
|
|
+ class="normal-btn-width"
|
|
|
+ >{{ $t("确 定") }}</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
</el-drawer>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -46,6 +106,7 @@
|
|
|
<script>
|
|
|
export default {
|
|
|
name: "edit",
|
|
|
+ props:['data'],
|
|
|
data(){
|
|
|
return {
|
|
|
drawerVisible:false,
|
|
|
@@ -61,14 +122,24 @@ export default {
|
|
|
list:[],
|
|
|
total:0,
|
|
|
currentPage:0,
|
|
|
- nowRow:-1
|
|
|
+ nowRow:-1,
|
|
|
+ personOpt:[],
|
|
|
+ isAdd:false,
|
|
|
+ isSave:true,
|
|
|
+ titleError:'',
|
|
|
+ begdateError:'',
|
|
|
+ enddateError:'',
|
|
|
+ useridError:'',
|
|
|
+ measureError:''
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
editBtn(){
|
|
|
+ console.log(this.data,'输出data的数据')
|
|
|
this.drawerVisible = true
|
|
|
this.param.content.pageNumber = 1
|
|
|
this.listData()
|
|
|
+ this.personList()
|
|
|
},
|
|
|
async listData(){
|
|
|
const res = await this.$api.requested(this.param)
|
|
|
@@ -76,16 +147,146 @@ export default {
|
|
|
console.log(res.data,'方案列表')
|
|
|
},
|
|
|
addRow(){
|
|
|
+ this.isAdd = true
|
|
|
+ this.isSave = true
|
|
|
this.nowRow = this.list.length + 1
|
|
|
this.list.push({
|
|
|
+ sa_service_improvementid:this.$route.query.id,
|
|
|
+ sa_service_improvement_planid:0,
|
|
|
rowindex:this.list.length + 1,
|
|
|
title:'',
|
|
|
begdate:'',
|
|
|
enddate:'',
|
|
|
measure:'',
|
|
|
- name:''
|
|
|
+ name:'',
|
|
|
+ userid_charge:''
|
|
|
})
|
|
|
},
|
|
|
+ async personList(){
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ id:20221102090303,
|
|
|
+ content:{
|
|
|
+ containssub:1,
|
|
|
+ departmentids:[this.data.departmentid],
|
|
|
+ isExport:'',
|
|
|
+ pageNumber:1,
|
|
|
+ pageSize:999999
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (res.code == 0){
|
|
|
+ this.tool.showMessage(res,()=>{})
|
|
|
+ }else {
|
|
|
+ this.personOpt = res.data
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async delClick(data){
|
|
|
+ console.log(data,'输出data')
|
|
|
+ if (data.sa_service_improvement_planid == 0){
|
|
|
+ this.param.content.pageNumber = 1
|
|
|
+ this.listData()
|
|
|
+ }else {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 2026020210234702,
|
|
|
+ "content": {
|
|
|
+ "sa_service_improvement_planid": data.sa_service_improvement_planid
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if (res.code == 0){
|
|
|
+ this.tool.showMessage(res,()=>{})
|
|
|
+ }else {
|
|
|
+ this.param.content.pageNumber = 1
|
|
|
+ this.listData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.isAdd = false
|
|
|
+ },
|
|
|
+ async onSave(data){
|
|
|
+ if (data.title == ''){
|
|
|
+ this.titleError = '任务名称不可为空'
|
|
|
+ }else {
|
|
|
+ this.titleError = ''
|
|
|
+ }
|
|
|
+ if (data.begdate == ''){
|
|
|
+ this.begdateError = '开始日期不能为空'
|
|
|
+ }else {
|
|
|
+ this.begdateError = ''
|
|
|
+ }
|
|
|
+ if (data.enddate == ''){
|
|
|
+ this.enddateError = '结束日期不可为空'
|
|
|
+ }else {
|
|
|
+ this.enddateError = ''
|
|
|
+ }
|
|
|
+ if (data.userid_charge == ''){
|
|
|
+ this.useridError = '责任人不能为空'
|
|
|
+ }else {
|
|
|
+ this.useridError = ''
|
|
|
+ }
|
|
|
+ if (data.measure == ''){
|
|
|
+ this.measureError = '措施不能为空'
|
|
|
+ }else {
|
|
|
+ this.measureError = ''
|
|
|
+ }
|
|
|
+ if (data.title && data.begdate && data.enddate && data.measure && data.userid_charge){
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 2026020210233202,
|
|
|
+ "content": {
|
|
|
+ "sa_service_improvementid": this.$route.query.id,
|
|
|
+ "sa_service_improvement_planid": data.sa_service_improvement_planid,
|
|
|
+ "title": data.title, //主要原因
|
|
|
+ "begdate": data.begdate, //改善建议
|
|
|
+ "enddate": data.enddate, //责任部门
|
|
|
+ "userid_charge": data.userid_charge, //责任人
|
|
|
+ "measure": data.measure //措施
|
|
|
+ },
|
|
|
+ })
|
|
|
+ if (res.code == 0){
|
|
|
+ this.tool.showMessage(res,()=>{})
|
|
|
+ }else {
|
|
|
+ this.isAdd = false
|
|
|
+ this.isSave = false
|
|
|
+ this.nowRow = -1
|
|
|
+ this.param.content.pageNumber = 1
|
|
|
+ this.listData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeName(val,data){
|
|
|
+ if (val) {
|
|
|
+ this.useridError = ''
|
|
|
+ }
|
|
|
+ this.list[val.rowindex -1].userid_charge = val.name
|
|
|
+ },
|
|
|
+ editClick(data){
|
|
|
+ this.isSave = true
|
|
|
+ this.nowRow = data.rowindex
|
|
|
+ },
|
|
|
+ setError(data){
|
|
|
+ if (data.title == ''){
|
|
|
+ this.titleError = '任务名称不可为空'
|
|
|
+ }else {
|
|
|
+ this.titleError = ''
|
|
|
+ }
|
|
|
+ if (data.begdate == ''){
|
|
|
+ this.begdateError = '开始日期不能为空'
|
|
|
+ }else {
|
|
|
+ this.begdateError = ''
|
|
|
+ }
|
|
|
+ if (data.enddate == ''){
|
|
|
+ this.enddateError = '结束日期不可为空'
|
|
|
+ }else {
|
|
|
+ this.enddateError = ''
|
|
|
+ }
|
|
|
+ if (data.userid_charge == ''){
|
|
|
+ this.useridError = '责任人不能为空'
|
|
|
+ }else {
|
|
|
+ this.useridError = ''
|
|
|
+ }
|
|
|
+ if (data.measure == ''){
|
|
|
+ this.measureError = '措施不能为空'
|
|
|
+ }else {
|
|
|
+ this.measureError = ''
|
|
|
+ }
|
|
|
+ },
|
|
|
onClose(){}
|
|
|
},
|
|
|
created() {
|