workTimeWeek.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="tabs-container">
  3. <el-row :gutter="20">
  4. <!--机构数据-->
  5. <el-col :span="4" :xs="24">
  6. <org-tree
  7. v-model="queryParams.orgId"
  8. @defaultKey="getDefaultKey"
  9. @checkChange="changeCheckBox"
  10. @click="handleNodeClick"
  11. ></org-tree>
  12. </el-col>
  13. <!--table数据-->
  14. <el-col :span="20" :xs="24">
  15. <!-- 搜索条件 -->
  16. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  17. <el-form-item label="生效日期">
  18. <el-date-picker
  19. v-model="dateRange"
  20. style="width: 240px"
  21. value-format="yyyy-MM-dd hh:mm:ss"
  22. type="daterange"
  23. range-separator="-"
  24. start-placeholder="开始日期"
  25. end-placeholder="结束日期"
  26. ></el-date-picker>
  27. </el-form-item>
  28. <el-form-item label="仅显示当前生效" label-width="120px">
  29. <el-switch
  30. v-model="queryParams.isEnable"
  31. inactive-color="#ccc">
  32. </el-switch>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  36. <el-button icon="el-icon-refresh" size="mini" @click="resetForm">重置</el-button>
  37. </el-form-item>
  38. </el-form>
  39. <!-- 按纽 -->
  40. <el-row :gutter="10" class="mb8">
  41. <el-col :span="1.5">
  42. <el-button
  43. type="primary"
  44. plain
  45. icon="el-icon-plus"
  46. size="mini"
  47. @click="addTemplate"
  48. v-hasPermi="['system:user:add']"
  49. >新增作息模板</el-button>
  50. </el-col>
  51. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  52. </el-row>
  53. <el-table
  54. v-loading="loading"
  55. style="width: auto;"
  56. border
  57. height="600"
  58. size="small"
  59. :data="tableList">
  60. <el-table-column fixed label="序号" type="index" align="center" width="50"></el-table-column>
  61. <el-table-column v-if="columns[0].visible" prop="orgName" label="机构" :show-overflow-tooltip="true"></el-table-column>
  62. <el-table-column v-if="columns[1].visible" prop="effectiveDate" label="生效日期" ></el-table-column>
  63. <el-table-column v-if="columns[2].visible" prop="workDay" label="工作日"></el-table-column>
  64. <el-table-column v-if="columns[3].visible" prop="modifiedName" label="更新人"></el-table-column>
  65. <el-table-column v-if="columns[4].visible" prop="updateTime" label="更新时间" ></el-table-column>
  66. <el-table-column v-if="columns[5].visible" label="操作" width="100" >
  67. <template slot-scope="r">
  68. <!-- <el-button type="text" v-if="r.row.timeCheck===0||r.row.timeCheck===3" @click="onEdit(r.row)">编辑</el-button>-->
  69. <!-- <el-button type="text" v-if="r.row.timeCheck===0" @click="onDelete(r.row.id)">删除</el-button>-->
  70. <!-- <el-button type="text" v-if="r.row.timeCheck===1||r.row.timeCheck===2" @click="info(r.row)">查看</el-button>-->
  71. <el-button type="text" v-hasPermi="['system:user:details']" @click="lookItem(r.row)">查看</el-button>
  72. </template>
  73. </el-table-column>
  74. </el-table>
  75. <pagination
  76. v-show="total >0"
  77. :total="total"
  78. :page.sync="queryParams.pageNum"
  79. :limit.sync="queryParams.pageSize"
  80. @pagination="getList"
  81. />
  82. </el-col>
  83. </el-row>
  84. <dialog-template ref="modalTemplate" @ok="getList" ></dialog-template>
  85. </div>
  86. </template>
  87. <script>
  88. import OrgTree from "@/components/orgTree";
  89. import DialogTemplate from './dialog.template'
  90. /** 引入节点树接口*/
  91. import { deptTreeSelect} from "@/api/system/public";
  92. import {weekTableList} from './api'
  93. import {formatTime} from "@/utils/ruoyi";
  94. export default {
  95. /** 得先引入字典才能使用 */
  96. dicts: ['sys_business_type'],
  97. components: {OrgTree,DialogTemplate},
  98. data() {
  99. return {
  100. loading:false,
  101. //选中的行
  102. selectRow:null,
  103. // 显示搜索条件
  104. showSearch: true,
  105. // 用户表格数据
  106. tableList: null,
  107. // 树选项
  108. orgTree: null,
  109. // 是否显示弹出层
  110. open: false,
  111. // 通过机构名称查询tree
  112. deptName: null,
  113. //是否关联下级
  114. checked: false,
  115. //自定义机构树数据
  116. defaultProps: {
  117. children: "children",
  118. label: "name"
  119. },
  120. // 查询参数
  121. queryParams: {
  122. pageNum: 1,
  123. pageSize: 10,
  124. checkSub: true,
  125. orgId: null,
  126. isEnable:false,
  127. },
  128. dateRange:[],
  129. total:0,
  130. // 列信息
  131. columns: [
  132. { key: 0, label: `机构`, visible: true },
  133. { key: 1, label: `日期`, visible: true },
  134. { key: 2, label: `营业状态`, visible: true },
  135. { key: 3, label: `上下班时间段`, visible: true },
  136. { key: 4, label: `营业时间段`, visible: true },
  137. { key: 5, label: `午休时间段`, visible: true },
  138. { key: 6, label: `更新人`, visible: true },
  139. { key: 7, label: `更新时间`, visible: true },
  140. { key: 8, label: `操作`, visible: true }
  141. ],
  142. //默认选中节点
  143. defaultKeys:[],
  144. };
  145. },
  146. computed: {
  147. pickerOptions() {
  148. return {
  149. start: "00:00",
  150. end: "24:00",
  151. step: "00:10",
  152. };
  153. },
  154. },
  155. created() {
  156. // this.getDeptTree();
  157. // this.getConfigKey("sys.user.initPassword").then(response => {
  158. // this.initPassword = response.msg;
  159. // });
  160. },
  161. methods: {
  162. getDefaultKey(key) {
  163. this.queryParams.orgId = key;
  164. this.getList();
  165. },
  166. /** 搜索按钮操作 */
  167. handleQuery() {
  168. this.queryParams.pageNum = 1;
  169. this.getList();
  170. },
  171. /** 查看 */
  172. lookItem(row) {
  173. this.selectRow = row;
  174. this.$refs.modalTemplate.show(row);
  175. },
  176. addTemplate(){
  177. this.$refs.modalTemplate.add();
  178. },
  179. /** 下穿状态改变*/
  180. changeCheckBox(){
  181. this.getList();
  182. },
  183. /** 查询列表 */
  184. getList() {
  185. weekTableList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  186. this.tableList = response.data.records;
  187. this.total = response.data.total;
  188. this.loading = false;
  189. }
  190. ).catch(err=>{
  191. this.loading = false;
  192. })
  193. },
  194. /** 查询机构树 */
  195. getDeptTree() {
  196. deptTreeSelect().then(response => {
  197. this.orgTree = response.data;
  198. this.defaultKeys.push(response.data[0].id);
  199. this.queryParams.orgId = response.data[0].id;
  200. this.handleQuery();
  201. });
  202. },
  203. // 筛选节点
  204. filterNode(value, data) {
  205. if (!value) return true;
  206. return data.name.indexOf(value) !== -1;
  207. },
  208. // 节点单击事件
  209. handleNodeClick(data) {
  210. this.queryParams.orgId = data.id;
  211. this.handleQuery();
  212. },
  213. /** 提交按钮 */
  214. submitForm() {
  215. },
  216. /** 导出按钮操作 */
  217. handleExport() {
  218. this.download('system/time/export', {
  219. ...this.queryParams
  220. }, `user_${new Date().getTime()}.xlsx`)
  221. },
  222. /* 重置搜索 */
  223. resetForm(name){
  224. this.queryParams = {
  225. pageNum: 1,
  226. pageSize: 10,
  227. orgId: null,
  228. isEnable:false,
  229. }
  230. this.dateRange = [];
  231. this.getList();
  232. },
  233. }
  234. };
  235. </script>