Pārlūkot izejas kodu

修改判断标准相关

jiangbiao 3 gadi atpakaļ
vecāks
revīzija
2d18767bdc

+ 21 - 0
master/src/main/java/com/ruoyi/project/plant/controller/TTargetlistController.java

@@ -311,4 +311,25 @@ public class TTargetlistController extends BaseController
         logger.info("failRow:" +String.valueOf(failRow));
         return AjaxResult.success(String.valueOf(successNumber), failRow);
     }
+
+    @GetMapping("/getAllContent")
+    public AjaxResult getAllContent(TTargetlist tTargetlist){
+        List<TTargetlist> list;
+        if (StringUtils.isEmpty(tTargetlist.getYear())) {
+            Calendar calendar = Calendar.getInstance();
+            tTargetlist.setYear(String.valueOf(calendar.get(Calendar.YEAR)));
+            list = tTargetlistService.selectAllContent(tTargetlist);
+            if (CollectionUtils.isEmpty(list)) {
+                tTargetlist.setYear(String.valueOf(calendar.get(Calendar.YEAR)-1));
+                list = tTargetlistService.selectAllContent(tTargetlist);
+            }
+        } else {
+            list = tTargetlistService.selectAllContent(tTargetlist);
+        }
+        return AjaxResult.success(list);
+    }
+    @GetMapping("/getAllMeasures")
+    public AjaxResult getAllMeasures(TTargetlist tTargetlist){
+        return AjaxResult.success(tTargetlistService.selectAllMeasures(tTargetlist));
+    }
 }

+ 5 - 0
master/src/main/java/com/ruoyi/project/plant/mapper/TTargetlistMapper.java

@@ -40,6 +40,11 @@ public interface TTargetlistMapper
     @DataScope(deptAlias = "d")
     public List<TTargetlist> selectListMeasures(TTargetlist tTargetlist);
 
+    @DataScope(deptAlias = "d")
+    public List<TTargetlist> selectAllContent(TTargetlist tTargetlist);
+    @DataScope(deptAlias = "d")
+    public List<TTargetlist> selectAllMeasures(TTargetlist tTargetlist);
+
     /**
      * 新增目标录入
      * 

+ 3 - 0
master/src/main/java/com/ruoyi/project/plant/service/ITTargetlistService.java

@@ -35,6 +35,9 @@ public interface ITTargetlistService
      */
     public List<TTargetlist> selectListMeasures(TTargetlist tTargetlist);
 
+    public List<TTargetlist> selectAllContent(TTargetlist tTargetlist);
+    public List<TTargetlist> selectAllMeasures(TTargetlist tTargetlist);
+
     /**
      * 新增目标录入
      * 

+ 9 - 0
master/src/main/java/com/ruoyi/project/plant/service/impl/TTargetlistServiceImpl.java

@@ -56,6 +56,15 @@ public class TTargetlistServiceImpl implements ITTargetlistService
         return tTargetlistMapper.selectListMeasures(tTargetlist);
     }
 
+    @Override
+    public List<TTargetlist> selectAllContent(TTargetlist tTargetlist) {
+        return tTargetlistMapper.selectAllContent(tTargetlist);
+    }
+    @Override
+    public List<TTargetlist> selectAllMeasures(TTargetlist tTargetlist) {
+        return tTargetlistMapper.selectAllMeasures(tTargetlist);
+    }
+
     /**
      * 新增目标录入
      *

+ 23 - 0
master/src/main/resources/mybatis/plant/TTargetlistMapper.xml

@@ -64,6 +64,29 @@
         order by d.year desc, d.item_top asc, d.item_last asc
     </select>
 
+    <select id="selectAllContent" parameterType="TTargetlist" resultMap="TTargetlistResult">
+        select  d.description from t_targetlist d
+        <where>
+            <if test="year != null "> and year = #{year}</if>
+            and d.parent_id != 0
+            and d.del_flag = 0
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+        order by d.year desc, d.item_top asc, d.item_last asc
+    </select>
+
+    <select id="selectAllMeasures" parameterType="TTargetlist" resultMap="TTargetlistResult">
+        select  m.measures, m.responsible, m.expected_date,d.description from t_targetlist d  left join t_targetmeasures m on m.targetlist_id = d.id and m.del_flag = 0
+        <where>
+            and description =#{description}
+            and d.parent_id != 0
+            and d.del_flag = 0
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+        order by d.year desc, d.item_top asc, d.item_last asc
+    </select>
     <select id="selectListMeasures" parameterType="TTargetlist" resultMap="TTargetlistResult">
         select d.id, d.parent_id, d.yardstick, d.partners, d.plant_code, d.item, d.description, d.targets, d.year, m.id as measuresId, m.measures, m.responsible, m.expected_date, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks ,s.dept_name from t_targetlist d
         left join sys_dept s on s.dept_id = d.dept_id

+ 17 - 0
ui/src/api/plant/targetlist.js

@@ -18,6 +18,23 @@ export function listMeasures(query) {
   })
 }
 
+// 查询目标措施内容列表
+export function getAllContent(query) {
+  return request({
+    url: '/plant/targetlist/getAllContent',
+    method: 'get',
+    params: query
+  })
+}
+// 查询判定标准列表
+export function getAllMeasures(query) {
+  return request({
+    url: '/plant/targetlist/getAllMeasures',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询目标录入详细
 export function getTargetlist(id) {
   return request({

+ 66 - 3
ui/src/views/plant/targetagreement/index.vue

@@ -112,7 +112,7 @@
             size="mini"
             type="text"
             icon="el-icon-document"
-            @click="handleYardstick(scope.row)"
+            @click="handleYardstick(scope.row),selectFocus(year)"
             v-hasPermi="['plant:targetyardstick:edit']"
           >{{ $t('判定标准') }}</el-button>
           <el-button
@@ -237,7 +237,21 @@
       <el-table v-loading="yardstickLoading" :data="targetyardstickList" border>
         <el-table-column :label="$t('目标')" align="center" header-align="center" prop="target">
           <template slot-scope="scope">
-            <el-input v-if="scope.row.isEdit" v-model="scope.row.target" :placeholder="$t('请输入')+$t('目标')" />
+              <el-select
+                v-if="scope.row.isEdit"
+                v-model="scope.row.target"
+                placeholder="请输入或选择"
+                clearable
+                filterable
+                allow-create
+              >
+                <el-option
+                  v-for="item in contentList"
+                  :key="item.description"
+                  :label="item.description"
+                  :value="item.description">
+                </el-option>
+              </el-select>
             <span v-else>{{ scope.row.target }}</span>
           </template>
         </el-table-column>
@@ -255,7 +269,24 @@
         </el-table-column>
         <el-table-column :label="$t('判定标准')" align="left" header-align="center" prop="yardstick" width="500" >
           <template slot-scope="scope">
-            <el-input v-if="scope.row.isEdit" type="textarea" :rows="4" v-model="scope.row.yardstick" :placeholder="$t('请输入')+$t('判定标准')" />
+            <el-select style="width:100%"
+              v-if="scope.row.isEdit"
+              v-model="scope.row.yardstick"
+              placeholder="请输入或选择"
+              clearable
+              multiple
+              filterable
+              allow-create
+              @focus="selectChange(scope.row.target)"
+              @blur="selectBlur"
+            >
+              <el-option
+                v-for="item in measuresList"
+                :key="item.measures"
+                :label="item.measures"
+                :value="item.measures">
+              </el-option>
+            </el-select>
             <span v-else>{{ scope.row.yardstick }}</span>
           </template>
         </el-table-column>
@@ -401,6 +432,7 @@ import { getToken } from "@/utils/auth";
 import {allFileList, delCommonfile ,updateCommonfile ,addCommonfile} from "@/api/common/commonfile";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {getAllContent, getAllMeasures} from "@/api/plant/targetlist";
 
 
 export default {
@@ -408,6 +440,9 @@ export default {
   components: { Treeselect },
   data() {
     return {
+      year: new Date().getFullYear(),
+      contentList: [],
+      measuresList: [],
       // 遮罩层
       loading: true,
       yardstickLoading: true,
@@ -560,6 +595,24 @@ export default {
     });
   },
   methods: {
+    selectFocus(year){
+      this.queryParams.year=year;
+      getAllContent(this.queryParams).then(response => {
+        console.log(response)
+        this.contentList = response.data;
+        console.log(this.contentList)
+      });
+    },
+    selectChange(content){
+      this.queryParams.description=content;
+      getAllMeasures(this.queryParams).then(response => {
+        this.measuresList = response.data;
+      });
+      this.queryParams.description=null;
+    },
+    selectBlur() {
+      this.measuresList = [];
+    },
     /** 查询目标协议列表 */
     getList() {
       this.loading = true;
@@ -724,6 +777,7 @@ export default {
         }
         this.yardstickLoading = false;
         this.yardstickOpen = true;
+        this.year=row.year;
         this.yardstickTitle = employeeName + year + this.$t('年') + this.$t('判断标准');
       });
     },
@@ -751,6 +805,15 @@ export default {
       that.yardstickLoading = true;
       this.yardstickForm = row;
       this.yardstickForm.agreementId = this.yardstickQueryParams.agreementId;
+      let newYardstick="";
+      console.log(row.yardstick)
+      row.yardstick.forEach(
+        item=>{
+          newYardstick+=item+",";
+        }
+      )
+      row.yardstick = newYardstick.substring(0,newYardstick.length-1)
+      console.log(row.yardstick)
       if (this.rowActualpost !== "24") {
         var partner = null;
         this.yardstickForm.partners.forEach(function (value,key,arr) {