index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <div class="app-container">
  3. <!-- 添加或修改预约开票申请对话框 -->
  4. <el-dialog :title="$t('提交申请')" :visible.sync="visible" width="1200px" append-to-body>
  5. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  6. <el-form-item :label="$t('申请开票')">
  7. <el-table :data="devList" border style="width: 100%;">
  8. <el-table-column label="作业单位" align="center" prop="workUnit" :formatter="workUnitFormat"/>
  9. <el-table-column label="作业区域" align="center" prop="workArea" :formatter="workAreaFormat"/>
  10. <el-table-column label="单元号" align="center" prop="unitNumber" :formatter="unitNumberFormat"/>
  11. <el-table-column label="楼层位置" align="center" prop="floorLocation" :formatter="floorLocationFormat"/>
  12. <el-table-column label=" 作业开始时间" align="center" prop="workStartTime" width="100">
  13. <template slot-scope="scope">
  14. <span>{{ parseTime(scope.row.workStartTime, '{y}-{m}-{d}') }}</span>
  15. </template>
  16. </el-table-column>
  17. <el-table-column label="作业结束时间" align="center" prop="workEndTime" width="100">
  18. <template slot-scope="scope">
  19. <span>{{ parseTime(scope.row.workEndTime, '{y}-{m}-{d}') }}</span>
  20. </template>
  21. </el-table-column>
  22. <el-table-column label="联系人" align="center" prop="contact" :show-overflow-tooltip="true"/>
  23. <el-table-column label="联系方式" align="center" prop="phonenumber" :show-overflow-tooltip="true"/>
  24. <el-table-column label="状态" align="center" prop="status" width="100" :formatter="statusFormat"/>
  25. </el-table>
  26. </el-form-item>
  27. <el-form-item label="内容">
  28. <el-input type="textarea" :placeholder="$t('原因')+$t('空格')+$t('描述')"
  29. v-model="form.content"
  30. maxlength="200" show-word-limit
  31. :autosize="{ minRows: 2, maxRows: 10}"></el-input>
  32. </el-form-item>
  33. <el-form-item :label="$t('附件')" prop="fileUrl">
  34. <el-upload
  35. ref="doc"
  36. :limit="5"
  37. :headers="doc.headers"
  38. :action="doc.url"
  39. :disabled="doc.isUploading"
  40. :on-progress="handleFileDocProgress"
  41. :on-success="handleFileDocSuccess"
  42. :on-remove="handleRemove"
  43. :auto-upload="true"
  44. :file-list="fileList"
  45. drag
  46. >
  47. <i class="el-icon-upload"></i>
  48. <div class="el-upload__text">
  49. {{ $t('将文件拖到此处,或') }}
  50. <em>{{ $t('点击上传') }}</em>
  51. </div>
  52. <div v-if="showDelay" class="el-upload__tip" slot="tip">{{ this.fileTips }}</div>
  53. </el-upload>
  54. </el-form-item>
  55. <el-row>
  56. <el-col :span="12">
  57. <el-form-item :label="$t('用户主管')" prop="userSupId">
  58. <el-select v-model="form.userSupId" filterable :placeholder="$t('请选择') + $t('用户主管')" disabled>
  59. <el-option
  60. v-for="dict in managerOptions"
  61. :key="dict.userId"
  62. :label="dict.nickName"
  63. :value="dict.userId">
  64. </el-option>
  65. </el-select>
  66. </el-form-item>
  67. </el-col>
  68. </el-row>
  69. <!-- <el-row>-->
  70. <!-- <el-col :span="12">-->
  71. <!-- <el-form-item label="装置主管" prop="devSupId">-->
  72. <!-- <el-select v-model="form.devSupId" filterable :placeholder="$t('请选择') + $t('装置主管')">-->
  73. <!-- <el-option-->
  74. <!-- v-for="dict in managerOptions"-->
  75. <!-- :key="dict.userId"-->
  76. <!-- :label="dict.nickName"-->
  77. <!-- :value="dict.userId">-->
  78. <!-- </el-option>-->
  79. <!-- </el-select>-->
  80. <!-- </el-form-item>-->
  81. <!-- </el-col>-->
  82. <!-- </el-row>-->
  83. <el-row>
  84. <el-col :span="12">
  85. <el-form-item v-if="this.isToday" label="装置工程师" prop="devEngineerId">
  86. <el-select v-model="form.devEngineerId" filterable :placeholder="$t('请选择') + $t('装置工程师')">
  87. <el-option
  88. v-for="dict in managerOptions"
  89. :key="dict.userId"
  90. :label="dict.nickName"
  91. :value="dict.userId">
  92. </el-option>
  93. </el-select>
  94. </el-form-item>
  95. </el-col>
  96. </el-row>
  97. <el-row>
  98. <el-col :span="12">
  99. <el-form-item v-if="this.isSpecial" :label="$t('装置经理')" prop="managerconId">
  100. <el-select v-model="form.managerconId" filterable :placeholder="$t('请选择') + $t('装置经理')">
  101. <el-option
  102. v-for="dict in managerOptions"
  103. :key="dict.userId"
  104. :label="dict.nickName"
  105. :value="dict.userId">
  106. </el-option>
  107. </el-select>
  108. </el-form-item>
  109. </el-col>
  110. </el-row>
  111. <!-- <el-row>-->
  112. <!-- <el-col :span="12">-->
  113. <!-- <el-form-item label="班长" prop="monitorId">-->
  114. <!-- <el-select v-model="form.monitorId" filterable :placeholder="$t('请选择') + $t('班长')">-->
  115. <!-- <el-option-->
  116. <!-- v-for="dict in managerOptions"-->
  117. <!-- :key="dict.userId"-->
  118. <!-- :label="dict.nickName"-->
  119. <!-- :value="dict.userId">-->
  120. <!-- </el-option>-->
  121. <!-- </el-select>-->
  122. <!-- </el-form-item>-->
  123. <!-- </el-col>-->
  124. <!-- </el-row>-->
  125. </el-form>
  126. <div slot="footer" class="dialog-footer">
  127. <el-button type="primary" @click="submitForm">确 定</el-button>
  128. <el-button @click="cancel">取 消</el-button>
  129. </div>
  130. </el-dialog>
  131. </div>
  132. </template>
  133. <script>
  134. import {
  135. listInvoice,
  136. getInvoice,
  137. delInvoice,
  138. addInvoice,
  139. updateInvoice,
  140. exportInvoice,
  141. importTemplate
  142. } from "@/api/invoice/invoice";
  143. import {treeselect} from "@/api/system/dept";
  144. import {getToken} from "@/utils/auth";
  145. import Treeselect from "@riophae/vue-treeselect";
  146. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  147. import Editor from '@/components/Editor';
  148. import {listPostUser} from "@/api/system/user";
  149. import log from "@/views/monitor/job/log";
  150. export default {
  151. name: "Invoice",
  152. components: {Treeselect},
  153. data() {
  154. return {
  155. isToday: false,
  156. isSpecial: false,
  157. doc: {
  158. file: "",
  159. // 是否显示弹出层(报告附件)
  160. open: false,
  161. // 弹出层标题(报告附件)
  162. title: "",
  163. // 是否禁用上传
  164. isUploading: false,
  165. // 是否更新已经存在的用户数据
  166. updateSupport: 0,
  167. // 报告附件上传位置编号
  168. ids: 0,
  169. showDelay: false,
  170. fileList: [],
  171. // 设置上传的请求头部
  172. headers: {Authorization: "Bearer " + getToken()},
  173. // 上传的地址
  174. url: process.env.VUE_APP_BASE_API + "/sems/specfile/uploadFile",
  175. commonfileList: null,
  176. pType: 'traning',
  177. pId: null
  178. },
  179. // 遮罩层
  180. loading: true,
  181. managerOptions: [],
  182. devList: [],
  183. form: {},
  184. // 状态字典
  185. statusOptions: [],
  186. // 作业单位字典
  187. workUnitOptions: [],
  188. // 作业区域字典
  189. workAreaOptions: [],
  190. // 单元号字典
  191. unitNumberOptions: [],
  192. // 楼层字典
  193. floorLocationOptions: [],
  194. // 用户单位字典
  195. userUnitOptions: [],
  196. // 用户主管字典
  197. userMgOptions: [],
  198. // 作业类型字典
  199. workTypeOptions: [],
  200. // 风险等级字典
  201. riskLevelOptions: [],
  202. // 监护人单位字典
  203. guardianUnitOptions: [],
  204. visible: false,
  205. rules: {
  206. userSupId: [
  207. {required: true, message: this.$t('用户主管') + this.$t('不能为空'), trigger: "blur"}
  208. ],
  209. managerconId: [
  210. {required: true, message: this.$t('装置经理') + this.$t('不能为空'), trigger: "blur"}
  211. ],
  212. devEngineerId: [
  213. {required: true, message: this.$t('装置工程师') + this.$t('不能为空'), trigger: "blur"}
  214. ]
  215. }
  216. }
  217. },
  218. watch: {
  219. // 根据名称筛选部门树
  220. deptName(val) {
  221. this.$refs.tree.filter(val);
  222. }
  223. },
  224. created() {
  225. //设置表格高度对应屏幕高度
  226. this.$nextTick(() => {
  227. this.clientHeight = document.body.clientHeight - 250
  228. })
  229. // this.getList();
  230. this.getTreeselect();
  231. this.getTreeselect();
  232. },
  233. methods: {
  234. //附件上传中处理
  235. handleFileDocProgress(event, file, fileList) {
  236. },
  237. handleRemove(file, fileList) {
  238. this.fileList = fileList
  239. },
  240. //附件上传成功处理
  241. handleFileDocSuccess(response, file, fileList) {
  242. this.fileList = fileList
  243. if (response.code == 200) {
  244. this.$alert(this.$t('导入成功'), this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  245. } else {
  246. this.$alert(response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  247. }
  248. },
  249. init(rows) {
  250. this.reset();
  251. this.fileList = [];
  252. this.getDicts("booking_work_status").then(response => {
  253. this.statusOptions = response.data;
  254. });
  255. this.getDicts("book_work_area").then(response => {
  256. this.workAreaOptions = response.data;
  257. });
  258. this.getDicts("book_unit_number").then(response => {
  259. this.unitNumberOptions = response.data;
  260. });
  261. this.getDicts("book_floor_location").then(response => {
  262. this.floorLocationOptions = response.data;
  263. });
  264. this.getDicts("book_user_mg").then(response => {
  265. this.userMgOptions = response.data;
  266. });
  267. this.getDicts("book_user_unit").then(response => {
  268. this.userUnitOptions = response.data;
  269. });
  270. this.getDicts("book_work_unit").then(response => {
  271. this.workUnitOptions = response.data;
  272. });
  273. this.getDicts("book_work_type").then(response => {
  274. this.workTypeOptions = response.data;
  275. });
  276. this.getDicts("book_risk_level").then(response => {
  277. this.riskLevelOptions = response.data;
  278. });
  279. this.getDicts("book_guardian_unit").then(response => {
  280. this.guardianUnitOptions = response.data;
  281. });
  282. this.form.userSupId=10000;
  283. this.form.devSupId=10081;
  284. this.form.devEngineerId=10082;
  285. this.form.managerconId=10084;
  286. console.log(rows)
  287. this.devList = rows;
  288. console.log(this.devList)
  289. if (rows[0].workStartTime === rows[0].createdate)
  290. this.isToday = true;
  291. if (rows[0].workType === 1 || rows[0].workType === 2 || rows[0].workType === 15) {
  292. this.isSpecial = true;
  293. }
  294. this.form.invoiceId=rows[0].bookingticketId;
  295. listPostUser({
  296. // postCode: 'wxjl'
  297. }).then(response => {
  298. this.managerOptions = response;
  299. console.log(this.managerOptions)
  300. });
  301. this.visible = true
  302. },
  303. submitForm() {
  304. this.$refs["form"].validate(valid => {
  305. if (valid) {
  306. this.form.files = []
  307. if (this.fileList.length > 0) {
  308. for (let i = 0; i < this.fileList.length; i++) {
  309. let obj = {}
  310. obj.fileName = this.fileList[i].name
  311. obj.fileUrl = this.fileList[i].response.msg
  312. this.form.files.push(obj)
  313. }
  314. }
  315. if (this.form.workStartTime && this.form.workStartTime === this.form.createdate)
  316. this.form.isToday = 1;
  317. if (this.form.workType === 1 || this.form.workType === 2 || this.form.workType === 15) {
  318. this.form.isSpecial = 1;
  319. }
  320. addInvoice(this.form).then(response => {
  321. this.msgSuccess(this.$t('新增成功'));
  322. this.visible = false;
  323. // this.getList();
  324. })
  325. }
  326. });
  327. },
  328. // 状态字典翻译
  329. statusFormat(row, column) {
  330. return this.selectDictLabel(this.statusOptions, row.status);
  331. },
  332. // 字典翻译
  333. workUnitFormat(row, column) {
  334. return this.selectDictLabel(this.workUnitOptions, row.workUnit);
  335. },
  336. // 字典翻译
  337. workAreaFormat(row, column) {
  338. return this.selectDictLabel(this.workAreaOptions, row.workArea);
  339. },
  340. // 字典翻译
  341. unitNumberFormat(row, column) {
  342. return this.selectDictLabel(this.unitNumberOptions, row.unitNumber);
  343. },
  344. // 字典翻译
  345. floorLocationFormat(row, column) {
  346. return this.selectDictLabel(this.floorLocationOptions, row.floorLocation);
  347. },
  348. // 字典翻译
  349. userMgFormat(row, column) {
  350. return this.selectDictLabel(this.userMgOptions, row.userMg);
  351. },
  352. // 字典翻译
  353. userUnitFormat(row, column) {
  354. return this.selectDictLabel(this.userUnitOptions, row.userUnit);
  355. },
  356. // 字典翻译
  357. workTypeFormat(row, column) {
  358. return this.selectDictLabel(this.workTypeOptions, row.workType);
  359. },
  360. // 字典翻译
  361. riskLevelFormat(row, column) {
  362. return this.selectDictLabel(this.riskLevelOptions, row.riskLevel);
  363. },
  364. // 字典翻译
  365. guardianUnitFormat(row, column) {
  366. return this.selectDictLabel(this.guardianUnitOptions, row.guardianUnit);
  367. },
  368. // 取消按钮
  369. cancel() {
  370. this.visible = false;
  371. this.reset();
  372. },
  373. // 表单重置
  374. reset() {
  375. this.form = {
  376. id: null,
  377. userId: null,
  378. managerconId: null,
  379. userSupId: null,
  380. devEngineerId: null,
  381. monitorId: null,
  382. devType: null,
  383. approveType: null,
  384. content: null,
  385. fileUrls: null,
  386. status: 0,
  387. creattime: null,
  388. enddate: null,
  389. processId: null,
  390. apNo: null,
  391. delFlag: null,
  392. deptId: null,
  393. devSupId: null
  394. };
  395. this.resetForm("form");
  396. }
  397. }
  398. };
  399. </script>