|
@@ -1,8 +1,12 @@
|
|
|
const $ = require('jquery');
|
|
|
-require("../css/moduleManager.less");
|
|
|
+require("../css/qcList.less");
|
|
|
+// require("./../resource/My97DatePicker/WdatePicker.js")
|
|
|
+// require("./../resource/My97DatePicker/skin/WdatePicker.css")
|
|
|
const {api} = require('./api.js')
|
|
|
const {post} = require('./utils.js')
|
|
|
|
|
|
+let tabList
|
|
|
+
|
|
|
function getTabData(){
|
|
|
const param = {
|
|
|
fileCode: "",
|
|
@@ -13,8 +17,8 @@ function getTabData(){
|
|
|
post(api.qcList,param).then(res =>{
|
|
|
console.log('ress', res)
|
|
|
if(res.data.code == '0'){
|
|
|
- const data = res.data.data.records
|
|
|
- renderTab(data)
|
|
|
+ tabList = res.data.data.records
|
|
|
+ renderTab(tabList)
|
|
|
}else{}
|
|
|
}).catch((e) =>{
|
|
|
|
|
@@ -24,12 +28,17 @@ function getTabData(){
|
|
|
getTabData()
|
|
|
function renderTab(data){
|
|
|
let str = ``
|
|
|
+ let hasSelectAll = true
|
|
|
for(let i = 0; i < data.length; i++){
|
|
|
const item = data[i]
|
|
|
+ if(!item.hasSelect){
|
|
|
+ hasSelectAll = false
|
|
|
+ }
|
|
|
str += `
|
|
|
- <tr data-id=${item.id} data-index=${i}>
|
|
|
- <td>${i+1}</td>
|
|
|
+ <tr data-index=${i}>
|
|
|
+ <td class="scoreOperaItem">${item.hasSelect ? '选择':'未选择'}</td>
|
|
|
<td>${item.behospitalCode}</td>
|
|
|
+ <td>${item.fileCode}</td>
|
|
|
<td>${item.name}</td>
|
|
|
<td>${item.sex}</td>
|
|
|
<td>${item.age}</td>
|
|
@@ -44,70 +53,55 @@ function renderTab(data){
|
|
|
</tr>
|
|
|
`
|
|
|
}
|
|
|
+ if(hasSelectAll){
|
|
|
+ $('.scoreOpera').html("选择")
|
|
|
+ $('.scoreOpera').attr("data-selectall",true)
|
|
|
+ }else{
|
|
|
+ $('.scoreOpera').html("未选择")
|
|
|
+ $('.scoreOpera').attr("data-selectall",false)
|
|
|
+ }
|
|
|
$('tbody').html(str)
|
|
|
- bindEdit(data)
|
|
|
+ bindScoreOperaItem()
|
|
|
}
|
|
|
-
|
|
|
-function bindEdit(data){
|
|
|
- $('.editItem').click(function(e){
|
|
|
- const index = $(this).parent().attr('data-index')
|
|
|
- editItem(data[index])
|
|
|
+//全选绑定
|
|
|
+bindOperaAll()
|
|
|
+function bindScoreOperaItem(){
|
|
|
+ $(".scoreOperaItem").on("click", function(e){
|
|
|
+ const index = $(this).parent().attr("data-index")
|
|
|
+ console.log(index)
|
|
|
+ tabList[index].hasSelect = tabList[index].hasSelect ? false:true
|
|
|
+ renderTab(tabList)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-function editItem(item){
|
|
|
- const itemCpoy = JSON.parse(JSON.stringify(item))
|
|
|
- $('.pop-box').remove()
|
|
|
- $('.container').append('<div class="pop-box"></div>')
|
|
|
- const str = `
|
|
|
- <div><span>提示信息:</span> <input class="itemTipMsg" value=${itemCpoy.msg} /></div>
|
|
|
- <div><span>分值:</span> <input class="itemScore" type="number" value=${itemCpoy.score} /></div>
|
|
|
- <div><span>单项否决</span><span class="itemReject">${itemCpoy.isReject}</span></div>
|
|
|
- <div><span>启用</span><span class="itemUsed">${itemCpoy.isUsed}</span></div>
|
|
|
- <div class="confirmEdit">确定</div>
|
|
|
- `
|
|
|
- $('.pop-box').html(str)
|
|
|
- $(".itemTipMsg").on("input", function(e){
|
|
|
- const val = $(this).val()
|
|
|
- itemCpoy.msg = val
|
|
|
- })
|
|
|
- $(".itemScore").on("input", function(e){
|
|
|
- const val = $(this).val()
|
|
|
- itemCpoy.score = val
|
|
|
- })
|
|
|
- $(".itemReject").on("click", function(e){
|
|
|
- itemCpoy.isReject = itemCpoy.isReject == 1 ? 0 : 1
|
|
|
- $('.pop-box').remove()
|
|
|
- editItem(itemCpoy)
|
|
|
- })
|
|
|
- $(".itemUsed").on("click", function(e){
|
|
|
- itemCpoy.isUsed = itemCpoy.isUsed == 1 ? 0 : 1
|
|
|
- $('.pop-box').remove()
|
|
|
- editItem(itemCpoy)
|
|
|
- })
|
|
|
-
|
|
|
- $(".confirmEdit").on("click", function(){
|
|
|
- saveEdit(itemCpoy)
|
|
|
- $('.pop-box').remove()
|
|
|
+function bindOperaAll(){
|
|
|
+ $('.scoreOpera').on("click", function(e){
|
|
|
+ const hasSelectAll = $('.scoreOpera').attr("data-selectall")
|
|
|
+ console.log('hasSelectAll',hasSelectAll)
|
|
|
+ if(hasSelectAll == 'true'){
|
|
|
+
|
|
|
+ for(let i = 0; i < tabList.length; i++){
|
|
|
+ tabList[i].hasSelect = false
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ for(let i = 0; i < tabList.length; i++){
|
|
|
+ tabList[i].hasSelect = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ renderTab(tabList)
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-function saveEdit(item){
|
|
|
+
|
|
|
+function recordScore(behospitalCode){
|
|
|
const param = {
|
|
|
- id: item.id,
|
|
|
- isReject: item.isReject,
|
|
|
- isUsed: item.isUsed,
|
|
|
- msg: item.msg,
|
|
|
- score: item.score
|
|
|
+ behospitalCode: behospitalCode
|
|
|
}
|
|
|
-
|
|
|
- post(api.updataQcCasesEntry,param).then(res =>{
|
|
|
+ post(api.recordScore,param).then(res =>{
|
|
|
if(res.data.code == '0'){
|
|
|
- const data = res.data.data
|
|
|
- getTabData()
|
|
|
+
|
|
|
}else{}
|
|
|
}).catch((e) =>{
|
|
|
|
|
|
})
|
|
|
-}
|
|
|
+}
|
|
|
+
|