123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>心理量表后台维护界面</title>
- <link rel="stylesheet" href="./css/element-ui.css">
- <script src="./js/Vue.js"></script>
- <script src="./js/element-ui.js"></script>
- <script src="./js/2.1.4jquery.min.js"></script>
- <style>
- * {
- margin: 0;
- padding: 0;
- }
- body {
- /*background: #F2F6FC;*/
- }
- .sources {
- width: 100%;
- padding: 24px;
- box-sizing: border-box;
- border: 1px solid #ebebeb;
- border-radius: 3px;
- transition: .2s;
- margin-bottom: 40px;
- }
- h2 {
- font-size: 24px;
- color: #333333;
- line-height: 80px;
- text-align: center;
- }
- .wrap {
- width: 1280px;
- margin: 0 auto;
- }
- </style>
- </head>
- <body>
- <div id="app">
- <div class="wrap">
- <h2>心理量表后台维护界面</h2>
- <div class="sources">
- <el-row>
- <el-col :span="14">
- <el-form style="width: 100%" ref="form" :model="form" label-width="140px">
- <el-form-item label="量表导入模板下载">
- <el-button type="primary" @click="download(1)">下载</el-button>
- </el-form-item>
- <el-form-item label="文件">
- <el-input @change="getFile" type="file" v-model="form.file"></el-input>
- </el-form-item>
- <el-form-item label="量表名称">
- <el-input v-model="form.scaleName"></el-input>
- </el-form-item>
- <el-form-item label="量表英文名称">
- <el-input v-model="form.eName"></el-input>
- </el-form-item>
- <el-form-item label="量表指导语">
- <el-input type="textarea" v-model="form.scaleDesc"></el-input>
- </el-form-item>
- <el-form-item label="计分原则">
- <el-input type="textarea" v-model="form.scoringPrinciple"></el-input>
- </el-form-item>
- <el-form-item label="量表录入人">
- <el-input v-model="form.uploader"></el-input>
- </el-form-item>
- <el-form-item label="量表分类">
- <el-select v-model="form.scaleCate" multiple placeholder="请选择">
- <el-option v-for="item in categorys" :key="item.sequence" :label="item.name"
- :value="item.ename">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="适用人群">
- <el-select v-model="people" multiple placeholder="请选择">
- <el-option v-for="item in men" :key="item.sequence" :label="item.label"
- :value="item.value" :disabled="item.value != 0 && !disabled">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="量表权限">
- <el-select v-model="form.currentLimit" placeholder="量表权限">
- <el-option v-for="item in limit" :label="item.label" :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button :disabled="isLoading" type="primary" @click="onSubmit">提交</el-button>
- <el-button>清空</el-button>
- </el-form-item>
- </el-form>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- </body>
- <script>
- var app = new Vue({
- el: '#app',
- data: {
- currentPage: 1,
- form: {
- eName: ''
- },
- people: [],
- tableData: [],
- total: 0,
- file: {},
- isLoading: false,
- searchName: '',
- categorys: [],
- scaleCate: [],
- men: [{ value: '0', label: '全部' }, { value: '1', label: '儿童' }, { value: '2', label: '小学生' }, { value: '3', label: '中学及以上' }, { value: '4', label: '军警' }
- , { value: '5', label: '老年人' }, { value: '6', label: '精神病患者' }, { value: '7', label: '家长' }, { value: '8', label: '护士长' }, { value: '9', label: '单身人士' }
- , { value: '10', label: '职工' }, { value: '11', label: '心理疾病患者' }, { value: '12', label: '身体疾病患者' }, { value: '13', label: '青少年' }, { value: '14', label: '成年人' }
- , { value: '15', label: '教师' }, { value: '16', label: '孕妇' }, { value: '17', label: '已婚人士' }, { value: '18', label: '女性' }, { value: '19', label: '男性' }
- , { value: '20', label: '运动员' }, { value: '21', label: '司机' }, { value: '22', label: '医务人员' }, { value: '23', label: '教练' }, { value: '24', label: '糖尿病患者' }
- , { value: '25', label: '患者家属' }],
- limit: [{ value: 'public', label: '公开' }, { value: 'private', label: '私密' }],
- currentLimit: "",
- dialogFormVisible: false,
- editInfo: {
- id: "",
- type: [],
- scaleLimit: "",
- flag: ""
- },
- ePeople: []
- },
- computed: {
- disabled() {
- return this.people.indexOf('0') == -1
- },
- eDisabled() {
- return this.ePeople.indexOf('0') == -1
- }
- },
- created: function () {
- this.loadData(1, 10);
- this.loadCategory();
- },
- methods: {
- changeCategory: function (ename) {
- let name = "";
- this.categorys.forEach((item) => {
- if (item.ename == ename) {
- name = item.name;
- }
- })
- return name
- },
- loadCategory: function () {
- vm = this;
- $.ajax({
- type: "GET",
- url: "http://cognitive.wistcm.com:8080/category/loadCategory",
- success: function (data) {
- vm.categorys = data.data;
- }
- });
- },
- loadData: function (n, s) {
- var searchURL = "http://cognitive.wistcm.com:8080/subjectInfo?pageNum=" + n + "&pageSize=" + s;
- if (this.searchName != '') {
- searchURL = searchURL + "&searchName=" + this.searchName;
- }
- console.log("searchUrl-----" + searchURL);
- $.ajax({
- type: "GET",
- url: searchURL,
- success: function (data) {
- app.tableData = data.data.data;
- app.total = data.data.allNum;
- }
- });
- },
- getFile: function () {
- this.file = event.target.files[0];
- },
- onSubmit: function () {
- if (this.isLoading) {
- this.$message.error('请勿重复提交');
- return;
- }
- if (!this.form.file) {
- this.$message.error('请上传文件');
- return;
- }
- if (!this.form.scaleName) {
- this.$message.error('量表名称不能为空');
- return;
- }
- if (!this.form.scaleDesc) {
- this.$message.error('量表指导语不能为空');
- return;
- }
- if (!this.form.uploader) {
- this.$message.error('量表录入人不能为空');
- return;
- }
- if (!this.form.scoringPrinciple) {
- this.$message.error('量表录入人不能为空');
- return;
- }
- var formdata = new FormData();
- formdata.append("file", this.file);
- formdata.append("scaleName", this.form.scaleName);
- formdata.append("eName", this.form.eName);
- formdata.append("scaleDesc", this.form.scaleDesc);
- formdata.append("uploader", this.form.uploader);
- formdata.append("scoringPrinciple", this.form.scoringPrinciple);
- formdata.append("scaleCate", this.form.scaleCate);
- formdata.append("people", this.people)
- formdata.append("currentLimit", this.form.currentLimit);
- this.isLoading = true;
- $.ajax({
- type: "POST",
- url: "http://cognitive.wistcm.com:8080/subjectInfoUpload/importTest",
- contentType: false,
- processData: false,
- data: formdata
- }).then(data => {
- this.isLoading = false;
- if (data.code == 200) {
- this.$message.success("提交成功");
- this.people = [];
- } else {
- this.$message.error(data.msg);
- }
- this.clearForm();
- this.loadData(1, 10);
- })
- },
- currentChange(i) {
- this.currentPage = i;
- this.loadData(i, 10);
- },
- download: function (i, name) {
- if (i == 1) {
- window.open('http://cognitive.wistcm.com:8080/file/download/model', '_blank');
- } else {
- window.open("http://cognitive.wistcm.com:8080/file/download/scale?file_name=" + name, '_blank');
- }
- },
- clearForm: function () {
- this.form = {};
- this.file = {};
- },
- // 修改
- edit(info) {
- this.ePeople = [];
- this.editInfo.type = [];
- if (info.category != null) {
- info.category.forEach(item => {
- this.editInfo.type.push(item.ename)
- })
- }
- this.editInfo.scaleLimit = info.scaleLimit;
- this.editInfo.id = info.id;
- this.editInfo.flag = info.flag;
- if (info.people) {
- this.ePeople = info.people.split(',');
- }
- this.dialogFormVisible = true;
- },
- updateScaleInfo() {
- let vm = this
- vm.editInfo.people = this.ePeople;
- $.ajax({
- type: "POST",
- url: "http://cognitive.wistcm.com:8080/subjectInfoUpload/update",
- contentType: 'application/json;charset=utf-8',
- data: JSON.stringify(vm.editInfo),
- }).then(data => {
- this.isLoading = false;
- this.$message.success("提交成功");
- this.ePeople = [];
- this.clearForm();
- this.loadData(vm.currentPage, 10);
- }).catch(res => {
- this.$message.error("提交失败");
- })
- }
- }
- })
- </script>
- </html>
|