AutoTestStatDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <div>
  3. <crumbs title="详情" linkTo="TransformTask">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="所属医院:">
  6. <el-select size="mini" v-model.trim="filter.hospitalId" @change="getValue" placeholder="所属医院" clearable>
  7. <el-option v-for="item in hospitalList" :label="item.name" :value="item.val" :key="item.id" ></el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="所属模块:">
  11. <el-select size="mini" v-model.trim="filter.casesId" placeholder="所属模块" clearable>
  12. <el-option v-for="item in moduleList" :label="item.name" :value="item.val" :key="item.id" ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="缺陷名称:">
  16. <el-input size="mini" v-model.trim="filter.entryName" placeholder="缺陷名称" clearable></el-input>
  17. </el-form-item>
  18. <el-form-item label="条目编码:">
  19. <el-input size="mini" v-model.trim="filter.code" placeholder="条目编码" clearable></el-input>
  20. </el-form-item>
  21. <el-form-item>
  22. <el-button size="mini" @click="filterDatas">确认</el-button>
  23. </el-form-item>
  24. </el-form>
  25. </crumbs>
  26. <div class="contents">
  27. <el-table
  28. :data="list"
  29. border
  30. style="width: 100%">
  31. <el-table-column
  32. type="index"
  33. :index="indexMethod"
  34. label="编号"
  35. width="60">
  36. </el-table-column>
  37. <el-table-column
  38. :resizable = "false"
  39. label="所属医院"
  40. prop="hospitalId"
  41. :formatter="hisFormatter"
  42. >
  43. </el-table-column>
  44. <el-table-column
  45. :resizable = "false"
  46. prop="casesName"
  47. label="所属模块">
  48. </el-table-column>
  49. <el-table-column
  50. :resizable = "false"
  51. prop="entryName"
  52. label="缺陷名称"
  53. width="180"
  54. show-overflow-tooltip>
  55. </el-table-column>
  56. <el-table-column
  57. :resizable = "false"
  58. prop="code"
  59. label="条目编码">
  60. </el-table-column>
  61. <el-table-column
  62. :resizable = "false"
  63. prop="typeStr"
  64. label="差异数量"
  65. show-overflow-tooltip>
  66. </el-table-column>
  67. <el-table-column
  68. :resizable = "false"
  69. prop="typeStr"
  70. label="病人住院序号"
  71. show-overflow-tooltip>
  72. </el-table-column>
  73. </el-table>
  74. <el-pagination :current-page.sync="currentPage"
  75. @current-change="currentChange"
  76. background
  77. :page-size.sync="pageSize"
  78. :page-sizes="pageSizeArr"
  79. @size-change="handleSizeChange"
  80. :layout="pageLayout"
  81. :total="total">
  82. </el-pagination>
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. import api from '@api/qualityControl.js';
  88. import config from '@api/config.js';
  89. import utils from '@api/utils.js'
  90. export default {
  91. name: 'TransformTask',
  92. data: function() {
  93. return {
  94. list: [],
  95. hospitalList: [],
  96. moduleList:[],
  97. qcTypeNameList:[],
  98. searched: false,
  99. filter: {
  100. typeName:"",//质控类型名称
  101. hospitalId: "", //所属医院
  102. entryName:"", //条目名称
  103. casesId:null,//所属模块
  104. code:"",//条目编码
  105. },
  106. currentPage: 1,
  107. pageSize: config.pageSize,
  108. pageSizeArr:config.pageSizeArr,
  109. pageLayout:config.pageLayout,
  110. total: 0,
  111. }
  112. },
  113. created() {
  114. const _this=this;
  115. this.getTypeNameList()
  116. setTimeout(function(){
  117. _this.getAllTypes().then(()=>{
  118. _this.getDataList()
  119. })
  120. },100);
  121. },
  122. watch: {
  123. 'filter': {
  124. handler: function () {
  125. this.searched = false;
  126. },
  127. deep: true
  128. }
  129. },
  130. beforeRouteEnter(to, from, next) {
  131. next(vm => {
  132. //const pm = to.param;
  133. Object.assign(vm, to.params);
  134. vm.inCurrentPage=to.params.currentPage;
  135. })
  136. },
  137. methods: {
  138. moduleFormatter(row, column, cellValue){
  139. const it = this.moduleList.find(item => item.id == cellValue);
  140. return it?it.name:'';
  141. },
  142. hisFormatter(row, column, cellValue){
  143. const it = this.hospitalList.find(item => item.val == cellValue);
  144. return it?it.name:'';
  145. },
  146. getAllTypes(){
  147. if(localStorage.getItem("qcModuleTypes")){
  148. this.hospitalList = JSON.parse(localStorage.getItem("qcHospitalTypes"));
  149. this.moduleList = JSON.parse(localStorage.getItem("qcModuleTypes"));
  150. return new Promise(function(resolve, reject){
  151. resolve()
  152. });
  153. }
  154. //获取枚举信息
  155. return api.getQcTypes().then((res)=>{
  156. if(res.data.code==="0"){
  157. const data = res.data.data;
  158. localStorage.setItem("qcFieldTypes",JSON.stringify(data[11]));
  159. localStorage.setItem("qcModuleTypes",JSON.stringify(data[12]));
  160. localStorage.setItem("qcHospitalTypes",JSON.stringify(data[13]));
  161. this.hospitalList = JSON.parse(localStorage.getItem("qcHospitalTypes"));
  162. this.moduleList = JSON.parse(localStorage.getItem("qcModuleTypes"));
  163. }else{
  164. this.warning("获取枚举信息失败");
  165. }
  166. });
  167. },
  168. getTypeNameList(hospitalId){
  169. api.getQcEntryTypeByHospital({hospitalId:hospitalId}).then((res) => {
  170. if(res.data.code == 0){
  171. // let list = res.data.data.records
  172. this.qcTypeNameList = res.data.data
  173. }
  174. })
  175. },
  176. handleSizeChange(val){
  177. this.pageSize = val;
  178. this.currentPage = utils.getCurrentPage(this.currentPage, this.total, this.pageSize);
  179. this.getDataList();
  180. },
  181. getValue(val) {
  182. console.log('changeVal', )
  183. THIS.filter.typeName = ""
  184. },
  185. getDataList(isTurnPage) {
  186. const param = this.getFilterItems(isTurnPage);
  187. this.searched = true;
  188. const loading = this.$loading({
  189. lock: true,
  190. text: 'Loading',
  191. spinner: 'el-icon-loading',
  192. background: 'rgba(0, 0, 0, 0.7)'
  193. });
  194. api.getQcEntryTypeList(param).then((res) => {
  195. loading.close()
  196. if(res.data.code == 0){
  197. let list = res.data.data.records
  198. /*for(let i = 0; i < list.length; i++){
  199. list[i].hospitalId = this.hospitalList.find(item => item.val == list[i].hospitalId).name
  200. list[i].modeId = this.moduleList.find(item => item.val == list[i].modeId).name
  201. }*/
  202. this.list = list;
  203. this.total = res.data.data.total;
  204. if(this.inCurrentPage!==undefined){
  205. this.currentPage=this.inCurrentPage;
  206. this.inCurrentPage = undefined;
  207. }
  208. }
  209. })
  210. },
  211. filterDatas() {
  212. this.currentPage = 1;
  213. this.getDataList();
  214. },
  215. addTemp() {
  216. const pam = this.searched ? {
  217. currentPage: this.currentPage,
  218. pageSize:this.pageSize,
  219. filter: this.filter
  220. } : {currentPage: this.currentPage,pageSize:this.pageSize};
  221. this.$router.push({
  222. name: 'ItemDataTypeRelation',
  223. params: pam
  224. })
  225. },
  226. modifyIndeptTag(row, type) {
  227. api.getQcEntryTypeDetail({ "entryId": row.entryId,"hospitalId": row.hospitalId}).then((res)=>{
  228. const {code,data,msg} = res.data;
  229. const hospitalItem = this.hospitalList.find(item => item.val == row.hospitalId);
  230. const hospitalName = hospitalItem ? hospitalItem.name:''
  231. if(code=='0'){
  232. const item = Object.assign({},{hospitalName:hospitalName},data);
  233. const pam = this.searched ? {
  234. currentPage: this.currentPage,
  235. filter: this.filter
  236. } : {currentPage: this.currentPage};
  237. if(type == 'modify') {
  238. this.$router.push({name: 'ItemDataTypeRelation', params: Object.assign(pam, {isEdit: true, data: item})});
  239. } else if( type == 'copy') {
  240. this.$router.push({name: 'ItemDataTypeRelation', params: Object.assign(pam, {isCopy: true, data: item})});
  241. } else {
  242. return
  243. }
  244. }else{
  245. this.$message({
  246. message: msg,
  247. type: 'warning'
  248. });
  249. }
  250. });
  251. //this.$router.push({name:'AddIndeptLabel',params:{isEdit:true,data:row}});
  252. },
  253. currentChange(next) {
  254. this.currentPage = next;
  255. this.getDataList(true);
  256. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  257. // this.list = this.cacheData[next];
  258. // } else {
  259. // this.getDataList();
  260. // }
  261. },
  262. clearFilter(){
  263. this.filter={
  264. hospitalId: "",
  265. typeName:"",
  266. entryName:"",
  267. casesId:null,
  268. code:""
  269. };
  270. },
  271. getFilterItems(isTurnPage) {
  272. //翻页时筛选条件没点确定则清空
  273. if(isTurnPage&&!this.searched){
  274. this.clearFilter();
  275. };
  276. const {hospitalId,typeName,entryName,casesId,code} = this.filter
  277. const param = {
  278. current: this.inCurrentPage||this.currentPage,
  279. size: this.pageSize,
  280. hospitalId: hospitalId,
  281. typeName:typeName,
  282. entryName:entryName,
  283. casesId:casesId,
  284. code:code
  285. };
  286. return param;
  287. },
  288. indexMethod(index) {
  289. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  290. },
  291. getTagType(val) {
  292. return val
  293. },
  294. warning(msg,type){
  295. this.$message({
  296. showClose: true,
  297. dangerouslyUseHTMLString: true,
  298. message:'<p>'+msg+'</p>',
  299. type:type||'warning'
  300. })
  301. },
  302. showConfirmDialog(msg,resolve){
  303. this.$alert(msg, '提示', {
  304. confirmButtonText: '确定',
  305. type: 'warning'
  306. }).then(() => {
  307. resolve();
  308. }).catch(() => {});
  309. },
  310. showDelDialog(row){
  311. const param = {
  312. "ids": row.id,
  313. }
  314. this.showConfirmDialog('是否删除该模板?',()=>{
  315. api.delQCTemp(param).then((res)=>{
  316. if(res.data.code=='0'){
  317. if(!this.searched){
  318. //未点确认时清空搜索条件
  319. this.clearFilter();
  320. }
  321. if(this.list.length==1){
  322. //当前在最后一页且只有一条数据时,删除后跳到前一页
  323. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  324. }
  325. this.getDataList();
  326. this.warning(res.data.msg || '操作成功','success');
  327. }else{
  328. this.warning(res.data.msg);
  329. }
  330. }).catch((error)=>{
  331. this.warning(error);
  332. })
  333. });
  334. }
  335. }
  336. }
  337. </script>
  338. <style lang="less">
  339. @import "../../less/admin.less";
  340. .delete{
  341. color: red
  342. }
  343. .delete:hover {
  344. color: red;
  345. }
  346. .el-select .el-input .el-icon-arrow-up{
  347. display: inline-block!important;
  348. }
  349. .el-select .el-input .el-icon-circle-close{
  350. float:left;
  351. }
  352. .el-pagination__sizes{
  353. margin-right: 20px;
  354. .el-input .el-input__inner{
  355. height: 28px;
  356. line-height: 28px;
  357. }
  358. }
  359. </style>