657 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			657 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			Plaintext
		
	
	
| <template>
 | ||
|   <box-content style="height: 100%;background: #fff;">
 | ||
|     <!-- 搜索框 -->
 | ||
|     <div class="search">
 | ||
|       <el-form :inline="true" class="base-search-form">
 | ||
|         <!-- 审核问题 -->
 | ||
|         <el-form-item :label="$t('trials:qcCfg:table:questionName')">
 | ||
|           <el-input v-model="searchData.QuestionName" clearable style="width:120px;" />
 | ||
|         </el-form-item>
 | ||
|         <!-- 类型 -->
 | ||
|         <el-form-item :label="$t('trials:qcCfg:table:type')">
 | ||
|           <el-select v-model="searchData.Type" clearable>
 | ||
|             <el-option v-for="item of $d.QcType" :value="item.value" :label="item.label" />
 | ||
|           </el-select>
 | ||
|         </el-form-item>
 | ||
|         <el-form-item :label="$t('trials:qcCfg:table:isEnable')">
 | ||
|           <el-select v-model="searchData.IsEnable" clearable>
 | ||
|             <el-option v-for="item of $d.IsEnable" :value="item.value" :label="item.label" />
 | ||
|           </el-select>
 | ||
|         </el-form-item>
 | ||
|         <el-form-item :label="$t('trials:qcCfg:table:isRequired')">
 | ||
|           <el-select v-model="searchData.isRequired" clearable>
 | ||
|             <el-option v-for="item of $d.YesOrNo" :value="item.value" :label="item.label" />
 | ||
|           </el-select>
 | ||
|         </el-form-item>
 | ||
|         <el-form-item>
 | ||
|           <el-button type="primary" icon="el-icon-search" @click="handleSearch">
 | ||
|             {{ $t('common:button:search') }}
 | ||
|           </el-button>
 | ||
|           <el-button type="primary" icon="el-icon-refresh-left" @click="handleReset">
 | ||
|             {{ $t('common:button:reset') }}
 | ||
|           </el-button>
 | ||
|         </el-form-item>
 | ||
|       </el-form>
 | ||
|       <span style="margin-left:auto">
 | ||
|         <el-button
 | ||
|           v-if="!isConfirm && hasPermi(['trials:trials-panel:setting:qc-question:default-question'])"
 | ||
|           type="primary"
 | ||
|           :disabled="loading"
 | ||
|           icon="el-icon-plus"
 | ||
|           @click="handleAdd"
 | ||
|         >
 | ||
|           {{ $t('trials:qcCfg:button:default') }}
 | ||
|         </el-button>
 | ||
|         <el-button
 | ||
|           v-if="!isConfirm && hasPermi(['trials:trials-panel:setting:qc-question:custom-question'])"
 | ||
|           type="primary"
 | ||
|           :disabled="loading"
 | ||
|           icon="el-icon-plus"
 | ||
|           @click="openCustomDialog"
 | ||
|         >
 | ||
|           {{ $t('trials:qcCfg:button:custom') }}
 | ||
|         </el-button>
 | ||
|         <el-button
 | ||
|           v-if="(!isConfirm && isHaveQCQuestion)"
 | ||
|           v-hasPermi="['trials:trials-panel:setting:qc-question:confirm']"
 | ||
|           type="danger"
 | ||
|           :disabled="loading"
 | ||
|           icon="el-icon-circle-check"
 | ||
|           @click="handleConfirm"
 | ||
|         >
 | ||
|           {{ $t('trials:qcCfg:button:confirm') }}
 | ||
|         </el-button>
 | ||
|       </span>
 | ||
|     </div>
 | ||
| 
 | ||
|     <el-table
 | ||
|       v-loading="loading"
 | ||
|       v-adaptive="{bottomOffset:45}"
 | ||
|       :data="list"
 | ||
|       stripe
 | ||
|       height="100"
 | ||
|     >
 | ||
|       <!-- <el-table-column type="index" width="60" /> -->
 | ||
|       <!-- 序号 -->
 | ||
|       <el-table-column
 | ||
|         prop="ShowOrder"
 | ||
|         :label="$t('trials:qcCfg:table:order')"
 | ||
|         width="60"
 | ||
|       />
 | ||
|       <!-- 审核问题 -->
 | ||
|       <el-table-column
 | ||
|         prop="QuestionName"
 | ||
|         :label="$t('trials:qcCfg:table:questionName')"
 | ||
|         show-overflow-tooltip
 | ||
|       />
 | ||
|       <!-- 类型 -->
 | ||
|       <el-table-column
 | ||
|         prop="Type"
 | ||
|         :label="$t('trials:qcCfg:table:type')"
 | ||
|         show-overflow-tooltip
 | ||
|         width="120"
 | ||
|       >
 | ||
|         <template slot-scope="scope">
 | ||
|           {{ $fd('QcType', scope.row.Type) }}
 | ||
|         </template>
 | ||
|       </el-table-column>
 | ||
|       <!-- 选项 -->
 | ||
|       <el-table-column
 | ||
|         prop="TypeValue"
 | ||
|         :label="$t('trials:qcCfg:table:typeValue')"
 | ||
|         show-overflow-tooltip
 | ||
|       />
 | ||
| 
 | ||
|       <!-- 是否必填 -->
 | ||
|       <el-table-column
 | ||
|         prop="IsRequired"
 | ||
|         :label="$t('trials:qcCfg:table:isRequired')"
 | ||
|         width="120"
 | ||
|       >
 | ||
|         <template slot-scope="scope">
 | ||
|           {{ $fd('YesOrNo', scope.row.IsRequired) }}
 | ||
|         </template>
 | ||
|       </el-table-column>
 | ||
|       <!-- 启用状态 -->
 | ||
|       <el-table-column
 | ||
|         prop="IsEnable"
 | ||
|         :label="$t('trials:qcCfg:table:isEnable')"
 | ||
|         width="120"
 | ||
|       >
 | ||
|         <template slot-scope="scope">
 | ||
|           {{ $fd('IsEnable', scope.row.IsEnable) }}
 | ||
|         </template>
 | ||
|       </el-table-column>
 | ||
|       <!-- 父问题 -->
 | ||
|       <el-table-column
 | ||
|         prop="ParentShowOrder"
 | ||
|         :label="$t('trials:qcCfg:table:parentQs')"
 | ||
|         show-overflow-tooltip
 | ||
|         width="120"
 | ||
|       />
 | ||
|       <!-- 父问题触发值 -->
 | ||
|       <el-table-column
 | ||
|         prop="ParentTriggerValue"
 | ||
|         :label="$t('trials:qcCfg:table:parentTriggerValue')"
 | ||
|         show-overflow-tooltip
 | ||
|       />
 | ||
| 
 | ||
|       <el-table-column
 | ||
|         v-if="hasPermi(['trials:trials-panel:setting:qc-question:edit','trials:trials-panel:setting:qc-question:delete']) && !isConfirm"
 | ||
|         :label="$t('common:action:action')"
 | ||
|         width="300"
 | ||
|       >
 | ||
|         <template slot-scope="scope">
 | ||
|           <el-button
 | ||
|             v-hasPermi="['trials:trials-panel:setting:qc-question:edit']"
 | ||
|             circle
 | ||
|             :title="$t('common:button:edit')"
 | ||
|             icon="el-icon-edit-outline"
 | ||
|             @click="handleEdit(scope.row)"
 | ||
|           />
 | ||
|           <el-button
 | ||
|             v-hasPermi="['trials:trials-panel:setting:qc-question:delete']"
 | ||
|             circle
 | ||
|             :title="$t('common:button:delete')"
 | ||
|             icon="el-icon-delete"
 | ||
|             @click="handleDelete(scope.row)"
 | ||
|           />
 | ||
| 
 | ||
|         </template>
 | ||
|       </el-table-column>
 | ||
|     </el-table>
 | ||
| 
 | ||
|     <!-- 新增默认问题 -->
 | ||
|     <el-dialog
 | ||
|       v-if="addVisible"
 | ||
|       :visible.sync="addVisible"
 | ||
|       style="width:100%"
 | ||
|       :close-on-click-modal="false"
 | ||
|       custom-class="base-dialog-wrapper"
 | ||
|       :title="$t('trials:qcCfg:button:default')"
 | ||
|     >
 | ||
|       <div class="base-modal-body">
 | ||
|         <AddQcQuestion @getList="getList" @closeDialog="closeAddDialog" />
 | ||
|       </div>
 | ||
|     </el-dialog>
 | ||
| 
 | ||
|     <!-- 编辑qc问题 -->
 | ||
|     <el-dialog
 | ||
|       v-if="editVisible"
 | ||
|       :show-close="true"
 | ||
|       :visible.sync="editVisible"
 | ||
|       custom-class="base-dialog-wrapper"
 | ||
|       :title="$t('trials:qcCfg:dialogTitle:edit')"
 | ||
|       width="600px"
 | ||
|     >
 | ||
|       <div style="border:1px solid #e0e0e0;padding:10px;">
 | ||
|         <el-form
 | ||
|           ref="qcQuestionForm"
 | ||
|           v-loading="formLoading"
 | ||
|           :model="rowData"
 | ||
|           :rules="rules"
 | ||
|           label-width="100px"
 | ||
|           size="small"
 | ||
|         >
 | ||
|           <!-- 审核问题 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:questionName')" prop="QuestionName">
 | ||
|             <el-input v-model="rowData.QuestionName" />
 | ||
|           </el-form-item>
 | ||
| 
 | ||
|           <!-- 类型 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:type')">
 | ||
|             <el-select v-model="rowData.Type">
 | ||
|               <el-option v-for="item of $d.QcType" :value="item.value" :label="item.label" />
 | ||
|             </el-select>
 | ||
|           </el-form-item>
 | ||
|           <!-- 选项 -->
 | ||
|           <el-form-item
 | ||
|             v-if="rowData.Type === 'select' || rowData.Type === 'radio'"
 | ||
|             :label="$t('trials:qcCfg:table:typeValue')"
 | ||
|             prop="TypeValue"
 | ||
|           >
 | ||
|             <el-input v-model="rowData.TypeValue" :placeholder="$t('trials:qcCfg:message:typeValue')" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" />
 | ||
|           </el-form-item>
 | ||
|           <!-- 序号 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:order')" prop="ShowOrder">
 | ||
|             <el-input-number v-model="rowData.ShowOrder" controls-position="right" :min="0" />
 | ||
|           </el-form-item>
 | ||
|           <!-- 是否必填 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:isRequired')">
 | ||
|             <el-radio-group v-model="rowData.IsRequired">
 | ||
|               <el-radio v-for="item of $d.YesOrNo" :label="item.value">{{ item.label }}</el-radio>
 | ||
|             </el-radio-group>
 | ||
|           </el-form-item>
 | ||
|           <!-- 启用状态 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:isEnable')">
 | ||
|             <el-radio-group v-model="rowData.IsEnable">
 | ||
|               <el-radio v-for="item of $d.IsEnable" :label="item.value">{{ item.label }}</el-radio>
 | ||
|             </el-radio-group>
 | ||
|           </el-form-item>
 | ||
|           <!-- 父问题 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:parentQs')">
 | ||
|             <el-select v-model="rowData.ParentId" clearable @change="((val)=>{parentQuestionChange(val, rowData)})">
 | ||
|               <el-option
 | ||
|                 v-for="item of parentOptions"
 | ||
|                 :key="item.Id"
 | ||
|                 :label="item.QuestionName"
 | ||
|                 :value="item.Id"
 | ||
|               />
 | ||
|             </el-select>
 | ||
|           </el-form-item>
 | ||
|           <!-- 父问题触发值 -->
 | ||
|           <el-form-item v-if="rowData.ParentId" :label="$t('trials:qcCfg:table:parentTriggerValue')" prop="ParentTriggerValue">
 | ||
|             <el-select v-model="rowData.ParentTriggerValue">
 | ||
|               <el-option
 | ||
|                 v-for="item of parentTriggerValOptions"
 | ||
|                 :key="item"
 | ||
|                 :label="item"
 | ||
|                 :value="item"
 | ||
|               />
 | ||
|             </el-select>
 | ||
|           </el-form-item>
 | ||
|         </el-form>
 | ||
|       </div>
 | ||
|       <div slot="footer" class="base-modal-footer">
 | ||
|         <el-button size="small" type="primary" :disabled="btnLoading" @click="editVisible = false">
 | ||
|           {{ $t('common:button:cancel') }}
 | ||
|         </el-button>
 | ||
|         <el-button size="small" type="primary" :loading="btnLoading" @click="handleSaveQuestion">
 | ||
|           {{ $t('common:button:save') }}
 | ||
|         </el-button>
 | ||
|       </div>
 | ||
|     </el-dialog>
 | ||
| 
 | ||
|     <!-- 自定义QC问题 -->
 | ||
|     <el-dialog
 | ||
|       v-if="customQuestionVisible"
 | ||
|       :show-close="true"
 | ||
|       :visible.sync="customQuestionVisible"
 | ||
|       :title="$t('trials:qcCfg:dialogTitle:custom')"
 | ||
|       custom-class="base-dialog-wrapper"
 | ||
|       width="600px"
 | ||
|     >
 | ||
|       <div style="border:1px solid #e0e0e0;padding:10px;">
 | ||
|         <el-form
 | ||
|           ref="qcCustomQuestionForm"
 | ||
|           v-loading="formLoading"
 | ||
|           :model="form"
 | ||
|           label-width="100px"
 | ||
|           size="small"
 | ||
|         >
 | ||
|           <!-- 审核问题 -->
 | ||
|           <el-form-item
 | ||
|             :label="$t('trials:qcCfg:table:questionName')"
 | ||
|             prop="QuestionName"
 | ||
|             :rules="[
 | ||
|               { required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
 | ||
|             ]"
 | ||
|           >
 | ||
|             <el-input v-model="form.QuestionName" />
 | ||
|           </el-form-item>
 | ||
| 
 | ||
|           <!-- 类型 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:type')">
 | ||
|             <el-select v-model="form.Type">
 | ||
|               <el-option v-for="item of $d.QcType" :value="item.value" :label="item.label" />
 | ||
|             </el-select>
 | ||
|           </el-form-item>
 | ||
|           <!-- 选项 -->
 | ||
|           <el-form-item
 | ||
|             v-if="form.Type === 'select' || form.Type === 'radio'"
 | ||
|             :label="$t('trials:qcCfg:table:typeValue')"
 | ||
|             prop="TypeValue"
 | ||
|             :rules="[
 | ||
|               { required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }
 | ||
|             ]"
 | ||
|           >
 | ||
|             <el-input v-model="form.TypeValue" :placeholder="$t('trials:qcCfg:message:typeValue')" />
 | ||
|           </el-form-item>
 | ||
|           <!-- 序号 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:order')">
 | ||
|             <el-input-number v-model="form.ShowOrder" controls-position="right" :min="0" />
 | ||
|           </el-form-item>
 | ||
|           <!-- 是否必填 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:isRequired')">
 | ||
|             <el-radio-group v-model="form.IsRequired">
 | ||
|               <el-radio v-for="item of $d.YesOrNo" :label="item.value">{{ item.label }}</el-radio>
 | ||
|             </el-radio-group>
 | ||
|           </el-form-item>
 | ||
|           <!-- 启用状态 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:isEnable')">
 | ||
|             <el-radio-group v-model="form.IsEnable">
 | ||
|               <el-radio v-for="item of $d.IsEnable" :label="item.value">{{ item.label }}</el-radio>
 | ||
|             </el-radio-group>
 | ||
|           </el-form-item>
 | ||
|           <!-- 父问题 -->
 | ||
|           <el-form-item :label="$t('trials:qcCfg:table:parentQs')">
 | ||
|             <el-select v-model="form.ParentId" clearable @change="((val)=>{parentQuestionChange(val, form)})">
 | ||
|               <el-option
 | ||
|                 v-for="item of parentOptions"
 | ||
|                 :key="item.Id"
 | ||
|                 :label="item.QuestionName"
 | ||
|                 :value="item.Id"
 | ||
|               />
 | ||
|             </el-select>
 | ||
|           </el-form-item>
 | ||
|           <!-- 父问题触发值 -->
 | ||
|           <el-form-item
 | ||
|             v-if="form.ParentId"
 | ||
|             :label="$t('trials:qcCfg:table:parentTriggerValue')"
 | ||
|             :rules="[
 | ||
|               { required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
 | ||
|             ]"
 | ||
|           >
 | ||
|             <el-select v-model="form.ParentTriggerValue">
 | ||
|               <el-option
 | ||
|                 v-for="item of parentTriggerValOptions"
 | ||
|                 :key="item"
 | ||
|                 :label="item"
 | ||
|                 :value="item"
 | ||
|               />
 | ||
|             </el-select>
 | ||
|           </el-form-item>
 | ||
|         </el-form>
 | ||
|       </div>
 | ||
|       <div slot="footer" class="base-modal-footer">
 | ||
|         <el-button size="small" type="primary" :disabled="btnLoading" @click="customQuestionVisible = false">
 | ||
|           {{ $t('common:button:cancel') }}
 | ||
|         </el-button>
 | ||
|         <el-button size="small" type="primary" :loading="btnLoading" @click="handleSaveCustomQuestion">
 | ||
|           {{ $t('common:button:save') }}
 | ||
|         </el-button>
 | ||
|       </div>
 | ||
|     </el-dialog>
 | ||
| 
 | ||
|     <!--签名框 -->
 | ||
|     <el-dialog
 | ||
|       v-if="signVisible"
 | ||
|       :visible.sync="signVisible"
 | ||
|       :close-on-click-modal="false"
 | ||
|       width="600px"
 | ||
|       custom-class="base-dialog-wrapper"
 | ||
|     >
 | ||
|       <div slot="title">
 | ||
|         <span style="font-size:18px;">{{ $t('common:dialogTitle:sign') }}</span>
 | ||
|         <span style="font-size:12px;margin-left:5px">{{ `(${$t('common:label:sign')}${ currentUser })` }}</span>
 | ||
|       </div>
 | ||
|       <SignForm ref="signForm" :sign-code-enum="signCode" @closeDialog="closeSignDialog" />
 | ||
|     </el-dialog>
 | ||
|   </box-content>
 | ||
| </template>
 | ||
| <script>
 | ||
| import { getTrialQCQuestionConfigureList, addOrUpdateTrialQCQuestionConfigure, deleteTrialQCQuestionConfigure, batchAddTrialQCQuestionConfigure, getTrialQCQuestionSelectList } from '@/api/trials'
 | ||
| import { trialConfigSignatureConfirm } from '@/api/trials/setting'
 | ||
| import AddQcQuestion from './components/addQcQuestion'
 | ||
| import BoxContent from '@/components/BoxContent'
 | ||
| import SignForm from '@/views/trials/components/newSignForm'
 | ||
| import const_ from '@/const/sign-code'
 | ||
| const searchDataDefault = () => {
 | ||
|   return {
 | ||
|     QuestionName: '',
 | ||
|     Type: '',
 | ||
|     IsEnable: null
 | ||
|   }
 | ||
| }
 | ||
| export default {
 | ||
|   name: 'QcQuestions',
 | ||
|   components: { BoxContent, AddQcQuestion, SignForm },
 | ||
|   data() {
 | ||
|     return {
 | ||
|       searchData: searchDataDefault(),
 | ||
|       list: [],
 | ||
|       total: 0,
 | ||
|       loading: false,
 | ||
|       addVisible: false,
 | ||
|       editVisible: false,
 | ||
|       rowData: {
 | ||
|         Id: '',
 | ||
|         IsEnable: true,
 | ||
|         IsRequired: true,
 | ||
|         QuestionName: '',
 | ||
|         ShowOrder: 0,
 | ||
|         TrialId: '',
 | ||
|         Type: '',
 | ||
|         TypeValue: '',
 | ||
|         ParentId: '',
 | ||
|         ParentTriggerValue: ''
 | ||
|       },
 | ||
|       rules: {
 | ||
|         QuestionName: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
 | ||
|           { max: 50, message: `${this.$t('common:ruleMessage:maxLength')} 50` }],
 | ||
|         TypeValue: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
 | ||
|           { max: 200, message: `${this.$t('common:ruleMessage:maxLength')} 200` }],
 | ||
|         ParentTriggerValue: [
 | ||
|           { required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur' }
 | ||
|         ]
 | ||
|       },
 | ||
|       customQuestionVisible: false,
 | ||
|       form: {
 | ||
|         Id: '',
 | ||
|         QuestionName: '',
 | ||
|         IsRequired: true,
 | ||
|         IsEnable: true,
 | ||
|         Type: 'select',
 | ||
|         TypeValue: '',
 | ||
|         ShowOrder: 0,
 | ||
|         ParentId: '',
 | ||
|         ParentTriggerValue: ''
 | ||
|       },
 | ||
|       formLoading: false,
 | ||
|       parentOptions: [],
 | ||
|       parentTriggerValOptions: [],
 | ||
|       btnLoading: false,
 | ||
|       signText: '',
 | ||
|       signCode: null,
 | ||
|       currentUser: zzSessionStorage.getItem('userName'),
 | ||
|       signVisible: false,
 | ||
|       userTypeEnumInt: zzSessionStorage.getItem('userTypeEnumInt') * 1,
 | ||
|       qCQuestionConfirmedUserId: '',
 | ||
|       isConfirm: true,
 | ||
|       isHaveQCQuestion: false,
 | ||
|       trialId: ''
 | ||
|     }
 | ||
|   },
 | ||
|   // computed: {
 | ||
|   //   isConfirm() {
 | ||
|   //     return !!this.qCQuestionConfirmedUserId
 | ||
|   //   }
 | ||
|   // },
 | ||
|   mounted() {
 | ||
|     this.trialId = this.$route.query.trialId
 | ||
|     this.getList()
 | ||
|   },
 | ||
|   methods: {
 | ||
|     // 获取qc模板信息
 | ||
|     getList() {
 | ||
|       this.loading = true
 | ||
|       this.searchData.TrialId = this.trialId
 | ||
|       getTrialQCQuestionConfigureList(this.searchData).then(res => {
 | ||
|         this.loading = false
 | ||
|         this.list = res.Result
 | ||
|         this.isConfirm = !!(res.OtherInfo.QCQuestionConfirmedUserId !== null && res.OtherInfo.QCQuestionConfirmedUserId !== '')
 | ||
|         this.isHaveQCQuestion = res.OtherInfo.IsHaveQCQuestion
 | ||
|       }).catch(() => { this.loading = false })
 | ||
|     },
 | ||
|     // 打开系统模板配置项
 | ||
|     handleAdd() {
 | ||
|       this.addVisible = true
 | ||
|     },
 | ||
|     // 编辑qc问题配置信息
 | ||
|     handleEdit(row) {
 | ||
|       this.editVisible = true
 | ||
|       this.formLoading = true
 | ||
|       var param = {
 | ||
|         trialId: this.trialId,
 | ||
|         typeArray: ['select', 'radio'],
 | ||
|         id: row.Id
 | ||
|       }
 | ||
|       getTrialQCQuestionSelectList(param).then(res => {
 | ||
|         this.formLoading = false
 | ||
|         this.parentOptions = res.Result
 | ||
|         if (Object.keys(row).length) {
 | ||
|           this.rowData = { ...row }
 | ||
|         }
 | ||
|       }).catch(() => {
 | ||
|         this.formLoading = false
 | ||
|       })
 | ||
|     },
 | ||
|     // 更新qc问题配置信息
 | ||
|     handleSaveQuestion() {
 | ||
|       this.$refs.qcQuestionForm.validate(valid => {
 | ||
|         if (!valid) return
 | ||
|         this.btnLoading = true
 | ||
|         addOrUpdateTrialQCQuestionConfigure(this.rowData).then(res => {
 | ||
|           this.btnLoading = false
 | ||
|           if (res.IsSuccess) {
 | ||
|             this.editVisible = false
 | ||
|             this.getList()
 | ||
|             this.$message.success(this.$t('common:message:savedSuccessfully'))
 | ||
|           }
 | ||
|         }).catch(() => { this.btnLoading = false })
 | ||
|       })
 | ||
|     },
 | ||
|     // 删除qc问题配置项
 | ||
|     handleDelete(row) {
 | ||
|       // 判断该问题是否存在子问题,如果有则不允许删除
 | ||
|       const i = this.list.findIndex(item => item.ParentId === row.Id)
 | ||
|       if (i !== -1) {
 | ||
|         this.$message.error(this.$t('trials:qcCfg:message:deleteWarning'))
 | ||
|       } else {
 | ||
|         this.$confirm(this.$t('trials:qcCfg:message:delete'), {
 | ||
|           type: 'warning',
 | ||
|           distinguishCancelAndClose: true
 | ||
|         })
 | ||
|           .then(() => {
 | ||
|             this.loading = true
 | ||
|             deleteTrialQCQuestionConfigure(this.trialId, row.Id)
 | ||
|               .then(res => {
 | ||
|                 this.loading = false
 | ||
|                 if (res.IsSuccess) {
 | ||
|                   // this.list.splice(this.list.findIndex(item => item.Id === row.Id), 1)
 | ||
|                   this.getList()
 | ||
|                   this.$message.success(this.$t('common:message:deletedSuccessfully'))
 | ||
|                 }
 | ||
|               }).catch(() => { this.loading = false })
 | ||
|           })
 | ||
|       }
 | ||
|     },
 | ||
|     // 保存自定义配置
 | ||
|     handleSaveCustomQuestion() {
 | ||
|       this.$refs.qcCustomQuestionForm.validate(valid => {
 | ||
|         if (!valid) return
 | ||
|         const qcArr = []
 | ||
|         qcArr.push(this.form)
 | ||
|         this.btnLoading = true
 | ||
|         batchAddTrialQCQuestionConfigure(this.trialId, qcArr).then(res => {
 | ||
|           this.btnLoading = false
 | ||
|           if (res.IsSuccess) {
 | ||
|             this.customQuestionVisible = false
 | ||
|             this.$message.success(this.$t('common:message:savedSuccessfully'))
 | ||
|             this.getList()
 | ||
|           }
 | ||
|         }).catch(() => { this.btnLoading = false })
 | ||
|       })
 | ||
|     },
 | ||
|     // 打开自定义qc问题配置框
 | ||
|     openCustomDialog() {
 | ||
|       this.customQuestionVisible = true
 | ||
|       this.form.Id = ''
 | ||
|       this.form.QuestionName = ''
 | ||
|       this.form.IsRequired = true
 | ||
|       this.form.IsEnable = true
 | ||
|       this.form.Type = 'select'
 | ||
|       this.form.TypeValue = ''
 | ||
|       this.form.ShowOrder = 0
 | ||
|       this.form.ParentId = ''
 | ||
|       this.form.ParentTriggerValue = ''
 | ||
|       this.getParentOpntions()
 | ||
|     },
 | ||
|     // 获取父问题下拉框选项
 | ||
|     getParentOpntions() {
 | ||
|       var param = {
 | ||
|         trialId: this.trialId,
 | ||
|         typeArray: ['select', 'radio']
 | ||
|       }
 | ||
|       getTrialQCQuestionSelectList(param).then(res => {
 | ||
|         this.parentOptions = res.Result
 | ||
|       })
 | ||
|     },
 | ||
|     // 父问题change事件
 | ||
|     parentQuestionChange(val, data) {
 | ||
|       if (val) {
 | ||
|         var index = this.parentOptions.findIndex(item => {
 | ||
|           return item.Id === val
 | ||
|         })
 | ||
|         if (index !== -1) {
 | ||
|           this.parentTriggerValOptions = this.parentOptions[index].TypeValue.split('|')
 | ||
|         }
 | ||
|       } else {
 | ||
|         data.ParentTriggerValue = ''
 | ||
|       }
 | ||
|     },
 | ||
| 
 | ||
|     closeAddDialog() {
 | ||
|       this.addVisible = false
 | ||
|     },
 | ||
| 
 | ||
|     // 关闭模态框
 | ||
|     closeDialog(flag) {
 | ||
|       this.model_cfg.visible = false
 | ||
|       if (!flag) return
 | ||
|       this.getList()
 | ||
|     },
 | ||
|     // 查询
 | ||
|     handleSearch() {
 | ||
|       this.getList()
 | ||
|     },
 | ||
|     // 重置
 | ||
|     handleReset() {
 | ||
|       this.searchData = searchDataDefault()
 | ||
|       this.getList()
 | ||
|     },
 | ||
|     // 确认前签名
 | ||
|     handleConfirm() {
 | ||
|       if (!this.list || this.list.length === 0) {
 | ||
|         this.$message.error('请先配置QC审核问题再进行确认!')
 | ||
|         return
 | ||
|       }
 | ||
|       const { QCConfirmation } = const_.processSignature
 | ||
|       this.signCode = QCConfirmation
 | ||
|       this.signVisible = true
 | ||
|     },
 | ||
|     // 关闭签名框并设置确认状态
 | ||
|     closeSignDialog(isSign, signInfo) {
 | ||
|       if (isSign) {
 | ||
|         this.signConfirm(signInfo)
 | ||
|       } else {
 | ||
|         this.signVisible = false
 | ||
|       }
 | ||
|     },
 | ||
|     // 签名确认
 | ||
|     signConfirm(signInfo) {
 | ||
|       this.loading = true
 | ||
|       const params = {
 | ||
|         data: {
 | ||
|           trialId: this.trialId,
 | ||
|           signCode: signInfo.SignCode
 | ||
|         },
 | ||
|         signInfo: signInfo
 | ||
|       }
 | ||
|       trialConfigSignatureConfirm(params).then(res => {
 | ||
|         this.loading = false
 | ||
|         if (res.IsSuccess) {
 | ||
|           this.$message.success(this.$t('common:message:savedSuccessfully'))
 | ||
|           this.$refs['signForm'].btnLoading = false
 | ||
|           this.signVisible = false
 | ||
|           this.getList()
 | ||
|         }
 | ||
|       }).catch(_ => {
 | ||
|         this.loading = false
 | ||
|         this.$refs['signForm'].btnLoading = false
 | ||
|       })
 | ||
|     }
 | ||
|   }
 | ||
| }
 | ||
| </script>
 |