Quellcode durchsuchen

优化自定义

qinzhipeng_v@didiglobal.com vor 4 Jahren
Ursprung
Commit
27c832e695

+ 7 - 4
src/views/reportManagement/ReleaseReport/newReleaeTemplate.vue

@@ -179,8 +179,10 @@ export default {
     },
     templateId: {
       handler(newV) {
-        if (newV === '新建模版' || newV.name === '编辑模版') { // 新建、编辑模版
+        console.log(newV, '你恐惧烦恼的你')
+        if (newV.name === '新建模版' || newV.name === '编辑模版') { // 新建、编辑模版
           this.releaseType = true
+          this.from = { ...this.from, ...newV.from }
           newV.name === '编辑模版' ? this.settingGetReportModuleById(newV.set_up) : ''
           return false
         }
@@ -222,7 +224,8 @@ export default {
     setDefaultData(dav) {
       const from = dav
       this.from = { ...this.from, ...dav, 'taskIds': from.taskId }
-      this.customList = from.customFields
+      // console.log( from.customFields, '编辑')
+      // this.customList = from.customFields
       console.log(dav, '编辑')
       if (from.devPlanTimeStart) {
         this.$set(this.from, 'devPlanTimeStart', [from.devPlanTimeStart, from.devPlanTimeEnd]) // 计划开发开始时间-计划开发结束时间
@@ -442,10 +445,10 @@ export default {
             throw error
           }
           this.loading = false
-          const apis = e === '新建模版' ? settingAddReportModule : settingUpdateReportModule
+          const apis = e.name === '新建模版' ? settingAddReportModule : settingUpdateReportModule
           apis(data).then(res => {
             if (res.code === 200) {
-              this.$message({ type: 'success', message: `${e}成功` })
+              this.$message({ type: 'success', message: `${e.name}成功` })
               this.$emit('getreportTemplate')
               this.$emit('reportReturn')
             }

+ 9 - 11
src/views/reportManagement/components/Custom/index.vue

@@ -13,7 +13,7 @@
           </el-select>
         </el-col>
         <el-col :span="8">
-          <el-select v-model="item.conditions" style="width: 80%; margin-right: 10px;" placeholder="选择展示条件">
+          <el-select v-model="item.conditions" style="width: 90%; margin-right: 10px;" placeholder="选择展示条件">
             <el-option-group label="默认">
               <el-option v-for="i in options" :key="i.value" :label="i.label" :value="i.value" />
             </el-option-group>
@@ -30,29 +30,28 @@
       </el-row>
       <el-row :gutter="20">
         <el-col :span="12" class="Layout_flex_start">
-          <span style="margin-left: 30px; min-width: 100px;">字段类型</span>
+          <span style="margin-left: 50px; min-width: 100px;">字段类型</span>
           <el-select v-model="item.type" placeholder="字段类型" style="width: 100%;">
             <el-option v-for="i in FieldType" :key="i.value" :label="i.label" :value="i.value" />
           </el-select>
         </el-col>
         <el-col v-show="item.type === 3 || item.type === 4" :span="12">
-          <el-input v-model="item.Select" type="text" style="width: 50%; margin-right: 10px;" placeholder="添加选择项" show-word-limit />
-          <i class="el-icon-check icon-message" style="margin-right: 10px;" @click="setTags(item.Select, index)" />
-          <i class="el-icon-close icon-message" @click="item.Select = null" />
+          <el-input v-model="item.Select" type="text" clearable style="width: 50%; margin-right: 10px;" placeholder="添加选择项" show-word-limit />
+          <span class="icon-message" style="margin-right: 10px;" @click="setTags(item.Select, index)">添加</span>
         </el-col>
       </el-row>
       <el-row v-show="item.type === 3 || item.type === 4" :gutter="20">
-        <el-col :span="22" class="Layout_flex_start" style="margin-left: 30px; align-items: baseline;">
+        <el-col :span="22" class="Layout_flex_start" style="margin-left: 50px; align-items: baseline;">
           <span style="min-width: 100px;">选择项</span>
           <span>
-            <el-tag v-for="(tag, k) in item.options" :key="k" closable style="margin: 0 20px 20px 0;" type="info" @close="handleClose(tag, index)">{{ tag }}</el-tag>
+            <el-tag v-for="(tag, k) in item.options" :key="k" closable style="margin: 0 10px 10px 0;" type="info" @close="handleClose(tag, index)">{{ tag }}</el-tag>
           </span>
         </el-col>
       </el-row>
     </div>
-    <el-button type="text" style="margin-left: 80px;" @click="setAddCustomContent">
-      <span class="el-icon-plus icon-design" /> 新增字段
-    </el-button>
+    <span style="color: #1890ff; cursor: pointer;" @click="setAddCustomContent">
+      <i class="el-icon-plus" style="border: 1px solid #1890ff; font-size: 12px; text-align: center;" /> 新增字段
+    </span>
   </div>
 </template>
 
@@ -156,7 +155,6 @@ export default {
 <style lang="less" scoped>
 @import '@/styles/PublicStyle/index.less';
 .reportManage-custom {
-  margin-left: 50px;
   .el-row {
     margin-bottom: 20px;
   }

+ 3 - 2
src/views/reportManagement/components/DailyReport.vue

@@ -9,7 +9,7 @@
       <el-step title="发送报告" />
     </el-steps>
 
-    <modules v-if="showOne" style="min-height: 34vh;" :data="selectTemplate" :fromradio="fromData.radio" @getFromData="getFromData" @createModule="open_new_template" @deleModule="settingDeleteReportModule" />
+    <modules v-if="showOne" style="min-height: 34vh;" :data="selectTemplate" :report-home="reportHome" :fromradio="fromData.radio" @getFromData="getFromData" @createModule="open_new_template" @deleModule="settingDeleteReportModule" />
 
     <div class="report-leftRight">
       <!-- 自定义字段组件 -->
@@ -36,7 +36,7 @@
     </div>
     <div slot="footer" class="dialog-footer" :align="reportHome === `模版管理` || reportHome === `自定义字段` ? 'right' : 'center'">
       <div v-if="reportHome === `自定义字段`">
-        <el-button size="small" type="primary" @click="closeCustom">取消</el-button>
+        <el-button size="small" @click="closeCustom">取消</el-button>
         <el-button size="small" type="primary" @click="$refs.custom.confirmUpload()">确定</el-button>
       </div>
       <el-button v-if="reportHome === `模版管理`" size="small" type="primary" @click="handleClose">确认</el-button>
@@ -216,6 +216,7 @@ export default {
       this.reportTamplate = false // 编辑区域
       this.newDailyTemplate = false // 隐藏第二步
       this.dailyPreview = false // 隐藏第三步
+      this.customList = []
       this.getreportTemplate()
     },
 

+ 6 - 10
src/views/reportManagement/components/ReleaseReport.vue

@@ -9,7 +9,7 @@
       <el-step title="发送报告" />
     </el-steps>
 
-    <modules v-if="showOne" style="min-height: 34vh;" :data="selectTemplate" :fromradio="fromData.radio" @getFromData="getFromData" @createModule="open_new_template" @deleModule="settingDeleteReportModule" />
+    <modules v-if="showOne" style="min-height: 34vh;" :data="selectTemplate" :report-home="reportHome" :fromradio="fromData.radio" @getFromData="getFromData" @createModule="open_new_template" @deleModule="settingDeleteReportModule" />
 
     <div class="report-leftRight">
        <!-- 自定义字段组件 -->
@@ -37,7 +37,7 @@
     </div>
     <div slot="footer" class="dialog-footer" :align="reportHome === `模版管理` || reportHome === `自定义字段` ? 'right' : 'center'">
       <div v-if="reportHome === `自定义字段`">
-        <el-button size="small" type="primary" @click="closeCustom">取消</el-button>
+        <el-button size="small" @click="closeCustom">取消</el-button>
         <el-button size="small" type="primary" @click="$refs.custom.confirmUpload()">确定</el-button>
       </div>
       <el-button v-if="reportHome === `模版管理`" size="small" type="primary" @click="handleClose">确认</el-button>
@@ -177,18 +177,19 @@ export default {
     },
 
     reportReturn() { // 新建模版点击返回
-      this.reportHome = '准出报告' // 步骤条
+      this.reportHome = this.tits // 步骤条
       this.showOne = true // 模版选择
       this.reportTamplate = false // 编辑区域
       this.newDailyTemplate = false // 隐藏第二步
       this.dailyPreview = false // 隐藏第三步
+      this.customList = []
       this.getreportTemplate()
     },
 
     open_new_template(val) { // 点击新建模版
-      !val ? this.templateId = '新建模版' : this.templateId = { 'name': '编辑模版', 'set_up': val.id }
+      !val ? this.templateId = { 'name': '新建模版', from: this.customList.length === 0 ? this.temporary.from : [] } : this.templateId = { 'name': '编辑模版', 'set_up': val.id }
       this.tits = this.reportHome
-      if (this.templateId === '新建模版') {
+      if (this.templateId.name === '新建模版') {
         this.reportTamplate = true // 编辑区域
         this.reportHome = '创建准出报告模版' // 步骤条
         this.showOne = false // 模版选择
@@ -208,7 +209,6 @@ export default {
         const res = await settingDeleteReportModule({ id: item.id }, item.id)
         if (res.code === 200) {
           this.getreportTemplate()
-          this.closeDefaultPopover()
           this.$message({ message: '已删除’', type: 'success', duration: 1000, offset: 150 })
         }
       } else {
@@ -232,10 +232,6 @@ export default {
       this.reportHome = '自定义字段'
     },
 
-    closeDefaultPopover() { // 模拟点击
-      this.$refs.refName.click()
-    },
-
     getCreateData() { // 保存,下一步
       this.$refs.dailyTemplate.reportreleaseCreate(this.updateDaily)
     },

+ 3 - 3
src/views/reportManagement/components/TestingReport.vue

@@ -9,7 +9,7 @@
       <el-step title="发送报告" />
     </el-steps>
 
-    <modules v-if="showOne" style="min-height: 34vh;" :data="selectTemplate" :fromradio="fromData.radio" @getFromData="getFromData" @createModule="open_new_template" @deleModule="settingDeleteReportModule" />
+    <modules v-if="showOne" style="min-height: 34vh;" :data="selectTemplate" :report-home="reportHome" :fromradio="fromData.radio" @getFromData="getFromData" @createModule="open_new_template" @deleModule="settingDeleteReportModule" />
 
     <div class="report-leftRight">
       <!-- 自定义字段组件 -->
@@ -36,7 +36,7 @@
     </div>
     <div slot="footer" class="dialog-footer" :align="reportHome === `模版管理` || reportHome === `自定义字段` ? 'right' : 'center'">
       <div v-if="reportHome === `自定义字段`">
-        <el-button size="small" type="primary" @click="closeCustom">取消</el-button>
+        <el-button size="small" @click="closeCustom">取消</el-button>
         <el-button size="small" type="primary" @click="$refs.custom.confirmUpload()">确定</el-button>
       </div>
       <el-button v-if="reportHome === `模版管理`" size="small" type="primary" @click="handleClose">确认</el-button>
@@ -213,7 +213,7 @@ export default {
     },
 
     reportReturn() { // 新建模版点击返回
-      this.reportHome = '提测报告' // 步骤条
+      this.reportHome = this.tits // 步骤条
       this.showOne = true // 模版选择
       this.newDailyTemplate = false // 隐藏第二步
       this.dailyPreview = false // 隐藏第三步

+ 21 - 3
src/views/reportManagement/components/template/customTemplate.vue

@@ -1,7 +1,7 @@
 <template>
   <el-row :gutter="20" class="Layout">
     <el-col v-for="(item, index) in customs" :key="index" :span="12">
-      <span v-show="!show && isShow(item) || show && item.bool" style="margin-bottom:20px;" class="Layout_space_between">
+      <span v-if="!show && isShow(item) || show && item.bool" style="margin-bottom:20px;" class="Layout_space_between">
         <span class="from-name"><span v-if="item.required" style="color: red;">*</span>{{ item.fieldName }} </span>
         <el-input v-if="item.type === 1" v-model="item.content" size="small" :disabled="disab" style="width:100%;" placeholder="请输入" @change="getFormValue" />
         <el-input v-if="item.type === 2" v-model="item.content" type="textarea" size="small" :disabled="disab" :rows="1" style="width:100%;" placeholder="请输入" @change="getFormValue" />
@@ -79,6 +79,7 @@ export default {
           })
         }
       })
+      console.log(checkList.indexOf(conditions) !== -1, '返回的bool')
       return checkList.indexOf(conditions) !== -1
     },
     getFormValue(e) {
@@ -88,10 +89,27 @@ export default {
       const keys = []
       this.customs.map(item => {
         if (e.type < 4) {
-          item.conditions === `${e.fieldKey}_${e.content}` ? item.bool = true : ''
+          if (item.conditions === `${e.fieldKey}_${e.content}`) {
+            item.bool = true
+            item.bools = true
+          } else {
+            if (item.conditions.split('_')[0] === e.fieldKey) {
+              item.bool = false
+              delete item.bools
+            }
+          }
         } else if (e.type === 4) {
           e.contents.map(i => {
-            item.conditions === `${e.fieldKey}_${i}` ? item.bool = true : ''
+            if (item.conditions === `${e.fieldKey}_${i}`) {
+              item.bool = true
+              item.bools = true
+            } else {
+              if (item.conditions.split('_')[0] === e.fieldKey) {
+                item.bool = false
+                delete item.bools
+              }
+            }
+            // item.conditions === `${e.fieldKey}_${i}` ? item.bool = true : ''
           })
         }
       })

+ 6 - 4
src/views/reportManagement/components/template/index.vue

@@ -9,7 +9,8 @@
         <div ref="refName" style="margin: 20px 0;">
           <el-row v-for="(item, index) in selectTemplate" :key="index" type="flex" justify="center" style="padding-right: 15px;">
             <el-col :span="19">
-              <el-radio v-model="radio" class="creatorList" :label="item.id" @change="$emit('getFromData', radio)">{{ item.moduleName }}</el-radio>
+              <span v-if="reportHome === '模版管理'" class="creatorList">{{ item.moduleName }}</span>
+              <el-radio v-else v-model="radio" class="creatorList" :label="item.id" @change="$emit('getFromData', radio)">{{ item.moduleName }}</el-radio>
             </el-col>
             <el-col :span="5" class="creatorList">
               <div class="Layout_space_between">
@@ -30,8 +31,8 @@
             </el-col>
           </el-row>
         </div>
-        <div class="el-icon-circle-plus-outline creatorList didi-hover" @click="$emit('createModule', null)">
-          <span style="margin-left: 8px; color: #333;">新建模版</span>
+        <div style="color: #409EFF;cursor: pointer;" @click="$emit('createModule', null)">
+          <i class="el-icon-circle-plus-outline creatorList" style="font-size: 16px;color: #409EFF;" /> 新建模版
         </div>
       </div>
   </div>
@@ -41,7 +42,8 @@
 export default {
   props: {
     data: { type: Array, required: true },
-    fromradio: { type: Number, required: true }
+    fromradio: { type: Number, required: true },
+    reportHome: { type: String, required: true }
   },
   data() {
     return {

+ 1 - 0
src/views/reportManagement/daily/dailyTemplate.vue

@@ -209,6 +209,7 @@ export default {
           }
           this.loading = false
           const apis = val ? dailyReportUpdate : dailyReportCreate
+          !val ? delete this.fromCreateData.id : ''
           apis(this.fromCreateData).then(res => {
             if (res.code === 200) {
               this.$emit('SaveNextStep', res.data)

+ 1 - 1
src/views/reportManagement/testPresentation.vue

@@ -10,7 +10,7 @@
           <el-input v-if="history" v-model="screenForm.reportName" size="small" filterable placeholder="报告名称搜索" style="width:100%;" @change="history ? getList(screenForm.reportName) : gethistoryData(screenForm.reportName)" />
         </div>
         <div v-if="history && title !== '测试日报'" class="Layout_space_between">
-          <span style="min-width: 40px;">状态</span>
+          <span style="min-width: 70px;">通过状态</span>
           <el-select v-model="screenForm.passStatus" size="medium" clearable filterable placeholder="请选择" style="width:100%;" @change="getList(screenForm.passStatus)">
             <el-option v-for="item in reportStatusList" :key="item.code" :label="item.name" :value="item.code" />
           </el-select>