index.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <!-- 搜索条件 -->
  5. <el-select v-model="getdataListParm.parammaps.pastureName" placeholder="牧场" class="filter-item" style="width: 110px" @change="changePastureName">
  6. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
  7. </el-select>
  8. <el-input v-model="getdataListParm.parammaps.eqCode" placeholder="设备内部编号" clearable class="filter-item" style="width: 130px" />
  9. <el-input v-model="getdataListParm.parammaps.eqName" placeholder="设备名称" style="width: 130px;" class="filter-item" />
  10. <el-select v-model="getdataListParm.parammaps.deptId" clearable placeholder="部门" class="filter-item" style="width: 100px">
  11. <el-option v-for="item in findAllDepart" :key="item.id" :label="item.name" :value="item.id" />
  12. </el-select>
  13. <el-select v-model="getdataListParm.parammaps.syStatus" clearable placeholder="状态" class="filter-item" style="width:100px;">
  14. <el-option v-for="item in getDictByName" :key="item.id" :label="item.label" :value="item.value" />
  15. </el-select>
  16. <el-date-picker v-model="getdataListParm.parammaps.enabledTime" type="date" placeholder="开启日期" style="width:140px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
  17. <el-date-picker v-model="getdataListParm.parammaps.blockTime" type="date" placeholder="关闭日期" style="width:140px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
  18. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
  19. <div>
  20. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_add">启停</el-button>
  21. </div>
  22. </div>
  23. <el-table
  24. :key="tableKey"
  25. v-loading="listLoading"
  26. element-loading-text="给我一点时间"
  27. :data="list"
  28. border
  29. fit
  30. highlight-current-row
  31. style="width: 100%;"
  32. :row-style="rowStyle"
  33. :cell-style="cellStyle"
  34. class="elTable"
  35. >
  36. <el-table-column label="序号" align="center" type="index" width="50px">
  37. <template slot-scope="scope">
  38. <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="牧场" min-width="90px" align="center">
  42. <template slot-scope="scope">
  43. <span>{{ scope.row.pastureName }}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="设备名称" min-width="100px" align="center">
  47. <template slot-scope="scope">
  48. <span>{{ scope.row.eqName }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="设备内部编号" min-width="110px" align="center">
  52. <template slot-scope="scope">
  53. <span>{{ scope.row.eqCode }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="规格" min-width="90px" align="center">
  57. <template slot-scope="scope">
  58. <span>{{ scope.row.specification }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="品牌" min-width="110px" align="center">
  62. <template slot-scope="scope">
  63. <span>{{ scope.row.brandName }}</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="设备图片" min-width="110px" align="center">
  67. <template slot-scope="scope">
  68. <el-popover placement="right" title="" trigger="hover">
  69. <img v-if="scope.row.picpath !== ''" :src="scope.row.picpath">
  70. <img v-if="scope.row.picpath !== ''" slot="reference" :src="scope.row.picpath" :alt="scope.row.srcpath" style="height: 100px;width:100px;">
  71. </el-popover>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="启停状态" min-width="70px" align="center">
  75. <template slot-scope="scope">
  76. <span>{{ scope.row.changeStatue }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="部门" min-width="80px" align="center">
  80. <template slot-scope="scope">
  81. <span>{{ scope.row.deptName }}</span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="最近开启时间" sortable prop="enabledTime" min-width="120px" align="center" />
  85. <el-table-column label="最近关闭时间" sortable prop="blockTime" min-width="120px" align="center" />
  86. <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width" fixed="right">
  87. <template slot-scope="{row}">
  88. <el-button type="success" size="mini" :disabled="row.changeStatue=='启用'? true : false" @click="handleSST(row)">开启</el-button>
  89. <el-button type="danger" size="mini" :disabled="row.changeStatue=='停用'? true : false" @click="handleSST(row)">关闭</el-button>
  90. <el-button type="primary" size="mini" @click="form_see(row)">启停记录</el-button>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="getList" />
  95. <!-- 弹出层新增or修改 -->
  96. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
  97. <el-form ref="temp" :rules="rules" :model="temp" label-position="right" label-width="140px">
  98. <el-row>
  99. <el-col :span="8">
  100. <el-form-item label="设备名称:" prop="assetName">
  101. <el-autocomplete
  102. ref="assetName"
  103. v-model="temp.assetName"
  104. value-key="assetName"
  105. class="inline-input"
  106. :fetch-suggestions="formNameSearch"
  107. placeholder="请输入内容"
  108. :disabled="dialogStatus==='update'"
  109. style="width:100%;"
  110. @select="handleformNameSelect"
  111. >
  112. <template slot-scope="{ item }">
  113. <div class="name" style="display: inline;">{{ item.eqName }}</div>
  114. <span class="addr">{{ item.eqCode }}</span>
  115. </template>
  116. </el-autocomplete>
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="8">
  120. <el-form-item label="设备内部编号:" prop="eqCode">
  121. <el-autocomplete
  122. ref="eqCode"
  123. v-model="temp.eqCode"
  124. value-key="eqCode"
  125. class="inline-input"
  126. :fetch-suggestions="formNumberSearch"
  127. placeholder="请输入内容"
  128. :disabled="dialogStatus==='update'"
  129. style="width:100%;"
  130. @select="handleformNumberSelect"
  131. >
  132. <template slot-scope="{ item }">
  133. <div class="name" style="display: inline;">{{ item.eqName }}</div>
  134. <span class="addr">{{ item.eqCode }}</span>
  135. </template>
  136. </el-autocomplete>
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="8">
  140. <el-form-item label="启停状态:">
  141. <el-input v-model="temp.changeStatue" disabled style="width:100%;" />
  142. </el-form-item>
  143. </el-col>
  144. </el-row>
  145. <el-row>
  146. <el-col :span="8">
  147. <el-form-item label="牧场:">
  148. <!-- <span>{{ temp.pastureName }}</span> -->
  149. <el-input v-model="temp.pastureName" disabled style="width:100%;" />
  150. </el-form-item>
  151. </el-col>
  152. <el-col :span="8">
  153. <el-form-item label="部门:">
  154. <el-input v-model="temp.deptName" disabled style="width:100%;" />
  155. </el-form-item>
  156. </el-col>
  157. <el-col :span="8">
  158. <el-form-item label="操作人:" prop="employeId">
  159. <el-select v-model="temp.employeId" placeholder="操作人" class="filter-item" style="width:100%;">
  160. <el-option
  161. v-for="item in findAllEmploye"
  162. :key="item.id"
  163. :label="item.name"
  164. :value="item.id"
  165. />
  166. </el-select>
  167. </el-form-item>
  168. </el-col>
  169. </el-row>
  170. <el-row v-if="false">
  171. <el-col :span="8">
  172. <el-form-item label="操作时间:" prop="inputDatetime">
  173. <el-date-picker
  174. v-model="temp.inputDatetime"
  175. type="datetime"
  176. placeholder="操作时间"
  177. style="width:100%;"
  178. :picker-options="pickerOptions0"
  179. />
  180. </el-form-item>
  181. </el-col>
  182. </el-row>
  183. </el-form>
  184. <div slot="footer" class="dialog-footer">
  185. <el-button v-if="temp.changeStatue =='停用'" type="primary" @click="createStartData()">开启</el-button>
  186. <el-button v-if="temp.changeStatue =='启用'" type="primary" @click="createStopData()">停用</el-button>
  187. <el-button @click="dialogFormVisible = false;getList()">关闭</el-button>
  188. </div>
  189. </el-dialog>
  190. <el-dialog :title="textMap[dialogStatusSST]" :visible.sync="dialogFormVisibleSST" :close-on-click-modal="false" style="width:500px;margin:0 auto;margin-bottom:50px">
  191. <div class="app-SST">
  192. <el-form ref="tempSST" :rules="rules" :model="tempSST" label-position="right" label-width="100px">
  193. <h3 style="margin-bottom:50px;">是否{{ tempSST.changeStatue =="停用"?"开启":"关闭" }}?</h3>
  194. </el-form>
  195. <div slot="footer" class="dialog-footer">
  196. <el-button type="primary" @click="tempSST.changeStatue =='停用'?add_dialog_saveSST1():add_dialog_saveSST2()">确认</el-button>
  197. <el-button @click="dialogFormVisibleSST = false">关闭</el-button>
  198. </div>
  199. </div>
  200. </el-dialog>
  201. <!-- 启停记录 -->
  202. <el-dialog :title="cardTitle" :visible.sync="dialogFormVisibleCard" :close-on-click-modal="false" width="90%">
  203. <div class="app-contentcard">
  204. <el-form ref="rowSeeData" :rules="rules" :model="rowSeeData" label-position="right" label-width="120px" style="width: 100%;margin:0 auto;">
  205. <div class="filter-container">
  206. <el-date-picker v-model="getdataListParmSee.parammaps.startTime" type="date" placeholder="开启日期" style="width:140px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
  207. <el-date-picker v-model="getdataListParmSee.parammaps.stopTime" type="date" placeholder="关闭日期" style="width:140px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
  208. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_searchDelivery">搜索</el-button>
  209. </div>
  210. </el-form>
  211. <el-table
  212. :key="tableKey"
  213. v-loading="listLoadingSee"
  214. element-loading-text="给我一点时间"
  215. :data="listSee"
  216. border
  217. fit
  218. highlight-current-row
  219. style="width: 100%;"
  220. :row-style="rowStyle"
  221. :cell-style="cellStyle"
  222. class="elTable"
  223. @sort-change="tableSort"
  224. >
  225. <el-table-column label="序号" align="center" type="index" width="50px">
  226. <template slot-scope="scope">
  227. <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
  228. </template>
  229. </el-table-column>
  230. <el-table-column label="开启时间" sortable prop="enabledTime" min-width="110px" align="center">
  231. <template slot-scope="scope">
  232. <span>{{ scope.row.enabledTime }}</span>
  233. </template>
  234. </el-table-column>
  235. <el-table-column label="关闭时间" sortable prop="blockTime" min-width="110px" align="center">
  236. <template slot-scope="scope">
  237. <span>{{ scope.row.blockTime }}</span>
  238. </template>
  239. </el-table-column>
  240. <el-table-column label="运行时间(分钟)" sortable prop="runTime" min-width="110px" align="center">
  241. <template slot-scope="scope">
  242. <span>{{ scope.row.runTime }}</span>
  243. </template>
  244. </el-table-column>
  245. <el-table-column label="开启人" min-width="110px" align="center">
  246. <template slot-scope="scope">
  247. <span>{{ scope.row.enabledName }}</span>
  248. </template>
  249. </el-table-column>
  250. <el-table-column label="关闭人" min-width="110px" align="center">
  251. <template slot-scope="scope">
  252. <span>{{ scope.row.blockName }}</span>
  253. </template>
  254. </el-table-column>
  255. </el-table>
  256. <pagination v-show="totalSee>0" :total="totalSee" :page.sync="getdataListParmSee.offset" :limit.sync="getdataListParmSee.pagecount" @pagination="getListSee" />
  257. </div>
  258. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:10px">
  259. <el-button @click="dialogFormVisibleCard = false">关闭</el-button>
  260. </div>
  261. </el-dialog>
  262. </div>
  263. </template>
  264. <script>
  265. // 引入
  266. // eslint-disable-next-line no-unused-vars
  267. import { GetDataByName, GetDataByNames, ExecDataByConfig, PostDataByName } from '@/api/common'
  268. import waves from '@/directive/waves' // waves directive
  269. import { parseTime, sortChange } from '@/utils/index.js'
  270. // eslint-disable-next-line no-unused-vars
  271. import { validateEMail } from '@/utils/validate.js'
  272. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  273. // eslint-disable-next-line no-unused-vars
  274. import { parse } from 'querystring'
  275. import Cookies from 'js-cookie'
  276. export default {
  277. name: 'SST',
  278. components: { Pagination },
  279. directives: { waves },
  280. data() {
  281. return {
  282. tableKey: 0,
  283. list: null,
  284. total: 0,
  285. listLoading: true,
  286. requestParam: {
  287. name: 'insertAsset',
  288. offset: 0,
  289. pagecount: 0,
  290. parammaps: {}
  291. },
  292. // 1-2:table&搜索传参
  293. getdataListParm: {
  294. // name: 'getAssetSTTList',
  295. name: 'geteqSTTList',
  296. page: 1,
  297. offset: 1,
  298. pagecount: 10,
  299. returntype: 'Map',
  300. parammaps: {
  301. eqCode: '',
  302. eqName: '',
  303. pastureName: Cookies.get('pasturename'),
  304. deptName: '',
  305. syStatus: '',
  306. deptId: this.$route.query.deptId,
  307. blockTime: '',
  308. enabledTime: ''
  309. }
  310. },
  311. requestParamSST: {
  312. name: 'updateEQStartStop',
  313. parammaps: {
  314. inputDatetime: new Date(),
  315. employeId: Cookies.get('employeid'),
  316. pastureId: Cookies.get('pastureid'),
  317. sttId: ''
  318. }
  319. },
  320. temp: {
  321. pastureName: '',
  322. deptName: '',
  323. deptId: '',
  324. employeName: '',
  325. eqName: '',
  326. assetId: '',
  327. eqCode: '',
  328. inputDatetime: new Date(),
  329. typeName: '',
  330. assTypeId: '',
  331. syStatus: '',
  332. employeId: this.$store.state.user.employeid,
  333. departmentId: this.$store.state.user.departmentid,
  334. pastureId: this.$store.state.user.pastureid
  335. },
  336. tempSST: {
  337. },
  338. // 2-3:下拉框请求后数据加入[]
  339. findAllProvider: [],
  340. findAllAssetType: [],
  341. findAllPasture: [],
  342. findAllDepart: [],
  343. findAllEmploye: [],
  344. getDictByName: [], createDepartList: [], edit: 0,
  345. // 2-1.请求下拉框接口
  346. requestParams: [
  347. { name: 'findAllProvider', offset: 0, pagecount: 0, params: [] },
  348. { name: 'findAllAssetType', offset: 0, pagecount: 0, params: [] },
  349. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
  350. { name: 'findAllDepart', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
  351. { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
  352. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['设备使用记录'] }
  353. ],
  354. getDepartParam: {
  355. name: 'findAllDepart', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }
  356. },
  357. postDataPramas: {},
  358. assetA: { eqName: '', eqCode: '' },
  359. requestFilterParams: {
  360. name: 'findAssetMain',
  361. page: 1,
  362. offset: 1,
  363. pagecount: 20,
  364. returntype: 'Map',
  365. parammaps: {}
  366. },
  367. dialogFormVisible: false,
  368. dialogFormVisibleCheck: false,
  369. dialogStatus: '',
  370. dialogFormVisibleSST: false,
  371. dialogStatusSST: '',
  372. dialogStatusCheck: '',
  373. textMap: {
  374. create: '新增',
  375. sst: '设备启停'
  376. },
  377. dialogPvVisible: false,
  378. // 新加的列表用的==========================================
  379. cardTitle: '启停记录',
  380. dialogFormVisibleCard: false,
  381. dialogStatusCard: '',
  382. listLoadingSee: true,
  383. rowSeeData: {},
  384. listSee: [],
  385. totalSee: 0,
  386. getdataListParmSee: {
  387. name: 'getAssetSTT1',
  388. page: 1,
  389. offset: 1,
  390. pagecount: 10,
  391. returntype: 'Map',
  392. parammaps: {
  393. assetId: '',
  394. startTime: '',
  395. stopTime: '',
  396. pastureId: Cookies.get('pastureid')
  397. }
  398. },
  399. // 新加的列表用的==========================================
  400. // 时间设置
  401. pickerOptions0: {
  402. disabledDate(time) {
  403. return time.getTime() > Date.now() - 8.64e6
  404. }
  405. },
  406. // 校验规则
  407. rules: {
  408. assetName: [{ required: true, message: '必填', trigger: 'remove-tag' }],
  409. eqCode: [{ required: true, message: '必填', trigger: 'expand-change' }]
  410. },
  411. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  412. cellStyle: { padding: 0 + 'px' }
  413. }
  414. },
  415. created() {
  416. this.$store.dispatch('user/getInfo')
  417. this.getDownList()
  418. this.getList()
  419. },
  420. methods: {
  421. tableSort(column) {
  422. sortChange(column, this.listSee)
  423. },
  424. // 模糊查询-名称
  425. formNumberSearch(queryString, cb) {
  426. this.requestFilterParams.parammaps['eqCode'] = queryString
  427. this.requestFilterParams.parammaps['assetName'] = ''
  428. this.requestFilterParams.parammaps['pastureId'] = this.$store.state.user.pastureid
  429. GetDataByName(this.requestFilterParams).then(response => {
  430. cb(response.data.list)
  431. })
  432. },
  433. formNameSearch(queryString, cb) {
  434. this.requestFilterParams.parammaps['eqCode'] = ''
  435. this.requestFilterParams.parammaps['assetName'] = queryString
  436. this.requestFilterParams.parammaps['pastureId'] = this.$store.state.user.pastureid
  437. GetDataByName(this.requestFilterParams).then(response => {
  438. cb(response.data.list)
  439. })
  440. },
  441. handleformNumberSelect(item) {
  442. this.temp.assetNumber = item.assetNumber
  443. this.temp.assetName = item.assetName
  444. this.temp.eqCode = item.eqCode
  445. this.temp.eqName = item.eqName
  446. this.temp.eqCode = item.eqCode
  447. this.temp.eqName = item.eqName
  448. this.temp.eqId = item.eqId
  449. this.temp.id = item.assetId
  450. this.temp.pastureId = item.pastureId
  451. this.temp.pastureName = item.pastureName
  452. this.temp.deptName = item.deptName
  453. this.temp.deptId = item.deptName
  454. this.temp.changeStatue = item.changeStatue
  455. // this.temp.inputDatetime = parseTime(new Date(), '{y}-{m}-{d}')
  456. // this.temp.inputDatetime = this.temp.inputDatetime
  457. if (item.sttId === undefined || item.sttId === null) {
  458. this.temp.sttId = 0
  459. } else {
  460. this.temp.sttId = item.sttId
  461. }
  462. },
  463. handleformNameSelect(item) {
  464. console.log(item)
  465. this.temp.assetNumber = item.assetNumber
  466. this.temp.assetName = item.assetName
  467. this.temp.eqCode = item.eqCode
  468. this.temp.eqName = item.eqName
  469. this.temp.id = item.assetId
  470. this.temp.eqId = item.eqId
  471. this.temp.pastureId = item.pastureId
  472. this.temp.pastureName = item.pastureName
  473. this.temp.deptName = item.deptName
  474. this.temp.deptId = item.deptName
  475. this.temp.changeStatue = item.changeStatue
  476. // this.temp.inputDatetime = parse(new Date(), '{y}-{m}-{d} {h}:{i}')
  477. // this.temp.inputDatetime = this.temp.inputDatetime
  478. console.log(item.inputDatetime)
  479. if (item.sttId === undefined || item.sttId === null) {
  480. this.temp.sttId = 0
  481. } else {
  482. this.temp.sttId = item.sttId
  483. }
  484. },
  485. // 1-1: table&搜索
  486. getList() {
  487. this.listLoading = true
  488. if (this.getdataListParm.parammaps.enabledTime === null) {
  489. this.getdataListParm.parammaps.enabledTime = ''
  490. }
  491. if (this.getdataListParm.parammaps.blockTime === null) {
  492. this.getdataListParm.parammaps.blockTime = ''
  493. }
  494. GetDataByName(this.getdataListParm).then(response => {
  495. console.log('表格', response.data.list)
  496. this.list = response.data.list
  497. if (response.data.list !== null) {
  498. for (let i = 0; i < response.data.list.length; i++) {
  499. if (response.data.list[i].srcpath !== null && response.data.list[i].picpath !== null && response.data.list[i].srcpath !== undefined && response.data.list[i].picpath !== undefined) {
  500. this.list[i].srcpath = process.env.VUE_APP_BASE_API + response.data.list[i].srcpath
  501. this.list[i].picpath = process.env.VUE_APP_BASE_API + response.data.list[i].picpath
  502. } else {
  503. this.list[i].srcpath = ''
  504. this.list[i].picpath = ''
  505. }
  506. console.log(this.list[i].srcpath)
  507. }
  508. }
  509. this.pageNum = response.data.pageNum
  510. this.pageSize = response.data.pageSize
  511. if (response.data.total) {
  512. this.total = response.data.total
  513. }
  514. // Just to simulate the time of the request
  515. setTimeout(() => {
  516. this.listLoading = false
  517. }, 100)
  518. })
  519. this.temp = {
  520. pastureName: '',
  521. deptName: '',
  522. deptId: '',
  523. employeName: '',
  524. eqName: '',
  525. assetId: '',
  526. eqCode: '',
  527. inputDatetime: new Date(),
  528. typeName: '',
  529. assTypeId: '',
  530. syStatus: '',
  531. employeId: this.$store.state.user.employeid,
  532. departmentId: this.$store.state.user.departmentid,
  533. pastureId: this.$store.state.user.pastureid
  534. }
  535. },
  536. // 2-2:下拉框
  537. getDownList() {
  538. GetDataByNames(this.requestParams).then(response => {
  539. this.findAllProvider = response.data.findAllProvider.list
  540. this.findAllAssetType = response.data.findAllAssetType.list
  541. this.findAllPasture = response.data.findAllPasture.list
  542. this.findAllEmploye = response.data.findAllEmploye.list
  543. this.getDictByName = response.data.getDictByName.list
  544. this.getDepartDownList()
  545. })
  546. },
  547. getDepartDownList() {
  548. GetDataByName(this.getDepartParam).then(response => {
  549. this.findAllDepart = response.data.list
  550. })
  551. },
  552. changePastureName(item) {
  553. this.getDepartParam.parammaps.pastureId = this.findAllPasture.find(obj => obj.name == item).id
  554. this.getdataListParm.parammaps.deptId = ''
  555. this.getDepartDownList()
  556. },
  557. getCreateDepartDownList() {
  558. GetDataByName(this.getDepartParam).then(response => {
  559. this.createDepartList = response.data.list
  560. if (this.edit == 1) {
  561. if (this.createDepartList.find(obj => obj.id == Cookies.get('departmentid'))) {
  562. this.createTemp.departmentId = parseInt(Cookies.get('departmentid'))
  563. this.createTemp.departmentName = this.createDepartList.find(obj => obj.id == Cookies.get('departmentid')).name
  564. } else {
  565. this.createTemp.departmentId = response.data.list[0].id
  566. this.createTemp.departmentName = response.data.list[0].name
  567. }
  568. console.log(this.createTemp.departmentName, 'this.createTemp.departmentName')
  569. }
  570. })
  571. },
  572. changePasture(item) {
  573. this.getDepartParam.parammaps.pastureId = item
  574. this.edit = 1
  575. this.getCreateDepartDownList()
  576. },
  577. changeDepart(item) {
  578. this.createTemp.departmentName = this.createDepartList.find(obj => obj.id == item).name
  579. },
  580. form_search() {
  581. this.listLoading = true
  582. this.getdataListParm.offset = 1
  583. this.getList()
  584. },
  585. handleModifyStatus(row, status) {
  586. this.$message({
  587. message: '操作成功',
  588. type: 'success'
  589. })
  590. row.status = status
  591. },
  592. form_reset() {
  593. this.temp = {
  594. pastureName: '',
  595. deptName: '',
  596. deptId: '',
  597. employeName: '',
  598. eqName: '',
  599. assetId: '',
  600. eqCode: '',
  601. inputDatetime: new Date(),
  602. typeName: '',
  603. assTypeId: '',
  604. syStatus: '',
  605. employeId: parseInt(Cookies.get('employeid')),
  606. departmentId: parseInt(Cookies.get('departmentid')),
  607. pastureId: parseInt(Cookies.get('pastureid'))
  608. }
  609. },
  610. form_edit(row) {
  611. this.temp = Object.assign({}, row) // copy obj
  612. this.dialogStatus = 'update'
  613. this.dialogFormVisible = true
  614. this.$nextTick(() => {
  615. this.$refs['temp'].clearValidate()
  616. })
  617. },
  618. form_add() {
  619. this.form_reset()
  620. this.edit = 1
  621. this.getDepartParam.parammaps.pastureId = this.temp.pastureId
  622. this.getCreateDepartDownList()
  623. this.dialogStatus = 'create'
  624. this.dialogFormVisible = true
  625. this.$nextTick(() => {
  626. this.$refs['temp'].clearValidate()
  627. })
  628. },
  629. // 设备启停按钮
  630. handleSST(row) {
  631. // console.log(1)
  632. this.dialogStatusSST = 'sst'
  633. this.dialogFormVisibleSST = true
  634. this.tempSST = Object.assign({}, row)
  635. console.log(this.tempSST)
  636. },
  637. // 启用
  638. add_dialog_saveSST1() {
  639. console.log(this.tempSST)
  640. var sendData = {
  641. name: 'updateEQStartStop',
  642. parammaps: {
  643. SSPstatue: '启用',
  644. id: this.tempSST.id,
  645. sttId: this.tempSST.sttId1,
  646. employeId: Cookies.get('employeid'),
  647. pastureId: this.tempSST.pastureId
  648. }
  649. }
  650. PostDataByName(sendData).then(response => {
  651. console.log(response)
  652. if (response.msg === 'fail') {
  653. this.$notify({
  654. title: '失败',
  655. message: '保存失败-' + response.data,
  656. type: 'warning',
  657. duration: 2000
  658. })
  659. } else {
  660. this.getList()
  661. this.dialogFormVisibleSST = false
  662. this.$notify({
  663. title: '成功',
  664. message: '修改成功',
  665. type: 'success',
  666. duration: 2000
  667. })
  668. }
  669. })
  670. },
  671. add_dialog_saveSST2() {
  672. console.log(this.tempSST)
  673. var sendData = {
  674. name: 'updateEQStartStop',
  675. parammaps: {
  676. SSPstatue: '停用',
  677. id: this.tempSST.id,
  678. sttId: this.tempSST.sttId1,
  679. employeId: Cookies.get('employeid'),
  680. pastureId: this.tempSST.pastureId
  681. }
  682. }
  683. PostDataByName(sendData).then(response => {
  684. console.log(response)
  685. if (response.msg === 'fail') {
  686. this.$notify({
  687. title: '失败',
  688. message: '保存失败-' + response.data,
  689. type: 'warning',
  690. duration: 2000
  691. })
  692. } else {
  693. this.getList()
  694. this.dialogFormVisibleSST = false
  695. this.$notify({
  696. title: '成功',
  697. message: '修改成功',
  698. type: 'success',
  699. duration: 2000
  700. })
  701. }
  702. })
  703. },
  704. add_dialog_saveSST() {
  705. this.requestParamSST.parammaps.id = this.tempSST.id
  706. this.requestParamSST.parammaps.pastureId = this.tempSST.pastureId
  707. this.requestParamSST.parammaps.sttId = this.tempSST.sttId
  708. this.requestParamSST.parammaps.changeStatue = this.tempSST.changeStatue
  709. PostDataByName(this.requestParamSST).then(response => {
  710. console.log(response)
  711. if (response.msg === 'fail') {
  712. this.$notify({
  713. title: '失败',
  714. message: '保存失败-' + response.data,
  715. type: 'warning',
  716. duration: 2000
  717. })
  718. } else {
  719. this.getList()
  720. this.dialogFormVisibleSST = false
  721. this.$notify({
  722. title: '成功',
  723. message: '修改成功',
  724. type: 'success',
  725. duration: 2000
  726. })
  727. }
  728. })
  729. },
  730. // 启用
  731. // createStartData() {
  732. // this.$refs['temp'].validate(valid => {
  733. // if (valid) {
  734. // if (this.temp.changeStatue === '停用') {
  735. // this.postDataPramas.common = { 'returnmap': '0' }
  736. // this.postDataPramas.data = []
  737. // this.postDataPramas.data[0] = { 'name': 'updateByIdEnabled', 'type': 'e', 'parammaps': { }}
  738. // this.postDataPramas.data[0].parammaps = this.temp
  739. // this.postDataPramas.data[1] = { 'name': 'insertSTT', 'type': 'e', 'parammaps': { }}
  740. // this.postDataPramas.data[1].parammaps.inputDatetime = this.temp.inputDatetime
  741. // this.postDataPramas.data[1].parammaps.employeId = this.temp.employeId
  742. // this.postDataPramas.data[1].parammaps.id = this.temp.id
  743. // this.postDataPramas.data[1].parammaps.pastureId = this.temp.pastureId
  744. // this.postDataPramas.data[2] = { 'name': 'updateByIdAsset', 'type': 'e', 'parammaps': { }}
  745. // this.postDataPramas.data[2].parammaps.sttId = '@insertSTT.LastInsertId'
  746. // this.postDataPramas.data[2].parammaps.id = this.temp.id
  747. // this.postDataPramas.data[2].parammaps.pastureId = this.temp.pastureId
  748. // ExecDataByConfig(this.postDataPramas).then(response => {
  749. // if (response.msg === 'fail') {
  750. // this.$notify({
  751. // title: '变更失败',
  752. // message: response.data,
  753. // type: 'warning',
  754. // duration: 2000
  755. // })
  756. // } else {
  757. // this.getList()
  758. // this.dialogFormVisible = false
  759. // this.$notify({
  760. // title: '',
  761. // message: '变更成功',
  762. // type: 'success',
  763. // duration: 2000
  764. // })
  765. // }
  766. // })
  767. // } else {
  768. // this.$notify({
  769. // title: '',
  770. // message: '设备启用中,必须先停止才能再次启用',
  771. // type: 'warning',
  772. // duration: 2000
  773. // })
  774. // }
  775. // }
  776. // })
  777. // },
  778. createStartData() {
  779. this.$refs['temp'].validate(valid => {
  780. if (valid) {
  781. console.log(this.temp)
  782. var sendData = {
  783. name: 'updateEQStartStop',
  784. parammaps: {
  785. SSPstatue: '启用',
  786. sttId: this.temp.sttId,
  787. id: this.temp.eqId,
  788. employeId: Cookies.get('employeid'),
  789. pastureId: this.temp.pastureId
  790. }
  791. }
  792. PostDataByName(sendData).then(response => {
  793. console.log(response)
  794. if (response.msg === 'fail') {
  795. this.$notify({
  796. title: '失败',
  797. message: '保存失败-' + response.data,
  798. type: 'warning',
  799. duration: 2000
  800. })
  801. } else {
  802. this.getList()
  803. this.dialogFormVisible = false
  804. this.$notify({
  805. title: '成功',
  806. message: '修改成功',
  807. type: 'success',
  808. duration: 2000
  809. })
  810. }
  811. })
  812. }
  813. })
  814. },
  815. // 停用
  816. // createStopData() {
  817. // this.$refs['temp'].validate(valid => {
  818. // if (valid) {
  819. // if (this.temp.changeStatue === '启用') {
  820. // this.postDataPramas.common = { 'returnmap': '0' }
  821. // this.postDataPramas.data = []
  822. // this.postDataPramas.data[0] = { 'name': 'updateByIdBlock', 'type': 'e', 'parammaps': { }}
  823. // this.postDataPramas.data[0].parammaps = this.temp
  824. // this.postDataPramas.data[1] = { 'name': 'updateSTT', 'type': 'e', 'parammaps': { }}
  825. // this.postDataPramas.data[1].parammaps.inputDatetime = this.temp.inputDatetime
  826. // this.postDataPramas.data[1].parammaps.employeId = this.temp.employeId
  827. // this.postDataPramas.data[1].parammaps.id = this.temp.sttId
  828. // this.postDataPramas.data[1].parammaps.pastureId = this.temp.pastureId
  829. // ExecDataByConfig(this.postDataPramas).then(response => {
  830. // if (response.msg === 'fail') {
  831. // this.$notify({
  832. // title: '变更失败',
  833. // message: response.data,
  834. // type: 'warning',
  835. // duration: 2000
  836. // })
  837. // } else {
  838. // this.getList()
  839. // this.dialogFormVisible = false
  840. // this.$notify({
  841. // title: '',
  842. // message: '变更成功',
  843. // type: 'success',
  844. // duration: 2000
  845. // })
  846. // }
  847. // })
  848. // } else {
  849. // this.$notify({
  850. // title: '',
  851. // message: '设备停止中,必须先启用才能停止使用',
  852. // type: 'warning',
  853. // duration: 2000
  854. // })
  855. // }
  856. // }
  857. // })
  858. // },
  859. createStopData() {
  860. this.$refs['temp'].validate(valid => {
  861. if (valid) {
  862. console.log(this.temp)
  863. var sendData = {
  864. name: 'updateEQStartStop',
  865. parammaps: {
  866. SSPstatue: '停用',
  867. sttId: this.temp.sttId,
  868. id: this.temp.eqId,
  869. employeId: Cookies.get('employeid'),
  870. pastureId: this.temp.pastureId
  871. }
  872. }
  873. PostDataByName(sendData).then(response => {
  874. console.log(response)
  875. if (response.msg === 'fail') {
  876. this.$notify({
  877. title: '失败',
  878. message: '保存失败-' + response.data,
  879. type: 'warning',
  880. duration: 2000
  881. })
  882. } else {
  883. this.getList()
  884. this.dialogFormVisible = false
  885. this.$notify({
  886. title: '成功',
  887. message: '修改成功',
  888. type: 'success',
  889. duration: 2000
  890. })
  891. }
  892. })
  893. }
  894. })
  895. },
  896. form_see(row) {
  897. this.rowSeeData = Object.assign({}, row)
  898. this.cardTitle = '启停记录 设备名称:' + row.eqName + '设备编号:' + row.eqCode
  899. this.dialogFormVisibleCard = true
  900. this.getdataListParmSee.parammaps.assetId = row.id
  901. this.getListSee()
  902. },
  903. form_searchDelivery() {
  904. if (this.getdataListParmSee.parammaps.inputDatetime === null) {
  905. this.getdataListParmSee.parammaps.inputDatetime = ''
  906. }
  907. this.getdataListParmSee.offset = 1
  908. this.getListSee()
  909. },
  910. getListSee() {
  911. if (this.getdataListParmSee.parammaps.startTime !== undefined && this.getdataListParmSee.parammaps.startTime !== null) {
  912. } else {
  913. this.getdataListParmSee.parammaps.startTime = ''
  914. }
  915. if (this.getdataListParmSee.parammaps.stopTime !== undefined && this.getdataListParmSee.parammaps.stopTime !== null) {
  916. } else {
  917. this.getdataListParmSee.parammaps.stopTime = ''
  918. }
  919. GetDataByName(this.getdataListParmSee).then(response => {
  920. this.listSee = response.data.list
  921. console.log('记录列表数据', response.data.list)
  922. this.pageNum = response.data.pageNum
  923. this.pageSize = response.data.pageSize
  924. if (response.data.total) {
  925. this.totalSee = response.data.total
  926. }
  927. // Just to simulate the time of the request
  928. setTimeout(() => {
  929. this.listLoadingSee = false
  930. }, 300)
  931. })
  932. }
  933. }
  934. }
  935. </script>