qinxianzhangyao
2024-05-20 edb5616505a118523882a83f53f00e88d03bd373
src/views/hosp/surveyTemplate/index.vue
@@ -194,59 +194,98 @@
            />
          </el-select>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" />
        </el-form-item>
        <div v-if="DaTianYa == false">
          <el-divider content-position="center">问卷模板问题信息</el-divider>
          <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
              <el-button
                type="primary"
                icon="el-icon-plus"
                size="mini"
                @click="addmembers()"
                >添加
              </el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="danger"
                icon="el-icon-delete"
                size="mini"
                @click.native.prevent="Delete()"
                >删除
              </el-button>
            </el-col>
          </el-row>
          <el-table
            style="width: 450px"
            border
            :data="form.tjSurveyTempQuesList"
            @selection-change="handleTjSurveyTempQuesSelectionChange"
          >
            <el-table-column type="selection" width="40" align="center" />
            <el-table-column label="问题id" prop="qid" width="179">
              <template slot-scope="scope">
                <el-input v-model="scope.row.qid" placeholder="请输入问题id" />
              </template>
            </el-table-column>
            <el-table-column label="问题名" prop="qname" width="190">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row.qname"
                  placeholder="请输入问题名"
                />
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
     <!-- 问卷详情抽屉 -->
     <el-drawer
      title="问卷详情"
      :visible.sync="drawer"
      :with-header="true"
      size="40%"
    >
      <el-form
        v-for="(item, index) in intList"
        :key="index"
        style="margin-left: 15px"
      >
        <el-form-item>
          <span
            style="color: red; margin-left: 5px"
            v-if="item.isRequired == 'Y'"
            >*</span
          >
          {{ index + 1 > 9 ? index + 1 : "0" + (index + 1) }}.{{
            item.question
          }}
          <span v-if="item.type == '0'">(单选)</span>
          <span v-if="item.type == '1'">(多选)</span><br />
          <label
            v-for="(item5, index) in item.tjSurveyOptionsList"
            :key="index"
          >
            <!-- <img v-show="item.type == '1'" v-if="item5.qid ==item.qid"   class="select-radio" src="../../../assets/images/weixuanzhong.png" alt="">
                <img v-show="item.type == '1'" v-else  class="select-radio1" src="../../../assets/images/xuanzhong.png" alt=""> -->
            <input
              v-show="item.type == '0'"
              type="radio"
              :name="item5.qid"
              :value="item5.oid"
            /><label class="inp" v-show="item.type == '0'">{{
              item5.ooption
            }}</label>
            <input
              v-show="item.type == '1'"
              type="checkbox"
              :name="item5.qid"
              :value="item5.oid"
            /><label class="inp" v-show="item.type == '1'">{{
              item5.ooption
            }}</label>
            <el-rate
              v-show="item.type == '2'"
              v-model="myscore"
              show-text
            ></el-rate>
            <el-input
              v-show="item.type == '3'"
              v-model="inpu"
              style="width: 280px"
            />
            <!-- <el-date-picker
              v-show="item.type == '4'"
              v-model="value2"
              align="right"
              type="date"
              placeholder="选择日期"
              :picker-options="pickerOptions"
            >
            </el-date-picker> -->
            <!-- <el-input-number
              v-show="item.type == '5'"
              v-model="num"
              :min="1"
              :max="10000"
            ></el-input-number>
            <el-input-number
              v-show="item.type == '6'"
              v-model="numf"
              :precision="2"
              :step="0.0"
              :max="10000"
            ></el-input-number> -->
          </label>
        </el-form-item>
      </el-form>
      <!-- <el-button type="primary" size="mini" @click="tijiao">提交</el-button> -->
    </el-drawer>
    <el-drawer
      :visible.sync="previewDialogVisible"
      :before-close="handleClose"
@@ -269,6 +308,7 @@
  getneedDesign,
  getcanDelete,
  updateQybz,
  getQuesByMid
} from "@/api/hosp/surveyTemplate";
import { Message } from "element-ui";
export default {
@@ -292,10 +332,14 @@
      }
    };
    return {
      inpu:"",
      num: 0,
      myscore: null,
      // 遮罩层
      loading: true,
      drawer:false,
      previewKey: +new Date(),
      previewDialogVisible:false,
      previewDialogVisible: false,
      // 选中数组
      ids: [],
      // 子表选中数据
@@ -315,6 +359,7 @@
      selectionList: [],
      // 弹出层标题
      title: "",
      intList: [],
      // 是否显示弹出层
      open: false,
      DaTianYa: false,
@@ -404,6 +449,7 @@
    handleAdd() {
      this.reset();
      this.title = "添加问卷模板";
      getneedDesign().then((res) => {
        if (res.msg == "false") {
          this.DaTianYa = false;
@@ -443,7 +489,6 @@
      if (!that.selectionList) {
        that.$modal.msgSuccess("请选择需要删除的数据");
      } else {
        console.log(that.form.tjSurveyTempQuesList);
        that.selectionList.forEach((item) => {
          that.form.tjSurveyTempQuesList.forEach((item1, index) => {
            if (item.qid == item1.qid) {
@@ -454,17 +499,31 @@
      }
    },
    xiangqing(row) {
      const mid = row.mid
      const mid = row.mid;
      getSurveyTemplate(mid).then((response) => {
      if (response.data.designId == null) {
      } else {
        this.$router.push({
          query: { key:response.data.designId},
        });
        this.previewDialogVisible = true;
      }
    })
        if (response.data.designId == null) {
          this.drawer = true;
          getQuesByMid(mid)
          .then((res) => {
            res.data.sort(
              (a, b) =>
                new Date(a.createTime).getTime() -
                new Date(b.createTime).getTime()
            ); //这是升序,倒序的话翻过来
            this.intList = res.data;
          })
          .catch((err) => {
            // 通过catch捕获错误消息
            return err;
          });
        } else {
          this.$router.push({
            query: { key: response.data.designId },
          });
          this.previewDialogVisible = true;
        }
      });
    },
    handleClose() {
      this.reload();
@@ -487,22 +546,23 @@
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const mid = row.mid || this.ids;
      getSurveyTemplate(mid).then((response) => {
        this.form = response.data;
        if (response.data.tjSurveyTempQuesList.length >= 1) {
          this.form.tjSurveyTempQuesList = response.data.tjSurveyTempQuesList;
        }
        if ( this.form.designId == null) {
            this.DaTianYa = false;
            this.title = "修改问卷模板";
            this.open = true;
          } else {
            this.DaTianYa = true;
            this.form.formKey = this.form.designId;
            this.form.type = 1;
            this.toProjectHandle(this.form, "editor");
          }
        if (this.form.designId == null) {
          this.DaTianYa = false;
          this.title = "修改问卷模板";
          this.open = true;
        } else {
          this.DaTianYa = true;
          this.form.formKey = this.form.designId;
          this.form.type = 1;
          this.toProjectHandle(this.form, "editor");
        }
      });
    },
    /** 提交按钮 */
@@ -517,8 +577,12 @@
            });
          } else {
            addSurveyTemplate(this.form).then((response) => {
              // this.$modal.msgSuccess("新增成功");
              this.toProjectHandle(response.data, "editor");
              if (this.DaTianYa == false) {
                this.$modal.msgSuccess("新增成功");
              } else {
                this.toProjectHandle(response.data, "editor");
              }
              this.open = false;
              this.getList();
            });