TemplateMaintenance.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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.val" :key="item.val" ></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. if(newVal != preVal){
  131. if(newVal == 1){
  132. this.AdscriptionsOwnTo = this.deptAndDisInfo.deptDTOS
  133. this.filter.ownTo = ''
  134. }else if(newVal == 2){
  135. this.AdscriptionsOwnTo = this.deptAndDisInfo.disDTOS
  136. this.filter.ownTo = ''
  137. }else{
  138. this.AdscriptionsOwnTo = []
  139. this.filter.ownTo = ''
  140. }
  141. }
  142. }
  143. },
  144. methods: {
  145. getSubTemplate() {
  146. api.getAllDeptAndDisInfo().then((res) => {
  147. if (res.data.code === '0') {//获取科室和疾病所有信息
  148. let result = res.data.data
  149. this.deptAndDisInfo = result
  150. localStorage.setItem('deptDis',JSON.stringify(result))
  151. }
  152. })
  153. },
  154. getDropList() {
  155. let templateType = localStorage.getItem('icssEnumsData') ? JSON.parse(localStorage.getItem('icssEnumsData')).moduleInfoTypeEnum : []
  156. this.AdscriptionsType = templateType
  157. return api.getDropList().then((res) =>{
  158. if(res.data.code === '0') {
  159. this.tagTypes = res.data.data[6];
  160. this.Adscriptions = res.data.data[4];
  161. localStorage.setItem('typeLis',JSON.stringify(res.data.data[4]))
  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. if(res.data.code == 0){
  172. const list = res.data.data.records
  173. for (var i = 0; i < list.length; i++) {
  174. for (var j = 0; j < this.tagTypes.length; j++) {
  175. if(list[i].tagType === this.tagTypes[j].val) {
  176. list[i].tagTypeCn = this.tagTypes[j].name;
  177. }
  178. }
  179. for (var z = 0; z < this.Adscriptions.length; z++) {
  180. if(list[i].type === this.Adscriptions[z].val) {
  181. list[i].typeCn = this.Adscriptions[z].name
  182. }
  183. }
  184. }
  185. this.list = list;
  186. this.total = res.data.data.total;
  187. }
  188. })
  189. },
  190. filterDatas() {
  191. this.currentPage = 1;
  192. this.getDataList();
  193. },
  194. addIndeptTag() {
  195. this.$router.push({path:'LT-YXSJWH-TJMBWH'})
  196. },
  197. modifyIndeptTag(row) {
  198. // api.detailsTag({ids:row.id}).then((res) => {
  199. // if (res.data.code === '0') {//获取科室和疾病所有信息
  200. // let result = res.data.data
  201. // console.log(result)
  202. // }
  203. // })
  204. Promise.all([
  205. api.getModuleInfoOne({moduleId:row.id}),
  206. api.getModuleDetailInfo({moduleId:row.id})
  207. ]).then((data)=>{
  208. let data0 = data[0].data;
  209. let data1 = data[1].data;
  210. let allData = {},topMsg={},rightMsg={};
  211. if(data0.code == 0){
  212. topMsg = Object.assign({},data0.data);
  213. }
  214. if(data1.code == 0){
  215. rightMsg = Object.assign({},data1);
  216. }
  217. allData = Object.assign({},topMsg,rightMsg)
  218. this.$router.push({name:'TemplateMaintenanceWrap',params:{isEdit:true,data:allData}});
  219. })
  220. },
  221. currentChange(next) {
  222. this.currentPage = next;
  223. this.getDataList();
  224. },
  225. getFilterItems() {
  226. const param = {
  227. current: this.currentPage,
  228. size: this.pageSize,
  229. type: this.filter.tagAdscription,
  230. moduleType:this.filter.templateType,
  231. relationId:this.filter.ownTo
  232. };
  233. return param;
  234. },
  235. indexMethod(index) {
  236. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  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,type){
  254. this.showConfirmDialog('是否删除该标签?',()=>{
  255. api.delTemplate({ids:id,type:type}).then((res)=>{
  256. if(res.data.code=='0'){
  257. this.getDataList();
  258. this.warning(res.data.msg || '操作成功','success');
  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. .delete{
  272. color: red
  273. }
  274. .delete:hover {
  275. color: red;
  276. }
  277. </style>