WXL (wul)
15 小时以前 d93ed5c5aadcf3d49f824339c26ebfac911be06d
src/views/knowledge/questionnaire/compilequer/index.vue
@@ -671,19 +671,75 @@
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-form-item label="关联服务">
                        <div
                          v-if="item.sendTaskname"
                          class="service-tag-container"
                        >
                          <el-tag
                            type="success"
                            closable
                            @close="removeService(item)"
                            class="service-tag"
                          >
                            <i class="el-icon-connection service-icon"></i>
                            {{ item.sendTaskname }}
                          </el-tag>
                        </div>
                        <div v-else class="service-add-btn">
                          <el-button
                            type="success"
                            size="small"
                            icon="el-icon-plus"
                            @click="openServiceDialog(item)"
                            class="add-service-btn"
                          >
                            选择任务
                          </el-button>
                        </div>
                      </el-form-item>
                    </el-row>
                    <el-row :gutter="10">
                      <el-form-item label="异常提醒">
                        <el-radio-group v-model="item.isabnormal">
                          <el-radio :label="1">是</el-radio>
                          <el-radio :label="0">否</el-radio>
                        </el-radio-group>
                      </el-form-item>
                      <el-form-item label="是否选中收集附加信息">
                        <el-radio-group v-model="item.appendflag">
                          <el-radio label="1">是</el-radio>
                          <el-radio label="0">否</el-radio>
                        </el-radio-group>
                      </el-form-item>
                      <el-col :span="11">
                        <!-- 修改:异常提醒部分 -->
                        <el-form-item label="异常提醒">
                          <el-select
                            v-model="item.isabnormal"
                            placeholder="请选择状态"
                          >
                            <el-option
                              :value="0"
                              label="正常"
                              :style="{ color: '#67C23A' }"
                            >
                              <span style="color: #67c23a">● 正常</span>
                            </el-option>
                            <el-option
                              :value="1"
                              label="异常"
                              :style="{ color: '#E6A23C' }"
                            >
                              <span style="color: #e6a23c">● 异常</span>
                            </el-option>
                            <el-option
                              :value="2"
                              label="警告"
                              :style="{ color: '#F56C6C' }"
                            >
                              <span style="color: #f56c6c">● 警告</span>
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </el-col>
                      <el-col :span="11">
                        <el-form-item label="是否选中收集附加信息">
                          <el-radio-group v-model="item.appendflag">
                            <el-radio label="1">是</el-radio>
                            <el-radio label="0">否</el-radio>
                          </el-radio-group>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row :gutter="10" v-if="topicobj.branchFlag == 1">
                      <el-col :span="20"
@@ -1254,6 +1310,144 @@
        </el-tabs>
      </div>
    </el-drawer>
    <!-- 选择任务弹窗 -->
    <el-dialog
      title="选择任务"
      :visible.sync="serviceDialogVisible"
      width="50%"
    >
      <div>
        <el-form
          :model="topqueryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          label-width="98px"
        >
          <el-form-item label="任务名称">
            <el-input
              v-model="topqueryParams.taskName"
              @keyup.enter.native="handleQuery"
            ></el-input>
          </el-form-item>
          <el-form-item label="任务类型" prop="status">
            <el-select
              v-model="topqueryParams.serviceType"
              placeholder="请选择服务类型"
            >
              <el-option
                v-for="item in taskoptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <el-table
          :data="filteredServiceList"
          v-loading="taskloading"
          @selection-change="handleServiceSelectionChange"
        >
          <el-table-column type="selection" width="55"></el-table-column>
          <el-table-column
            label="任务名称"
            fixed
            align="center"
            key="taskName"
            prop="taskName"
            :show-overflow-tooltip="true"
          />
          <el-table-column
            label="任务描述"
            align="center"
            key="taskDesc"
            prop="taskDesc"
            :show-overflow-tooltip="true"
          />
          <el-table-column
            label="服务项目"
            align="center"
            key="templatename"
            prop="templatename"
            :show-overflow-tooltip="true"
          />
          <el-table-column
            label="总任务/已随访"
            align="center"
            key="nickName"
            width="120"
            prop="nickName"
          >
            <template slot-scope="scope">
              <span
                >{{
                  scope.row.wfs || scope.row.wfs == 0
                    ? scope.row.wfs + scope.row.yfs
                    : ""
                }}/{{ scope.row.yfs }}</span
              >
            </template>
          </el-table-column>
          <el-table-column
            label="是否长期任务"
            align="center"
            key="longTask"
            prop="longTask"
          >
            <template slot-scope="scope">
              <span>{{ scope.row.longTask ? "长期任务" : "非长期" }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="状态"
            align="center"
            key="sendState"
            prop="sendState"
          >
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.task_status"
                :value="scope.row.sendState"
              />
            </template>
          </el-table-column>
          <el-table-column
            label="创建人"
            align="center"
            key="createBy"
            prop="createBy"
            :show-overflow-tooltip="true"
          />
          <el-table-column
            label="创建时间"
            sortable
            align="center"
            prop="createTime"
          >
            <template slot-scope="scope">
              <span>{{ formatTime(scope.row.createTime) }}</span>
            </template>
          </el-table-column>
        </el-table>
        <pagination
          v-show="tasktotal > 0"
          :total="tasktotal"
          :page.sync="topqueryParams.pageNum"
          :limit.sync="topqueryParams.pageSize"
          @pagination="gettaskList"
        />
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="serviceDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="confirmServiceSelection"
          >确定</el-button
        >
      </span>
    </el-dialog>
    <!-- 添加适用疾病窗口 -->
    <Optional-Form
      ref="child"
@@ -1275,17 +1469,12 @@
  depthospgetsonlist,
  getQtemplateobj,
  compileQtemplate,
  Qtemplateinfo,
  compileissue,
  delQtemplateinfo,
  Followupinfo,
  issueinfo,
  getissuelist,
  depthospgetsondel,
  deltargetillness,
  addtargetillness,
  getillnesslist,
  illnesslistget,
  getTasklist,
  getillness,
} from "@/api/AiCentre/index";
import OptionalForm from "@/components/OptionalForm"; //正则组件
@@ -1294,7 +1483,7 @@
export default {
  name: "Questionnaireinfo",
  dicts: ["sys_normal_disable", "sys_user_sex", "task_status"],
  components: { OptionalForm },
  data() {
@@ -1317,8 +1506,39 @@
      dialogVisiblepatient: false, //适用疾病窗口
      inputValue: "",
      topicobj: {},
      topqueryParams: {
        pageNum: 1,
        pageSize: 10,
        type: 3,
      },
      tasktotal: 0,
      taskloading: false,
      taskoptions: [
        {
          value: 4,
          label: "宣教关怀",
          raw: {
            cssClass: "",
            listClass: "",
          },
        },
        {
          value: 5,
          label: "复诊通知",
          raw: {
            cssClass: "",
            listClass: "",
          },
        },
      ],
      // 总条数
      total: 1,
      serviceDialogVisible: false, // 选择任务弹窗显示控制
      serviceSearch: "", // 任务搜索关键词
      serviceList: [], // 任务列表
      filteredServiceList: [],
      selectedService: null, // 选中的任务
      currentOptionItem: null, // 当前正在设置的任务选项项
      ruleForm: {
        svyTemplateLibScripts: [],
        tempDetpRelevances: [],
@@ -1767,6 +1987,62 @@
        });
      }
    },
    // ---------------选项任务绑定
    openServiceDialog(item) {
      this.gettaskList();
      this.currentOptionItem = item;
    },
    gettaskList() {
      getTasklist(this.topqueryParams).then((response) => {
        this.filteredServiceList = response.rows;
        this.tasktotal = response.total;
        this.serviceDialogVisible = true;
        this.$forceUpdate();
        this.taskloading = false;
      });
    },
    handleQuery() {
      this.topqueryParams.pageNum = 1;
      this.gettaskList();
    },
    // 新增方法:加载任务列表
    loadServiceList() {
      // 这里调用API获取任务列表
      // 示例数据,实际使用时需要调用相应的API
      this.serviceList = [
        { id: 1, taskName: "随访任务1", taskType: "常规随访" },
        { id: 2, taskName: "健康评估任务", taskType: "健康评估" },
        { id: 3, taskName: "用药提醒任务", taskType: "用药管理" },
      ];
    },
    // 新增方法:处理任务选择变化
    handleServiceSelectionChange(selection) {
      this.selectedService = selection.length > 0 ? selection[0] : null;
    },
    // 新增方法:确认选择任务
    confirmServiceSelection() {
      console.log(this.selectedService);
      console.log(this.currentOptionItem);
      if (this.selectedService && this.currentOptionItem) {
        this.currentOptionItem.sendTaskname = this.selectedService.taskName;
        this.currentOptionItem.sendTaskid = this.selectedService.taskid;
        this.serviceDialogVisible = false;
        this.serviceSearch = "";
        this.selectedService = null;
      } else {
        this.$message.warning("请选择一个任务");
      }
    },
    // 新增方法:移除关联服务
    removeService(item) {
      item.sendTaskname = "";
      item.sendTaskid = "";
    },
    // ------------------------
    // 下一步
    nextstep() {
      if (this.Editprogress <= 2) {
@@ -2472,6 +2748,135 @@
  -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
    0 0 6px 0 rgba(0, 0, 0, 0.04);
}
.service-tag-container {
  display: inline-block;
  .service-tag {
    margin-right: 10px;
    max-width: 220px;
    height: 32px;
    line-height: 30px;
    padding: 0 12px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #e1f3d8;
    background: linear-gradient(135deg, #f0f9eb, #e1f3d8);
    box-shadow: 0 2px 4px rgba(103, 194, 58, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    &:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 8px rgba(103, 194, 58, 0.15);
      border-color: #b3e19d;
    }
    .service-icon {
      margin-right: 4px;
      font-size: 12px;
    }
    ::v-deep .el-icon-close {
      margin-left: 6px;
      font-size: 12px;
      color: #67c23a;
      background-color: #f0f9eb;
      border-radius: 50%;
      width: 16px;
      height: 16px;
      line-height: 16px;
      &:hover {
        background-color: #67c23a;
        color: white;
      }
    }
  }
}
.service-add-btn {
  display: inline-block;
  .add-service-btn {
    height: 32px;
    padding: 0 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    background: linear-gradient(135deg, #67c23a, #85ce61);
    border: none;
    box-shadow: 0 2px 4px rgba(103, 194, 58, 0.2);
    transition: all 0.3s ease;
    &:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 8px rgba(103, 194, 58, 0.3);
      background: linear-gradient(135deg, #5daf34, #7ac252);
    }
    &:active {
      transform: translateY(0);
      box-shadow: 0 2px 4px rgba(103, 194, 58, 0.2);
    }
    i {
      margin-right: 4px;
      font-size: 12px;
    }
  }
}
// 响应式设计
@media (max-width: 768px) {
  .service-tag-container .service-tag {
    max-width: 180px;
    font-size: 13px;
    padding: 0 10px;
  }
  .service-add-btn .add-service-btn {
    padding: 0 12px;
    font-size: 13px;
  }
}
// 添加动画效果
@keyframes tagFadeIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-5px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.service-tag {
  animation: tagFadeIn 0.3s ease-out;
}
// 为整个选项区域添加统一样式
.topicxq {
  .service-tag-container,
  .service-add-btn {
    margin: 8px 0;
  }
}
// 确保在表单中的正确布局
.el-form-item {
  .el-form-item__content {
    .service-tag-container,
    .service-add-btn {
      vertical-align: middle;
    }
  }
}
.custom-width {
  width: 100px; /* 设置宽度样式 */
}