index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <script setup>
  2. import { Search } from '@element-plus/icons-vue'
  3. import { getTime } from "~/utils/helper";
  4. const status = ref();
  5. const statusData = ref([
  6. {
  7. name: "声音定制管理",
  8. status: "1",
  9. },
  10. {
  11. name: "形象定制管理",
  12. status: "2",
  13. }
  14. ]);
  15. changeStatus("1");
  16. function changeStatus(data) {
  17. status.value = data;
  18. }
  19. const keywordVoice = $ref('')
  20. let tableData = $ref([])
  21. const total = ref(0);
  22. const page = ref(1);
  23. const limit = ref(10);
  24. function handleCurrentChange(val) {
  25. page.value = val
  26. getData()
  27. }
  28. getData()
  29. function getData() {
  30. request({
  31. url: '/aimooc/xnszr_audio/index',
  32. data: {
  33. page: page.value,
  34. limit: limit.value,
  35. keyword: keywordVoice
  36. }
  37. }).then(res => {
  38. tableData = res.data.page_data
  39. total.value = Number(res.data.total_rows)
  40. })
  41. }
  42. const keywordImage = $ref('')
  43. let tableDataImage = $ref([])
  44. const totalImage = ref(0);
  45. const pageImage = ref(1);
  46. const limitImage = ref(10);
  47. function handleCurrentChangeImage(val) {
  48. pageImage.value = val
  49. getDataImage()
  50. }
  51. getDataImage()
  52. function getDataImage() {
  53. request({
  54. url: '/aimooc/xnszr_img/index',
  55. data: {
  56. page: pageImage.value,
  57. limit: limitImage.value,
  58. keyword: keywordImage
  59. }
  60. }).then(res => {
  61. tableDataImage = res.data.page_data
  62. totalImage.value = Number(res.data.total_rows)
  63. })
  64. }
  65. const dialogFormVisible_check = ref(false)
  66. const formLabelWidth = "100px";
  67. const ruleFormRef = ref();
  68. const checkForm = ref({
  69. result: "",
  70. reason: "",
  71. });
  72. let currentType = ''
  73. let operationRow = {}
  74. function openAuditDialog(type, row) {
  75. currentType = type
  76. operationRow = row
  77. if (type == 'voice') {
  78. checkForm.value.result = row.axa_sycj_shzt_v2
  79. checkForm.value.reason = row.axa_bzms
  80. dialogFormVisible_check.value = true
  81. } else if (type == 'image') {
  82. checkForm.value.result = row.axi_rxcj_shzt_v2
  83. checkForm.value.reason = row.axi_bzms
  84. dialogFormVisible_check.value = true
  85. }
  86. }
  87. const rules = ref({
  88. result: [
  89. {
  90. required: true,
  91. message: "请选择一项",
  92. trigger: "change",
  93. },
  94. ],
  95. reason: [{ required: true, message: "请输入理由", trigger: "blur" }],
  96. });
  97. //审核按钮
  98. const checkSubmit = (formEl) => {
  99. if (!formEl) return;
  100. formEl.validate((valid, fields) => {
  101. if (valid) {
  102. if (currentType == 'voice') {
  103. request({
  104. url: '/aimooc/xnszr_audio/edit', data: {
  105. axa_id: operationRow.axa_id,
  106. aimooc_xnszr_audio: {
  107. axa_sycj_shzt_v2: checkForm.value.result,
  108. axa_bzms: checkForm.value.result == 2 ? checkForm.value.reason : ''
  109. }
  110. }
  111. }).then(res => {
  112. if (res.code == 1) {
  113. ElMessage({
  114. message: res.msg,
  115. type: "success",
  116. });
  117. dialogFormVisible_check.value = false;
  118. getData()
  119. }
  120. })
  121. } else if (currentType == 'image') {
  122. request({
  123. url: '/aimooc/xnszr_img/edit', data: {
  124. axi_id: operationRow.axi_id,
  125. aimooc_xnszr_img: {
  126. axi_rxcj_shzt_v2: checkForm.value.result,
  127. axi_bzms: checkForm.value.result == 2 ? checkForm.value.reason : ''
  128. }
  129. }
  130. }).then(res => {
  131. if (res.code == 1) {
  132. ElMessage({
  133. message: res.msg,
  134. type: "success",
  135. });
  136. dialogFormVisible_check.value = false;
  137. getDataImage()
  138. }
  139. })
  140. }
  141. } else {
  142. console.log("error submit!", fields);
  143. }
  144. });
  145. };
  146. function del(type, row) {
  147. ElMessageBox.confirm("确定要删除这条记录吗?", {
  148. confirmButtonText: "确定",
  149. cancelButtonText: "取消",
  150. type: "warning",
  151. })
  152. .then(async () => {
  153. if (type == 'voice') {
  154. const { code, data } = await request({
  155. url: "/aimooc/xnszr_audio/delete",
  156. data: { axa_id: row.axa_id },
  157. });
  158. if (code === "1") {
  159. ElMessage.success("删除成功!");
  160. getData()
  161. }
  162. } else if (type == 'image') {
  163. const { code, data } = await request({
  164. url: "/aimooc/xnszr_img/delete",
  165. data: { axi_id: row.axi_id },
  166. });
  167. if (code === "1") {
  168. ElMessage.success("删除成功!");
  169. getDataImage()
  170. }
  171. }
  172. })
  173. .catch(() => { });
  174. }
  175. const router = useRouter()
  176. function voiceDetail(row) {
  177. router.push({
  178. path: '/home/szrdzgl/voiceDetail', query: {
  179. axa_id: row.axa_id
  180. }
  181. })
  182. }
  183. let imageVisableDialog = $ref(false)
  184. let videoUrl = $ref('')
  185. function viewImageDetail(row) {
  186. videoUrl = row.axi_rxcj_spwj_v2
  187. imageVisableDialog = true
  188. }
  189. </script>
  190. <template>
  191. <div class="h-full flex flex-col">
  192. <el-scrollbar view-class="h-full flex flex-col">
  193. <div class="my-15px flex items-center justify-between">
  194. <div class="flex space-x-6">
  195. <div v-for="(item, index) in statusData" :key="index" class="pageTitle"
  196. :class="status === item.status && 'active'" @click="changeStatus(item.status)">
  197. {{ item.name }}
  198. </div>
  199. </div>
  200. <div class="flex items-center">
  201. <el-input v-show="status == 1" v-model="keywordVoice" class="ml-20px h-42px rounded-8px" placeholder="搜索"
  202. :prefix-icon="Search" @change="getData()" />
  203. <el-input v-show="status == 2" v-model="keywordImage" class="ml-20px h-42px rounded-8px" placeholder="搜索"
  204. :prefix-icon="Search" @change="getDataImage()" />
  205. </div>
  206. </div>
  207. <div v-if="status == 1">
  208. <el-table :data="tableData" size="large">
  209. <el-table-column prop="axa_name" label="声音名称" />
  210. <el-table-column prop="axa_mssc" label="声音描述" />
  211. <el-table-column prop="axa_sycj_syxb_v2" label="性别">
  212. <template #default="scope">
  213. <span>{{ scope.row.axa_sycj_syxb_v2 == 'female' ? '女' : scope.row.axa_sycj_syxb_v2 == 'male' ? '男' : ''
  214. }}</span>
  215. </template>
  216. </el-table-column>
  217. <el-table-column prop="create_dateline" label="创建时间">
  218. <template #default="scope">
  219. <span>{{ getTime(scope.row.create_dateline) }}</span>
  220. </template>
  221. </el-table-column>
  222. <el-table-column prop="axa_sycj_shzt_v2" label="审核状态">
  223. <template #default="scope">
  224. <span
  225. :style="'color:' + (scope.row.axa_sycj_shzt_v2 == '1' ? '#55B51F' : scope.row.axa_sycj_shzt_v2 ==
  226. '2' ? '#FF6A55' : scope.row.axa_sycj_shzt_v2 == '3' ? '' : scope.row.axa_sycj_shzt_v2 == '4' ? '#fdcb9e' : '')">{{
  227. scope.row.axa_sycj_shzt_v2 == '1' ? '通过' : scope.row.axa_sycj_shzt_v2 ==
  228. '2' ? '不通过' : scope.row.axa_sycj_shzt_v2 == '3' ? '待审核' : scope.row.axa_sycj_shzt_v2 == '4' ? '未完成' : ''
  229. }}</span>
  230. </template>
  231. </el-table-column>
  232. <el-table-column prop="opeation" label="操作">
  233. <template #default="scope">
  234. <div style="display: flex;">
  235. <img src="../../../assets/szrdzgl-detail.png" style="cursor: pointer;"
  236. @click="voiceDetail(scope.row)" />
  237. <img src="../../../assets/szrdzgl-audit.png" style="cursor: pointer;margin-left: 10px;"
  238. @click="openAuditDialog('voice', scope.row)" />
  239. <img src="../../../assets/szrdzgl-delete.png" style="cursor: pointer;margin-left: 10px;"
  240. @click="del('voice', scope.row)" />
  241. </div>
  242. </template>
  243. </el-table-column>
  244. </el-table>
  245. <div class="flex justify-end box-border px-80px pb-30px mt-20px" style="color: #000;">
  246. <el-pagination v-model:current-page="page" v-model:page-size="limit"
  247. layout="total, sizes, prev, pager, next, jumper" :total="total" @current-change="handleCurrentChange" />
  248. </div>
  249. </div>
  250. <div v-if="status == 2">
  251. <el-table :data="tableDataImage" size="large">
  252. <el-table-column prop="axi_name" label="形象名称" />
  253. <el-table-column prop="axi_img" label="头像">
  254. <template #default="scope">
  255. <el-image style="width: 100px; height: 100px" :src="scope.row.axi_img" :zoom-rate="1.2" :max-scale="7"
  256. :min-scale="0.2" :preview-src-list="[scope.row.axi_img]" :initial-index="0" fit="cover" :z-index="99999" :preview-teleported="true"/>
  257. </template>
  258. </el-table-column>
  259. <el-table-column prop="create_dateline" label="创建时间">
  260. <template #default="scope">
  261. <span>{{ getTime(scope.row.create_dateline) }}</span>
  262. </template>
  263. </el-table-column>
  264. <el-table-column prop="axi_rxcj_shzt_v2" label="审核状态">
  265. <template #default="scope">
  266. <span
  267. :style="'color:' + (scope.row.axi_rxcj_shzt_v2 == '1' ? '#55B51F' : scope.row.axi_rxcj_shzt_v2 ==
  268. '2' ? '#FF6A55' : scope.row.axi_rxcj_shzt_v2 == '3' ? '' : scope.row.axi_rxcj_shzt_v2 == '4' ? '#fdcb9e' : '')">{{
  269. scope.row.axi_rxcj_shzt_v2 == '1' ? '通过' : scope.row.axi_rxcj_shzt_v2 ==
  270. '2' ? '不通过' : scope.row.axi_rxcj_shzt_v2 == '3' ? '待审核' : scope.row.axi_rxcj_shzt_v2 == '4' ? '未完成' : ''
  271. }}</span>
  272. </template>
  273. </el-table-column>
  274. <el-table-column prop="opeation" label="操作">
  275. <template #default="scope">
  276. <div style="display: flex;">
  277. <img src="../../../assets/szrdzgl-detail.png" style="cursor: pointer;"
  278. @click="viewImageDetail(scope.row)" />
  279. <img src="../../../assets/szrdzgl-audit.png" style="cursor: pointer;margin-left: 10px;"
  280. @click="openAuditDialog('image', scope.row)" />
  281. <img src="../../../assets/szrdzgl-delete.png" style="cursor: pointer;margin-left: 10px;"
  282. @click="del('image', scope.row)" />
  283. </div>
  284. </template>
  285. </el-table-column>
  286. </el-table>
  287. <div class="flex justify-end box-border px-80px pb-30px mt-20px" style="color: #000;">
  288. <el-pagination v-model:current-page="pageImage" v-model:page-size="limitImage"
  289. layout="total, sizes, prev, pager, next, jumper" :total="totalImage"
  290. @current-change="handleCurrentChangeImage" />
  291. </div>
  292. </div>
  293. </el-scrollbar>
  294. <el-dialog v-model="dialogFormVisible_check" title="审核" width="360px">
  295. <el-form :model="checkForm" ref="ruleFormRef" :rules="rules" label-position="top">
  296. <el-form-item label="" :label-width="formLabelWidth" prop="result">
  297. <el-radio-group v-model="checkForm.result">
  298. <el-radio label="1">通过</el-radio>
  299. <el-radio label="2">不通过</el-radio>
  300. </el-radio-group>
  301. </el-form-item>
  302. <el-form-item v-if="checkForm.result == '2'" label="备注描述:" :label-width="formLabelWidth" prop="reason">
  303. <el-input v-model="checkForm.reason" :autosize="{ minRows: 3 }" type="textarea" />
  304. </el-form-item>
  305. </el-form>
  306. <template #footer>
  307. <el-button type="primary" class="w-full" size="large" @click="checkSubmit(ruleFormRef)">确认</el-button>
  308. </template>
  309. </el-dialog>
  310. <el-dialog v-model="imageVisableDialog" width="1000px" style="height: 600px;">
  311. <video v-if="imageVisableDialog" :src="videoUrl" controls style="width: 100%;height: 500px;"></video>
  312. </el-dialog>
  313. </div>
  314. </template>
  315. <route lang="json">{
  316. "meta": {
  317. "title": "数字人定制管理",
  318. "img": "/images/szrdzgl.png",
  319. "sort": 8
  320. }
  321. }</route>
  322. <style lang="scss" scoped>
  323. @use "~/styles/page.scss";
  324. </style>