123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366 |
- <!--大屏计划-->
- <template>
- <div class="app-container labNotifyplan">
- <div class="labNotifyplan-page" v-if="pageType == 1">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="关键字" prop="searchValue">
- <el-input
- v-model="queryParams.searchValue"
- placeholder="标题/发布单位/发布人"
- clearable
- size="small"
- />
- </el-form-item>
- <el-form-item label="发布时间" prop="createTimeDate" label-width="80px">
- <el-date-picker
- :clearable="false"
- v-model="createTimeDate"
- size="small"
- style="width: 240px"
- value-format="yyyy-MM-dd"
- type="daterange"
- range-separator="-"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- ></el-date-picker>
- </el-form-item>
- <el-form-item style="float: right;">
- <el-col :span="1.5">
- <p class="add-button-one-120"
- @click="pageTypeClick(2)"
- v-hasPermi="['laboratory:worknotifyplan:add']"
- >新增</p>
- </el-col>
- </el-form-item>
- <el-form-item>
- <p class="inquire-button-one" @click="handleQuery">查询</p>
- <p class="reset-button-one" @click="resetQuery">重置</p>
- </el-form-item>
- </el-form>
- <el-table v-loading="loading" border :data="notifyplanList" @selection-change="handleSelectionChange">
- <!--<el-table-column type="selection" width="55" align="center" />-->
- <!--<el-table-column label="主键" align="center" prop="id" />-->
- <el-table-column label="标题" align="left" prop="title" />
- <el-table-column label="发布单位" align="left" prop="company" />
- <el-table-column label="发布人" align="left" prop="createBy" />
- <el-table-column label="发布时间" align="left" prop="createTime" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160" v-if="tableButtonType">
- <template slot-scope="scope">
- <div class="button-box" style="display: flex">
- <p class="table-min-button"
- style="margin-right: 10px"
- @click="pageTypeClick(3,scope.row)"
- v-hasPermi="['laboratory:worknotifyplan:query']"
- >查看</p>
- <p class="table-min-button"
- style="margin-right: 10px"
- @click="handleDelete(scope.row)"
- v-hasPermi="['laboratory:worknotifyplan:remove']"
- >删除</p>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination :page-sizes="[20, 30, 40, 50]"
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- <add-page v-if="pageType == 2"></add-page>
- <info-page v-if="pageType == 3" :infoData="infoData"></info-page>
- <!-- 添加或修改大屏通知计划对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-form-item label="标题" prop="title">
- <el-input v-model="form.title" maxLength="12" placeholder="请输入通知标题" style="width:330px;" :disabled="lookType"/>
- </el-form-item>
- <el-form-item label="发布单位" prop="company">
- <el-input v-model="form.company" maxLength="12" placeholder="请输入发布单位" style="width:330px;" :disabled="lookType"/>
- </el-form-item>
- <el-form-item label="内容" prop="content" v-if="!lookType">
- <el-upload
- style="display: inline-block"
- class="avatar-uploader"
- :action="uploadImgUrl"
- :show-file-list="false"
- :on-success="(res)=>handleAvatarSuccess(res)"
- :headers="headers"
- :before-upload="beforeAvatarUpload">
- <p class="reset-button-one left-button" style="width:160px;"><i class="el-icon-upload2" style="margin-right:10px;"></i>请上传文件</p>
- </el-upload>
- <a href="" style="display: inline-block;margin-left:20px;color:#0E9EED;">下载范例</a>
- </el-form-item>
- <p v-if="form.content&&!lookType" style="display:inline-block;margin:0 0 0 80px;text-align:center;height:30px;line-height:30px;font-size:14px;padding:0 20px;border-radius:6px;color:#fff;background:#0E9EED;">{{upDataName}}</p>
- <a v-if="form.content&&lookType" :href="form.content" style="display:inline-block;margin:0 0 0 80px;text-align:center;height:30px;line-height:30px;font-size:14px;padding:0 20px;border-radius:6px;color:#fff;background:#0E9EED;">Excel文件</a>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="cancel">取 消</el-button>
- <el-button type="primary" @click="submitForm" v-if="!lookType">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { notifyplanListJh, getNotifyplan, delNotifyplan, addNotifyplan, updateNotifyplan } from "@/api/laboratory/notifyplan";
- import { getToken } from "@/utils/auth";
- import addPage from "./addPage.vue"
- import infoPage from "./infoPage.vue"
- export default {
- name: "Notifyplan",
- components: {
- addPage,
- infoPage
- },
- data() {
- return {
- tableButtonType:this.hasPermiDom(['laboratory:worknotifyplan:query','laboratory:worknotifyplan:remove']),
- pageType:1,
- uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
- headers: {
- Authorization: "Bearer " + getToken(),
- },
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 大屏通知计划表格数据
- notifyplanList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize:20,
- searchValue: null,
- title: null,
- notifyType: null,
- type: null,
- contentName: null,
- contentUrl: null,
- content: null,
- company: null,
- status: null,
- createUserid: null,
- createUsername: null,
- updateUserid: null,
- updateUsername: null,
- },
- createTimeDate:[],
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- title: [
- { required: true, message: "请输入通知标题", trigger: "blur" },
- { required: true, message: "请输入通知标题", validator: this.spaceJudgment, trigger: "blur" }
- ],
- company: [
- { required: true, message: "请输入发布单位", trigger: "blur" },
- { required: true, message: "请输入发布单位", validator: this.spaceJudgment, trigger: "blur" }
- ],
- content: [
- { required: true, message: "请上传文件", trigger: "blur" }
- ],
- },
- lookType:false,
- upDataName:"",
- };
- },
- created() {
- this.getList();
- },
- methods: {
- pageTypeClick(type,row){
- if(this.pageType != type){
- if(type == 1){
- this.pageType = 1;
- this.getList();
- }else if(type == 2){
- this.pageType = 2;
- }else if(type == 3){
- this.pageType = 3;
- this.infoData = row;
- }
- }
- },
- //上传相关
- handleAvatarSuccess(res) {
- let obj ={
- name:this.upDataName,
- url:res.data.url,
- };
- this.form.content = res.data.url;
- this.$forceUpdate()
- },
- beforeAvatarUpload(file) {
- let type = false;
- console.log('file',file);
- if (file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || file.type == 'application/vnd.ms-excel') {
- this.upDataName = file.name;
- type = true;
- }else{
- this.$message.error('只能上传xls或xlsx格式表格');
- type = false;
- }
- return type;
- },
- /** 查询大屏通知计划列表 */
- getList() {
- if(this.createTimeDate[0]){
- this.queryParams.beginTime = this.createTimeDate[0];
- this.queryParams.endTime = this.createTimeDate[1];
- }else {
- this.queryParams.beginTime = null
- this.queryParams.endTime = null
- }
- this.loading = true;
- this.queryParams.type = 2;
- notifyplanListJh(this.queryParams).then( response => {
- this.notifyplanList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- // 表单参数
- this.form = {
- id: null,
- title: null,
- company: null,
- content: null,
- type:1,
- };
- this.resetForm("form");
- this.$forceUpdate();
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.createTimeDate = []
- // this.resetForm("queryForm");
- this.$set(this,'queryParams',{
- pageNum: 1,
- pageSize:20,
- searchValue:"",
- });
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- // let obj = {
- // title:"",
- // company:"",
- // content:"",
- // }
- // this.$set(this,'form',obj);
- this.lookType = false;
- this.open = true;
- this.reset();
- this.title = "新增计划";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- const id = row.id || this.ids
- getNotifyplan(id).then( response => {
- // this.form = response.data;
- this.open = true;
- this.lookType = true;
- this.reset();
- this.$set(this,'form',response.data);
- this.title = "计划详情";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- updateNotifyplan(this.form).then( response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- this.form.type = 2;
- addNotifyplan(this.form).then( response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$confirm('是否确认删除?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delNotifyplan(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- }).catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download('laboratory/notifyplan/export', {
- ...this.queryParams
- }, `laboratory_notifyplan.xlsx`)
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .labNotifyplan{
- display: flex !important;
- flex-direction: column;
- box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
- overflow: hidden;
- .labNotifyplan-page{
- flex:1;
- display: flex !important;
- flex-direction: column;
- padding:11px 20px 20px!important;
- overflow: hidden;
- }
- }
- </style>
|