RuleCheck.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <div>
  3. <crumbs title="规则维护" :minWidth="titleWidth" class="knowledgeTitle">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="规则名称:">
  6. <el-input size="mini" v-model="filter.description" placeholder="请输入" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item label="规则类型:">
  9. <el-select v-model="filter.ruleType" clearable placeholder="请选择" size="mini">
  10. <el-option v-for="item in ruleTypeList" :key="item.val" :label="item.name" :value="item.val">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="规则术语类型:">
  15. <el-select v-model="filter.libType" clearable placeholder="请选择" size="mini">
  16. <el-option v-for="item in ruleTermTypeList" :key="item.val" :label="item.name"
  17. :value="item.val">
  18. </el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="医学标准术语:">
  22. <el-input size="mini" v-model="filter.libName" placeholder="请输入" clearable></el-input>
  23. </el-form-item>
  24. </el-form>
  25. <el-form class="secLine" :inline="true">
  26. <el-form-item label="基础规则术语类型:">
  27. <el-select v-model="filter.baseLibType" clearable placeholder="请选择" size="mini">
  28. <el-option v-for="item in baseTypeList" :key="item.val" :label="item.name" :value="item.val">
  29. </el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="基础医学标准术语:">
  33. <el-input size="mini" v-model="filter.baseLibName" placeholder="请输入" clearable></el-input>
  34. </el-form-item>
  35. <el-form-item>
  36. <el-button size="mini" @click="filterDatas">确认</el-button>
  37. </el-form-item>
  38. </el-form>
  39. </crumbs>
  40. <div class="contents knowledgeContents">
  41. <el-table :data="list" border style="width: 100%">
  42. <el-table-column type="index" :index="indexMethod" label="编号" width="120"></el-table-column>
  43. <el-table-column prop="ruleTypeName" label="规则类型" width="240">
  44. </el-table-column>
  45. <el-table-column prop="libTypeName" label="规则术语类型"></el-table-column>
  46. <el-table-column prop="libName" label="医学标准术语">
  47. </el-table-column>
  48. <el-table-column label="操作" width="120" fixed="right">
  49. <template slot-scope="scope">
  50. <el-button type="text" size="small" @click="checkData(scope.row)">查看</el-button>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <el-pagination :current-page.sync="currentPage" @current-change="currentChange" background
  55. :page-size="pageSize" :page-sizes="pageSizeArr" @size-change="handleSizeChange" :layout="pageLayout"
  56. :total="total"></el-pagination>
  57. </div>
  58. <el-dialog title="查看" :visible.sync="dialogVisible" :before-close="closecheckDialog" width="80rem"
  59. v-if="dialogVisible" :close-on-click-modal="false">
  60. <CheckRule :rulelist="rulelist" :baseTypeList="baseTypeList" :baseTermTypeList="baseTermTypeList"
  61. :ruleType="filter.ruleType?ruleTypeList.find(it => it.val == filter.ruleType).name:''"
  62. :libType="filter.libType?ruleTermTypeList.find(it => it.val == filter.libType).name:''"
  63. :libName="filter.libName?filter.libName:''">
  64. </CheckRule>
  65. <!-- <span slot="footer" class="dialog-footer">
  66. <el-button @click="closecheckDialog" style="margin-right: 15px">关闭</el-button>
  67. </span> -->
  68. </el-dialog>
  69. </div>
  70. </template>
  71. <script>
  72. import api from '@api/knowledgeLib.js';
  73. import config from '@api/config.js';
  74. import utils from '@api/utils.js';
  75. import CheckRule from "./CheckRule.vue";
  76. export default {
  77. name: 'ZskRuleCheck',
  78. data: function() {
  79. return {
  80. list: [],
  81. searched: false,
  82. filter: {
  83. // parStatus: '',
  84. // parDescription: '',
  85. // parConceptName: '',
  86. // parRuleType: '',
  87. description: '', //规则名称
  88. ruleType: '', //规则类型
  89. libType: '', //规则术语类型
  90. libName: '', //医学标准术语
  91. baseLibType: '', //基础规则术语类型
  92. baseLibName: '', //基础医学标准术语
  93. },
  94. ruleTypeList: [], //规则类型列表 1
  95. ruleTermTypeList: [], //规则术语类型列表 2
  96. conceptList: [], //医学标准术语列表 3
  97. baseTypeList: [], //基础规则类型列表 4
  98. baseTermTypeList: [], //基础规则术语类型列表 5
  99. rulelist: [], //查看
  100. cacheData: {},
  101. currentPage: 1,
  102. pageSize: config.pageSize,
  103. pageSizeArr: config.pageSizeArr,
  104. pageLayout: config.pageLayout,
  105. total: 0,
  106. titleWidth: '970px', //头部最小宽度
  107. dialogVisible: false,
  108. };
  109. },
  110. components: {
  111. CheckRule
  112. },
  113. created() {
  114. // const param = this.$route.params;
  115. // console.log(param)
  116. // if (param.currentPage) {
  117. // this.inCurrentPage = param.currentPage;
  118. // }
  119. // if (param.filter) {
  120. // this.filter = param.filter;
  121. // }
  122. const that = this;
  123. //返回时避免参数未赋值就获取列表
  124. setTimeout(function() {
  125. that.getDataList();
  126. });
  127. this.getDict();
  128. },
  129. watch: {
  130. filter: {
  131. handler: function() {
  132. this.searched = false;
  133. },
  134. deep: true
  135. }
  136. },
  137. // beforeRouteEnter(to, from, next) {
  138. // next(vm => {
  139. // //const pm = to.param;
  140. // Object.assign(vm, to.params);
  141. // vm.inCurrentPage=to.params.currentPage;
  142. // })
  143. // },
  144. methods: {
  145. getDict() {
  146. api.zskgetDict().then(res => {
  147. if (res.data.code == '0') {
  148. const data = res.data.data;
  149. this.ruleTypeList = data[-101]
  150. this.ruleTermTypeList = data[-102]
  151. this.baseTypeList = data[-103]
  152. this.baseTermTypeList = data[-104]
  153. console.log(this.baseTypeList)
  154. // const arr = data['20'].map(it => it.val);
  155. // //this.dict = arr.join(",");
  156. // //this.msgDict=(data['21'].map((it)=>it.val)||[]).join(",");
  157. // localStorage.setItem('zskDicts', arr.join(','));
  158. // localStorage.setItem(
  159. // 'zskMsgDict',
  160. // (data['21'].map(it => it.val) || []).join(',')
  161. // );
  162. // localStorage.setItem('zskNumDict', data['22'][0].val);
  163. // localStorage.setItem('zskSubDict', (data['23'].map(it => it.val) || []).join(','));
  164. // localStorage.setItem('zskDragDict', (data['27'].map(it => it.val) || []).join(','));
  165. // localStorage.setItem('zskDelDict', data['26'][0].val);
  166. }
  167. })
  168. .catch(error => {
  169. console.log(error);
  170. });
  171. },
  172. statusTrans(type) {
  173. const obj = this.ruleTypeList.find(it => it.type === type);
  174. return obj && obj.name;
  175. },
  176. handleSizeChange(val) {
  177. this.pageSize = val;
  178. this.currentPage = utils.getCurrentPage(
  179. this.currentPage,
  180. this.total,
  181. this.pageSize
  182. );
  183. this.getDataList();
  184. },
  185. filterDatas() {
  186. this.currentPage = 1;
  187. this.getDataList(1);
  188. },
  189. getDataList(flag, isTurnPage) {
  190. const params = this.getFilterItems(isTurnPage);
  191. this.searched = true;
  192. const loading = this.$loading({
  193. lock: true,
  194. text: 'Loading',
  195. spinner: 'el-icon-loading',
  196. background: 'rgba(0, 0, 0, 0.7)'
  197. });
  198. api.zskgetRulePage(params).then(res => {
  199. loading.close();
  200. if (res.data.code == '0') {
  201. const data = res.data.data;
  202. this.list = data.records;
  203. if (!flag) {
  204. //搜索时不缓存
  205. this.cacheData[params.current] = data.records;
  206. } else {
  207. this.cacheData = {};
  208. }
  209. this.total = data.total;
  210. if (this.inCurrentPage !== undefined) {
  211. this.currentPage = this.inCurrentPage;
  212. this.inCurrentPage = undefined;
  213. }
  214. } else {
  215. this.warning(res.data.msg || '获取列表数据失败');
  216. }
  217. })
  218. .catch(error => {
  219. loading.close();
  220. console.log(error);
  221. });
  222. },
  223. getFilterItems(isTurnPage) {
  224. //翻页时筛选条件没点确定则清空
  225. if (isTurnPage && !this.searched) {
  226. this.clearFilter();
  227. }
  228. const param = {
  229. current: this.inCurrentPage || this.currentPage,
  230. size: this.pageSize,
  231. libName: this.filter.libName.trim(),
  232. libType: this.filter.libType,
  233. ruleType: this.filter.ruleType,
  234. baseLibName: this.filter.baseLibName.trim(),
  235. baseLibType: this.filter.baseLibType,
  236. description: this.filter.description.trim(),
  237. };
  238. return param;
  239. },
  240. indexMethod(index) {
  241. return (this.currentPage - 1) * this.pageSize + index + 1;
  242. },
  243. currentChange(next) {
  244. this.currentPage = next;
  245. /*if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  246. this.list = this.cacheData[next];
  247. } else {*/
  248. this.getDataList(1, true);
  249. //}
  250. },
  251. warning(msg, type) {
  252. this.$message({
  253. showClose: true,
  254. message: msg,
  255. type: type || 'warning'
  256. });
  257. },
  258. checkData(row) {
  259. if (!this.searched) {
  260. this.clearFilter();
  261. }
  262. const param = {
  263. baseLibName: this.filter.baseLibName,
  264. baseLibType: this.filter.baseLibType,
  265. description: this.filter.description,
  266. libName: row.libName,
  267. libType: row.libType,
  268. ruleType: row.ruleType,
  269. }
  270. api.zskgetRuleDetail(param).then((res) => {
  271. if (res.data.code == "0") {
  272. this.rulelist = res.data.data
  273. this.dialogVisible = true
  274. }
  275. })
  276. .catch((error) => {
  277. console.log(error);
  278. });
  279. },
  280. closecheckDialog() {
  281. this.dialogVisible = false
  282. },
  283. clearFilter() {
  284. this.filter = {
  285. description: '',
  286. ruleType: '',
  287. libType: '',
  288. libName: '',
  289. baseLibType: '',
  290. baseLibName: '',
  291. };
  292. },
  293. }
  294. };
  295. </script>
  296. <style lang="less" scoped>
  297. @import '../../less/admin.less';
  298. /deep/ .container.knowledgeTitle {
  299. height: 80px;
  300. }
  301. /deep/ .contents.knowledgeContents {
  302. padding: 104px 20px 0;
  303. }
  304. /deep/ .secLine.el-form {
  305. float: right;
  306. display: block;
  307. position: relative;
  308. top: -5px;
  309. }
  310. .delete {
  311. color: red;
  312. }
  313. .review {
  314. color: #22ccc8;
  315. }
  316. .el-table .cell {
  317. overflow: hidden;
  318. white-space: nowrap;
  319. }
  320. #upFile {
  321. display: none !important;
  322. }
  323. .unvailable {
  324. color: #fe7d3d;
  325. &:hover {
  326. color: #f19061;
  327. }
  328. }
  329. // /deep/.el-dialog__footer{
  330. // padding-bottom:10px
  331. // }
  332. </style>