index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <template>
  2. <div class="app-container">
  3. <div class="search">
  4. <el-input v-model="table.getdataListParm.parammaps.empCode" :placeholder="$t('role.yhmc')" style="width: 180px;" class="filter-item" clearable />
  5. <el-input v-model="table.getdataListParm.parammaps.empname" :placeholder="$t('role.ygxm')" style="width: 180px;" class="filter-item" clearable />
  6. <el-select v-model="table.getdataListParm.parammaps.enable" :placeholder="$t('formulationEvaluation.sfqy')" class="filter-item" style="width: 120px;" clearable>
  7. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  8. </el-select>
  9. <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" :range-separator="$t('common.to')" :start-placeholder="$t('common.startTime')" :end-placeholder="$t('common.endTime')" style="width: 250px;" />
  10. <!-- 临时注释 -->
  11. <!-- <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="公众号关注状态" class="filter-item" style="width: 150px;" clearable>
  12. <el-option v-for="item in attentionStatusList" :key="item.id" :label="item.name" :value="item.id" />
  13. </el-select> -->
  14. <!-- 临时注释 -->
  15. <el-button class="successBorder" @click="form_search">{{$t('common.query')}}</el-button>
  16. <el-button class="successBorder" @click="handleRefresh">{{$t('common.reset')}}</el-button>
  17. </div>
  18. <div class="operation">
  19. <el-button v-if="isRoleEdit" icon="el-icon-plus" class="success" @click="handleCreate">{{$t('formulationEvaluation.add')}}</el-button>
  20. <el-button v-if="isRoleEdit" icon="el-icon-delete" class="danger" @click="form_delete">{{$t('formulationEvaluation.del')}}</el-button>
  21. </div>
  22. <div class="table">
  23. <el-table
  24. :key="table.tableKey"
  25. v-loading="table.listLoading"
  26. :element-loading-text="$t('common.tableMsg')"
  27. :data="table.list"
  28. border
  29. fit
  30. highlight-current-row
  31. style="width: 100%;"
  32. :row-style="rowStyle"
  33. :cell-style="cellStyle"
  34. class="elTable table-fixed"
  35. @selection-change="handleSelectionChange"
  36. >
  37. <el-table-column type="selection" align="center" width="50" />
  38. <el-table-column :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px">
  39. <template slot-scope="scope">
  40. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  41. </template>
  42. </el-table-column>
  43. <!-- <el-table-column :label="$t('auth.signIn')" min-width="180px" align="center"> -->
  44. <el-table-column :label="$t('role.yhmc')" min-width="180px" align="center">
  45. <template slot-scope="scope">
  46. <span v-if="scope.row.NoEdit">{{ scope.row.username }}</span>
  47. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.username" :placeholder="$t('role.jysysjh')" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" />
  48. </template>
  49. </el-table-column>
  50. <el-table-column :label="$t('role.ygxm')" min-width="130px" align="center">
  51. <template slot-scope="scope">
  52. <span v-if="scope.row.NoEdit">{{ scope.row.empname }}</span>
  53. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.empname" :placeholder="$t('role.zf1')" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" />
  54. </template>
  55. </el-table-column>
  56. <el-table-column :label="$t('role.sjh')" min-width="180px" align="center">
  57. <template slot-scope="scope">
  58. <span v-if="scope.row.NoEdit">{{ scope.row.phone }}</span>
  59. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.phone" :placeholder="$t('role.zf2')" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="11" style="width:95%;padding:10px 0;" />
  60. </template>
  61. </el-table-column>
  62. <el-table-column :label="$t('role.js')" min-width="150px" align="center">
  63. <template slot-scope="scope">
  64. <span v-if="scope.row.NoEdit">{{ scope.row.rolename }}</span>
  65. <el-select v-if="scope.row.Edit" v-model="scope.row.roleid" :placeholder="$t('role.js')" class="filter-item" style="width:90%;padding:10px 0;" filterable @change="changeRolename">
  66. <el-option v-for="item in roleList" :key="item.id" :label="item.rolename" :value="item.id" />
  67. </el-select>
  68. </template>
  69. </el-table-column>
  70. <!-- 临时注释 -->
  71. <!-- <el-table-column label="公众号关注状态" min-width="150px" align="center">
  72. <template slot-scope="scope">
  73. <span v-if="scope.row.NoEdit">{{ scope.row.rolename }}</span>
  74. <el-select v-if="scope.row.Edit" v-model="scope.row.roleid" :placeholder="$t('role.js')"class="filter-item" style="width:90%;padding:10px 0;" filterable @change="changeRolename">
  75. <el-option v-for="item in attentionStatusList" :key="item.id" :label="item.name" :value="item.id" />
  76. </el-select>
  77. </template>
  78. </el-table-column> -->
  79. <!-- 临时注释 -->
  80. <el-table-column
  81. :label="$t('supplier.cjsj')" min-width="110px" align="center">
  82. <template slot-scope="scope">
  83. <span>{{ scope.row.createdtime }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column :label="$t('role.cjr')" min-width="110px" align="center">
  87. <template slot-scope="scope">
  88. <span>{{ scope.row.createmp }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column :label="$t('formulationEvaluation.sfqy')" min-width="110px" align="center">
  92. <template slot-scope="scope">
  93. <el-switch v-model="scope.row.enable" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.$index, scope.row)" />
  94. </template>
  95. </el-table-column>
  96. <el-table-column :label="$t('errorAnalysis.cz')" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  97. <template slot-scope="{row}">
  98. <!-- 新增 -->
  99. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData(row)" />
  100. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  101. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel(row)" />
  102. <!-- 扫码接收消息 -->
  103. <!-- 临时注释 -->
  104. <a v-if="row.isUpdate && isRoleEdit" class="correcting" size="mini" style="width: 80px;" @click="handleScanningCode(row)">{{$t('role.sm')}}</a>
  105. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  106. <!-- 临时注释 -->
  107. <!-- 重置密码 -->
  108. <a v-if="row.isUpdate && isRoleEdit" class="correcting" size="mini" style="width: 80px;" @click="handleResetPassword(row)">{{$t('role.cczmm')}}</a>
  109. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  110. <!-- 编辑 -->
  111. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  112. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  113. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  114. <!-- 编辑保存 -->
  115. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" class="miniSuccess" icon="el-icon-folder-checked" @click="updateData(row)" />
  116. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  117. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. <pagination v-show="table.total>0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  122. </div>
  123. <el-dialog :title="textMap[QRcode.dialogStatus]" :visible.sync="QRcode.dialogFormVisible" :close-on-click-modal="false" width="50%">
  124. <div class="QRcode">
  125. <div class="content">
  126. <div class="title">
  127. <p>{{$t('role.msg1')}}</p>
  128. <p>{{$t('role.msg2')}}</p>
  129. </div>
  130. <div style="font-weight: 600;">{{$t('role.gzwx')}}</div>
  131. <img :src="imgUrl" alt="">
  132. </div>
  133. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom: 40px;">
  134. <el-button class="save" :disabled="isokDisable" @click="QRcode.dialogFormVisible = false;">{{$t('errorAnalysis.confirm')}}</el-button>
  135. </div>
  136. </div>
  137. </el-dialog>
  138. </div>
  139. </template>
  140. <script>
  141. import { GetDataByName, PostDataByName, failproccess, GetDataByNames, ExecDataByConfig, checkButtons } from '@/api/common'
  142. import Cookies from 'js-cookie'
  143. import { parseTime } from '@/utils/index.js'
  144. import { MessageBox } from 'element-ui'
  145. import Pagination from '@/components/Pagination'
  146. export default {
  147. name: 'User',
  148. components: { Pagination },
  149. data() {
  150. return {
  151. isRoleEdit: [],
  152. requestParams: [
  153. { name: 'getRoleAll', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }}
  154. ],
  155. enableList: [{ id: 1,
  156. name:this.$t('supplier.yes')}, { id: 0,
  157. name:this.$t('supplier.no') }], // 是否启用
  158. attentionStatusList: [{ id: 1, name: '已关注公众号' }, { id: 0, name: '未关注公众号' }],
  159. roleList: [], // 角色
  160. table: {
  161. getdataListParm: {
  162. name: 'getuserallL',
  163. page: 1,
  164. offset: 1,
  165. pagecount: parseInt(Cookies.get('pageCount')),
  166. returntype: 'Map',
  167. parammaps: {
  168. pastureid: Cookies.get('pastureid'),
  169. empCode: '',
  170. empname: '',
  171. enable: '',
  172. startTime: '',
  173. stopTime: '',
  174. inputDatetime: ''
  175. }
  176. },
  177. tableKey: 0,
  178. list: [],
  179. total: 0,
  180. listLoading: true,
  181. temp: {}
  182. },
  183. requestParam: {},
  184. isokDisable: false,
  185. selectList: [],
  186. QRcode:{
  187. dialogStatus: '',
  188. dialogFormVisible:false,
  189. },
  190. textMap: {
  191. QRcode:this.$t('message.msg111')
  192. },
  193. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  194. cellStyle: { padding: 0 + 'px' },
  195. imgUrl:''
  196. }
  197. },
  198. created() {
  199. this.getList()
  200. this.getDownList()
  201. this.getButtons()
  202. },
  203. methods: {
  204. getButtons() {
  205. const Edit = 'User'
  206. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  207. this.isRoleEdit = isRoleEdit
  208. },
  209. getDownList() {
  210. GetDataByNames(this.requestParams).then(response => {
  211. this.roleList = response.data.getRoleAll.list
  212. })
  213. },
  214. getList() {
  215. this.table.listLoading = true
  216. GetDataByName(this.table.getdataListParm).then(response => {
  217. console.log('table数据', response.data.list)
  218. if (response.data.list !== null) {
  219. for (let i = 0; i < response.data.list.length; i++) {
  220. this.$set(response.data.list[i], 'Edit', false) // 编辑
  221. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  222. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  223. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  224. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  225. }
  226. this.table.list = response.data.list
  227. this.table.pageNum = response.data.pageNum
  228. this.table.pageSize = response.data.pageSize
  229. } else {
  230. this.table.list = []
  231. }
  232. this.table.total = response.data.total
  233. setTimeout(() => {
  234. this.table.listLoading = false
  235. }, 100)
  236. })
  237. },
  238. handleEnableChange() {
  239. console.log('点击了是否启用')
  240. },
  241. form_search() {
  242. console.log('点击了查询')
  243. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  244. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  245. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  246. } else {
  247. this.table.getdataListParm.parammaps.inputDatetime = ''
  248. this.table.getdataListParm.parammaps.startTime = ''
  249. this.table.getdataListParm.parammaps.stopTime = ''
  250. }
  251. this.table.getdataListParm.offset = 1
  252. this.getList()
  253. },
  254. handleRefresh() {
  255. console.log('点击了重置')
  256. this.table.getdataListParm.parammaps.empCode = ''
  257. this.table.getdataListParm.parammaps.empname = ''
  258. this.table.getdataListParm.parammaps.enable = ''
  259. this.table.getdataListParm.parammaps.startTime = ''
  260. this.table.getdataListParm.parammaps.stopTime = ''
  261. this.table.getdataListParm.parammaps.inputDatetime = ''
  262. this.table.getdataListParm.offset = 1
  263. this.getList()
  264. },
  265. handleCreate() {
  266. // 编辑true/不可编辑false
  267. // 新增操true,编辑false,编辑保存false
  268. for (let i = 0; i < this.table.list.length; i++) {
  269. if (this.table.list[i].Edit === true) {
  270. console.log(123)
  271. this.$message({ type: 'error', message: this.$t('driver.messageNote'), duration: 2000 })
  272. return false
  273. }
  274. }
  275. this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'createdtime': parseTime(new Date(), '{y}-{m}-{d}'), 'createmp': Cookies.get('employename'), 'username': '', 'roleid': '' })
  276. },
  277. changeRolename(item) {
  278. this.table.temp.rolename = this.roleList.find(obj => obj.id === item).rolename
  279. },
  280. createData(row) {
  281. console.log('点击了新增保存', row)
  282. this.table.temp.pastureid = Cookies.get('pastureid')
  283. this.table.temp.empname = row.empname
  284. this.table.temp.username = row.username
  285. this.table.temp.phone = row.phone
  286. this.table.temp.createmp = row.createmp
  287. this.table.temp.enable = row.enable
  288. this.table.temp.roleid = row.roleid
  289. // 检验用户名称/角色是否为空
  290. if (this.table.temp.username == '' && this.table.temp.roleid == '') {
  291. this.$message({ type: 'error', message: '用户名称/角色不能为空', duration: 2000 })
  292. return false
  293. } else if (this.table.temp.username == '') {
  294. this.$message({ type: 'error', message: '用户名称不能为空', duration: 2000 })
  295. return false
  296. } else if (this.table.temp.roleid == '') {
  297. this.$message({ type: 'error', message: '角色不能为空', duration: 2000 })
  298. return false
  299. }
  300. // 检验手机号是否为11位数字
  301. if (this.table.temp.phone !== undefined && this.table.temp.phone !== '') {
  302. const phone = /^\d{11}$/
  303. if (!phone.test(this.table.temp.phone)) {
  304. this.$message({ type: 'error', message: '请输入11位手机号', duration: 2000 })
  305. return false
  306. }
  307. }
  308. this.isokDisable = true
  309. setTimeout(() => {
  310. this.isokDisable = false
  311. }, 1000)
  312. this.requestParam.name = 'createUser'
  313. this.table.temp.isgroups = Cookies.get('ispastureuse')
  314. this.requestParam.parammaps = this.table.temp
  315. PostDataByName(this.requestParam).then(response => {
  316. console.log('新增保存发送参数', this.requestParam)
  317. if (response.msg !== 'fail') {
  318. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  319. this.getList()
  320. } else {
  321. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  322. }
  323. })
  324. },
  325. createCancel(row) {
  326. console.log('点击了新增取消')
  327. for (let i = 0; i < this.table.list.length; i++) {
  328. if (row.myId === this.table.list[i].myId) {
  329. var listIndex = this.table.list.indexOf(this.table.list[i])
  330. }
  331. if (listIndex > -1) {
  332. this.table.list.splice(listIndex, 1)
  333. return
  334. }
  335. }
  336. },
  337. handleUpdate(row) {
  338. for (let i = 0; i < this.table.list.length; i++) {
  339. if (this.table.list[i].Edit == true) {
  340. this.$message({ type: 'error', message: this.$t('driver.messageNote'), duration: 2000 })
  341. return false
  342. }
  343. }
  344. // 编辑true,不可编辑false
  345. row.Edit = true
  346. row.NoEdit = false
  347. // 新增false,编辑false,编辑保存true
  348. row.isCreate = false
  349. row.isUpdate = false
  350. row.isUpdateSave = true
  351. row.roleid = String(row.roleid)
  352. this.table.temp.roleid = row.roleid
  353. this.table.temp.rolename = row.rolename
  354. },
  355. updateData(row) {
  356. console.log('点击了编辑保存', row)
  357. this.table.temp.pastureid = row.pastureid
  358. this.table.temp.empname = row.empname
  359. this.table.temp.username = row.username
  360. this.table.temp.phone = row.phone
  361. this.table.temp.createmp = row.createmp
  362. this.table.temp.enable = row.enable
  363. this.table.temp.roleid = row.roleid
  364. this.table.temp.id = row.id
  365. // 校验用户名称/角色是否为空
  366. if (this.table.temp.username == '' && this.table.temp.roleid == '') {
  367. this.$message({ type: 'error', message: '用户名称/角色不能为空', duration: 2000 })
  368. return false
  369. } else if (this.table.temp.username == '') {
  370. this.$message({ type: 'error', message: '用户名称不能为空', duration: 2000 })
  371. return false
  372. } else if (this.table.temp.roleid == '') {
  373. this.$message({ type: 'error', message: '角色不能为空', duration: 2000 })
  374. return false
  375. }
  376. console.log(this.table.temp.phone)
  377. // 检验手机号是否为11位数字
  378. if (this.table.temp.phone !== undefined && this.table.temp.phone !== '') {
  379. const phone = /^\d{11}$/
  380. if (!phone.test(this.table.temp.phone)) {
  381. this.$message({ type: 'error', message: '请输入11位手机号', duration: 2000 })
  382. return false
  383. }
  384. }
  385. this.isokDisable = true
  386. setTimeout(() => {
  387. this.isokDisable = false
  388. }, 1000)
  389. this.requestParam.name = 'updateUser'
  390. this.requestParam.parammaps = this.table.temp
  391. PostDataByName(this.requestParam).then(response => {
  392. console.log('新增保存发送参数', this.requestParam)
  393. if (response.msg !== 'fail') {
  394. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  395. this.getList()
  396. } else {
  397. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  398. }
  399. })
  400. },
  401. updateCancel(row) {
  402. console.log('点击了编辑取消')
  403. // 编辑false,不可编辑true
  404. row.Edit = false
  405. row.NoEdit = true
  406. // 新增false,编辑true,编辑保存false
  407. row.isCreate = false
  408. row.isUpdate = true
  409. row.isUpdateSave = false
  410. this.getList()
  411. },
  412. handleRowDelete(row) {
  413. console.log('点击了行内删除')
  414. MessageBox.confirm( this.$t('common.delMsg'), {
  415. confirmButtonText: this.$t('common.confirm'), cancelButtonText: this.$t('common.cancel'), type: 'warning'
  416. }).then(() => {
  417. this.selectList = []
  418. this.requestParam.name = 'deleteUser'
  419. this.requestParam.parammaps = {}
  420. this.requestParam.parammaps.pastureid = row.pastureid
  421. this.requestParam.parammaps.id = row.id
  422. PostDataByName(this.requestParam).then(response => {
  423. if (response.msg === 'fail') {
  424. this.$notify({ title: this.$t('common.delfail'), message: response.data, type: 'warning', duration: 2000 })
  425. } else {
  426. this.$notify({ title: this.$t('common.succes'),message: this.$t('common.delSuccess'), type: 'success', duration: 2000 })
  427. this.getList()
  428. }
  429. })
  430. }).catch(() => {
  431. this.$message({ type: 'info', message: this.$t('common.cancelMsg') })
  432. })
  433. },
  434. handleSelectionChange(val) {
  435. console.log('勾选数据', val)
  436. this.selectList = val
  437. },
  438. form_delete() {
  439. console.log('点击了删除')
  440. if (this.selectList.length == 0) {
  441. this.$message({ type: 'error', message: '请选择用户信息', duration: 2000 })
  442. } else {
  443. MessageBox.confirm( this.$t('common.delMsg'), {
  444. confirmButtonText: this.$t('common.confirm'), cancelButtonText: this.$t('common.cancel'), type: 'warning'
  445. }).then(() => {
  446. console.log(this.selectList)
  447. this.requestParam.common = { 'returnmap': '0' }
  448. this.requestParam.data = []
  449. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  450. this.requestParam.data[0].children = []
  451. this.requestParam.data[0].children[0] = { 'name': 'deleteUser', 'type': 'e', 'parammaps': {
  452. id: '@insertSpotList.id',
  453. pastureid: '@insertSpotList.pastureid'
  454. }}
  455. ExecDataByConfig(this.requestParam).then(response => {
  456. console.log('删除保存发送参数', this.requestParam)
  457. if (response.msg === 'fail') {
  458. this.$notify({ title: this.$t('common.delfail'), message: response.data, type: 'warning', duration: 2000 })
  459. } else {
  460. this.$notify({ title: '',message: this.$t('common.delSuccess'), type: 'success', duration: 2000 })
  461. this.getList()
  462. }
  463. })
  464. })
  465. }
  466. },
  467. handleResetPassword(row) {
  468. MessageBox.confirm('是否确认将此用户密码重置为默认密码123456?', {
  469. confirmButtonText: this.$t('common.confirm'),
  470. cancelButtonText: this.$t('common.cancel'),
  471. type: 'warning'
  472. }).then(() => {
  473. this.requestParam.name = 'initPassword'
  474. this.requestParam.parammaps = {}
  475. this.requestParam.parammaps.pastureid = row.pastureid
  476. this.requestParam.parammaps.id = row.id
  477. PostDataByName(this.requestParam).then(() => {
  478. this.getList()
  479. this.resetRequestParam()
  480. this.dialogFormVisible = false
  481. this.$notify({
  482. title: this.$t('common.succes'),
  483. message: '重置密码成功',
  484. type: 'success',
  485. duration: 2000
  486. })
  487. })
  488. })
  489. },
  490. handleScanningCode(row){
  491. this.QRcode.dialogStatus = 'QRcode'
  492. this.QRcode.dialogFormVisible = true
  493. this.imgUrl = 'http://tmrwatch.cn/wx/code?scene_str=tmrwatch.'+ Cookies.get('pastureid')+'.'+ row.username + '.'+row.empname
  494. console.log(this.imgUrl)
  495. }
  496. }
  497. }
  498. </script>
  499. <style lang="scss" scoped>
  500. // .search{margin-top:10px;}
  501. .QRcode{display:flex;justify-content: center; align-items:center;}
  502. .content{
  503. /* margin-top: 100px; */
  504. width: 500px;
  505. }
  506. .content img{
  507. max-width:300px;
  508. }
  509. </style>