problemHandleTable.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div>
  3. <div style="padding-bottom: 20px; border-bottom: 1px solid rgba(0, 0, 0, 0.06)">
  4. <div class="pushWorkShopBar">
  5. <span class="pushiWorkShopSpan">推送车间</span>
  6. <img src="../img/edit.png" @click="handleWorkShopEdit()" />
  7. <span class="descriptionSpan">请点击编辑按钮,选择需要发送问题处理通知</span>
  8. </div>
  9. <div class="workshopList">
  10. <div class="left" ref="listLeft">
  11. <el-tag type="primary" v-for="item in selectedUser" :key="item.code">
  12. {{ item.name }}
  13. </el-tag>
  14. </div>
  15. <div v-if="!isExpandShow" class="right" @click="toExpand()">
  16. <div
  17. style="display: flex; height: 24px; justify-content: center; align-items: center"
  18. v-if="isExpand"
  19. >
  20. <span>展开</span><img src="@/assets/icons/arrow_bottom.png" />
  21. </div>
  22. <div
  23. style="display: flex; height: 24px; justify-content: center; align-items: center"
  24. v-else
  25. >
  26. <span>收起</span><img src="@/assets/icons/arrow_top.png" />
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <el-table
  32. :data="problemTableData"
  33. stripe
  34. height="calc(100vh - 400px)"
  35. :cell-style="{ textAlign: 'center' }"
  36. :header-cell-style="{ 'text-align': 'center' }"
  37. style="width: 100%; margin-top: 16px; --el-table-border-color: none"
  38. >
  39. <el-table-column width="156" prop="issuePhase" label="问题阶段" />
  40. <el-table-column width="176" prop="issueState" label="审核状态">
  41. <template #default="scope">
  42. <el-tag type="warning" v-if="scope.row.issueState === 1">
  43. {{ issueStateMapping[scope.row.issueState] }}
  44. </el-tag>
  45. <el-tag type="danger" v-else-if="scope.row.issueState === 6">
  46. {{ issueStateMapping[scope.row.issueState] }}
  47. </el-tag>
  48. <el-tag type="success" v-else-if="scope.row.issueState === 7">
  49. {{ issueStateMapping[scope.row.issueState] }}
  50. </el-tag>
  51. <el-tag type="primary" v-else>{{ issueStateMapping[scope.row.issueState] }}</el-tag>
  52. </template>
  53. </el-table-column>
  54. <el-table-column width="156" prop="recipient" label="推送对象" />
  55. <el-table-column width="520" prop="content" label="推送文案" />
  56. <el-table-column label="操作" fixed="right">
  57. <template #default="scope">
  58. <div class="operation">
  59. <el-tooltip class="box-item" effect="light" content="编辑" placement="bottom">
  60. <img
  61. src="../img/edit.png"
  62. @click="handleProbleEdit(scope.row.id, scope.row.content)"
  63. />
  64. </el-tooltip>
  65. </div>
  66. </template>
  67. </el-table-column>
  68. <template #empty>
  69. <div class="emptyDiv">
  70. <img src="../img/empty.png" class="emptyImg" />
  71. <span class="emptySpan">暂无数据</span>
  72. </div>
  73. </template>
  74. </el-table>
  75. <el-dialog
  76. v-model="workDialog"
  77. title="添加推送车间"
  78. align-center
  79. :close-on-click-modal="false"
  80. style="height: 583px"
  81. :width="731"
  82. :destroy-on-close="true"
  83. class="workShopDialog"
  84. >
  85. <WorkShopTree @cancel="handleCancle" @submit="handleSubmit" :selectedUser="selectedUser" />
  86. </el-dialog>
  87. <el-dialog
  88. v-model="showDialog"
  89. title="请输入推送文案"
  90. align-center="true"
  91. width="400"
  92. @close="closeDialog()"
  93. :close-on-click-modal="false"
  94. class="contentDialog"
  95. >
  96. <el-input
  97. v-model="content"
  98. style="width: 380px; padding: 0 65px 0 0"
  99. :autosize="{ minRows: 1, maxRows: 4 }"
  100. maxlength="100"
  101. show-word-limit
  102. type="textarea"
  103. />
  104. <template #footer>
  105. <div class="dialog-footer">
  106. <el-button @click="closeDialog()">取消</el-button>
  107. <el-button type="primary" @click="submitDialog()">确认</el-button>
  108. </div>
  109. </template>
  110. </el-dialog>
  111. </div>
  112. </template>
  113. <script lang="ts" setup>
  114. import { ref, onMounted, nextTick } from 'vue';
  115. import { problemPhase, issueStateMapping } from '../type';
  116. import {
  117. queryIssueProcessMessage,
  118. modifyContent,
  119. modifyWorkshopList,
  120. queryWorkshopNamebyIds,
  121. } from '../api/index';
  122. import WorkShopTree from './WorkShopTree.vue';
  123. import { ElMessage } from 'element-plus';
  124. const problemTableData = ref<problemPhase[]>([]);
  125. const workDialog = ref<boolean>(false);
  126. const showDialog = ref<boolean>(false);
  127. const content = ref<string>('');
  128. const listLeft = ref();
  129. const isExpandShow = ref<boolean>(false);
  130. const isExpand = ref<boolean>(true);
  131. const toExpand = () => {
  132. isExpand.value = !isExpand.value;
  133. if (isExpand.value) {
  134. listLeft.value.style.maxHeight = '24px';
  135. } else {
  136. listLeft.value.style.maxHeight = 'none';
  137. }
  138. };
  139. const editId = ref<number>(0);
  140. const handleWorkShopEdit = () => {
  141. workDialog.value = true;
  142. };
  143. const handleProbleEdit = (id: number, _content: string) => {
  144. showDialog.value = true;
  145. editId.value = id;
  146. content.value = _content;
  147. };
  148. const submitDialog = () => {
  149. modifyContent(content.value, editId.value)
  150. .then(() => {
  151. ElMessage({
  152. message: '修改成功',
  153. type: 'success',
  154. plain: true,
  155. });
  156. closeDialog();
  157. queryIssueData();
  158. })
  159. .catch((error) => {
  160. console.error(error);
  161. });
  162. };
  163. const closeDialog = () => {
  164. showDialog.value = false;
  165. };
  166. interface UserList {
  167. code: number | string;
  168. name: string;
  169. id: number;
  170. }
  171. const selectedUser = ref<UserList[]>([]);
  172. const queryIssueData = () => {
  173. queryIssueProcessMessage().then((res) => {
  174. let params;
  175. if (res[0].workshopList) {
  176. params = JSON.parse(res[0].workshopList);
  177. } else {
  178. params = [];
  179. }
  180. queryWorkshopNamebyIds(params).then((res) => {
  181. selectedUser.value = res;
  182. nextTick(() => {
  183. const height = listLeft.value.scrollHeight;
  184. isExpandShow.value = height > 24 ? false : true;
  185. });
  186. });
  187. problemTableData.value = res;
  188. });
  189. };
  190. const handleCancle = () => {
  191. workDialog.value = false;
  192. };
  193. const handleSubmit = (selectedData: UserList[]) => {
  194. const params = selectedData.map((item) => item.id);
  195. modifyWorkshopList(params).then(() => {
  196. ElMessage({
  197. message: '添加成功',
  198. type: 'success',
  199. plain: true,
  200. });
  201. workDialog.value = false;
  202. queryIssueData();
  203. });
  204. };
  205. onMounted(() => {
  206. queryIssueData();
  207. });
  208. </script>
  209. <style lang="scss" scoped>
  210. .pushWorkShopBar {
  211. margin: 24px 0 0 0;
  212. display: flex;
  213. img {
  214. cursor: pointer;
  215. }
  216. :nth-of-type(1) {
  217. margin-right: 12px;
  218. margin-bottom: 16px;
  219. }
  220. .pushiWorkShopSpan {
  221. width: 56px;
  222. height: 20px;
  223. font-weight: 600;
  224. font-size: 14px;
  225. color: #303133;
  226. line-height: 20px;
  227. }
  228. .descriptionSpan {
  229. width: 250px;
  230. height: 14px;
  231. font-weight: 400;
  232. font-size: 12px;
  233. color: #999999;
  234. line-height: 20px;
  235. }
  236. }
  237. .workshopList {
  238. display: flex;
  239. .left {
  240. display: flex;
  241. flex-wrap: wrap;
  242. width: 95%;
  243. max-height: 24px;
  244. overflow-y: hidden;
  245. gap: 20px;
  246. }
  247. .right {
  248. flex: 1;
  249. cursor: pointer;
  250. span {
  251. font-weight: 400;
  252. font-size: 12px;
  253. color: #303133;
  254. line-height: 17px;
  255. }
  256. img {
  257. margin-left: 4px;
  258. }
  259. }
  260. }
  261. .emptyDiv {
  262. margin-top: 78px;
  263. margin: auto;
  264. width: 396px;
  265. .emptyImg {
  266. height: 257px;
  267. }
  268. .emptySpan {
  269. font-family: PingFangSC, PingFang SC;
  270. font-weight: 400;
  271. font-size: 18px;
  272. color: rgba(0, 0, 0, 0.45);
  273. text-align: left;
  274. font-style: normal;
  275. }
  276. }
  277. .operation {
  278. display: flex;
  279. justify-content: center;
  280. width: 100%;
  281. }
  282. // .editWorkShopDialog {
  283. // .editWorkShopHeader {
  284. // width: 96px;
  285. // height: 24px;
  286. // .titleSpan {
  287. // font-weight: 600;
  288. // font-size: 16px;
  289. // color: rgba(0, 0, 0, 0.88);
  290. // line-height: 24px;
  291. // }
  292. // }
  293. // .editWorkShopDialogLeft {
  294. // height: 523px;
  295. // width: 50%;
  296. // border-right: 1px solid rgba(0, 0, 0, 0.06);
  297. // }
  298. // .editWorkShopDialogRight {
  299. // height: 523px;
  300. // width: 50%;
  301. // position: relative;
  302. // .dialogBottom {
  303. // position: absolute;
  304. // right: 0;
  305. // bottom: 0;
  306. // display: flex;
  307. // justify-content: flex-end;
  308. // margin-top: 12px;
  309. // }
  310. // }
  311. // }
  312. // :deep(.el-dialog) {
  313. // border-radius: 8px;
  314. // }
  315. // :deep(.el-dialog__body) {
  316. // height: 523px;
  317. // border-radius: 8px;
  318. // display: flex;
  319. // }
  320. </style>