hisContent.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <div class="app-container">
  3. <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="his.query" label-width="100px">
  4. <el-form-item label="回顾/截止日期" prop="deadlineTime">
  5. <el-date-picker v-model="his.query.deadlineTime" clearable placeholder="请选择回顾/截止日期"
  6. size="small"
  7. style="width: 200px"
  8. type="date"
  9. value-format="yyyy-MM-dd" @change="getContentList">
  10. </el-date-picker>
  11. </el-form-item>
  12. <el-form-item label="类型" label-width="50px" prop="workType">
  13. <el-select v-model="his.query.workType" placeholder="请选择类型" clearable size="small"
  14. style="width: 100%;" @change="getContentList">
  15. <el-option
  16. v-for="dict in workTypeOptions"
  17. :key="dict.dictValue"
  18. :label="dict.dictLabel"
  19. :value="dict.dictValue"
  20. />
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="状态" label-width="50px" prop="status">
  24. <el-select v-model="his.query.status" placeholder="请选择状态" clearable size="small"
  25. style="width: 100%;" @change="getContentList">
  26. <el-option
  27. v-for="dict in agendaStatusOptions"
  28. :key="dict.dictValue"
  29. :label="dict.dictLabel"
  30. :value="dict.dictValue"
  31. />
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="跟踪人" label-width="70px" prop="responsible">
  35. <el-input v-model="his.query.responsible" placeholder="请输入跟踪人"/>
  36. </el-form-item>
  37. <el-form-item>
  38. <el-button icon="el-icon-search" size="mini" type="cyan" @click="getContentList">搜索</el-button>
  39. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  40. </el-form-item>
  41. </el-form>
  42. <el-row :gutter="10" class="mb8">
  43. <right-toolbar :showSearch.sync="showSearch" @queryTable="getContentList"></right-toolbar>
  44. </el-row>
  45. <el-table :data="his.contentList" :height="clientHeight" border>
  46. <el-table-column align="center" label="主题" prop="subject"/>
  47. <el-table-column align="center" label="会议编号" prop="meetingNo"/>
  48. <el-table-column align="center" label="会议时间" prop="meetingDate">
  49. <template slot-scope="scope">
  50. <span>{{ parseTime(scope.row.meetingDate, '{y}-{m}-{d}') }}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column align="center" label="内容" prop="agendaContent">
  54. <template slot-scope="scope">
  55. <el-input v-if="scope.row.isEdit&&scope.row.workType==='P'" v-model="scope.row.agendaContent"
  56. placeholder="请输入行动项内容"
  57. type="textarea"/>
  58. <span v-else>{{ scope.row.agendaContent }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column align="center" label="类型" prop="workType"/>
  62. <el-table-column align="center" label="跟踪人" prop="responsible"/>
  63. <el-table-column align="center" label="回顾/截止时间" prop="deadlineTime" width="180">
  64. <template slot-scope="scope">
  65. <span>{{ parseTime(scope.row.deadlineTime, '{y}-{m}-{d}') }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column align="center" label="状态" prop="status">
  69. <template slot-scope="scope">
  70. <el-select v-if="scope.row.isEdit" v-model="scope.row.status" placeholder="请选择状态"
  71. clearable
  72. size="small" style="width: 100%;">
  73. <el-option
  74. v-for="dict in agendaStatusOptions"
  75. :key="dict.dictValue"
  76. :label="dict.dictLabel"
  77. :value="dict.dictValue"
  78. />
  79. </el-select>
  80. <span v-else>{{ scope.row.status }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column align="center" class-name="small-padding fixed-width" label="操作">
  84. <template slot-scope="scope">
  85. <el-button
  86. v-if="!scope.row.isEdit&&scope.row.workType!=='I'"
  87. v-hasPermi="['plant:content:edit']"
  88. icon="el-icon-edit"
  89. size="mini"
  90. type="text"
  91. @click="handleUpdateRecord(scope.row)"
  92. >修改
  93. </el-button>
  94. <el-button v-if="scope.row.isEdit"
  95. icon="el-icon-check"
  96. size="mini"
  97. type="text"
  98. @click="save(scope.row)"
  99. >保存
  100. </el-button>
  101. <el-button v-if="scope.row.isEdit"
  102. icon="el-icon-close"
  103. size="mini"
  104. type="text"
  105. @click="cancelRecord(scope.row,scope.$index)"
  106. >取消
  107. </el-button>
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. <pagination
  112. v-show="his.total>0"
  113. :limit.sync="his.query.pageSize"
  114. :page.sync="his.query.pageNum"
  115. :total="his.total"
  116. @pagination="getContentList"
  117. />
  118. </div>
  119. </template>
  120. <script>
  121. import {listContent2, updateContent} from "@/api/plant/content";
  122. export default {
  123. name: "hisContent",
  124. data() {
  125. return {
  126. his: {
  127. open: false,
  128. contentList: [],
  129. total: 0,
  130. query: {
  131. pageNum: 1,
  132. pageSize: 10,
  133. isHis: 1,
  134. }
  135. },
  136. // 显示搜索条件
  137. showSearch: false,
  138. clientHeight: 300,
  139. workTypeOptions: [],
  140. agendaStatusOptions: [],
  141. plantCodeOptions: [],
  142. }
  143. },
  144. created() {
  145. //设置表格高度对应屏幕高度
  146. this.$nextTick(() => {
  147. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  148. })
  149. this.getContentList();
  150. this.getDicts("PLANT_DIVIDE").then(response => {
  151. this.plantCodeOptions = response.data;
  152. });
  153. this.getDicts("agenda_type").then(res => {
  154. this.workTypeOptions = res.data;
  155. });
  156. this.getDicts("agenda_status").then(res => {
  157. this.agendaStatusOptions = res.data;
  158. });
  159. },
  160. methods: {
  161. save(row) {
  162. let data = {
  163. id: row.id,
  164. status: row.status,
  165. agendaContent: row.agendaContent,
  166. }
  167. updateContent(data).then(res => {
  168. this.$modal.msgSuccess("修改成功");
  169. row.isEdit = false;
  170. this.getContentList();
  171. })
  172. },
  173. handleUpdateRecord(row) {
  174. // 备份原始数据
  175. row['oldRow'] = JSON.parse(JSON.stringify(row));
  176. this.$nextTick(() => {
  177. row.isEdit = true;
  178. })
  179. },
  180. cancelRecord(row, index) {
  181. // 如果是新增的数据
  182. if (row.isAdd) {
  183. this.record.dataList.splice(index, 1)
  184. } else {
  185. // 不是新增的数据 还原数据
  186. for (const i in row.oldRow) {
  187. row[i] = row.oldRow[i]
  188. }
  189. row.isEdit = false
  190. }
  191. },
  192. getContentList() {
  193. listContent2(this.his.query).then(response => {
  194. response.rows.forEach(item => {
  195. item["isEdit"] = false;
  196. })
  197. this.his.contentList = response.rows;
  198. this.his.total = response.total;
  199. });
  200. },
  201. /** 重置按钮操作 */
  202. resetQuery() {
  203. this.resetForm("queryForm");
  204. this.handleQuery();
  205. },
  206. }
  207. }
  208. </script>
  209. <style scoped>
  210. </style>