cma_search/client/src/views/qualityinspect/inspecttaskdo.vue

316 lines
9.5 KiB
Python

<template>
<div class="app-container">
<el-card>
<div slot="header" class="clearfix">
<span>任务详情</span>
</div>
<div style="margin-left: 10px; margin-right: 10px">
<el-row :gutter="20">
<el-col :span="6">
<div style="margin-bottom: 6px">
<span class="term">任务名称:</span>
<span class="desc"> {{ task.name }}</span>
</div>
</el-col>
<el-col :span="6">
<div style="margin-bottom: 6px">
<span class="term">巡检开始日期:</span>
<span class="desc"> {{ task.start_date }}</span>
</div>
</el-col>
<el-col :span="6">
<div style="margin-bottom: 6px">
<span class="term">巡检结束日期:</span>
<span class="desc"> {{ task.end_date }}</span>
</div>
</el-col>
<el-col :span="6">
<div style="margin-bottom: 6px">
<span class="term">创建人:</span>
<span class="desc" v-if="task.create_by_">
{{ task.create_by_.name }}/</span
>
<span class="desc" v-if="task.belong_dept_">{{
task.belong_dept_.name
}}</span>
</div>
</el-col>
</el-row>
</div>
</el-card>
<el-card style="margin-top: 2px">
<div slot="header" class="clearfix">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>创建子任务</el-button
>
</div>
<el-table
border
fit
stripe
highlight-current-row
max-height="400px"
style="margin-top:2px"
>
<el-table-column type="selection" align="center" width="55" />
<el-table-column label="序号" type="index" align="center" width="55" />
<el-table-column label="材料">
<template slot-scope="scope">{{ scope.row.content_name }}</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<el-tag type="danger" v-if="scope.row.state == '待报送'">{{
scope.row.state
}}</el-tag>
<el-tag
type="warning"
v-else-if="
scope.row.state == '待整改' || scope.row.state == '待发布'
"
>{{ scope.row.state }}</el-tag
>
<el-tag type="success" v-else-if="scope.row.state == '已确认'">{{
scope.row.state
}}</el-tag>
<el-tag v-else-if="scope.row.state == '已报送'">{{
scope.row.state
}}</el-tag>
</template>
</el-table-column>
<el-table-column label="报送要求/备注">
<template slot-scope="scope">{{ scope.row.note }}</template>
</el-table-column>
<el-table-column label="是否适用">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_yes" effect="plain"></el-tag>
<el-tag type="danger" effect="plain" v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="报送情况">
<template slot-scope="scope" v-if="scope.row.up_user_"
>{{ scope.row.up_user_.name }}/{{ scope.row.up_date }}</template
>
</el-table-column>
<el-table-column label="报送说明">
<template slot-scope="scope" >{{ scope.row.noteb}}</template
>
</el-table-column>
<el-table-column label="文件">
<template slot-scope="scope" v-if="scope.row.files">
<el-link
v-if="scope.row.files.length > 1"
@click="handleRecord({ action: 'view', record: scope.row })"
>
<span style="color: red">{{ scope.row.files.length }}</span>
个文件</el-link
>
<div v-else v-for="item in scope.row.files_" v-bind:key="item.id">
<el-link :href="item.path" target="_blank" type="primary">{{
item.name
}}</el-link>
</div>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="240px"
fixed="right"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['record_delete'])"
type="danger"
size="small"
@click="handleRecord({ action: 'delete', record: scope.row })"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑任务' : '新增任务'"
>
<el-form
ref="Form"
:model="inspecttask"
label-width="80px"
label-position="right"
>
<el-form-item label="子任务名" prop="name">
<el-input v-model="inspecttask.name" placeholder="子任务名" />
</el-form-item>
<el-form-item label="选择组长" prop="leader">
<el-cascader
v-model="inspecttask.leader"
:options="typeOptions"
:props="{ emitPath: false }"
clearable
style="width: 100%"
></el-cascader>
</el-form-item>
<el-form-item label="选择组员" prop="member">
<el-input v-model="inspecttask.member" placeholder="选择组员" >
<el-button icon="el-icon-search" slot="append" @click="Createmember"></el-button>
</el-input>
</el-form-item>
<el-form-item label="选择组织" prop="leader">
<el-input v-model="inspecttask.leader" placeholder="选择组织" >
<el-button icon="el-icon-search" slot="append" @click="CreatOrg"></el-button>
</el-input>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
<!--组织弹框-->
<el-dialog
:visible.sync="dialogVisibles"
:title="选择组织"
:close-on-click-modal="false"
width="70%"
>
<orginit ref="leaderinit" @handleChose="chooseComplete" ></orginit>
</el-dialog>
<!--人员弹框-->
<el-dialog
:visible.sync="dialogVisibless"
:title="选择组织"
:close-on-click-modal="false"
width="70%"
>
<leaderinit ref="leaderinit" @handleChose="chooseComplete" ></leaderinit>
</el-dialog>
</div>
</template>
<style >
.term {
color: rgba(0, 0, 0, 0.85);
font-weight: bold;
font-size: 16px;
}
.desc {
color: rgba(0, 0, 0, 0.65);
font-weight: bold;
font-size: 16px;
}
.litem {
margin-bottom: 4px;
margin-left: 2px;
cursor: pointer;
color: #409eff;
}
</style>
<script>
import { getinspecttask, initinspecttask, appendinspecttask } from "@/api/inspectTask";
import orginit from "@/views/qualityinspect/orginit";
import leaderinit from "@/views/qualityinspect/leaderinit";
import {
getUserList
} from "@/api/user";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination";
import checkPermission from "@/utils/permission";
const defaulttask = {
name: "",
};
export default {
components: { Pagination,orginit,leaderinit},
data() {
return {
task: { id: 0 },
dialogVisibles: false,
dialogVisibless: false,
inspecttask: defaulttask,
dialogVisible: false,
listLoading: true,
typeOptions:[],
dialogVisible: false,
dialogType: "new",
data: {},
listQuery:{},
};
},
created() {
this.task.id = this.$route.params.id;
this.getinspecttask();
this.getTypeAll();
},
methods: {
checkPermission,
getinspecttask() {
getinspecttask(this.task.id).then((res) => {
this.task = res.data;
});
},
getTypeAll() {
getUserList().then((res) => {
this.typeOptions = genTree(res.data.results);
});
},
Createmember()
{
this.dialogVisibless = true;
},
CreatOrg()
{
this.dialogVisibles = true;
},
handleCreate() {
this.inspecttask = Object.assign({}, defaulttask);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
async confirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
updateinspecttask(this.inspecttask.id, this.inspecttask).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
} else {
createinspecttask(this.inspecttask).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
// this.$router.push({name: "Taskdo", params: { id: res.data.id }, })
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
},
};
</script>