BaseFieldList.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <div>
  3. <crumbs title="字段映射维护">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="所属医院:">
  6. <el-select size="mini" v-model="filter.hospitalId" placeholder="所属医院" clearable>
  7. <el-option v-for="item in hisTypes" :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="filter.modeId" placeholder="所属模块" clearable>
  12. <el-option v-for="item in fieldTypes" :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="filter.tagName" placeholder="备注"></el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button size="mini" @click="filterDatas">确认</el-button>
  20. <el-button size="mini" type="warning" @click="addBaseField">添加字段映射</el-button>
  21. </el-form-item>
  22. </el-form>
  23. </crumbs>
  24. <div class="contents">
  25. <el-table :data="list"
  26. border
  27. style="width: 100%">
  28. <!--<el-table-column
  29. type="index"
  30. :index="indexMethod"
  31. label="编号"
  32. width="60">
  33. </el-table-column>-->
  34. <el-table-column
  35. prop="gmtModified"
  36. label="所属医院"
  37. width="150"
  38. :formatter="hisFormatter"
  39. :show-overflow-tooltip="true">
  40. </el-table-column>
  41. <el-table-column
  42. prop="name"
  43. :formatter="moduleFormatter"
  44. label="所属模块">
  45. </el-table-column>
  46. <el-table-column
  47. prop="name"
  48. label="显示名称">
  49. </el-table-column>
  50. <el-table-column
  51. prop="val"
  52. label="取值字段">
  53. </el-table-column>
  54. <el-table-column
  55. prop="tagName"
  56. label="备注">
  57. </el-table-column>
  58. <!--<el-table-column
  59. prop="name"
  60. width="200"
  61. label="关联缺陷条目">
  62. </el-table-column>
  63. <el-table-column
  64. prop="name"
  65. width="60"
  66. label="换行">
  67. </el-table-column>
  68. <el-table-column
  69. prop="name"
  70. width="60"
  71. label="加粗">
  72. </el-table-column>
  73. <el-table-column
  74. prop="name"
  75. width="60"
  76. label="缩进">
  77. </el-table-column>-->
  78. <el-table-column
  79. label="操作" width="100">
  80. <template slot-scope="scope">
  81. <el-button type="text" size="small" @click="toEditField(scope.row, 'modify')">修改</el-button>
  82. <span style="margin:0 3px;">|</span>
  83. <el-button type="text" size="small" @click="toEditField(scope.row, 'copy')">复制</el-button>
  84. <span style="margin:0 3px;">|</span>
  85. <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row.id)">删除</el-button>
  86. </template>
  87. </el-table-column>
  88. </el-table>
  89. <el-pagination v-if="total>pageSize"
  90. :current-page.sync="currentPage"
  91. @current-change="currentChange"
  92. background
  93. :page-size="pageSize"
  94. layout="total,prev, pager, next, jumper"
  95. :total="total">
  96. </el-pagination>
  97. </div>
  98. </div>
  99. </template>
  100. <script>
  101. import api from '@api/qualityControl.js';
  102. export default {
  103. name: 'BaseField',
  104. data: function () {
  105. return {
  106. list: [],
  107. tagType:[1],
  108. currentPage: 1,
  109. pageSize: 10,
  110. total: 0,
  111. fieldTypes:[],
  112. searched:false,
  113. hisTypes:[],
  114. filter: {
  115. hospitalId:'',
  116. modeId:'',
  117. tagName: ''
  118. }
  119. }
  120. },
  121. created() {
  122. const _this=this;
  123. setTimeout(function() {
  124. _this.getAllTypes()
  125. },100);
  126. },
  127. watch:{
  128. 'filter':{
  129. handler:function(){
  130. this.searched = false;
  131. },
  132. deep:true
  133. }
  134. },
  135. beforeRouteEnter(to, from, next){
  136. next(vm => {
  137. //const pm = to.param;
  138. Object.assign(vm,to.params);
  139. vm.inCurrentPage=to.params.currentPage;
  140. })
  141. },
  142. methods: {
  143. moduleFormatter(item){
  144. const field = this.fieldTypes.filter((it)=>it.val==item.modeId);
  145. return field[0]?field[0].name:'';
  146. },
  147. hisFormatter(item){
  148. const field = this.hisTypes.filter((it)=>it.val==item.hospitalId);
  149. return field[0]?field[0].name:'';
  150. },
  151. getAllTypes(){
  152. if(localStorage.getItem("qcModuleTypes")){
  153. this.hisTypes = JSON.parse(localStorage.getItem("qcHospitalTypes"));
  154. this.fieldTypes = JSON.parse(localStorage.getItem("qcModuleTypes"));
  155. this.getDataList();
  156. return ;
  157. }
  158. //获取枚举信息
  159. api.getQcTypes().then((res)=>{
  160. if(res.data.code==="0"){
  161. const data = res.data.data;
  162. localStorage.setItem("qcModuleTypes",JSON.stringify(data[12]));
  163. localStorage.setItem("qcHospitalTypes",JSON.stringify(data[13]));
  164. this.hisTypes =data[13];
  165. this.fieldTypes =data[12];
  166. this.getDataList();
  167. }else{
  168. this.warning("获取枚举信息失败");
  169. }
  170. });
  171. },
  172. addBaseField(){
  173. const pam = this.searched ? {
  174. currentPage: this.currentPage,
  175. filter: this.filter
  176. } : {currentPage: this.currentPage};
  177. this.$router.push({name: 'FieldMatch', params: pam});
  178. },
  179. toEditField(row,type){
  180. api.getFieldDetail({id:row.id}).then((res)=>{
  181. const {code,data,msg} = res.data;
  182. if(code=='0'){
  183. const item = Object.assign({},row,data);
  184. const pam = this.searched ? {
  185. currentPage: this.currentPage,
  186. filter: this.filter
  187. } : {currentPage: this.currentPage};
  188. if(type == 'modify') {
  189. this.$router.push({name: 'FieldMatch', params: Object.assign(pam, {isEdit: true, info: item})});
  190. } else if( type == 'copy') {
  191. this.$router.push({name: 'FieldMatch', params: Object.assign(pam, {isCopy: true, info: item})});
  192. } else {
  193. return
  194. }
  195. }else{
  196. this.$message({
  197. message: msg,
  198. type: 'warning'
  199. });
  200. }
  201. });
  202. // this.$router.push({
  203. // name:'FieldMatch',
  204. // params: {info:row}
  205. // })
  206. },
  207. filterDatas(){
  208. this.currentPage = 1;
  209. this.getDataList();
  210. },
  211. getDataList() {
  212. const param = this.getFilterItems();
  213. this.searched = true;
  214. api.getFieldList(param).then((res) => {
  215. if (res.data.code == '0') {
  216. const data = res.data.data;
  217. this.list = data.records;
  218. this.total = data.total;
  219. }
  220. }).catch((error) => {
  221. console.log(error);
  222. });
  223. },
  224. getFilterItems() {
  225. const param = Object.assign({
  226. current: this.currentPage,
  227. size: this.pageSize
  228. },this.filter);
  229. return param;
  230. },
  231. indexMethod(index) {
  232. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  233. },
  234. currentChange(next) {
  235. this.currentPage = next;
  236. this.getDataList();
  237. },
  238. warning(msg,type){
  239. this.$message({
  240. showClose: true,
  241. message:msg,
  242. type:type||'warning'
  243. })
  244. },
  245. showConfirmDialog(msg,resolve){
  246. this.$alert(msg, '提示', {
  247. confirmButtonText: '确定',
  248. type: 'warning'
  249. }).then(() => {
  250. resolve();
  251. }).catch(() => {});
  252. },
  253. showDelDialog(id){
  254. this.showConfirmDialog('是否删除该字段映射?',()=>{
  255. api.delFieldMatch({ids:id}).then((res)=>{
  256. if(res.data.code=='0'){
  257. this.warning(res.data.msg||'操作成功','success');
  258. this.getDataList();
  259. }else{
  260. this.warning(res.data.msg);
  261. }
  262. }).catch((error)=>{
  263. this.warning(error);
  264. })
  265. });
  266. }
  267. }
  268. }
  269. </script>
  270. <style lang="less">
  271. @import "../../less/admin.less";
  272. .delete{
  273. color: red !important;
  274. }
  275. </style>