| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- <template>
- <div class="app-container">
- <div class="voice-layout">
- <!-- 左侧分组列表 -->
- <div class="voice-left-panel">
- <div class="group-title">
- <span>语音分组</span>
- <el-button
- type="primary"
- size="mini"
- icon="el-icon-plus"
- circle
- @click="handleAddGroup"
- ></el-button>
- </div>
- <div class="group-list">
- <div
- class="group-item"
- :class="{ active: currentGroupId === null }"
- @click="selectGroup(null)"
- >全部</div>
- <div
- v-for="item in groupList"
- :key="item.id"
- class="group-item"
- :class="{ active: currentGroupId === item.id }"
- @click="selectGroup(item.id)"
- >
- <span class="group-item-name">{{ item.voiceGroupName }}</span>
- <i class="el-icon-edit group-item-edit" @click.stop="handleEditGroup(item)"></i>
- </div>
- </div>
- </div>
- <!-- 右侧内容区 -->
- <div class="voice-right-panel">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="120px">
- <el-form-item label="语音文本" prop="voiceTxt">
- <el-input
- v-model="queryParams.voiceTxt"
- placeholder="请输入语音文本"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['qw:QwSopTempVoice:add']"
- >新增</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- <el-table border v-loading="loading" :data="QwSopTempVoiceList" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="语音文本" align="center" prop="voiceTxt" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['qw:QwSopTempVoice:remove']"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- </div>
- <!-- 添加或修改模板对应的销售语音文件对话框 -->
- <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="groupId">
- <el-select
- v-model="form.groupId"
- placeholder="请选择语音分组"
- clearable
- size="small"
- style="width: 100%"
- >
- <el-option
- v-for="item in groupList"
- :key="item.id"
- :label="item.voiceGroupName"
- :value="item.id"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="语音文本" prop="voiceTxt">
- <el-input type="textarea" :rows="6" v-model="form.voiceTxt" placeholder="请输入语音文本" />
- </el-form-item>
- </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>
- </div>
- </template>
- <script>
- import { listQwSopTempVoice, getQwSopTempVoice, delQwSopTempVoice, addQwSopTempVoice, updateQwSopTempVoice, exportQwSopTempVoice } from "@/api/qw/QwSopTempVoice";
- import { removeSidebar } from "@/api/qw/QwSopTempVoice";
- import { listQwSopTempVoiceGroup, addQwSopTempVoiceGroup, updateQwSopTempVoiceGroup } from "@/api/qw/QwSopTempVoiceGroup";
- export default {
- name: "QwSopTempVoice",
- data() {
- return {
- // 分组列表
- groupList: [],
- // 当前选中的分组ID,null表示全部
- currentGroupId: null,
- // 是否录制完成字典
- recordTypeOptions: [
- { dictLabel: '是', dictValue: '1' },
- { dictLabel: '否', dictValue: '2' }
- ],
- // 遮罩层
- loading: true,
- // 导出遮罩层
- exportLoading: false,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 模板对应的销售语音文件表格数据
- QwSopTempVoiceList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- companyUserId: null,
- companyId: null,
- qwUserId: null,
- tempId: null,
- ruleId: null,
- dayId: null,
- contentId: null,
- groupId: null,
- voiceTxt: null,
- voiceUrl: null,
- userVoiceUrl: null,
- recordType: null,
- duration: null,
- status: null
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- groupId: [
- { required: true, message: "请选择语音分组", trigger: "change" }
- ]
- }
- };
- },
- created() {
- this.getGroupList();
- this.getList();
- },
- methods: {
- /** 获取语音分组列表 */
- getGroupList() {
- listQwSopTempVoiceGroup({ pageNum: 1, pageSize: 999 }).then(response => {
- this.groupList = response.rows;
- });
- },
- /** 选择分组 */
- selectGroup(groupId) {
- this.currentGroupId = groupId;
- this.queryParams.groupId = groupId;
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 新增分组 */
- handleAddGroup() {
- this.$prompt('请输入语音分组名称', '新增分组', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- inputPattern: /\S/,
- inputErrorMessage: '分组名称不能为空'
- }).then(({ value }) => {
- addQwSopTempVoiceGroup({ voiceGroupName: value }).then(() => {
- this.msgSuccess('新增成功');
- this.getGroupList();
- });
- }).catch(() => {});
- },
- /** 修改分组名称 */
- handleEditGroup(item) {
- if (!item) return;
- this.$prompt('请输入新的分组名称', '修改分组', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- inputPattern: /\S/,
- inputErrorMessage: '分组名称不能为空',
- inputValue: item.voiceGroupName
- }).then(({ value }) => {
- updateQwSopTempVoiceGroup({ id: item.id, voiceGroupName: value }).then(() => {
- this.msgSuccess('修改成功');
- this.getGroupList();
- });
- }).catch(() => {});
- },
- /** 查询模板对应的销售语音文件列表 */
- getList() {
- this.loading = true;
- listQwSopTempVoice(this.queryParams).then(response => {
- this.QwSopTempVoiceList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- companyUserId: null,
- companyId: null,
- qwUserId: null,
- tempId: null,
- ruleId: null,
- dayId: null,
- contentId: null,
- groupId: null,
- voiceTxt: null,
- voiceUrl: null,
- userVoiceUrl: null,
- recordType: null,
- duration: null,
- createTime: null,
- updateTime: null,
- status: 0
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加模板对应的销售语音文本";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getQwSopTempVoice(id).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改模板对应的销售语音文本";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- updateQwSopTempVoice(this.form).then(response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addQwSopTempVoice(this.form).then(response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- this.$confirm('是否确认删除模板对应的销售语音文本---"' + row.voiceTxt + '"---的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return removeSidebar(row);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- }).catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- const queryParams = this.queryParams;
- this.$confirm('是否确认导出所有模板对应的销售语音文件数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.exportLoading = true;
- return exportQwSopTempVoice(queryParams);
- }).then(response => {
- this.download(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
- }
- }
- };
- </script>
- <style scoped>
- .app-container {
- position: relative;
- height: calc(100vh - 150px);
- overflow: hidden;
- box-sizing: border-box;
- }
- .voice-layout {
- position: absolute;
- top: 20px;
- left: 20px;
- right: 20px;
- bottom: 20px;
- display: flex;
- }
- .voice-left-panel {
- width: 200px;
- min-width: 200px;
- background: #fff;
- border-right: 1px solid #e8e8e8;
- display: flex;
- flex-direction: column;
- }
- .group-title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 16px;
- font-weight: bold;
- padding: 16px 16px 12px;
- border-bottom: 1px solid #e8e8e8;
- flex-shrink: 0;
- }
- .group-list {
- padding: 8px 8px 0;
- overflow-y: auto;
- flex: 1;
- }
- .group-item {
- padding: 10px 12px;
- cursor: pointer;
- border-radius: 4px;
- font-size: 14px;
- color: #333;
- transition: all 0.2s;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .group-item-name {
- flex: 1;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .group-item-edit {
- font-size: 13px;
- color: #999;
- flex-shrink: 0;
- margin-left: 6px;
- }
- .group-item-edit:hover {
- color: #1890ff;
- }
- .group-item:hover {
- background: #f0f2f5;
- }
- .group-item.active {
- background: #e6f7ff;
- color: #1890ff;
- font-weight: bold;
- }
- .voice-right-panel {
- flex: 1;
- padding-left: 16px;
- min-width: 0;
- overflow-y: auto;
- overflow-x: hidden;
- }
- </style>
|