CombinQuestion.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div>
  3. <crumbs title="组合填写单维护" class="simpleQ-crumb">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="归属:">
  6. <el-select size="mini" v-model="filter.tagAdscription" placeholder="归属" clearable>
  7. <el-option v-if="item.val!=6&&item.val!=7&&item.val!=8&&item.val!=9&&item.val!=10&&item.val!=21&&item.val!=22" v-for="item in Adscriptions" :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.tagType[0]" placeholder="类型" clearable>
  12. <el-option v-for="item in tagTypes" :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.tagSysName" placeholder="填写单系统名称" clearable></el-input>
  17. </el-form-item>
  18. <el-form-item label="填写单医生界面名称:">
  19. <el-input size="mini" v-model="filter.name" placeholder="填写单医生界面名称" clearable></el-input>
  20. </el-form-item>
  21. <el-form-item>
  22. <el-button size="mini" @click="filterDatas">确认</el-button>
  23. <el-button size="mini" type="warning" @click="addIndeptTag">添加组合填写单</el-button>
  24. </el-form-item>
  25. </el-form>
  26. </crumbs>
  27. <div class="contents simpleQ-contents">
  28. <el-table
  29. :data="list"
  30. border
  31. style="width: 100%">
  32. <el-table-column
  33. :resizable = "false"
  34. type="index"
  35. :index = 'indexMethod'
  36. label="编号"
  37. width="60">
  38. </el-table-column>
  39. <el-table-column
  40. :resizable = "false"
  41. prop="gmtModified"
  42. label="操作时间"
  43. width="180">
  44. </el-table-column>
  45. <el-table-column
  46. :resizable = "false"
  47. prop="tagName"
  48. label="填写单系统名称">
  49. </el-table-column>
  50. <el-table-column
  51. :resizable = "false"
  52. prop="name"
  53. label="填写单医生界面名称">
  54. </el-table-column>
  55. <el-table-column
  56. :resizable = "false"
  57. prop="typeCn"
  58. label="归属"
  59. width="80">
  60. </el-table-column>
  61. <el-table-column
  62. :resizable = "false"
  63. prop="tagTypeCn"
  64. label="类型">
  65. </el-table-column>
  66. <el-table-column
  67. :resizable = "false"
  68. prop="modifier"
  69. label="操作人"
  70. width="120">
  71. </el-table-column>
  72. <el-table-column
  73. :resizable = "false"
  74. prop="operate"
  75. label="操作"
  76. width="140">
  77. <template slot-scope="scope">
  78. <el-button @click="modifyIndeptTag(scope.row)" type="text" size="small">修改</el-button>
  79. <span style="margin:0 3px;">|</span>
  80. <el-button @click="modifyIndeptTag(scope.row,true)" type="text" size="small">复制</el-button>
  81. <span style="margin:0 3px;">|</span>
  82. <el-button @click="showDelDialog(scope.row)" class="delete" type="text" size="small">删除</el-button>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. <el-pagination :current-page.sync="currentPage"
  87. @current-change="currentChange"
  88. background
  89. :page-size="pageSize"
  90. :page-sizes="pageSizeArr"
  91. @size-change="handleSizeChange"
  92. :layout="pageLayout"
  93. :total="total">
  94. </el-pagination>
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. import api from '@api/preTreat.js';
  100. import config from '@api/config.js';
  101. import utils from '@api/utils.js';
  102. export default {
  103. name: 'combinQuestion',
  104. data: function() {
  105. return {
  106. list: [],
  107. tagTypes: [],
  108. Adscriptions: [],
  109. tagTypesList:[],
  110. searched:false,
  111. filter: {
  112. tagType: [], //标签类型
  113. tagAdscription: '', //标签归属
  114. tagSysName: '', //标签系统名称
  115. name:'', //界面名称
  116. },
  117. currentPage: 1,
  118. pageSize: config.pageSize,
  119. pageSizeArr:config.pageSizeArr,
  120. pageLayout:config.pageLayout,
  121. total: 0,
  122. }
  123. },
  124. created() {
  125. this.getDropList();
  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. handleSizeChange(val){
  144. this.pageSize = val;
  145. this.currentPage = utils.getCurrentPage(this.currentPage, this.total, this.pageSize);
  146. this.getDataList();
  147. },
  148. getDropList() {
  149. api.getPreTypeList().then((res) =>{
  150. this.getDataList();
  151. if(res.data.code === '0') {
  152. this.Adscriptions = res.data.data[1];
  153. this.tagTypes = res.data.data[3];
  154. this.tagTypes = this.tagTypes.filter(item => item.val != 0) //去掉名称为默认值的填写单类型
  155. }
  156. })
  157. },
  158. getDataList(isTurnPage) {
  159. const param = this.getFilterItems(isTurnPage);
  160. this.searched = true;
  161. const loading = this.$loading({
  162. lock: true,
  163. text: 'Loading',
  164. spinner: 'el-icon-loading',
  165. background: 'rgba(0, 0, 0, 0.7)'
  166. });
  167. api.getQuestionList(param).then((res) => {
  168. loading.close()
  169. const list = [...res.data.data.records];
  170. for (var i = 0; i < list.length; i++) {
  171. for (var j = 0; j < this.tagTypes.length; j++) {
  172. if(list[i].tagType == this.tagTypes[j].val) {
  173. list[i].tagTypeCn = this.tagTypes[j].name;
  174. }
  175. }
  176. //后台数据typeCn转换为筛选中对应的字段名称
  177. for (var z = 0; z < this.Adscriptions.length; z++) {
  178. if(list[i].type == this.Adscriptions[z].val) {
  179. list[i].typeCn = this.Adscriptions[z].name;
  180. }
  181. }
  182. }
  183. this.list = list;
  184. this.total = res.data.data.total;
  185. if(this.inCurrentPage!==undefined){
  186. this.currentPage=this.inCurrentPage;
  187. this.inCurrentPage = undefined;
  188. }
  189. })
  190. },
  191. filterDatas() {
  192. this.currentPage = 1;
  193. this.getDataList();
  194. },
  195. addIndeptTag() {
  196. const pam = this.searched?{currentPage:this.currentPage,
  197. pageSize:this.pageSize,
  198. filter:this.filter}:{currentPage:this.currentPage,
  199. pageSize:this.pageSize};
  200. this.$router.push({name:'AddCombinQuestion',
  201. params:pam});
  202. },
  203. modifyIndeptTag(row,isCopy) {
  204. api.questionDetail({id:row.id}).then((res)=>{
  205. const {code,data,msg} = res.data;
  206. if(code=='0'){
  207. const infos = Object.assign({},row,data);
  208. const pam = this.searched?{currentPage:this.currentPage,
  209. pageSize:this.pageSize,
  210. filter:this.filter}:{currentPage:this.currentPage,
  211. pageSize:this.pageSize};
  212. this.$router.push({name:'AddCombinQuestion',params:Object.assign(pam,{[isCopy?'isCopy':'isEdit']:true,data:infos})});
  213. }else{
  214. this.$message({
  215. message: msg,
  216. type: 'warning'
  217. });
  218. }
  219. });
  220. },
  221. currentChange(next) {
  222. this.currentPage = next;
  223. this.getDataList(true);
  224. },
  225. getFilterItems(isTurnPage) {
  226. //翻页时筛选条件没点确定则清空
  227. if(isTurnPage&&!this.searched){
  228. this.clearfilter();
  229. };
  230. let param = {
  231. tagTypeList: this.filter.tagType[0] ? this.filter.tagType: [4,6],
  232. current: this.inCurrentPage||this.currentPage,
  233. callType:2,
  234. size: this.pageSize,
  235. type: this.filter.tagAdscription,
  236. tagName: this.filter.tagSysName.trim(),
  237. name:this.filter.name.trim(), //界面名称
  238. };
  239. return param;
  240. },
  241. clearfilter(){
  242. this.filter={
  243. tagType: [], //标签类型
  244. tagAdscription: '', //标签归属
  245. tagSysName: '', //标签系统名称
  246. name:'', //界面名称
  247. };
  248. },
  249. indexMethod(index) {
  250. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  251. },
  252. getTagType(val) {
  253. return val
  254. },
  255. warning(msg,type){
  256. this.$message({
  257. showClose: true,
  258. message:msg,
  259. type:type||'warning'
  260. })
  261. },
  262. showConfirmDialog(msg,resolve){
  263. this.$alert(msg, '提示', {
  264. confirmButtonText: '确定',
  265. type: 'warning'
  266. }).then(() => {
  267. resolve();
  268. }).catch(() => {});
  269. },
  270. showDelDialog(row){
  271. const param = {
  272. "ids": row.id,
  273. "type": row.type
  274. };
  275. this.showConfirmDialog('是否删除该填写单?',()=>{
  276. api.questionDel(param).then((res)=>{
  277. if(res.data.code=='0'){
  278. if(!this.searched){
  279. //未点确认时清空搜索条件
  280. this.clearfilter();
  281. }
  282. if(this.list.length==1){
  283. //当前在最后一页且只有一条数据时,删除后跳到前一页
  284. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  285. }
  286. this.getDataList();
  287. this.warning(res.data.msg || '操作成功','success');
  288. }else{
  289. this.warning(res.data.msg);
  290. }
  291. }).catch((error)=>{
  292. this.warning(error);
  293. })
  294. });
  295. }
  296. }
  297. }
  298. </script>
  299. <style lang="less">
  300. @import "../../less/admin.less";
  301. .delete{
  302. color: red
  303. }
  304. .delete:hover {
  305. color: red;
  306. }
  307. .el-select .el-input .el-icon-arrow-up{
  308. display: inline-block!important;
  309. }
  310. .el-select .el-input .el-icon-circle-close{
  311. float:left;
  312. }
  313. </style>