TemplateMaintenance.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <div>
  3. <crumbs title="模板维护" style="min-width: 980px">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="模板类型:">
  6. <el-select size="mini" v-model="filter.templateType" placeholder="模板类型" clearable>
  7. <el-option v-for="item in AdscriptionsType" :label="item.name" :value="item.key" :key="item.key" ></el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="归属:">
  11. <el-select size="mini" v-model="filter.tagAdscription" placeholder="归属" clearable>
  12. <el-option v-for="item in Adscriptions" :label="item.name" :value="item.key" :key="item.key" ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="属于:">
  16. <el-select size="mini" v-model="filter.ownTo" placeholder="属于" clearable>
  17. <el-option v-if="!!item.name" v-for="item in AdscriptionsOwnTo" :label="item.name" :value="item.id" :key="item.id" ></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button size="mini" @click="filterDatas">确认</el-button>
  22. <el-button size="mini" type="warning" @click="addIndeptTag">添加模板</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. :resizable = "false"
  36. width="60">
  37. </el-table-column>
  38. <el-table-column
  39. :resizable = "false"
  40. prop="gmtModified"
  41. label="操作时间"
  42. width="180">
  43. </el-table-column>
  44. <el-table-column
  45. :resizable = "false"
  46. prop="name"
  47. label="模板名称">
  48. </el-table-column>
  49. <el-table-column
  50. :resizable = "false"
  51. prop="moduleTypeName"
  52. label="模板类型">
  53. </el-table-column>
  54. <el-table-column
  55. :resizable = "false"
  56. prop="relationName"
  57. label="属于">
  58. </el-table-column>
  59. <el-table-column
  60. :resizable = "false"
  61. prop="ascriptionName"
  62. label="归属">
  63. </el-table-column>
  64. <el-table-column
  65. :resizable = "false"
  66. prop="userName"
  67. label="操作人">
  68. </el-table-column>
  69. <el-table-column
  70. :resizable = "false"
  71. prop="operate"
  72. label="操作">
  73. <template slot-scope="scope">
  74. <el-button @click="modifyIndeptTag(scope.row)" type="text" size="small">修改</el-button>
  75. <el-button @click="showDelDialog(scope.row.id,scope.row.type)" class="delete" type="text" size="small">删除</el-button>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. </div>
  80. <div class="pagination">
  81. <el-pagination v-if="total>pageSize"
  82. :current-page.sync="currentPage"
  83. @current-change="currentChange"
  84. background
  85. :page-size="pageSize"
  86. layout="total,prev, pager, next, jumper"
  87. :total="total">
  88. </el-pagination>
  89. </div>
  90. </div>
  91. </template>
  92. <script>
  93. import api from '@api/icss.js';
  94. export default {
  95. name: 'TemplateMaintenance',
  96. data: function() {
  97. return {
  98. list: [],
  99. tagTypes: [],
  100. Adscriptions: [],
  101. AdscriptionsType:[],
  102. AdscriptionsOwnTo:[],
  103. tagTypesList: [],
  104. filter: {
  105. tagType: [], //标签类型
  106. templateType: '', //模板类型
  107. ownTo: '', //属于科室、慢病
  108. tagAdscription: '', //标签归属
  109. tagSysName: '', //标签系统名称
  110. },
  111. currentPage: 1,
  112. pageSize: 10,
  113. total: 0,
  114. deptAndDisInfo:[],
  115. }
  116. },
  117. created() {
  118. this.getDropList().then(() => {
  119. this.getDataList()
  120. })
  121. this.getSubTemplate()
  122. },
  123. computed:{
  124. tmpType(){
  125. return this.filter.templateType
  126. }
  127. },
  128. watch: {
  129. tmpType(newVal, preVal){
  130. console.log(newVal,preVal)
  131. if(newVal != preVal){
  132. if(newVal == 1){
  133. this.AdscriptionsOwnTo = this.deptAndDisInfo.deptDTOS
  134. this.filter.ownTo = ''
  135. }else if(newVal == 2){
  136. this.AdscriptionsOwnTo = this.deptAndDisInfo.disDTOS
  137. this.filter.ownTo = ''
  138. }else{
  139. this.AdscriptionsOwnTo = []
  140. this.filter.ownTo = ''
  141. }
  142. }
  143. }
  144. },
  145. methods: {
  146. getSubTemplate() {
  147. api.getAllDeptAndDisInfo().then((res) => {
  148. if (res.data.code === '0') {//获取科室和疾病所有信息
  149. let result = res.data.data
  150. this.deptAndDisInfo = result
  151. }
  152. })
  153. },
  154. getDropList() {
  155. let templateOwn = localStorage.getItem('icssEnumsData') ? JSON.parse(localStorage.getItem('icssEnumsData')).moduleTypeEnum : []
  156. let templateType = localStorage.getItem('icssEnumsData') ? JSON.parse(localStorage.getItem('icssEnumsData')).moduleInfoTypeEnum : []
  157. this.Adscriptions = templateOwn;
  158. this.AdscriptionsType = templateType
  159. return api.getDropList().then((res) =>{
  160. if(res.data.code === '0') {
  161. this.tagTypes = res.data.data[6];
  162. for (var i = 0; i < this.tagTypes.length; i++) {
  163. this.tagTypesList.push(this.tagTypes[i].val)
  164. }
  165. }
  166. })
  167. },
  168. getDataList() {
  169. const param = this.getFilterItems();
  170. api.getModuleInfoList(param).then((res) => {
  171. const list = res.data.data.records
  172. for (var i = 0; i < list.length; i++) {
  173. for (var j = 0; j < this.tagTypes.length; j++) {
  174. if(list[i].tagType === this.tagTypes[j].val) {
  175. list[i].tagTypeCn = this.tagTypes[j].name;
  176. }
  177. }
  178. for (var z = 0; z < this.Adscriptions.length; z++) {
  179. if(list[i].type === this.Adscriptions[z].val) {
  180. list[i].typeCn = this.Adscriptions[z].name
  181. }
  182. }
  183. }
  184. this.list = list;
  185. this.total = res.data.data.total;
  186. })
  187. },
  188. filterDatas() {
  189. this.currentPage = 1;
  190. this.getDataList();
  191. },
  192. addIndeptTag() {
  193. this.$router.push({path:'LT-YXSJWH-TJMBWH'})
  194. },
  195. modifyIndeptTag(row) {
  196. console.log(row)
  197. Promise.all([
  198. api.getModuleInfoOne({moduleId:row.id}),
  199. api.getModuleDetailInfo({moduleId:row.id})
  200. ]).then((data)=>{
  201. let data0 = data[0].data;
  202. let data1 = data[1].data;
  203. let allData = {},topMsg={},rightMsg={};
  204. if(data0.code == 0){
  205. topMsg = Object.assign({},data0.data);
  206. }
  207. if(data1.code == 0){
  208. rightMsg = Object.assign({},data1);
  209. }
  210. allData = Object.assign({},topMsg,rightMsg)
  211. this.$router.push({name:'TemplateMaintenanceWrap',params:{isEdit:true,data:allData}});
  212. })
  213. },
  214. currentChange(next) {
  215. this.currentPage = next;
  216. this.getDataList();
  217. },
  218. getFilterItems() {
  219. const param = {
  220. current: this.currentPage,
  221. size: this.pageSize,
  222. type: this.filter.tagAdscription,
  223. moduleType:this.filter.templateType,
  224. relationId:this.filter.ownTo
  225. };
  226. return param;
  227. },
  228. indexMethod(index) {
  229. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  230. },
  231. warning(msg,type){
  232. this.$message({
  233. showClose: true,
  234. message:msg,
  235. type:type||'warning'
  236. })
  237. },
  238. showConfirmDialog(msg,resolve){
  239. this.$alert(msg, '提示', {
  240. confirmButtonText: '确定',
  241. type: 'warning'
  242. }).then(() => {
  243. resolve();
  244. }).catch(() => {});
  245. },
  246. showDelDialog(id,type){
  247. this.showConfirmDialog('是否删除该标签?',()=>{
  248. api.delTemplate({ids:id,type:type}).then((res)=>{
  249. if(res.data.code=='0'){
  250. this.getDataList();
  251. this.warning(res.data.msg || '操作成功','success');
  252. }else{
  253. this.warning(res.data.msg);
  254. }
  255. }).catch((error)=>{
  256. this.warning(error);
  257. })
  258. });
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="less">
  264. .delete{
  265. color: red
  266. }
  267. .delete:hover {
  268. color: red;
  269. }
  270. </style>