Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

addtion.vue 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <div class="main-contain">
  3. <div class=" sign-and-weigh-box" style="background: white">
  4. <!--<manufacturer-or-dealer-dialog-->
  5. <!--ref="dialog"-->
  6. <!--:titles="manufacturerDialog.titles"-->
  7. <!--:formValue="manufacturerDialog.formValue"-->
  8. <!--:visibility="manufacturerDialog.isVisibility"-->
  9. <!--:type="manufacturerDialog.type"-->
  10. <!--:isCreated="manufacturerDialog.isCreated"-->
  11. <!--v-on:dialog-comfirm="manufacturerDialogComfirm"-->
  12. <!--v-on:dialog-cancle="manufacturerDialogCancle"-->
  13. <!--&gt;</manufacturer-or-dealer-dialog>-->
  14. <addition-dialog
  15. ref="dialog"
  16. :titles="Dialog.titles"
  17. :formValue="Dialog.formValue"
  18. :visibility="Dialog.isVisibility"
  19. :type="Dialog.type"
  20. :isCreated="Dialog.isCreated"
  21. v-on:dialog-comfirm="dialogComfirm"
  22. v-on:dialog-cancle="dialogCancle"
  23. ></addition-dialog>
  24. <el-row :gutter="15">
  25. <el-col>
  26. <div>
  27. <el-button
  28. size="small"
  29. icon="el-icon-circle-plus-outline"
  30. style="float: right;margin-bottom: 15px"
  31. type="primary"
  32. @click="showDialog"
  33. >新增
  34. </el-button>
  35. </div>
  36. <el-table
  37. :row-style="{ color: '#303133' }"
  38. :header-cell-style="{
  39. backgroundColor: 'rgb(245, 247, 250)',
  40. color: '#606266'
  41. }"
  42. :data="manufacturerData"
  43. style="width: 100%"
  44. border
  45. v-loading="loading"
  46. >
  47. <el-table-column label="国家编码" align="center">
  48. <template slot-scope="scope">
  49. {{ scope.row.code }}
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="费用名称" align="center">
  53. <template slot-scope="scope">
  54. {{ scope.row.name }}
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="金额" align="center">
  58. <template slot-scope="scope">
  59. {{ scope.row.price }}元
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="操作" align="center">
  63. <template slot-scope="scope">
  64. <el-tooltip
  65. class="item"
  66. effect="dark"
  67. content="编辑"
  68. placement="top"
  69. >
  70. <el-button
  71. size="small"
  72. type="primary"
  73. icon="el-icon-edit-outline"
  74. @click="handleEdit(scope.$index, scope.row)"
  75. >
  76. </el-button>
  77. </el-tooltip>
  78. <el-tooltip
  79. class="item"
  80. effect="dark"
  81. content="删除"
  82. placement="top"
  83. >
  84. <el-button
  85. size="small"
  86. type="danger"
  87. icon="el-icon-delete"
  88. @click="handleDelete(scope.$index, scope.row)"
  89. >
  90. </el-button>
  91. </el-tooltip>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <el-pagination
  96. @size-change="handleSizeChange"
  97. @current-change="handleCurrentChange"
  98. :page-sizes="[10, 50, 100]"
  99. :page-size="10"
  100. background
  101. align="right"
  102. style="margin-top:20px;"
  103. layout="total, sizes, prev, pager, next, jumper"
  104. :total="total"
  105. >
  106. </el-pagination>
  107. </el-col>
  108. </el-row>
  109. </div>
  110. </div>
  111. </template>
  112. <script>
  113. import {
  114. createAddition,
  115. modifyAddition,
  116. getAdditionList,
  117. deleteAddition,
  118. GetAddition
  119. } from '@/api/data'
  120. import AdditionDialog from './additionDialog'
  121. export default {
  122. components: {
  123. AdditionDialog,
  124. },
  125. name: 'addtion',
  126. data() {
  127. return {
  128. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  129. manufacturerData: [],
  130. total: 0,
  131. pageTotal: 0,
  132. pageSelect: 0,
  133. page: 1,
  134. limit: 10,
  135. loading: false,
  136. manufacturer_code: '',
  137. editId: '',
  138. editIndex: '',
  139. Dialog: {
  140. titles: '新增',
  141. isVisibility: false,
  142. isCreated: 1, //1.创建 2.编辑 3.查看详情
  143. formValue: {
  144. name: '',
  145. code: '',
  146. price: '',
  147. },
  148. resetForm: {
  149. name: '',
  150. code: '',
  151. price: '',
  152. }
  153. }
  154. }
  155. },
  156. methods: {
  157. handleEdit: function(index, row) {
  158. this.editId = row.id
  159. this.editIndex = index
  160. let params = {
  161. id: row.id
  162. }
  163. GetAddition(params).then(response => {
  164. if (response.data.state == 0) {
  165. this.$message.error(response.data.msg)
  166. return false
  167. } else {
  168. this.Dialog.formValue.class_name =
  169. response.data.data.addition.name
  170. this.Dialog.formValue.content_code =
  171. response.data.data.addition.code
  172. this.Dialog.formValue.price =
  173. response.data.data.addition.price
  174. this.Dialog.isCreated = 2
  175. this.$refs.dialog.show()
  176. }
  177. })
  178. },
  179. handleDelete: function(index, row) {
  180. this.$confirm('确认删除这条记录?', '删除记录', {
  181. confirmButtonText: '确定',
  182. cancelButtonText: '取消',
  183. type: 'warning'
  184. })
  185. .then(() => {
  186. let params = {
  187. id: row.id
  188. }
  189. deleteAddition(params).then(response => {
  190. if (response.data.state == 0) {
  191. this.$message.error(response.data.msg)
  192. return false
  193. } else {
  194. this.manufacturerData.splice(index, 1)
  195. this.$message.success('厂家已经删除')
  196. }
  197. })
  198. })
  199. .catch(() => {
  200. })
  201. },
  202. showDetails: function(index, row) {
  203. let params = {
  204. id: row.id
  205. }
  206. GetAddition(params).then(response => {
  207. if (response.data.state == 0) {
  208. this.$message.error(response.data.msg)
  209. return false
  210. } else {
  211. this.Dialog.formValue.name =
  212. response.data.data.addition.name
  213. this.Dialog.formValue.code =
  214. response.data.data.addition.code
  215. this.Dialog.formValue.price =
  216. response.data.data.addition.price
  217. this.Dialog.isCreated = 3
  218. this.Dialog.isVisibility = true
  219. }
  220. })
  221. },
  222. dialogComfirm: function(val) {
  223. // this.manufacturerDialog.isVisibility = false
  224. this.$refs.dialog.hide()
  225. if (val.isCreated == 2) {
  226. //修改
  227. let params = {
  228. name: val.name,
  229. code: val.code,
  230. price: val.price,
  231. id: this.editId,
  232. }
  233. modifyAddition(params).then(response => {
  234. if (response.data.state == 0) {
  235. this.$message.error(response.data.msg)
  236. return false
  237. } else {
  238. this.manufacturerData[this.editIndex].name =
  239. response.data.data.addition.name
  240. this.manufacturerData[this.editIndex].code =
  241. response.data.data.addition.code
  242. this.manufacturerData[this.editIndex].price =
  243. response.data.data.addition.price
  244. this.$message.success('修改成功')
  245. }
  246. })
  247. } else if (val.isCreated == 1) {
  248. //新增
  249. createAddition(val).then(response => {
  250. if (response.data.state == 0) {
  251. this.$message.error(response.data.msg)
  252. return false
  253. } else {
  254. this.manufacturerData.unshift(response.data.data.addition)
  255. this.$message.success('新增成功')
  256. }
  257. })
  258. }
  259. },
  260. dialogCancle: function() {
  261. this.$refs.dialog.hide()
  262. },
  263. showDialog: function() {
  264. this.Dialog.formValue = Object.assign(
  265. {},
  266. this.Dialog.resetForm
  267. )
  268. this.$refs.dialog.show()
  269. this.Dialog.isCreated = 1
  270. },
  271. handleSizeChange(val) {
  272. this.limit = val
  273. this.getList()
  274. },
  275. handleCurrentChange(val) {
  276. this.page = val
  277. this.getList()
  278. },
  279. getList() {
  280. let params = {
  281. page: this.page,
  282. limit: this.limit
  283. }
  284. this.loading = true
  285. getAdditionList(params).then(response => {
  286. if (response.data.state == 0) {
  287. this.loading = false
  288. this.$message.error(response.data.msg)
  289. return false
  290. } else {
  291. this.loading = false
  292. this.total = response.data.data.total
  293. this.manufacturerData = []
  294. for (let i = 0; i < response.data.data.addition.length; i++) {
  295. this.manufacturerData.push(response.data.data.addition[i])
  296. }
  297. }
  298. })
  299. }
  300. },
  301. created() {
  302. this.getList()
  303. }
  304. }
  305. </script>
  306. <style lang="scss">
  307. .el-table td,
  308. .el-table th.is-leaf,
  309. .el-table--border,
  310. .el-table--group {
  311. border-color: #d0d3da;
  312. }
  313. .el-table--border::after,
  314. .el-table--group::after,
  315. .el-table::before {
  316. background-color: #d0d3da;
  317. }
  318. </style>