index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. <template>
  2. <div class="app-container">
  3. <div ref="sousuH">
  4. <!-- 搜索工作栏 -->
  5. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  6. <el-form-item label="指令标题" prop="comTitle">
  7. <el-input v-model="queryParams.comTitle" placeholder="请输入指令标题" clearable @keyup.enter.native="handleQuery" />
  8. </el-form-item>
  9. <!-- <el-form-item label="状态" prop="status">
  10. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  11. <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" :key="dict.value" :label="dict.label"
  12. :value="dict.value" />
  13. </el-select>
  14. </el-form-item> -->
  15. <el-form-item label="指令类型" prop="comType">
  16. <el-select v-model="queryParams.comType" placeholder="请选择指令类型" clearable size="small">
  17. <el-option v-for="dict in this.getDictDatas(DICT_TYPE.INSPECTITEM_TYPE)" :key="dict.value" :label="dict.label"
  18. :value="dict.value" />
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item>
  22. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  23. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  24. </el-form-item>
  25. </el-form>
  26. <!-- 操作工具栏 -->
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
  30. v-hasPermi="['backend:com-info:create']">新增</el-button>
  31. </el-col>
  32. <el-col :span="1.5">
  33. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  34. :loading="exportLoading" v-hasPermi="['backend:com-info:export']">导出</el-button>
  35. </el-col>
  36. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  37. </el-row>
  38. </div>
  39. <!-- 列表 -->
  40. <el-table v-loading="loading" :data="list" :height="list.length ? tableHeight : 'auto'">
  41. <el-table-column label="ID" align="center" prop="id" />
  42. <el-table-column label="指令标题" align="center" prop="comTitle" />
  43. <el-table-column label="发布状态" align="center" prop="comStatus">
  44. <template slot-scope="{row}">
  45. <div>{{ row.comStatus == 1 ? '已发布' : '未发布' }}</div>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="指令内容" align="center">
  49. <template slot-scope="scope">
  50. <div v-html="scope.row.comContent"></div>
  51. </template>
  52. </el-table-column>
  53. <!-- <el-table-column label="状态" align="center" prop="status">
  54. <template v-slot="scope">
  55. <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
  56. </template>
  57. </el-table-column> -->
  58. <el-table-column label="指令类型" align="center" prop="comType">
  59. <template v-slot="scope">
  60. <dict-tag :type="DICT_TYPE.INSPECTITEM_TYPE" :value="scope.row.comType" />
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
  64. <template v-slot="scope">
  65. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  66. v-hasPermi="['backend:com-info:update']">修改</el-button>
  67. <!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  68. v-hasPermi="['backend:task-info:delete']">删除</el-button> -->
  69. <el-dropdown @command="(command) => handleCommand(command, scope.$index, scope.row)">
  70. <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
  71. <el-dropdown-menu slot="dropdown">
  72. <el-dropdown-item command="handleDelete" size="mini" type="text" icon="el-icon-delete"
  73. v-hasPermi="['backend:com-info:delete']">删除</el-dropdown-item>
  74. <el-dropdown-item command="handleSelectedOrg" size="mini" type="text"
  75. icon="el-icon-circle-check">已下达指令人员</el-dropdown-item>
  76. <el-dropdown-item command="handleOrg" size="mini" type="text"
  77. icon="el-icon-circle-check">下达单位</el-dropdown-item>
  78. <el-dropdown-item command="handPublish" size="mini" type="text" v-if="scope.row.comStatus == 0"
  79. icon="el-icon-circle-check">发布</el-dropdown-item>
  80. </el-dropdown-menu>
  81. </el-dropdown>
  82. <!-- <el-button size="mini" type="text" icon="el-icon-help" @click="lookMes(scope.row)">查看详情</el-button> -->
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. <!-- 分页组件 -->
  87. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  88. @pagination="getList" />
  89. <!-- 对话框(添加 / 修改) -->
  90. <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
  91. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  92. <el-form-item label="指令标题" prop="comTitle">
  93. <el-input v-model="form.comTitle" placeholder="请输入指令标题" />
  94. </el-form-item>
  95. <el-form-item label="指令类型" prop="comType">
  96. <el-select v-model="form.comType" placeholder="请选择指令类型" style="width: 100%;">
  97. <el-option v-for="dict in this.getDictDatas(DICT_TYPE.INSPECTITEM_TYPE)" :key="dict.value" :label="dict.label"
  98. :value="dict.value" />
  99. </el-select>
  100. </el-form-item>
  101. <el-form-item label="指令内容">
  102. <editor v-model="form.comContent" :min-height="192" />
  103. </el-form-item>
  104. <el-form-item label="附件id" prop="attId">
  105. <fileUpload v-model="form.attId" />
  106. </el-form-item>
  107. <!-- <el-form-item label="状态" prop="status">
  108. <el-radio-group v-model="form.status" style="width: 100%;">
  109. <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" :key="dict.value"
  110. :label="parseInt(dict.value)">{{ dict.label }}</el-radio>
  111. </el-radio-group>
  112. </el-form-item> -->
  113. <!-- <el-form-item label="单位类别">
  114. <el-select v-model="form.orgType" multiple placeholder="请选择单位类别">
  115. <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMPANY_inspectitem_kind)" :key="dict.value"
  116. :label="dict.label" :value="dict.value" />
  117. </el-select>
  118. </el-form-item> -->
  119. <!-- <el-form-item label="单位">
  120. <el-input clear @focus="handleFocus" @clear="handleClear" placeholder="请选择单位" v-model="orgList"
  121. clearable>
  122. <template slot="append">
  123. <i title="选择" @click="handleChoice" style="cursor:pointer;" class="el-icon-plus"></i>
  124. </template>
  125. </el-input>
  126. </el-form-item> -->
  127. </el-form>
  128. <div slot="footer" class="dialog-footer">
  129. <el-button type="primary" @click="submitForm">确 定</el-button>
  130. <el-button @click="cancel">取 消</el-button>
  131. </div>
  132. </el-dialog>
  133. <!-- 分配分管单位 -->
  134. <el-dialog title="分配分管单位" :visible.sync="openOrg" width="85vw" append-to-body v-if="openOrg">
  135. <choiceSelect ref="choiceSelect" :userId="form.id" :type="'comInfo'"></choiceSelect>
  136. <div slot="footer" class="dialog-footer">
  137. <el-button type="primary" @click="submitOrg">确 定</el-button>
  138. <el-button @click="cancelOrg">取 消</el-button>
  139. </div>
  140. </el-dialog>
  141. <!-- 已选择分管单位 -->
  142. <el-dialog title="已下达指令人员" :visible.sync="openSelectedOrg" width="85vw" append-to-body v-if="openSelectedOrg">
  143. <handleSelectedOrg ref="choiceSelect" :userId="form.id" :type="'comInfo'"></handleSelectedOrg>
  144. <div slot="footer" class="dialog-footer">
  145. <el-button type="primary" @click="openSelectedOrg = false">关 闭</el-button>
  146. </div>
  147. </el-dialog>
  148. <el-dialog title="已分配单位" :visible.sync="comInfoOrg" width="85vw" append-to-body>
  149. <handleSelectedOrg ref="choiceSelect" :userId="form.id" :type="'comInfoOrg'"></handleSelectedOrg>
  150. <div slot="footer" class="dialog-footer">
  151. <el-button type="primary" @click="comInfoOrg = false">关 闭</el-button>
  152. </div>
  153. </el-dialog>
  154. <!-- 查看下达的单位 -->
  155. <el-dialog title="下达单位" :visible.sync="downHouse" width="50%">
  156. <!-- <el-button plain icon="el-icon-download" size="mini" @click="nowExcel" type="warning" style="margin-bottom: 10px;">导出</el-button> -->
  157. <el-table :data="downList">
  158. <el-table-column label="单位名称" align="center" prop="id" />
  159. <el-table-column label="单位地址" align="center" prop="meetingId" />
  160. <el-table-column label="是否已读" align="center" prop="ppName" />
  161. <!-- <el-table-column label="参会人联系电话" align="center" prop="ppTel" width="200" />
  162. <el-table-column label="参会人单位id" align="center" prop="orgId" />
  163. <el-table-column label="参会人职务" align="center" prop="ppDuty" /> -->
  164. </el-table>
  165. <!-- <pagination v-show="totals > 0" :total="totals" page.sync="1" limit.sync="10" @pagination="getList" /> -->
  166. <span slot="footer" class="dialog-footer">
  167. <el-button @click="downHouse = false">取 消</el-button>
  168. <el-button type="primary" @click="downHouse = false">确 定</el-button>
  169. </span>
  170. </el-dialog>
  171. </div>
  172. </template>
  173. <script>
  174. import { createComInfo, updateComInfo, deleteComInfo, getComInfo, getComInfoPage, exportComInfoExcel, broadCominfo, setupComuser, getselfComuser,getNewsList } from "@/api/backend/comInfo"
  175. import Editor from '@/components/Editor'
  176. import { DICT_TYPE, getDictDatas } from "@/utils/dict";
  177. import choiceSelect from '@/components/choiceSelect';
  178. import FileUpload from '@/components/FileUpload'
  179. import handleSelectedOrg from '@/components/handleSelectedOrg';
  180. import { getTableHeight } from "@/utils/ruoyi.js";
  181. export default {
  182. name: "ComInfo",
  183. components: {
  184. Editor, choiceSelect, handleSelectedOrg, FileUpload,
  185. },
  186. data() {
  187. return {
  188. // 遮罩层
  189. loading: true,
  190. // 导出遮罩层
  191. exportLoading: false,
  192. // 显示搜索条件
  193. showSearch: true,
  194. // 总条数
  195. total: 0,
  196. // 指令信息列表
  197. list: [],
  198. // 弹出层标题
  199. title: "",
  200. // 是否显示弹出层
  201. open: false,
  202. // 查询参数
  203. queryParams: {
  204. pageNo: 1,
  205. pageSize: 10,
  206. comTitle: null,
  207. comContent: null,
  208. status: null,
  209. comType: null,
  210. },
  211. // 表单参数
  212. form: {
  213. status: 0
  214. },
  215. // 表单校验
  216. rules: {
  217. status: [{ required: true, message: "状态不能为空", trigger: "blur" }],
  218. comTitle: [{ required: true, message: "请输入指令标题", trigger: "blur" }],
  219. comType: [{ required: true, message: "请输入指令类型", trigger: "blur" }],
  220. },
  221. // =======单位信息==========================
  222. // 是否显示弹出层(分管单位)
  223. openOrg: false,
  224. // 最终选择的单位信息列表
  225. alreadySelectedOrgList: [],
  226. orgList: '',
  227. tableHeight: "",
  228. // 已选择单位
  229. openSelectedOrg: false,
  230. orgType: undefined,
  231. downHouse: false,//查看人员
  232. totals: 0,
  233. downList:[],
  234. comInfoOrg:false
  235. }
  236. },
  237. mounted() {
  238. //挂载window.onresize事件(动态设置table高度)
  239. window.addEventListener('resize', () => {
  240. this.$nextTick(() => {
  241. if (this.$refs['sousuH']) {
  242. this.tableHeight = getTableHeight(this.$refs['sousuH'].clientHeight + 200)
  243. }
  244. })
  245. })
  246. },
  247. created() {
  248. this.getList()
  249. this.$nextTick(() => {
  250. this.tableHeight = getTableHeight(this.$refs['sousuH'].clientHeight + 200)
  251. })
  252. },
  253. methods: {
  254. // 更多操作
  255. handleCommand(command, index, row) {
  256. const id = row.id
  257. getComInfo(id).then(response => {
  258. this.form = response.data
  259. })
  260. switch (command) {
  261. case 'handleUpdate':
  262. this.handleUpdate(row);//修改客户信息
  263. break;
  264. case 'handleDelete':
  265. this.handleDelete(row);//红号变更
  266. break;
  267. case 'handleOrg':
  268. this.handleOrg(row);
  269. break;
  270. case 'handleSelectedOrg':
  271. this.handleSelectedOrg(row);
  272. break;
  273. case 'handPublish':
  274. this.handPublish(row);
  275. break;
  276. default:
  277. break;
  278. }
  279. },
  280. /** 查询列表 */
  281. getList() {
  282. this.loading = true
  283. // 执行查询
  284. getComInfoPage(this.queryParams).then(response => {
  285. this.list = response.data.list
  286. this.total = response.data.total
  287. this.loading = false
  288. })
  289. },
  290. /** 取消按钮 */
  291. cancel() {
  292. this.open = false
  293. this.reset()
  294. },
  295. /** 表单重置 */
  296. reset() {
  297. this.form = {
  298. id: undefined,
  299. comTitle: undefined,
  300. comContent: undefined,
  301. attId: undefined,
  302. status: 0,
  303. comType: undefined,
  304. // orgType: undefined,
  305. }
  306. this.resetForm("form")
  307. this.orgList = ''
  308. },
  309. /** 搜索按钮操作 */
  310. handleQuery() {
  311. this.queryParams.pageNo = 1
  312. this.getList()
  313. },
  314. /** 重置按钮操作 */
  315. resetQuery() {
  316. this.resetForm("queryForm")
  317. this.handleQuery()
  318. },
  319. /** 新增按钮操作 */
  320. handleAdd() {
  321. this.reset()
  322. this.open = true
  323. this.title = "添加指令信息"
  324. },
  325. /** 修改按钮操作 */
  326. handleUpdate(row) {
  327. this.reset()
  328. const id = row.id
  329. getComInfo(id).then(response => {
  330. this.form = response.data
  331. this.open = true
  332. this.title = "修改指令信息"
  333. })
  334. },
  335. /** 提交按钮 */
  336. submitForm() {
  337. this.$refs["form"].validate((valid) => {
  338. if (!valid) {
  339. return
  340. }
  341. // 修改的提交
  342. if (this.form.id != null) {
  343. updateComInfo(this.form).then((response) => {
  344. this.$modal.msgSuccess("修改成功")
  345. this.open = false
  346. this.getList()
  347. })
  348. return
  349. }
  350. // 添加的提交
  351. createComInfo(this.form).then((response) => {
  352. this.$modal.msgSuccess("新增成功")
  353. this.open = false
  354. this.getList()
  355. })
  356. })
  357. },
  358. /** 删除按钮操作 */
  359. handleDelete(row) {
  360. const id = row.id
  361. this.$modal
  362. .confirm('是否确认删除指令为"' + row.comTitle + '"的数据项?')
  363. .then(function () {
  364. return deleteComInfo(id)
  365. })
  366. .then(() => {
  367. this.getList()
  368. this.$modal.msgSuccess("删除成功")
  369. })
  370. .catch(() => { })
  371. },
  372. /** 导出按钮操作 */
  373. handleExport() {
  374. // 处理查询参数
  375. let params = { ...this.queryParams }
  376. params.pageNo = undefined
  377. params.pageSize = undefined
  378. // 执行导出
  379. this.$modal
  380. .confirm("是否确认导出所有指令?")
  381. .then(() => {
  382. this.exportLoading = true
  383. return exportComInfoExcel(params)
  384. })
  385. .then((response) => {
  386. this.$download.excel(response, "指令下达.xls")
  387. this.exportLoading = false
  388. })
  389. .catch(() => { })
  390. },
  391. /**
  392. * 选单位
  393. */
  394. // ========获取已选单位信息=============================================================
  395. // -========================================================
  396. // =========表单添加时选单位=================================================
  397. handleClear() {
  398. this.form.orgList = "";
  399. },
  400. handleFocus() {
  401. this.handleChoice();
  402. },
  403. handleChoice() {
  404. // 打开弹窗
  405. this.openOrg = true;
  406. },
  407. // ============操作区修改单位=====================================================
  408. // 单位信息表单重置
  409. Orgreset() {
  410. this.alreadySelectedOrgList = []
  411. },
  412. // 打开单位信息v弹窗
  413. handleOrg(row) {
  414. this.Orgreset()
  415. if (row.id) {
  416. this.form.id = row.id
  417. }
  418. // 打开弹窗
  419. this.openOrg = true;
  420. },
  421. // /============单位弹窗功能====================================================
  422. /** 单位信息确认按钮 */
  423. submitOrg() {
  424. this.alreadySelectedOrgList = this.$refs["choiceSelect"].confirmMSg()
  425. this.orgType = this.$refs["choiceSelect"].confirmoOrgTypeMSg()
  426. console.log('this.orgType :>> ', this.orgType);
  427. // 关闭弹窗
  428. this.openOrg = false;
  429. this.submitFormOrg(this.$refs["choiceSelect"].confirmMSg(), this.$refs["choiceSelect"].confirmoOrgTypeMSg())
  430. },
  431. // 取消按钮(分管单位)
  432. cancelOrg() {
  433. this.openOrg = false;
  434. },
  435. // ========用于form表单已存在alreadySelectedOrgList单位信息时保存============================
  436. submitFormOrg(alreadySelectedOrgList, orgType) {
  437. var orgIds = []
  438. alreadySelectedOrgList.map(i => {
  439. orgIds.push(i.dwid)
  440. })
  441. this.form.orgTypes = orgType
  442. this.form.orgIds = orgIds
  443. this.form.comId = this.form.id
  444. console.log('this.form :>> ', this.form.id, this.form);
  445. // =====================
  446. setupComuser(this.form).then(response => {
  447. // this.$modal.msgSuccess("分配角色成功");
  448. });
  449. },
  450. // ===============已分配单位列表========================
  451. handleSelectedOrg(row) {
  452. if (row.id) {
  453. this.form.id = row.id
  454. }
  455. // 打开弹窗
  456. this.openSelectedOrg = true;
  457. },
  458. lookMes(row) {
  459. if (row.id) {
  460. this.form.id = row.id
  461. }
  462. this.comInfoOrg=true
  463. // getNewsList({ ids: row.id }).then(res => {
  464. // console.log(res.data[0].comBroadDOList, '111');
  465. // this.downList = res.data[0].comBroadDOList
  466. // this.downHouse = true
  467. // })
  468. },
  469. // -==========发布======================
  470. handPublish(row) {
  471. if (row.id) {
  472. broadCominfo({ comId: row.id }).then(response => {
  473. // this.$modal.msgSuccess("分配角色成功");
  474. this.getList()
  475. });
  476. }
  477. }
  478. },
  479. }
  480. </script>