index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <!--大屏通知-->
  2. <template>
  3. <div class="app-container labNotify">
  4. <div class="labNotifyPage" v-if="pageType == 1">
  5. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
  6. <el-form-item label="关键字" prop="searchValue" label-width="60px">
  7. <el-input
  8. v-model="queryParams.searchValue"
  9. placeholder="入标题/发布单位/发布人"
  10. clearable
  11. size="small"
  12. />
  13. </el-form-item>
  14. <el-form-item label="类型" prop="notifyType" label-width="60px">
  15. <el-select v-model="queryParams.notifyType" placeholder="请选择发布类型" clearable size="small">
  16. <el-option label="工作通知" :value="1" />
  17. <el-option label="校院通知" :value="2" />
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="发布时间" prop="createTimeDate" label-width="80px">
  21. <el-date-picker
  22. :clearable="false"
  23. v-model="createTimeDate"
  24. size="small"
  25. style="width: 240px"
  26. value-format="yyyy-MM-dd"
  27. type="daterange"
  28. range-separator="-"
  29. start-placeholder="开始日期"
  30. end-placeholder="结束日期"
  31. ></el-date-picker>
  32. </el-form-item>
  33. <el-form-item style="float: right;">
  34. <el-col :span="1.5">
  35. <p class="add-button-one-120"
  36. @click="pageTypeClick(2)"
  37. v-hasPermi="['laboratory:notifyplan:add']"
  38. >新增</p>
  39. </el-col>
  40. </el-form-item>
  41. <el-form-item >
  42. <p class="inquire-button-one" @click="handleQuery">查询</p>
  43. <p class="reset-button-one" @click="resetQuery">重置</p>
  44. </el-form-item>
  45. </el-form>
  46. <el-table v-loading="loading" border :data="notifyplanList" @selection-change="handleSelectionChange">
  47. <!--<el-table-column type="selection" width="55" align="center" />-->
  48. <!--<el-table-column label="主键" align="left" prop="id" />-->
  49. <el-table-column label="标题" align="left" prop="title" />
  50. <el-table-column label="发布单位" align="left" prop="company" />
  51. <el-table-column label="类型" align="left" prop="notifyType">
  52. <template slot-scope="scope">{{scope.row.notifyType == 1?'工作通知':(scope.row.notifyType == 2?'校院通知':'')}}</template>
  53. </el-table-column>
  54. <el-table-column label="发布人" align="left" prop="createUsername" />
  55. <el-table-column label="发布时间" align="left" prop="createTime" />
  56. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="160" v-if="tableButtonType">
  57. <template slot-scope="scope">
  58. <div class="button-box" style="display: flex">
  59. <p class="table-min-button"
  60. style="margin-right: 10px"
  61. @click="pageTypeClick(3,scope.row)"
  62. v-hasPermi="['laboratory:notifyplan:query']"
  63. >查看</p>
  64. <p class="table-min-button"
  65. style="margin-right: 10px"
  66. @click="handleDelete(scope.row)"
  67. v-hasPermi="['laboratory:notifyplan:remove']"
  68. >删除</p>
  69. </div>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. <pagination :page-sizes="[20, 30, 40, 50]"
  74. v-show="total>0"
  75. :total="total"
  76. :page.sync="queryParams.pageNum"
  77. :limit.sync="queryParams.pageSize"
  78. @pagination="getList"
  79. />
  80. </div>
  81. <add-page v-if="pageType == 2"></add-page>
  82. <info-page v-if="pageType == 3" :infoData="infoData"></info-page>
  83. <!-- 添加或修改大屏通知计划对话框 -->
  84. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  85. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  86. <el-form-item label="标题" prop="title">
  87. <el-input v-model="form.title" maxLength="12" placeholder="请输入通知标题" style="width:330px;" :disabled="lookType"/>
  88. </el-form-item>
  89. <el-form-item label="发布单位" prop="company">
  90. <el-input v-model="form.company" maxLength="12" placeholder="请输入发布单位" style="width:330px;" :disabled="lookType"/>
  91. </el-form-item>
  92. <el-form-item label="类型" prop="notifyType">
  93. <el-select v-model="form.notifyType" placeholder="请选择发布类型" style="width:330px;" :disabled="lookType">
  94. <el-option label="工作通知" :value="1" />
  95. <el-option label="校院通知" :value="2" />
  96. </el-select>
  97. </el-form-item>
  98. <el-form-item label="内容" prop="content">
  99. <el-input type="textarea" v-model="form.content"
  100. :rows="6" maxLength="100" placeholder="请输入内容"
  101. style="width:330px;" :disabled="lookType"/>
  102. </el-form-item>
  103. </el-form>
  104. <div slot="footer" class="dialog-footer">
  105. <el-button @click="cancel">关闭</el-button>
  106. <el-button type="primary" @click="submitForm" v-if="!lookType">确 定</el-button>
  107. </div>
  108. </el-dialog>
  109. </div>
  110. </template>
  111. <script>
  112. import { listNotifyplan, getNotifyplan, delNotifyplan, addNotifyplan, updateNotifyplan } from "@/api/laboratory/notifyplan";
  113. import addPage from "./addPage.vue"
  114. import infoPage from "./infoPage.vue"
  115. export default {
  116. name: "Notifyplan",
  117. components: {
  118. addPage,
  119. infoPage
  120. },
  121. data() {
  122. return {
  123. tableButtonType:this.hasPermiDom(['laboratory:notifyplan:query','laboratory:notifyplan:remove']),
  124. pageType:1,
  125. // 遮罩层
  126. loading: true,
  127. // 选中数组
  128. ids: [],
  129. // 非单个禁用
  130. single: true,
  131. // 非多个禁用
  132. multiple: true,
  133. // 显示搜索条件
  134. showSearch: true,
  135. // 总条数
  136. total: 0,
  137. // 大屏通知计划表格数据
  138. notifyplanList: [],
  139. // 弹出层标题
  140. title: "",
  141. // 是否显示弹出层
  142. open: false,
  143. // 查询参数
  144. queryParams: {
  145. pageNum: 1,
  146. pageSize:20,
  147. searchValue: null,
  148. title: null,
  149. notifyType: null,
  150. type: null,
  151. contentName: null,
  152. contentUrl: null,
  153. content: null,
  154. company: null,
  155. status: null,
  156. createUserid: null,
  157. createUsername: null,
  158. updateUserid: null,
  159. updateUsername: null,
  160. },
  161. createTimeDate:[],
  162. // 表单参数
  163. form: {},
  164. // 表单校验
  165. rules: {
  166. title: [
  167. { required: true, message: "请输入通知标题", trigger: "blur" },
  168. { required: true, message: "请输入通知标题", validator: this.spaceJudgment, trigger: "blur" }
  169. ],
  170. company: [
  171. { required: true, message: "请输入发布单位", trigger: "blur" },
  172. { required: true, message: "请输入发布单位", validator: this.spaceJudgment, trigger: "blur" }
  173. ],
  174. notifyType: [
  175. { required: true, message: "请选择发布类型", trigger: "blur" }
  176. ],
  177. content: [
  178. { required: true, message: "请输入内容", trigger: "blur" },
  179. { required: true, message: "请输入内容", validator: this.spaceJudgment, trigger: "blur" }
  180. ],
  181. },
  182. lookType:false,
  183. infoData:{},
  184. };
  185. },
  186. created() {
  187. this.getList();
  188. },
  189. methods: {
  190. pageTypeClick(type,row){
  191. if(this.pageType != type){
  192. if(type == 1){
  193. this.pageType = 1;
  194. this.getList();
  195. }else if(type == 2){
  196. this.pageType = 2;
  197. }else if(type == 3){
  198. this.pageType = 3;
  199. this.infoData = row;
  200. this.infoData.content = unescape(row.content);
  201. // this.infoData.content = decodeURI(row.content);
  202. }
  203. }
  204. },
  205. /** 查询大屏通知计划列表 */
  206. getList() {
  207. if(this.createTimeDate[0]){
  208. this.queryParams.beginTime = this.createTimeDate[0];
  209. this.queryParams.endTime = this.createTimeDate[1];
  210. }else {
  211. this.queryParams.beginTime = null
  212. this.queryParams.endTime = null
  213. }
  214. this.loading = true;
  215. this.queryParams.type = 1;
  216. listNotifyplan(this.queryParams).then( response => {
  217. this.notifyplanList = response.rows;
  218. this.total = response.total;
  219. this.loading = false;
  220. });
  221. },
  222. // 取消按钮
  223. cancel() {
  224. this.open = false;
  225. this.reset();
  226. },
  227. // 表单重置
  228. reset() {
  229. this.resetForm("form");
  230. this.form = {
  231. id: null,
  232. title: null,
  233. notifyType: null,
  234. content: null,
  235. company: null,
  236. type:1,
  237. };
  238. },
  239. /** 搜索按钮操作 */
  240. handleQuery() {
  241. this.queryParams.pageNum = 1;
  242. this.getList();
  243. },
  244. /** 重置按钮操作 */
  245. resetQuery() {
  246. this.createTimeDate = []
  247. // this.resetForm("queryForm");
  248. this.$set(this,'queryParams',{
  249. pageNum: 1,
  250. pageSize:20,
  251. searchValue:"",
  252. notifyType:"",
  253. });
  254. this.handleQuery();
  255. },
  256. // 多选框选中数据
  257. handleSelectionChange(selection) {
  258. this.ids = selection.map(item => item.id)
  259. this.single = selection.length!==1
  260. this.multiple = !selection.length
  261. },
  262. /** 新增按钮操作 */
  263. handleAdd() {
  264. this.reset();
  265. this.lookType = false;
  266. this.open = true;
  267. this.title = "新增通知";
  268. },
  269. /** 修改按钮操作 */
  270. handleUpdate(row) {
  271. this.reset();
  272. const id = row.id || this.ids
  273. getNotifyplan(id).then( response => {
  274. this.form = response.data;
  275. this.lookType = true;
  276. this.open = true;
  277. this.title = "通知详情";
  278. });
  279. },
  280. /** 提交按钮 */
  281. submitForm() {
  282. this.$refs["form"].validate(valid => {
  283. if (valid) {
  284. if (this.form.id != null) {
  285. updateNotifyplan(this.form).then( response => {
  286. this.msgSuccess("修改成功");
  287. this.open = false;
  288. this.getList();
  289. });
  290. } else {
  291. addNotifyplan(this.form).then( response => {
  292. this.msgSuccess("新增成功");
  293. this.open = false;
  294. this.getList();
  295. });
  296. }
  297. }
  298. });
  299. },
  300. /** 删除按钮操作 */
  301. handleDelete(row) {
  302. const ids = row.id || this.ids;
  303. this.$confirm('是否确认删除?', "警告", {
  304. confirmButtonText: "确定",
  305. cancelButtonText: "取消",
  306. type: "warning"
  307. }).then(function() {
  308. return delNotifyplan(ids);
  309. }).then(() => {
  310. this.getList();
  311. this.msgSuccess("删除成功");
  312. }).catch(() => {});
  313. },
  314. /** 导出按钮操作 */
  315. handleExport() {
  316. this.download('laboratory/notifyplan/export', {
  317. ...this.queryParams
  318. }, `laboratory_notifyplan.xlsx`)
  319. }
  320. }
  321. };
  322. </script>
  323. <style scoped lang="scss">
  324. .labNotify{
  325. display: flex !important;
  326. flex-direction: column;
  327. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  328. margin: 9px 20px 20px;
  329. overflow: hidden;
  330. .labNotifyPage{
  331. flex:1;
  332. display: flex !important;
  333. flex-direction: column;
  334. padding:11px 20px 20px!important;
  335. overflow: hidden;
  336. }
  337. }
  338. </style>