cma_search/client/src/views/ability/mQualityTask.vue

1182 lines
37 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-card>
<div slot="header" class="clearfix">
<span>我的报送任务</span>
</div>
<div>
<el-select
v-model="pageForm.org"
placeholder="报送部门"
@change="handleFilter"
clearable
>
<el-option
v-for="item in orgData"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</div>
<el-table
v-loading="listLoading"
:data="taskList.results"
border
fit
stripe
highlight-current-row
:height="topHeight"
@row-click="clickRow"
>
<el-table-column type="index" width="50"/>
<el-table-column label="任务名称">
<template #default="scope">
<span v-if="scope.row.qtask_">{{scope.row.qtask_.name}}</span>
</template>
</el-table-column>
<el-table-column label="任务状态">
<template #default="scope">
<span v-if="scope.row.qtask_">{{scope.row.qtask_.state}}</span>
</template>
</el-table-column>
<el-table-column label="截止日期">
<template #default="scope">
<span v-if="scope.row.qtask_">{{scope.row.qtask_.end_date}}</span>
</template>
</el-table-column>
<el-table-column label="报送部门">
<template #default="scope">
<span v-if="scope.row.org_">{{scope.row.org_.name}}</span>
</template>
</el-table-column>
</el-table>
<pagination
:total="taskList.count"
:page.sync="pageForm.page"
:limit.sync="pageForm.page_size"
@pagination="getrecordlist"
/>
</el-card>
<el-card style="margin-top:6px">
<div slot="header" class="clearfix">
<span v-if="qtaskName!==''" style="display: inline-block;line-height: 40px">{{qtaskName}}</span>
<span style="display: inline-block;line-height: 40px">记录详情</span>
<el-button
v-if="buttonsShow&&checkPermission(['qaction_create'])"
type="primary"
style="float: right"
@click="serviceUpdate()"
>
更新服务
</el-button>
<el-button
v-if="buttonsShow&&checkPermission(['qaction_create'])"
type="primary"
style="float: right;margin-right: 10px"
@click="qualiUpdate()"
>
编辑资质
</el-button>
<el-button
v-if="buttonsShow&&checkPermission(['qaction_create'])"
type="primary"
style="float: right;margin-right: 10px"
@click="qualiCreate()"
>
新增资质
</el-button>
<el-button
v-if="buttonsShow&&checkPermission(['qaction_create'])"
type="primary"
style="float: right"
@click="noChange('1')"
>
资质无新增
</el-button>
<el-button
v-if="buttonsShow&&checkPermission(['qaction_create'])"
type="primary"
style="float: right;margin-right: 10px"
@click="abilityCreate()"
>
新增能力
</el-button>
<el-button
v-if="buttonsShow&&checkPermission(['qaction_create'])"
type="primary"
style="float: right"
@click="noChange('2')"
>
能力无新增
</el-button>
</div>
<el-table
style="margin-top: 6px"
v-loading="listLoading"
:data="recordList.results"
border
fit
stripe
highlight-current-row
:height="bottomHeight"
>
<el-table-column type="index" width="50"/>
<el-table-column width="150px" label="任务标题">
<template>{{qtaskName}}</template>
</el-table-column>
<el-table-column label="操作类型">
<template slot-scope="scope">
<span v-if="scope.row.action==='ablity:create'">新增能力</span>
<span v-else-if="scope.row.action==='service:update'">更新服务</span>
<span v-else-if="scope.row.action==='quali:update'">更新资质</span>
<span v-else-if="scope.row.action==='quali:create'">新增资质</span>
<span v-else-if="scope.row.action==='ability:nochange'">能力无新增</span>
<span v-else-if="scope.row.action==='quali:nochange'">资质无新增</span>
</template>
</el-table-column>
<el-table-column label="确认情况">
<template slot-scope="scope">
<el-tag v-if="scope.row.confirmed" 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">
<el-link v-if="scope.row.file_" :href="scope.row.file_.file" target="_blank" type="primary">
{{scope.row.file_.name}}
</el-link>
<span v-if="scope.row.value1">
<el-link v-if="scope.row.value1.file_" :href="scope.row.value1.file_.file" target="_blank" type="primary">
{{scope.row.value1.file_.name}}
</el-link>
</span>
</template>
</el-table-column>
<el-table-column label="操作人">
<template slot-scope="scope">
<span v-if="scope.row.create_by_"> {{ scope.row.create_by_.name }}</span>
</template>
</el-table-column>
<el-table-column label="操作时间">
<template slot-scope="scope">{{ scope.row.update_time.substring(0, 16) }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
fixed="right"
>
<template slot-scope="scope">
<el-link
type="primary"
size="small"
@click="handleDetail( 'view',scope.row )"
>操作记录
</el-link>
<el-link
v-if="!scope.row.confirmed"
type="danger"
size="small"
@click="handleDelete( scope.row.id )"
>删除
</el-link>
</template>
</el-table-column>
</el-table>
<pagination
:total="recordList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
<el-dialog
:visible.sync="dialogVisibleAbility"
title="新增能力"
>
<el-form
ref="abilityForm"
:model="abilityForm"
label-width="120px"
label-position="right"
:rules="rule"
>
<el-form-item label="能力类型" prop="atype">
<el-select
style="width: 100%;"
v-model="abilityForm.atype"
placeholder="能力类型"
>
<el-option
v-for="item in atypeOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="能力领域" prop="afield">
<el-select
style="width: 100%;"
v-model="abilityForm.afield"
placeholder="能力领域"
>
<el-option
v-for="item in afieldOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="能力文件" prop="file">
<el-upload
ref="upload"
:action="upUrl"
:on-success="handleUpSuccess"
:on-remove="handleRemove"
:headers="upHeaders"
:file-list="fileLista"
:limit="1"
accept=".xls,.xlsx"
>
<el-button size="small" type="primary">上传文件</el-button>
</el-upload>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="对象数量">
<el-input-number v-model="abilityForm.num" :min="1" label="新增对象数量"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="方法标准数量">
<el-input-number v-model="abilityForm.num3" :min="1" label="新增方法标准数量"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="参数数量">
<el-input-number v-model="abilityForm.num2" :min="1" label="新增参数数量"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="产品标准数量">
<el-input-number v-model="abilityForm.num4" :min="1" label="新增产品标准数量"></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisibleAbility = false">取消</el-button>
<el-button type="primary" @click="confirmAbility('abilityForm')">
确认
</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="dialogVisible"
title="新增资质"
>
<el-form
ref="Form"
:model="qualiForm"
label-width="80px"
label-position="right"
:rules="rule"
>
<el-form-item label="资质认定" prop="type">
<el-select
style="width: 100%;"
v-model="qualiForm.type"
placeholder="资质认定"
@change="qualiTypeChange"
>
<el-option
v-for="item in typeOptions"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
<el-form-item label="资质名称" prop="name" v-if="qualiForm.type==='OTHER'">
<el-input v-model="qualiForm.name" placeholder="资质名称"/>
</el-form-item>
<el-form-item label="资质类型" v-if="qualiForm.type==='CMA'">
<el-select
style="width: 100%;"
v-model="qualiForm.grade"
placeholder="资质类型"
>
<el-option
v-for="item in gradeOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="资质类型" v-if="qualiForm.type==='CNAS'">
<el-select
style="width: 100%;"
v-model="qualiForm.grade"
placeholder="资质类型"
>
<el-option
v-for="item in gradeOptions1"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="资质类型" v-if="qualiForm.type==='OTHER'">
<el-input v-model="qualiForm.level" placeholder="资质类型"/>
</el-form-item>
<el-form-item label="有效期">
<el-date-picker
v-model="qualiForm.end_date"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择有效期">
</el-date-picker>
</el-form-item>
<el-form-item label="资质范围">
<el-input
type="textarea"
:rows="4"
v-model="qualiForm.scope"
></el-input>
</el-form-item>
<el-form-item label="描述">
<el-input
type="textarea"
:rows="4"
v-model="qualiForm.description"
placeholder="描述"
></el-input>
</el-form-item>
<el-form-item label="备案城市" v-if="qualiForm.type==='OTHER'">
<el-select
v-model="qualiForm.citys"
placeholder="备案城市"
style="width: 100%;"
filterable
remote
multiple
reserve-keyword
:remote-method="searchCity"
:loading="loading"
@change="getCheckCity"
>
<el-option
v-for="item in cityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="所在省" v-if="qualiForm.grade===20">
<el-select
v-model="qualiForm.province"
placeholder="省份"
clearable
style="width: 100%"
@change="getCites(qualiForm.province)"
>
<el-option
v-for="item in proviceOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所在市" v-if="qualiForm.grade===30">
<el-select
style="width: 100%;"
v-model="qualiForm.city"
placeholder="所在市"
filterable
remote
reserve-keyword
:remote-method="searchCity"
:loading="loading"
>
<el-option
v-for="item in cityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="资质文件" prop="file">
<el-upload
ref="upload"
:action="upUrl"
accept=".zip,.pdf,.jpg"
:on-success="handleUpSuccessQuality"
:on-remove="handleRemoveQuality"
:headers="upHeaders"
:file-list="fileLista"
:limit="1"
>
<el-button size="small" type="primary">上传文件</el-button>
<span class="el-upload__tip">
可上传压缩包.zip,图片.jpg.png等文件
</span>
</el-upload>
</el-form-item>
<!--<el-form-item label="资质文件">
<el-upload
ref="upload"
:action="upUrl"
:before-upload="beforeUpload"
:on-success="handleUpSuccessQuality"
:headers="upHeaders"
:on-remove="handleRemoveQuality"
:file-list="qualiForm.file"
multiple
:limit="1"
accept=".ppt,.pdf,.word.doc,.docx,.xls,.xlsx"
>
<el-button size="small" type="primary">上传文件</el-button>
<span class="el-upload__tip">
可上传多个pdf,word,ppt,excel,图片文件,单文件大小不超过50M
</span>
</el-upload>
</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="dialogVisibleQuliEdit"
title="编辑资质"
>
<el-table
v-if="!showForm"
:data="quliList"
fit
stripe
highlight-current-row
>
<el-table-column label="我的资质" prop="name">
</el-table-column>
<el-table-column
align="center"
label="操作"
>
<template #default="scope">
<el-link
type="primary"
size="small"
@click="handleEdit(scope.row)"
>编辑
</el-link>
</template>
</el-table-column>
</el-table>
<el-form
v-if="showForm"
ref="Form"
:model="qualiForm"
label-width="80px"
label-position="right"
:rules="rule"
>
<el-form-item label="资质认定" prop="type">
<el-select
style="width: 100%;"
v-model="qualiForm.type"
placeholder="资质认定"
@change="qualiTypeChange"
>
<el-option
v-for="item in typeOptions"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
<el-form-item label="资质名称" prop="name" v-if="qualiForm.type==='OTHER'">
<el-input v-model="qualiForm.name" placeholder="资质名称"/>
</el-form-item>
<el-form-item label="资质类型" v-if="qualiForm.type==='CMA'">
<el-select
style="width: 100%;"
v-model="qualiForm.grade"
placeholder="资质类型"
>
<el-option
v-for="item in gradeOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="资质类型" v-if="qualiForm.type==='CNAS'">
<el-select
style="width: 100%;"
v-model="qualiForm.grade"
placeholder="资质类型"
>
<el-option
v-for="item in gradeOptions1"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="资质类型" v-if="qualiForm.type==='OTHER'">
<el-input v-model="qualiForm.level" placeholder="资质类型"/>
</el-form-item>
<el-form-item label="有效期">
<el-date-picker
v-model="qualiForm.end_date"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择有效期">
</el-date-picker>
</el-form-item>
<el-form-item label="资质范围">
<el-input
type="textarea"
:rows="4"
v-model="qualiForm.scope"
></el-input>
</el-form-item>
<el-form-item label="描述">
<el-input
type="textarea"
:rows="4"
v-model="qualiForm.description"
placeholder="描述"
></el-input>
</el-form-item>
<el-form-item label="备案城市" v-if="qualiForm.type==='OTHER'">
<el-input v-model="citysName" disabled placeholder="备案城市"/>
<!--<span v-for="item in qualiForm.citys" :key="item.id">{{item.name}}</span>-->
</el-form-item>
<el-form-item label="所在省" v-if="qualiForm.grade===20">
<el-input v-model="province_name" disabled placeholder="所在省"/>
<!--{{ formData.province_name }}-->
</el-form-item>
<el-form-item label="所在市" v-if="qualiForm.grade===30">
<el-input v-model="city_name" disabled placeholder="所在市"/>
<!--{{ formData.city_name }}-->
</el-form-item>
<el-form-item label="资质文件" prop="file">
<el-upload
ref="upload"
:action="upUrl"
accept=".zip,.pdf,.jpg"
:on-success="handleUpSuccessQuality"
:on-remove="handleRemoveQuality"
:headers="upHeaders"
:file-list="fileLista"
:limit="1"
>
<el-button size="small" type="primary">上传文件</el-button>
<span class="el-upload__tip">
可上传压缩包.zip,图片.jpg.png等文件
</span>
</el-upload>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisibleQuliEdit = false">取消</el-button>
<el-button v-if="showForm" type="primary" @click="confirm('Form')">确认</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="dialogVisibleSever"
title="编辑服务"
>
<el-form
ref="severForm"
:model="severForm"
label-width="80px"
label-position="right"
:rules="rule"
>
<el-form-item label="服务内容" prop="value2">
<el-input
type="textarea"
:rows="4"
v-model="severForm.value2"
placeholder="服务内容"
></el-input>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisibleSever = false">取消</el-button>
<el-button type="primary" @click="submitEditSever('severForm')">确认</el-button>
</div>
</el-dialog>
<el-drawer
title="记录"
:visible.sync="drawer"
:with-header="false"
size="40%"
>
<div
v-if="showData.type==='service:update'"
style="padding: 10px 20px;position: relative"
>
<p style="font-size: 20px;font-weight: bold;">更新服务</p>
<p><span style="display: inline-block;width: 100px;font-weight: bold;">原始内容</span>{{showData.data.value1}}</p>
<p><span style="display: inline-block;width: 100px;font-weight: bold;">更新内容</span>{{showData.data.value2}}</p>
<el-divider></el-divider>
<el-button
v-if="actionType==='confirm'"
style="position: absolute;right:40px;margin-top: 20px"
type="primary"
@click="confirmClick"
>
确认
</el-button>
</div>
<div
v-if="showData.type==='quali:nochange'"
style="padding: 10px 20px;position: relative"
>
<p style="font-size: 20px;font-weight: bold;">资质无新增</p>
<el-button
v-if="actionType==='confirm'"
style="position: absolute;right:40px;margin-top: 20px"
type="primary"
@click="confirmClick"
>
确认
</el-button>
</div>
<div
v-if="showData.type==='ability:nochange'"
style="padding: 10px 20px;position: relative"
>
<p style="font-size: 20px;font-weight: bold;">能力无新增</p>
<el-button
v-if="actionType==='confirm'"
style="position: absolute;right:40px;margin-top: 20px"
type="primary"
@click="confirmClick"
>
确认
</el-button>
</div>
<div
v-if="showData.type==='ablity:create'"
style="padding: 10px 20px;position: relative"
>
<p style="font-size: 20px;font-weight: bold;">新增能力</p>
<p><span style="display: inline-block;width: 100px;font-weight: bold;">能力类型 </span>{{showData.data.atype_name}}</p>
<p><span style="display: inline-block;width: 100px;font-weight: bold;">能力领域</span>{{showData.data.afield_name}}</p>
<p v-if="showData.data.file_"><span style="display: inline-block;width: 100px;font-weight: bold;">上传文件</span>{{showData.data.file_.name}}</p>
<el-link v-if="showData.data.file_" :href="showData.data.file_.file" target="_blank" type="primary">{{showData.data.file_.name}}</el-link>
<el-divider></el-divider>
<el-button
v-if="actionType==='confirm'"
style="position: absolute;right:40px;margin-top: 20px"
type="primary"
@click="confirmClick"
>
确认
</el-button>
</div>
<quliShow
v-if="drawer&&showData.type==='quali:create'"
ref="quliShow"
:showData="showData"
@handleDo="handleDo"
></quliShow>
<quliShow
v-if="drawer&&showData.type==='quali:update'"
ref="quliShow"
:showData="showData"
:fieldList2="fieldList2"
@handleDo="handleDo"
></quliShow>
</el-drawer>
</div>
</template>
<script>
import {
getQtaskMy,
getQtask,
qactionMy,
getQualityMy,
createQuali,
qactionDelete,
updateQuali,
createAbility,
updateService,
provinceLists,
cityLists,
qactionItem,
qualiNoChange,
abilityNoChange
} from "@/api/ability";
import {getDictList} from "@/api/dict";
import {genTree} from "@/utils";
import {getOrgList} from "@/api/org";
import {getCMAGroup} from "@/api/cma";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import Treeselect from "@riophae/vue-treeselect";
import quliShow from "@/views/ability/quliShow";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {upUrl, upHeaders} from "@/api/file";
export default {
components: {Pagination, Treeselect,quliShow},
name: "mQualityTask",
data() {
return {
upHeaders: upHeaders(),
upUrl: upUrl(),
qtask: null,
checkedItem: null,
pageForm: {
page: 1,
page_size: 10,
org: '',
},
listQuery: {
page: 1,
page_size: 10,
task: null,
},
showData:{},
quliList: [],
orgData: [],
fileList: [],
cityOptions: [],
proviceOptions: [],
fileLista: [],
updateId: null,
taskList: {count: 0,},
recordList: {count: 0,},
drawer: false,
loading: false,
showForm: false,
multiple: true,
listLoading: false,
dialogVisible: false,
dialogVisibleSever: false,
dialogVisibleAbility: false,
dialogVisibleQuliEdit: false,
dialogType: "new",
severForm: {
qtask: null,
value2: '',
},
qualiForm: {
name: "",
type: "CMA",
grade: "",
scope: "",
level: "",
province: "",
city: "",
description: "",
end_date: "",
citys: [],
},
citysName:'',
city_name:'',
province_name:'',
abilityForm: {
atype: '',
afield: '',
file: '',
num: '',
num2: '',
num3: '',
num4: '',
qtask: '',
},
rule: {
name: [{required: true, message: "请输入名称", trigger: "blur"}],
orgs: [{required: true, message: "请选择上报公司", trigger: "blur"}],
atype: [{required: true, message: "请选择类型", trigger: "blur"}],
afield: [{required: true, message: "请选择能力领域", trigger: "blur"}],
value2: [{required: true, message: "请填写更新内容", trigger: "blur"}],
},
stateOptions: [
'待发布',
'进行中',
'已关闭',
],
typeOptions: [
'CMA',
'CNAS',
'OTHER'
],
fieldList2: [],
atypeOptions: [],
afieldOptions: [],//领域
gradeOptions: [{id: 10, name: '国家级'}, {id: 20, name: '省级'}, {id: 30, name: '市级'}],//等级
gradeOptions1: [{id: 40, name: '实验室'}, {id: 50, name: '检验机构'}],//等级
qtaskName: "",
atype_name: "",
afield_name: "",
actionType: "",
filterOrgText: "",
treeLoding: false,
buttonsShow: false,
topHeight: null,
bottomHeight: null,
}
},
mounted() {
let height1 = document.getElementsByClassName('app-main')[0].clientHeight / 2;
let height2 = document.getElementsByClassName('pagination-container')[0].clientHeight;
this.topHeight = height1 - height2 - 95;
this.bottomHeight = height1 - height2 - 80;
this.getTableList();
this.getGroup();
//领域类型
this.atypeOptions = [];
this.afieldOptions = [];
this.getOptions();
this.getProvince();
},
methods: {
noChange(index){
let that = this;
if(index==='1'){//资质无新增
that.$confirm("是否确定本月无新增资质?", "提示")
.then(async () => {
qualiNoChange({qtask:this.qtask}).then(res=>{
if (res.code >= 200 && res.code < 400) {
that.getList();
that.$message.success("成功");
}
})
})
.catch((err) => {
console.error(err);
});
}else{//能力无新增
that.$confirm("是否确定本月无新增能力?", "提示")
.then(async () => {
abilityNoChange({qtask:this.qtask}).then(res=>{
if (res.code >= 200 && res.code < 400) {
that.getList();
that.$message.success("成功");
}
})
})
.catch((err) => {
console.error(err);
});
}
},
getOptions() {
getDictList({type__code: "field_type", is_used: true}).then((res) => {
this.afieldOptions = genTree(res.data);
});
getDictList({type__code: "quality_type", is_used: true}).then((res1) => {
this.atypeOptions = genTree(res1.data);
});
},
getProvince() {
provinceLists({page: 1, page_size: 60}).then(res => {
this.proviceOptions = res.data.results;
});
cityLists().then(res => {
this.cityOptions = res.data.results;
})
},
searchCity(query) {
if (query !== '') {
this.loading = true;
cityLists({search: query}).then(res => {
this.cityOptions = res.data.results;
this.loading = false;
})
} else {
this.cityOptions = [];
}
},
getCheckCity(data) {
debugger;
console.log(data);
this.qualiForm.citys = data;
},
getCites(province) {
this.qualiForm.city = '';
cityLists({parent: province, page: 1, page_size: 100}).then(res => {
this.cityOptions = res.data.results;
})
},
handleUpSuccess(res, file, filelist) {
this.abilityForm.file = res.data.id;
},
handleRemove(file, filelist) {
this.abilityForm.file = null;
},
handleUpSuccessQuality(res, file, filelist) {
this.qualiForm.file = res.data.id;
},
//删除资质文件
handleRemoveQuality(file, filelist) {
this.qualiForm.file = null;
},
checkPermission,
getTableList() {
this.listLoading = true;
getQtaskMy(this.pageForm).then((response) => {
if (response.data) {
debugger;
this.taskList = response.data;
this.buttonsShow = false;
this.qtaskName = '';
this.recordList={count: 0,};
}
this.listLoading = false;
});
},
getGroup() {
getOrgList({can_supervision: true}).then((res) => {
this.orgData = res.data;
});
},
getrecordlist() {
this.getTableList();
},
handleFilter() {
this.getTableList();
},
clickRow(obj) {
this.checkedItem = obj;
this.qtask = obj.qtask;
this.qtaskName = obj.qtask_.name;
this.buttonsShow = true;
this.listQuery.qtask = obj.qtask;
qactionMy(this.listQuery).then((res) => {
this.recordList = res.data;
})
},
///////
getList() {
qactionMy(this.listQuery).then((res) => {
this.recordList = res.data;
})
},
//更新服务
serviceUpdate() {
this.dialogVisibleSever = true;
},
//更新服务提交
submitEditSever(form) {
let that = this;
this.$refs[form].validate((valid) => {
if (valid) {
that.severForm.qtask = this.qtask;
updateService(this.severForm).then((res) => {
if (res.code >= 200) {
that.getList();
that.dialogVisibleSever = false;
that.$message.success("成功");
}
});
} else {
return false;
}
});
},
//新增资质
qualiCreate() {
this.dialogType = 'new';
this.dialogVisible = true;
},
//编辑资质
qualiUpdate() {
this.dialogType = 'edit';
this.showForm = false;
this.dialogVisibleQuliEdit = true;
this.getQuliList();
},
getQuliList() {
getQualityMy().then(res => {
this.quliList = res.data.results;
})
},
//更改资质类型
qualiTypeChange() {
this.qualiForm.grade = '';
this.qualiForm.level = '';
if (this.qualiForm.type === 'OTHER') {
this.qualiForm.city = '';
this.qualiForm.province = '';
}else{
this.citys=[];
}
},
//编辑资质
handleEdit(row) {
this.city_name = '';
this.province_name = '';
this.citysName = '';
this.showForm = true;
this.qualiForm.id =row.id?row.id:'';
this.qualiForm.name = row.name?row.name:'';
this.qualiForm.type = row.type?row.type:'';
this.qualiForm.grade = row.grade?row.grade:'';
this.qualiForm.scope = row.scope?row.scope:'';
this.qualiForm.level = row.level?row.level:'';
this.qualiForm.province = row.province?row.province:'';
this.qualiForm.end_date = row.end_date?row.end_date:'';
this.province_name = row.province_name?row.province_name:'';
this.qualiForm.city = row.city?row.city:'';
this.qualiForm.file = row.file?row.file:'';
this.city_name = row.city_name?row.city_name:'';
this.qualiForm.description = row.description?row.description:'';
this.qualiForm.citys = row.citys?row.citys:[];
if(row.citys_&&row.citys_.length>0){
let citys = '';
row.citys_.forEach(item=>{
citys = citys+item.name;
});
this.citysName = citys;
}
},
//新增能力
abilityCreate() {
this.dialogVisibleAbility = true;
},
//提交资质
async confirm(form) {
let that = this;
that.$refs[form].validate((valid) => {
if (valid) {
let obj = new Object();
obj.qtask = that.qtask;
let value2 = new Object();
for (let [key, value] of Object.entries(that.qualiForm)) {
console.log(key,value);
if(value!==''&&value!==null&&value!==undefined){
value2[key] = value;
}
}
value2.citys.forEach((item,index)=>{
value2.citys[index] = parseInt(item);
});
obj.value2 = value2;
debugger;
console.log(obj);
console.log(obj.value2);
console.log(obj.value2.citys);
debugger;
const isEdit = that.dialogType === "edit";
if (isEdit) {
updateQuali(obj).then((res) => {
if (res.code >= 200 && res.code < 400) {
that.getList();
that.dialogVisibleQuliEdit = false;
that.$message.success("成功");
}
});
} else {
debugger;
console.log(obj);
createQuali(obj).then((res) => {
if (res.code >= 200 && res.code < 400) {
that.getList();
that.dialogVisible = false;
that.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
//提交服务更新
async confirmAbility(form) {
let that = this;
that.$refs[form].validate((valid) => {
if (valid) {
that.abilityForm.qtask = that.qtask;
createAbility(that.abilityForm).then((res) => {
if (res.code >= 200 && res.code < 400) {
that.getList();
that.dialogVisibleAbility = false;
that.$message.success("成功");
}
});
} else {
return false;
}
});
},
handleDetail(type,item){
let that = this;
that.drawer = true;
this.showData.id = item.id;
this.showData.data = item;
this.showData.type = item.action;
this.showData.action = type;
this.actionType = type;
this.fieldList2 =[];
if(item.action==='ablity:create'||item.action==='service:update'){
}else{
qactionItem(item.id).then(res=>{
if (res.code>=200) {
let updateDetail = res.data.update_detail;//更改字段
updateDetail.forEach(item=>{
this.fieldList2.push(item.field);//所有字段
});
this.drawer = true;
}
console.log(this.fieldList2)
})
}
},
//删除操作
handleDelete(id) {
let that = this;
that.$confirm("确认删除该操作吗?", "提示")
.then(async () => {
await qactionDelete(id).then(res => {
if (res.code >= 200 && res.code < 400) {
that.getList();
that.$message.success("成功");
}
});
})
.catch((err) => {
console.error(err);
});
},
},
}
</script>
<style scoped>
</style>