index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div class="app-container">
  3. <div class="main-right-box">
  4. <div class="main-search-box">
  5. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
  6. <el-form-item label="介绍信编号" prop="letterNo">
  7. <el-input
  8. v-model="queryParams.letterNo"
  9. placeholder="请输入关键字"
  10. clearable
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="来访事由" prop="reasons">
  15. <el-input
  16. v-model="queryParams.reasons"
  17. placeholder="请输入关键字"
  18. clearable
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="状态" prop="status">
  23. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
  24. <el-option
  25. v-for="dict in dict.type.letter_status"
  26. :key="dict.value"
  27. :label="dict.label"
  28. :value="dict.value"
  29. />
  30. </el-select>
  31. </el-form-item>
  32. </el-form>
  33. <el-row :gutter="10" class="mb8">
  34. <el-col :span="1.5">
  35. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  36. </el-col>
  37. <el-col :span="1.5">
  38. <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button
  42. type="primary"
  43. icon="el-icon-plus"
  44. size="mini"
  45. @click="handleAdd"
  46. v-hasPermi="['core:letter:add']"
  47. >录入介绍信</el-button>
  48. </el-col>
  49. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  50. </el-row>
  51. </div>
  52. <el-table v-loading="loading" height="650" border :data="letterList">
  53. <el-table-column label="介绍信编号" align="center" prop="letterNo" width="120">
  54. </el-table-column>
  55. <el-table-column label="接待机构" header-align="center" align="left" prop="receptionOrgNames" />
  56. <el-table-column label="来访事由" header-align="center" align="left" prop="reasons" width="300"/>
  57. <el-table-column label="开具日期" header-align="center" align="left" prop="startTime" width="150"/>
  58. <el-table-column label="有效天数" header-align="center" align="center" prop="effectiveDays" width="100"/>
  59. <!-- <el-table-column label="介绍信有效期" align="center" width="250">
  60. <template slot-scope="scope">
  61. <span>{{ scope.row.startTime}}~{{scope.row.endTime}}</span>
  62. </template>
  63. </el-table-column> -->
  64. <el-table-column label="状态" align="center" width="100" prop="status" >
  65. <template slot-scope="scope">
  66. <dict-tag :options="dict.type.letter_status" :value="scope.row.status"/>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="备注" header-align="center" align="left" width="200" prop="description" />
  70. <el-table-column label="操作" header-align="center" align="left" width="280" class-name="small-padding fixed-width">
  71. <template slot-scope="scope">
  72. <el-button
  73. size="mini"
  74. type="text"
  75. icon="el-icon-check"
  76. v-if="scope.row.status==0"
  77. @click="handleUseLetter(scope.row)"
  78. v-hasPermi="['core:letter:edit']"
  79. >下发</el-button>
  80. <el-button
  81. size="mini"
  82. type="text"
  83. icon="el-icon-view"
  84. @click="handleDetailInfo(scope.row)"
  85. v-hasPermi="['core:letter:edit']"
  86. >详情</el-button>
  87. <el-button
  88. size="mini"
  89. type="text"
  90. icon="el-icon-edit-outline"
  91. v-if="!scope.row.haveOutInRecord && scope.row.status!=2"
  92. @click="handleUpdate(scope.row)"
  93. v-hasPermi="['core:letter:edit']"
  94. >编辑</el-button>
  95. <el-button
  96. size="mini"
  97. type="text"
  98. v-if="scope.row.status!=2"
  99. icon="el-icon-delete"
  100. @click="handleDelete(scope.row)"
  101. v-hasPermi="['core:letter:remove']"
  102. >删除</el-button>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. <pagination
  107. v-show="total>0"
  108. :total="total"
  109. :page.sync="queryParams.pageNum"
  110. :limit.sync="queryParams.pageSize"
  111. @pagination="getList"
  112. />
  113. <dialog-add-letter ref="dialogAddLetter" @success="handleQuery(true)"></dialog-add-letter>
  114. <dialog-letter-detail ref="dialogLetterDetail" @success="handleQuery(true)"></dialog-letter-detail>
  115. </div>
  116. </div>
  117. </template>
  118. <script>
  119. import { listLetter, getLetter, delLetter, addLetter, updateLetter,updateLetterStatus } from "@/api/core/letter";
  120. import dialogAddLetter from "./dialog.addletter";
  121. import dialogLetterDetail from "./dialog.letter.detail.vue";
  122. export default {
  123. components: {dialogAddLetter,dialogLetterDetail},
  124. dicts: ['letter_status'],
  125. name: "Letter",
  126. data() {
  127. return {
  128. // 遮罩层
  129. loading: true,
  130. // 选中数组
  131. ids: [],
  132. // 非单个停用
  133. single: true,
  134. // 非多个停用
  135. multiple: true,
  136. // 显示搜索条件
  137. showSearch: true,
  138. // 总条数
  139. total: 0,
  140. // 介绍信表格数据
  141. letterList: [],
  142. // 弹出层标题
  143. title: "",
  144. // 是否显示弹出层
  145. open: false,
  146. // 查询参数
  147. queryParams: {
  148. pageNum: 1,
  149. pageSize: 10,
  150. letterNo:null,
  151. reasons: null,
  152. status: null,
  153. requestFromWeb:true,
  154. type:1,
  155. orgId:this.$store.getters.orgId,
  156. },
  157. // 表单参数
  158. form: {},
  159. // 表单校验
  160. rules: {
  161. }
  162. };
  163. },
  164. created() {
  165. this.getList();
  166. },
  167. methods: {
  168. /** 查询介绍信列表 */
  169. getList() {
  170. this.loading = true;
  171. listLetter(this.queryParams).then(response => {
  172. this.letterList = response.rows;
  173. this.total = response.total;
  174. this.loading = false;
  175. });
  176. },
  177. // 取消按钮
  178. cancel() {
  179. this.open = false;
  180. // this.reset();
  181. },
  182. /** 搜索按钮操作 */
  183. handleQuery() {
  184. this.queryParams.pageNum = 1;
  185. this.getList();
  186. },
  187. /** 重置按钮操作 */
  188. resetQuery() {
  189. this.resetForm("queryForm");
  190. this.handleQuery();
  191. },
  192. /** 新增按钮操作 */
  193. handleAdd() {
  194. this.$refs["dialogAddLetter"].show(null,{});
  195. },
  196. /** 修改按钮操作 */
  197. handleUpdate(row) {
  198. // this.reset();
  199. // const id = row.id || this.ids
  200. this.$refs["dialogAddLetter"].show(row.id ,{});
  201. },
  202. handleUseLetter(row)
  203. {
  204. updateLetterStatus({id:row.id,status:1}).then(response => {
  205. this.$modal.msgSuccess("修改成功");
  206. this.getList();
  207. });
  208. },
  209. handleDetailInfo(row)
  210. {
  211. this.$refs["dialogLetterDetail"].show(row.id);
  212. },
  213. /** 提交按钮 */
  214. submitForm() {
  215. this.$refs["form"].validate(valid => {
  216. if (valid) {
  217. if (this.form.id != null) {
  218. updateLetter(this.form).then(response => {
  219. this.$modal.msgSuccess("修改成功");
  220. this.getList();
  221. });
  222. } else {
  223. addLetter(this.form).then(response => {
  224. this.$modal.msgSuccess("新增成功");
  225. this.getList();
  226. });
  227. }
  228. }
  229. });
  230. },
  231. /** 删除按钮操作 */
  232. handleDelete(row) {
  233. const ids = row.id || this.ids;
  234. this.$modal.confirm('是否确认删除介绍信编号为 "' + row.letterNo + '" 的数据项?').then(function() {
  235. return delLetter(ids);
  236. }).then(() => {
  237. this.getList();
  238. this.$modal.msgSuccess("删除成功");
  239. }).catch(() => {});
  240. },
  241. }
  242. };
  243. </script>