index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <template-page
  3. v-if="pageShow"
  4. ref="pageRef"
  5. :get-list="getList"
  6. :exportList="exportList"
  7. :table-attributes="tableAttributes"
  8. :table-events="tableEvents"
  9. :options-evens-group="optionsEvensGroup"
  10. :moreParameters="moreParameters"
  11. :column-parsing="columnParsing"
  12. :operation="operation()"
  13. key="pageType"
  14. >
  15. <div class="cartographer_big">
  16. <el-dialog title="科室设置" width="100%" :modal="false" :visible.sync="formDialog" :before-close="handleClose">
  17. <zj-page-container>
  18. <zj-page-fill>
  19. <div style="box-sizing: border-box; padding: 20px 20px 0 20px">
  20. <zj-form-container ref="formRef" :form-data="formData" :form-attributes="{ size: 'mini' }">
  21. <zj-form-module title="科室设置" label-width="100px" :form-data="formData" :form-items="formItems">
  22. </zj-form-module>
  23. </zj-form-container>
  24. </div>
  25. </zj-page-fill>
  26. <div style="text-align: right; box-sizing: border-box; padding: 16px 20px">
  27. <el-button size="mini" @click="handleClose">取消</el-button>
  28. <el-button size="mini" type="primary" @click="save">保存</el-button>
  29. </div>
  30. </zj-page-container>
  31. </el-dialog>
  32. </div>
  33. </template-page>
  34. </template>
  35. <script>
  36. import TemplatePage from '@/components/template/template-page-1.vue'
  37. import import_mixin from '@/components/template/import_mixin.js'
  38. import operation_mixin from '@/components/template/operation_mixin.js'
  39. import {
  40. letterProcessList,
  41. letterProcessListExport,
  42. letterProcessDetailLetter,
  43. letterProcessAddLetter,
  44. letterProcessUpdateLetter,
  45. letterProcessDelLetter,
  46. letterProcessAppeal, // 网点申诉
  47. letterProcessCancel, // 作废
  48. letterProcessExamine, // 中心批复
  49. letterProcessReject, // 驳回
  50. letterProcessSend // 发送
  51. } from '@/api/workContactLetterPage.js'
  52. import { required } from '@/components/template/rules_verify.js'
  53. export default {
  54. components: { TemplatePage },
  55. mixins: [import_mixin, operation_mixin],
  56. data() {
  57. return {
  58. pageType: 'list',
  59. pageShow: true,
  60. // 表格属性
  61. tableAttributes: {
  62. // 启用勾选列
  63. selectColumn: true
  64. },
  65. // 表格事件
  66. tableEvents: {
  67. 'selection-change': this.selectionChange
  68. },
  69. // 勾选选中行
  70. recordSelected: [],
  71. /** 表单变量 */
  72. formDialog: false,
  73. formData: {
  74. dapartment: ''
  75. }
  76. }
  77. },
  78. computed: {
  79. // 事件组合
  80. optionsEvensGroup() {
  81. return [
  82. [
  83. [
  84. this.optionsEvensAuth('add', {
  85. click: this.openForm
  86. })
  87. ]
  88. ],
  89. [
  90. [
  91. this.optionsEvensAuth('void', {
  92. click: () => {
  93. if (this.recordSelected.length === 0) {
  94. this.$message.warning('请勾选数据')
  95. return
  96. }
  97. this.$confirm(' 是否继续?', '提示', {
  98. confirmButtonText: '确定',
  99. cancelButtonText: '取消',
  100. type: 'warning'
  101. })
  102. .then(() => {
  103. letterProcessCancel({
  104. ids: this.recordSelected.map(item => item.id)
  105. })
  106. .then(res => {
  107. this.$refs?.pageRef?.refreshList()
  108. this.recordSelected = []
  109. this.$message({
  110. message: '操作成功',
  111. type: 'success'
  112. })
  113. })
  114. .catch(err => {
  115. this.$message.error('操作失败')
  116. })
  117. })
  118. .catch(() => {})
  119. }
  120. })
  121. ]
  122. ],
  123. [
  124. [
  125. this.optionsEvensAuth('send', {
  126. click: () => {
  127. if (this.recordSelected.length === 0) {
  128. this.$message.warning('请勾选数据')
  129. return
  130. }
  131. this.$confirm(' 是否继续?', '提示', {
  132. confirmButtonText: '确定',
  133. cancelButtonText: '取消',
  134. type: 'warning'
  135. })
  136. .then(() => {
  137. letterProcessSend({
  138. ids: this.recordSelected.map(item => item.id)
  139. })
  140. .then(res => {
  141. this.$refs?.pageRef?.refreshList()
  142. this.recordSelected = []
  143. this.$message({
  144. message: '操作成功',
  145. type: 'success'
  146. })
  147. })
  148. .catch(err => {
  149. this.$message.error('操作失败')
  150. })
  151. })
  152. .catch(() => {})
  153. }
  154. })
  155. ]
  156. ],
  157. [
  158. [
  159. this.optionsEvensAuth('oneCaseRejected', {
  160. click: () => {
  161. if (this.recordSelected.length === 0) {
  162. this.$message.warning('请勾选数据')
  163. return
  164. }
  165. this.$confirm(' 是否继续?', '提示', {
  166. confirmButtonText: '确定',
  167. cancelButtonText: '取消',
  168. type: 'warning'
  169. })
  170. .then(() => {
  171. letterProcessReject({
  172. ids: this.recordSelected.map(item => item.id)
  173. })
  174. .then(res => {
  175. this.$refs?.pageRef?.refreshList()
  176. this.recordSelected = []
  177. this.$message({
  178. message: '操作成功',
  179. type: 'success'
  180. })
  181. })
  182. .catch(err => {
  183. this.$message.error('操作失败')
  184. })
  185. })
  186. .catch(() => {})
  187. }
  188. })
  189. ]
  190. ]
  191. ]
  192. },
  193. // 更多参数
  194. moreParameters() {
  195. return []
  196. },
  197. formItems() {
  198. return [
  199. // {
  200. // md: 12,
  201. // name: 'el-input',
  202. // attributes: {},
  203. // formItemAttributes: {
  204. // label: '科室名称',
  205. // prop: 'dapartment',
  206. // rules: [...required]
  207. // }
  208. // }
  209. ]
  210. }
  211. },
  212. methods: {
  213. // 列表请求函数
  214. getList: letterProcessList,
  215. // 列表导出函数
  216. exportList: letterProcessListExport,
  217. // 表格列解析渲染数据更改
  218. columnParsing(item, defaultData) {
  219. return defaultData
  220. },
  221. // 监听勾选变化
  222. selectionChange(data) {
  223. this.recordSelected = data
  224. },
  225. // 打开创建弹窗
  226. openForm() {
  227. this.formDialog = true
  228. },
  229. // 打开详情弹窗
  230. openDetailForm(row) {
  231. Promise.all([letterProcessDetailLetter({ id: row.id })]).then(([res1, res2]) => {
  232. this.formData = { ...res1.data }
  233. this.formDialog = true
  234. })
  235. },
  236. handleClose() {
  237. this.$refs?.formRef?.resetFields()
  238. this.$data.formData = this.$options.data().formData
  239. this.formDialog = false
  240. },
  241. // 操作按钮
  242. operation() {
  243. return this.operationBtn({
  244. edit: {
  245. click: ({ row, index, column }) => {
  246. this.openDetailForm(row)
  247. }
  248. },
  249. del: {
  250. conditions: ({ row, index, column }) => {
  251. return true
  252. },
  253. prompt: '确定删除?',
  254. click: ({ row, index, column }) => {
  255. letterProcessDelLetter({
  256. id: row.id
  257. })
  258. .then(res => {
  259. this.$refs.pageRef.refreshList()
  260. this.$message({
  261. type: 'success',
  262. message: `删除成功!`
  263. })
  264. })
  265. .catch(err => {
  266. console.log(err)
  267. })
  268. }
  269. }
  270. })
  271. },
  272. // 保存
  273. save() {
  274. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  275. if (valid) {
  276. ;(this.formData?.id ? letterProcessUpdateLetter : letterProcessAddLetter)(this.formData).then(res => {
  277. this.$message({
  278. type: 'success',
  279. message: '保存成功'
  280. })
  281. this.handleClose()
  282. this.$refs.pageRef.refreshList()
  283. })
  284. }
  285. })
  286. }
  287. }
  288. }
  289. </script>
  290. <style lang="scss" scoped></style>