index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="10" class="el-row-ex">
  4. <!--机构数据-->
  5. <!-- <el-col :span="4" :xs="24">
  6. <org-tree
  7. v-model="queryParams.orgId"
  8. @defaultKey="getDefaultKey"
  9. @checkChange="checkChange"
  10. @click="clickTreeNode"
  11. :customRequest="orgTree"
  12. ></org-tree>
  13. </el-col> -->
  14. <el-col :span="24" :xs="24" class="el-col-ex">
  15. <div class="main-right-box">
  16. <!-- 搜索条件 -->
  17. <div class="main-search-box">
  18. <!-- 搜索条件 -->
  19. <el-form
  20. :model="queryParams"
  21. ref="search"
  22. size="small"
  23. :inline="true"
  24. v-show="showSearch"
  25. >
  26. <el-form-item label="发布机构">
  27. <org-tree
  28. v-model="queryParams.orgId"
  29. @defaultKey="getDefaultKey"
  30. @checkChange="checkChange"
  31. @click="clickTreeNode"
  32. :customRequest="orgTree"
  33. ></org-tree>
  34. </el-form-item>
  35. <el-form-item prop="name" label="履职库名称" label-width="100">
  36. <el-input
  37. v-model="queryParams.name"
  38. :maxlength="50"
  39. placeholder="请输入履职库名称"
  40. clearable
  41. />
  42. </el-form-item>
  43. <el-form-item prop="orgType" label="履职机构类型">
  44. <el-select
  45. prop="orgType"
  46. label="履职机构类型"
  47. v-model="queryParams.orgType"
  48. placeholder="请选择履职机构类型"
  49. clearable
  50. >
  51. <el-option
  52. v-for="item in dict.type.sys_org_type"
  53. :key="item.value"
  54. :label="item.label"
  55. :value="item.value"
  56. >
  57. </el-option>
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item> </el-form-item>
  61. </el-form>
  62. <!-- 按纽 -->
  63. <el-row :gutter="10" class="mb8">
  64. <el-col :span="1.5">
  65. <el-button
  66. type="primary"
  67. icon="el-icon-search"
  68. size="mini"
  69. @click="refresh"
  70. v-hasPermi="['resumption:rule:query']"
  71. >搜索</el-button
  72. >
  73. <el-button
  74. type="primary"
  75. icon="el-icon-refresh"
  76. size="mini"
  77. @click="resetQuery"
  78. >重置</el-button
  79. >
  80. <el-button
  81. type="primary"
  82. icon="el-icon-plus"
  83. size="mini"
  84. @click="handleAdd()"
  85. v-hasPermi="['resumption:rule:add']"
  86. >新增履职内容库</el-button
  87. >
  88. </el-col>
  89. <right-toolbar
  90. :showSearch.sync="showSearch"
  91. @queryTable="getList"
  92. :columns="columns"
  93. ></right-toolbar>
  94. </el-row>
  95. </div>
  96. <el-table
  97. size="small"
  98. v-loading="loading"
  99. :data="pageData"
  100. @selection-change="handleSelectionChange"
  101. height="640"
  102. >
  103. <el-table-column
  104. header-align="center"
  105. type="index"
  106. label="序号"
  107. width="60"
  108. align="center"
  109. v-if="columns[0].visible"
  110. >
  111. <template slot-scope="scope">
  112. {{
  113. (queryParams.pageNum - 1) * queryParams.pageSize +
  114. scope.$index +
  115. 1
  116. }}
  117. </template>
  118. </el-table-column>
  119. <el-table-column
  120. header-align="center"
  121. prop="name"
  122. label="履职库名称"
  123. v-if="columns[1].visible"
  124. ></el-table-column>
  125. <el-table-column
  126. header-align="center"
  127. prop="orgType"
  128. label="履职机构类型"
  129. v-if="columns[2].visible"
  130. >
  131. <template slot-scope="r"
  132. >{{ getLabel(dict.type.sys_org_type, r.row.orgType) }}
  133. </template>
  134. </el-table-column>
  135. <el-table-column
  136. header-align="center"
  137. prop="orgName"
  138. label="发布机构"
  139. v-if="columns[3].visible"
  140. ></el-table-column>
  141. <el-table-column
  142. header-align="center"
  143. prop="status"
  144. label="状态"
  145. align="center"
  146. v-if="columns[4].visible"
  147. >
  148. <template slot-scope="r">
  149. <span>{{ getLabel(dict.type.plan_status, r.row.status) }}</span>
  150. </template>
  151. </el-table-column>
  152. <el-table-column
  153. header-align="center"
  154. prop="remark"
  155. label="备注"
  156. v-if="columns[5].visible"
  157. ></el-table-column>
  158. <el-table-column
  159. header-align="center"
  160. label="操作"
  161. class="small-padding fixed-width"
  162. width="250"
  163. >
  164. <template slot-scope="r">
  165. <el-button
  166. size="mini"
  167. type="text"
  168. icon="el-icon-edit-outline"
  169. @click="onEdit(r.row.id)"
  170. v-hasPermi="['resumption:rule:edit']"
  171. v-if="orgId == r.row.orgId"
  172. >编辑</el-button
  173. >
  174. <el-button
  175. size="mini"
  176. type="text"
  177. icon="el-icon-edit-outline"
  178. @click="onManageContent(r.row.id)"
  179. v-hasPermi="['resumption:rule:contentmanage']"
  180. v-if="orgId == r.row.orgId"
  181. >管理内容库</el-button
  182. >
  183. <el-button
  184. size="mini"
  185. type="text"
  186. icon="el-icon-view"
  187. @click="onManageContent(r.row.id)"
  188. v-hasPermi="['resumption:rule:contentmanage']"
  189. v-if="orgId != r.row.orgId"
  190. >查看内容库</el-button
  191. >
  192. <el-button
  193. type="text"
  194. size="mini"
  195. slot="reference"
  196. icon="el-icon-delete"
  197. v-if="orgId == r.row.orgId"
  198. v-hasPermi="['resumption:rule:remove']"
  199. @click="onDel(r.row.id)"
  200. >删除</el-button
  201. >
  202. </template>
  203. </el-table-column>
  204. </el-table>
  205. <pagination
  206. v-show="total > 0"
  207. :total="total"
  208. :page.sync="queryParams.pageNum"
  209. :limit.sync="queryParams.pageSize"
  210. @pagination="getList"
  211. />
  212. </div>
  213. </el-col>
  214. </el-row>
  215. <dialog-edit
  216. ref="editDialog"
  217. @success="getList()"
  218. :orgTypeOptions="dict.type.sys_org_type"
  219. :statusOptions="dict.type.plan_status"
  220. ></dialog-edit>
  221. </div>
  222. </template>
  223. <script>
  224. import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
  225. import { mapGetters } from "vuex";
  226. import DialogEdit from "./dialog.edit";
  227. import * as api from "@/api/resumption/rule";
  228. import { getLabel } from "./../../commonOption";
  229. import { wholeTreeByType } from "@/api/system/org.js";
  230. export default {
  231. name: "ruletype",
  232. dicts: ["sys_org_type", "plan_status"],
  233. components: {
  234. DialogEdit,
  235. OrgTree,
  236. },
  237. data() {
  238. const { params, query } = this.$route;
  239. return {
  240. isShow: false,
  241. loading: false,
  242. ids: [],
  243. // 非单个禁用
  244. single: true,
  245. // 非多个禁用
  246. multiple: true,
  247. // 显示搜索条件
  248. showSearch: true,
  249. total: 0,
  250. queryParams: {
  251. orgId: null,
  252. name: null,
  253. type: null,
  254. orgType: null,
  255. checkSub: true,
  256. pageNum: 1,
  257. pageSize: 10,
  258. ...query,
  259. },
  260. pageData: [],
  261. // 列信息
  262. columns: [
  263. { key: 0, label: `序号`, visible: true },
  264. { key: 1, label: `履职库名称`, visible: true },
  265. { key: 2, label: `履职机构类型`, visible: true },
  266. { key: 3, label: `发布机构`, visible: true },
  267. { key: 4, label: `状态`, visible: true },
  268. { key: 5, label: `备注`, visible: true },
  269. ],
  270. };
  271. },
  272. props: {},
  273. watch: {},
  274. computed: {
  275. ...mapGetters(["orgId"]),
  276. },
  277. methods: {
  278. getLabel,
  279. orgTree() {
  280. return wholeTreeByType(3);
  281. },
  282. refresh() {
  283. this.queryParams.pageNum = 1;
  284. this.getList();
  285. },
  286. getList() {
  287. this.loading = true;
  288. console.info(this.dict.type);
  289. this.pageData = [];
  290. api
  291. .list(this.queryParams)
  292. .then((response) => {
  293. this.pageData = response.rows;
  294. this.total = response.total;
  295. this.loading = false;
  296. })
  297. .catch(() => {
  298. this.loading = false;
  299. });
  300. },
  301. getDefaultKey(key) {
  302. this.queryParams.orgId = key;
  303. this.getList();
  304. },
  305. handleAdd(id, other = {}) {
  306. this.$refs.editDialog.show(id, other);
  307. },
  308. onEdit(id, other = {}) {
  309. this.$refs.editDialog.show(id, other);
  310. },
  311. onManageContent(id) {
  312. let path = `/core/resumption/rule/content/${id}`;
  313. this.$router.push(path);
  314. },
  315. onDel(id) {
  316. this.$modal
  317. .confirm("确定删除履职内容库定义?")
  318. .then(() => {
  319. return api.remove(id);
  320. })
  321. .then(() => {
  322. this.$message.info("删除成功");
  323. this.getList();
  324. });
  325. },
  326. // 多选框选中数据
  327. handleSelectionChange(selection) {
  328. this.ids = selection.map((item) => item.userId);
  329. this.single = selection.length != 1;
  330. this.multiple = !selection.length;
  331. },
  332. /** 重置按钮操作 */
  333. resetQuery() {
  334. this.resetForm("search");
  335. // this.queryParams.orgId = undefined;
  336. // this.$refs.tree.setCurrentKey(null);
  337. this.getList();
  338. },
  339. //单选框状态改变
  340. checkChange(state) {
  341. this.queryParams.checkSub = state;
  342. this.getList();
  343. },
  344. // 节点单击事件
  345. clickTreeNode(data) {
  346. this.queryParams.orgId = data.id;
  347. this.getList();
  348. },
  349. //apimark//
  350. },
  351. mounted() {},
  352. };
  353. </script>
  354. <style lang="scss" scoped>
  355. .el-table {
  356. display: flex;
  357. flex-direction: column;
  358. }
  359. .el-row-ex {
  360. height: 100%;
  361. ::v-deep .el-col-ex {
  362. height: 100%;
  363. }
  364. }
  365. </style>