uGantt.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <template>
  2. <div class="gdDetail-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="70px">
  4. <el-form-item label="委托单位" prop="weituoClient">
  5. <el-select v-model="queryParams.weituoClient" clearable filterable placeholder="请选择委托单位" @change="getWeituoClientOptions">
  6. <el-option
  7. v-for="item in weituoClientOptions"
  8. :key="item.value"
  9. :label="item.label"
  10. :value="item.value">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="委托编号" prop="weituoNo">
  15. <el-select v-model="queryParams.weituoNo" clearable filterable placeholder="请选择委托编号" @change="getWeituoNoOptions">
  16. <el-option
  17. v-for="item in weituoNoOptions"
  18. :key="item.value"
  19. :label="item.label"
  20. :value="item.value"
  21. >
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button type="primary" icon="el-icon-search" size="mini" @click="getHjlist">搜索</el-button>
  27. </el-form-item>
  28. </el-form>
  29. <uGantt :configColumns="configColumns" :taskLists="taskLists" ref="uGantt" @dbclick="rowDblclick" @addRow="addRow" @cellClick="cellClick">
  30. <!-- 其他需要自定义的弹窗数据 -->
  31. <!-- 双击事件弹窗 -->
  32. <el-dialog :title="title" :visible.sync="dialogVisible" width="45%">
  33. <el-form ref="currentDbEdit" :model="currentDbEdit" :rules="rules" label-width="80px">
  34. <el-form-item label="开始时间" prop="start_date">
  35. <el-date-picker v-model="currentDbEdit.start_date" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" @change="dataChange"></el-date-picker>
  36. </el-form-item>
  37. <el-form-item label="持续时间" prop="lastTime">
  38. <el-input-number v-model="currentDbEdit.lastTime" @change="handleChange" :min="1"></el-input-number>
  39. <span style="padding-left: 10px;">{{currentDbEdit.end_date}}</span>
  40. </el-form-item>
  41. <!-- <el-form-item label="报告编号" prop="reportNo" v-if="currentDbEdit.pid == null">
  42. <el-input v-model="currentDbEdit.reportNo" placeholder="请输入报告编号"></el-input>
  43. </el-form-item> -->
  44. <el-form-item label="试验设备" prop="shebeiIdArray" v-if="currentDbEdit.pid == null">
  45. <div class="eq-rili-view" style="display: flex;">
  46. <el-select v-model="currentDbEdit.shebeiIdArray" placeholder="请选择试验设备" style="width: 100%;" multiple>
  47. <el-option
  48. v-for="item in deviceOption"
  49. :key="item.value"
  50. :label="item.label"
  51. :value="item.value">
  52. </el-option>
  53. </el-select>
  54. <div class="search-btn" @click="handleEqCalendar">{{openRl == 1 ? '收起': '展开'}}</div>
  55. </div>
  56. </el-form-item>
  57. <el-form-item label="试验设备" prop="shebeiId" v-if="currentDbEdit.pid != null">
  58. <div class="eq-rili-view" style="display: flex;">
  59. <el-select v-model="currentDbEdit.shebeiId" placeholder="请选择试验设备" style="width: 100%;">
  60. <el-option
  61. v-for="item in deviceOption"
  62. :key="item.value"
  63. :label="item.label"
  64. :value="item.value">
  65. </el-option>
  66. </el-select>
  67. <div class="search-btn" @click="handleEqCalendar">{{openRl == 1 ? '收起': '展开'}}</div>
  68. </div>
  69. </el-form-item>
  70. <el-calendar v-if="openRl == 1">
  71. <template slot="dateCell" slot-scope="{date, data}">
  72. <!-- <div> -->
  73. <!-- 如果是当前选择月 -->
  74. <template v-if="data.type === 'current-month'">
  75. <!-- 这里加了周六周天的判断 -->
  76. <div :class="(date.getDay()==6 || date.getDay()==0)?'weeked' :'notweeked'">{{data.day.substring(8,10)}}</div>
  77. <!-- <div :class="(date.getDay()==6 || date.getDay()==0)?'weeked' :'notweeked'">{{data.day.split('-').slice(2).join('-')}}</div> -->
  78. <!-- 方法二:在方法中判断设置返回 -->
  79. <template v-if="dealMyDate(data.day)">
  80. <div v-for="(item, index) in dealMyDate(data.day)" :key="index" class="eqCalendar-item">
  81. <!-- <el-tag type="danger" :key="index" style="margin-right: 2px;" @click="chooseDevice(item)">
  82. {{ item.deviceName }}
  83. </el-tag> -->
  84. <div>
  85. {{ item.deviceName }}
  86. </div>
  87. </div>
  88. </template>
  89. <!-- <el-tag type="danger" v-if="dealMyDate(data.day).length > 0">
  90. {{ dealMyDate(data.day)[0].deviceName }}
  91. </el-tag> -->
  92. </template>
  93. <!-- 不是 -->
  94. <template v-else>
  95. <div style="text-align: right;">{{ data.day.split('-').slice(1).join('-') }}</div>
  96. </template>
  97. <!-- </div> -->
  98. </template>
  99. </el-calendar>
  100. <el-form-item label="传感器" prop="chuanganqiArray">
  101. <el-select v-model="currentDbEdit.chuanganqiArray" multiple filterable placeholder="请选择传感器" style="width: 100%;">
  102. <el-option
  103. v-for="item in chuanganqi"
  104. :key="item.value"
  105. :label="item.label"
  106. :value="item.value">
  107. </el-option>
  108. </el-select>
  109. </el-form-item>
  110. <el-form-item label="试验类型" prop="shiiyanTypeArray" v-if="currentDbEdit.pid != null">
  111. <el-select v-model="currentDbEdit.shiiyanTypeArray" multiple placeholder="请选择试验类型" style="width: 100%;">
  112. <el-option
  113. v-for="item in testTypeOptions"
  114. :key="item.value"
  115. :label="item.label"
  116. :value="item.value">
  117. </el-option>
  118. </el-select>
  119. </el-form-item>
  120. <el-form-item label="操作员" prop="worker" v-if="currentDbEdit.pid != null">
  121. <el-select v-model="currentDbEdit.worker" placeholder="请选择操作员" style="width: 100%;">
  122. <el-option
  123. v-for="item in worker"
  124. :key="item.label"
  125. :label="item.label"
  126. :value="item.label">
  127. </el-option>
  128. </el-select>
  129. </el-form-item>
  130. <el-form-item label="样品数量" prop="yangpinCount" v-if="currentDbEdit.pid != null">
  131. <el-input-number v-model="currentDbEdit.yangpinCount" :min="1"></el-input-number>
  132. </el-form-item>
  133. <el-form-item label="内容" prop="neirong" v-if="currentDbEdit.pid != null">
  134. <el-input type="textarea" autosize placeholder="请输入内容" v-model="currentDbEdit.neirong">
  135. </el-input>
  136. </el-form-item>
  137. <!-- <el-form-item label="结束" prop="end_date">
  138. <el-date-picker v-model="currentDbEdit.end_date" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  139. </el-form-item> -->
  140. </el-form>
  141. <!-- <div> -->
  142. <!-- 参数设定是固定格式,千万别改 -->
  143. <!-- 开始:<el-date-picker v-model="currentDbEdit.start_date" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  144. </div>
  145. <div>
  146. 结束:<el-date-picker v-model="currentDbEdit.end_date" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
  147. </div> -->
  148. <!-- 其他需要自定义的弹窗数据 -->
  149. <!-- <slot/> -->
  150. <!-- 日历弹窗 -->
  151. <el-dialog title="设备日历" :visible.sync="showCalendarDialog" width="60%" append-to-body>
  152. <el-calendar>
  153. <template slot="dateCell" slot-scope="{date, data}">
  154. <!-- <div> -->
  155. <!-- 如果是当前选择月 -->
  156. <template v-if="data.type === 'current-month'">
  157. <!-- 这里加了周六周天的判断 -->
  158. <div :class="(date.getDay()==6 || date.getDay()==0)?'weeked' :'notweeked'">{{data.day.substring(8,10)}}</div>
  159. <!-- <div :class="(date.getDay()==6 || date.getDay()==0)?'weeked' :'notweeked'">{{data.day.split('-').slice(2).join('-')}}</div> -->
  160. <!-- 方法二:在方法中判断设置返回 -->
  161. <template v-if="dealMyDate(data.day)">
  162. <template v-for="(item, index) in dealMyDate(data.day)">
  163. <el-tag type="danger" :key="index" style="margin-right: 2px;" @click="chooseDevice(item)">
  164. {{ item.deviceName }}
  165. </el-tag>
  166. </template>
  167. </template>
  168. <!-- <el-tag type="danger" v-if="dealMyDate(data.day).length > 0">
  169. {{ dealMyDate(data.day)[0].deviceName }}
  170. </el-tag> -->
  171. </template>
  172. <!-- 不是 -->
  173. <template v-else>
  174. <div style="text-align: right;">{{ data.day.split('-').slice(1).join('-') }}</div>
  175. </template>
  176. <!-- </div> -->
  177. </template>
  178. </el-calendar>
  179. <span slot="footer" class="dialog-footer">
  180. <el-button @click="showCalendarDialog = false">取 消</el-button>
  181. <el-button type="primary" @click="showCalendarDialog = false">确 定</el-button>
  182. </span>
  183. </el-dialog>
  184. <span slot="footer" class="dialog-footer">
  185. <el-popover
  186. style="margin-right: 10px;"
  187. placement="top"
  188. width="160"
  189. v-model="visible"
  190. v-if="currentDbEdit.pid != null && this.typeButton != 1">
  191. <p>确定删除改任务吗?</p>
  192. <div style="text-align: right; margin: 0">
  193. <el-button size="mini" type="text" @click="visible = false">取消</el-button>
  194. <el-button type="primary" size="mini" @click="remove">确定</el-button>
  195. </div>
  196. <el-button slot="reference">删 除</el-button>
  197. </el-popover>
  198. <!-- <el-button @click="remove">删 除</el-button> -->
  199. <el-button @click="cancel">关 闭</el-button>
  200. <el-button type="primary" @click="submit" v-if="currentDbEdit.pid != null">确 定</el-button>
  201. </span>
  202. </el-dialog>
  203. </uGantt>
  204. <itdm-weituo-info-modal ref="modalForm1"></itdm-weituo-info-modal>
  205. <!-- <u-gantt-dialog ref="dialogForm"></u-gantt-dialog> -->
  206. </div>
  207. </template>
  208. <script>
  209. import uGantt from '@/components/module-iTDM/uGantt/index.vue'
  210. import {getWeituoClientList, getWeituoInfoListByClient, getDeviceList, getXmjlList, getManagerList, getCgqList, saveProject, ajaxGetDictItems, saveProjectJl, delProjectJl, getDeviceCalendar} from '@/api/api'
  211. import UGanttDialog from './modules/uGanttDialog.vue'
  212. import ItdmWeituoInfoModal from '../weituo/modules/ItdmWeituoInfoModal.vue'
  213. import { httpAction, getAction } from '@/api/manage'
  214. export default {
  215. name: '',
  216. components: { uGantt,UGanttDialog, ItdmWeituoInfoModal },
  217. data () {
  218. return {
  219. // width:每列宽度--现在逻辑全部默认显示左边table,右边滚动
  220. // fixed:现在没有,如果需要一部分固定,一部分滚动,则需要重新设置一下组件
  221. // resize:暂时没用
  222. // align:每列文字显示
  223. // tree:暂时没用
  224. // 注意:start_date(开始日期)和end_date(结束日期)和add(添加按钮)是固定死的参数名,不能更改
  225. configColumns: [
  226. { name: "weituoNo", label: "委托编号", width: 140, fixed: true, resize: true, align: "center", tree: true },
  227. { name: "testItems", label: "检测项目", width: 80, fixed: true, resize: true, align: "center"},
  228. { name: "sampleName", label: "样品名称", width: 80, fixed: true, resize: true, align: "center" },
  229. { name: "start_date", label: "开始时间", width: 100, fixed: true, resize: true, align: "center" },
  230. { name: "end_date", label: "结束时间", width: 100, fixed: true, resize: true, align: "center" },
  231. { name: "statusC", label: "状态", width: 60, fixed: true, resize: true, align: "center" },
  232. { name: "add", label:"", width: 30 }
  233. ],
  234. // 注意:start_date(开始日期)和end_date(结束日期)和add(添加按钮)是固定死的参数名,不能更改
  235. // 注意:id和pid也是固定死的参数名,如果需要可以改组件
  236. // id、task_text: 也是固定死的,如果需要可以改组件
  237. taskLists: [],
  238. // taskLists: [{
  239. // id: 0,
  240. // testItems: 'ceshi',
  241. // sampleName: 'ceshi',
  242. // start_date: '2023-07-03',
  243. // end_date: '2023-07-04',
  244. // statusC: '0',
  245. // task_text: '111'
  246. // }, {
  247. // id: 1,
  248. // testItems: '测试',
  249. // sampleName: '测试',
  250. // start_date: '',
  251. // end_date: '',
  252. // statusC: '0',
  253. // }, {
  254. // id: 2,
  255. // testItems: 'ceshi',
  256. // sampleName: 'ceshi',
  257. // start_date: '2023-07-06',
  258. // end_date: '2023-07-10',
  259. // statusC: '1',
  260. // }, {
  261. // id: 3,
  262. // testItems: '测试',
  263. // sampleName: '测试',
  264. // start_date: '',
  265. // end_date: '',
  266. // statusC: '1',
  267. // },{
  268. // id: 4,
  269. // testItems: '测试',
  270. // sampleName: '测试',
  271. // start_date: '',
  272. // end_date: '',
  273. // statusC: '1',
  274. // },
  275. // {
  276. // id: 5,
  277. // testItems: '测试',
  278. // sampleName: '测试',
  279. // start_date: '',
  280. // end_date: '',
  281. // statusC: '1',
  282. // },
  283. // {
  284. // id: 6,
  285. // testItems: '测试',
  286. // sampleName: '测试',
  287. // start_date: '',
  288. // end_date: '',
  289. // statusC: '1',
  290. // },
  291. // {
  292. // id: 7,
  293. // testItems: '测试',
  294. // sampleName: '测试',
  295. // start_date: '',
  296. // end_date: '',
  297. // statusC: '1',
  298. // },
  299. // {
  300. // id: 8,
  301. // testItems: '测试',
  302. // sampleName: '测试',
  303. // start_date: '',
  304. // end_date: '',
  305. // statusC: '1',
  306. // },
  307. // {
  308. // id: 21,
  309. // testItems: 'ceshi1',
  310. // sampleName: 'ceshi',
  311. // start_date: '2023-07-05',
  312. // end_date: '2023-07-08',
  313. // statusC: '1',
  314. // pid: 2
  315. // }, {
  316. // id: 23,
  317. // testItems: 'ceshi3',
  318. // sampleName: 'ceshi',
  319. // start_date: '2023-07-02',
  320. // end_date: '2023-07-04',
  321. // statusC: '1',
  322. // pid: 2
  323. // },
  324. // {
  325. // id: 22,
  326. // testItems: 'ceshi2',
  327. // sampleName: 'ceshi',
  328. // start_date: '2023-07-06',
  329. // end_date: '2023-07-10',
  330. // statusC: '1',
  331. // pid: 2
  332. // }
  333. // ],
  334. // 查询条件
  335. queryParams: {},
  336. // 委托单位下拉列表
  337. weituoClientOptions: [],
  338. // 委托编号下拉列表
  339. weituoNoOptions: [],
  340. // 试验设备下拉列表
  341. deviceOption: [],
  342. // 传感器下拉列表
  343. chuanganqi: [],
  344. // 试验类型下拉列表
  345. testTypeOptions: [],
  346. // 操作员下拉列表
  347. worker: [],
  348. // 弹窗
  349. dialogVisible: false,
  350. title: '',
  351. // 弹窗内容
  352. currentDbEdit: {},
  353. // 数组中的第几个
  354. currentIndex: null,
  355. // 删除判断
  356. visible: false,
  357. // 点击按钮判断
  358. typeButton: null,
  359. // 表单校验
  360. rules: {
  361. },
  362. // 日历弹窗
  363. openRl: 1,
  364. showCalendarDialog: false,
  365. scheduleData: [],
  366. // 委托详情数据
  367. record: {},
  368. url: {
  369. queryById: "/weituo/itdmWeituoInfo/queryById"
  370. }
  371. }
  372. },
  373. created () {
  374. this.getClientList()
  375. this.getDevicelist()
  376. this.getCgqlist()
  377. this.initDictConfig()
  378. this.getManagerList()
  379. // 获取设备日历
  380. this.getDeviceCalendar()
  381. },
  382. mounted () {
  383. },
  384. methods: {
  385. // 单击事件
  386. cellClick(row, column){
  387. console.log(row.weituoId, column.label)
  388. if (column.label == '委托编号') {
  389. let httpurl = '';
  390. httpurl+=this.url.queryById;
  391. const id = {id:row.weituoId}
  392. getAction(httpurl,id).then((res)=>{
  393. console.log(res)
  394. this.record = res.result
  395. this.$refs.modalForm1.edit(this.record);
  396. this.$refs.modalForm1.title="委托详情";
  397. this.$refs.modalForm1.disableSubmit = true;
  398. }).finally(() => {
  399. // that.confirmLoading = false;
  400. })
  401. // this.$refs.dialogForm.open();
  402. }
  403. },
  404. // 获取设备日历
  405. getDeviceCalendar(){
  406. getDeviceCalendar().then((res) =>{
  407. this.scheduleData = res
  408. })
  409. },
  410. handleEqCalendar(){
  411. this.openRl = -this.openRl
  412. // this.showCalendarDialog = true
  413. },
  414. dealMyDate(v) {
  415. let res = ''
  416. for (let index = 0; index < this.scheduleData.length; index++) {
  417. const element = this.scheduleData[index];
  418. if(element.workDate === v){
  419. res = this.scheduleData[index].deviceList
  420. break
  421. }
  422. }
  423. console.log(res)
  424. return res
  425. },
  426. // 获取委托单位下拉列表
  427. getClientList(){
  428. getWeituoClientList().then((res) =>{
  429. console.log(res)
  430. this.weituoClientOptions = res.result.map( res => {
  431. return{
  432. value: res,
  433. label: res
  434. }
  435. })
  436. })
  437. },
  438. // 监听委托单位,获取对应委托编号列表
  439. getWeituoClientOptions(value){
  440. console.log(value)
  441. this.weituoNoOptions = []
  442. this.queryParams.weituoNo = ''
  443. getWeituoInfoListByClient(this.queryParams).then((res) =>{
  444. this.weituoNoOptions = res.result.map( res => {
  445. return{
  446. value: res.weituoNo, //传的值
  447. label: res.weituoNo, //展示
  448. }
  449. })
  450. })
  451. },
  452. // 监听委托编号赋值
  453. getWeituoNoOptions(value){
  454. // 方法1:this.$forceUpdate() 强制刷新
  455. // this.$forceUpdate()
  456. // 方法2:
  457. this.queryParams = {...this.queryParams}
  458. },
  459. // 通过委托编号查询检测项目
  460. getHjlist(){
  461. let that = this
  462. var queryParam = that.queryParams
  463. console.log(22,queryParam)
  464. getXmjlList(queryParam).then((res) => {
  465. console.log(17,res)
  466. that.taskLists = []
  467. if (res.result.length > 0 ) {
  468. that.taskLists = res.result.map(res => {
  469. var obj = res
  470. obj.pid = res.parent
  471. obj.start_date = res.jihuaStartDate
  472. obj.end_date = res.jihuaEndDate
  473. if (obj.pid == null){
  474. obj.task_text= res.deviceName+','+res.pm
  475. } else {
  476. obj.task_text= res.deviceName+','+res.worker
  477. }
  478. return obj
  479. })
  480. console.log(that.taskLists)
  481. }
  482. // else {
  483. // notification.open({
  484. // message: '注意',
  485. // description: '该委托编号不存在',
  486. // });
  487. // }
  488. })
  489. },
  490. // 获取设备下拉列表
  491. getDevicelist(){
  492. getDeviceList().then((res) => {
  493. console.log(res)
  494. this.deviceOption = res.map(response =>{
  495. return {
  496. value: response.id,
  497. label: response.deviceName
  498. }
  499. })
  500. })
  501. },
  502. // 获取传感器下拉列表
  503. getCgqlist(){
  504. getCgqList().then((res) => {
  505. this.chuanganqi = res.map(response =>{
  506. return {
  507. key: response.id,
  508. value: response.id,
  509. label: response.xuliehao
  510. }
  511. })
  512. })
  513. },
  514. // 字典获取试验类型下拉列表
  515. initDictConfig() {
  516. //获取字典 你的字典名称 ⬇⬇⬇⬇
  517. ajaxGetDictItems('shiiyan_type').then((res) => {
  518. console.log('字典',res)
  519. this.testTypeOptions = res.result.map(response =>{
  520. return {
  521. key: response.value,
  522. value: response.value,
  523. label: response.label
  524. }
  525. })
  526. })
  527. },
  528. // 获取操作员下拉列表
  529. getManagerList(){
  530. var query ={
  531. position: "操作员"
  532. }
  533. getManagerList(query).then((res) => {
  534. this.worker = res.map(response =>{
  535. return {
  536. key: response.name,
  537. value: response.id,
  538. label: response.name
  539. }
  540. })
  541. // this.initData()
  542. })
  543. },
  544. // 双击事件
  545. rowDblclick(current){
  546. console.log(current)
  547. this.openRl = 1
  548. this.currentDbEdit = current
  549. this.title = this.currentDbEdit.sampleName + '-' + this.currentDbEdit.testItems + '-' + this.currentDbEdit.pm
  550. // 根据开始时间结束时间计算持续时间
  551. this.currentDbEdit.lastTime = (new Date(this.currentDbEdit.end_date).getTime() - new Date(this.currentDbEdit.start_date).getTime()) / (1000 * 60 * 60 * 24)+1
  552. // this.currentIndex = this.taskLists.findIndex(res=>res.id === current.id)
  553. // this.currentDbEdit = this.taskLists[this.currentIndex]
  554. this.dialogVisible = true
  555. },
  556. // 监听开始时间得到结束时间
  557. dataChange(value){
  558. console.log(value)
  559. let nowDate = new Date(value)
  560. nowDate.setDate(nowDate.getDate() + this.currentDbEdit.lastTime -1)
  561. console.log(nowDate)
  562. let y = nowDate.getFullYear()
  563. let m = nowDate.getMonth() + 1
  564. m = m < 10 ? ('0' + m) : m
  565. let d = nowDate.getDate()
  566. d = d < 10 ? ('0' + d) : d
  567. this.currentDbEdit.end_date = y + '-' + m + '-' + d;
  568. return this.currentDbEdit.end_date
  569. },
  570. // 监听持续时间得到结束时间
  571. handleChange(value) {
  572. console.log(value,this.currentDbEdit.start_date);
  573. let nowDate = new Date(this.currentDbEdit.start_date)
  574. nowDate.setDate(nowDate.getDate() + value -1)
  575. console.log(nowDate)
  576. let y = nowDate.getFullYear()
  577. let m = nowDate.getMonth() + 1
  578. m = m < 10 ? ('0' + m) : m
  579. let d = nowDate.getDate()
  580. d = d < 10 ? ('0' + d) : d
  581. this.currentDbEdit.end_date = y + '-' + m + '-' + d;
  582. return this.currentDbEdit.end_date
  583. },
  584. // 新增事件
  585. addRow(row, index){
  586. this.typeButton = 1
  587. console.log(row, index)
  588. this.currentDbEdit = JSON.parse(JSON.stringify(row))
  589. this.currentDbEdit.parent = row.id
  590. this.currentDbEdit.pid = row.id
  591. this.dialogVisible = true
  592. },
  593. // 删除
  594. remove(){
  595. console.log(this.currentDbEdit.id)
  596. if (this.currentDbEdit.statusC == "不可修改"){
  597. this.$message.error('该项已进行,不可修改');
  598. this.visible = false
  599. }else{
  600. var select={id: this.currentDbEdit.id}
  601. delProjectJl(select).then((res) => {
  602. console.log("删除",res)
  603. if (res.success) {
  604. this.$message.success('删除成功');
  605. this.typeButton = null
  606. this.dialogVisible = false
  607. this.currentDbEdit = {}
  608. this.getHjlist()
  609. }
  610. })
  611. }
  612. },
  613. cancel(){
  614. this.currentDbEdit = {}
  615. this.typeButton = null
  616. this.dialogVisible = false
  617. },
  618. submit(){
  619. // this.taskLists[this.currentIndex].start_date = this.currentDbEdit.start_date
  620. // this.taskLists[this.currentIndex].end_date = this.currentDbEdit.end_date
  621. // this.dialogVisible = false
  622. // this.currentDbEdit = {}
  623. console.log(this.currentDbEdit)
  624. if (this.currentDbEdit.status == 3 || this.currentDbEdit.status == 1) {
  625. this.currentDbEdit.jihuaStartDate = this.currentDbEdit.start_date ;
  626. this.currentDbEdit.parent = this.currentDbEdit.pid ;
  627. saveProjectJl(this.currentDbEdit).then((res) => {
  628. console.log("提交返回",res)
  629. if (res.success) {
  630. this.$message.success('提交成功');
  631. this.typeButton = null
  632. this.dialogVisible = false
  633. this.currentDbEdit = {}
  634. this.getHjlist()
  635. }
  636. })
  637. } else {
  638. this.$message.error('不可修改');
  639. }
  640. },
  641. }
  642. }
  643. </script>
  644. <style lang="scss">
  645. .gdDetail-container{
  646. ::v-deep .el-table th.el-table__cell>.cell{
  647. padding-left: 0;
  648. padding-right: 0;
  649. }
  650. ::v-deep .el-table .cell{
  651. padding-left: 0;
  652. padding-right: 0;
  653. }
  654. .eq-rili-view{
  655. .el-select{
  656. .el-input__inner{
  657. border-top-right-radius: 0;
  658. border-bottom-right-radius: 0;
  659. border-right: 0;
  660. }
  661. }
  662. .search-btn{
  663. width: 60px;
  664. background-color: #1890ff;
  665. // padding: 0 22px;
  666. color: #fff;
  667. border-top-right-radius: 4px;
  668. border-bottom-right-radius: 4px;
  669. text-align: center;
  670. }
  671. }
  672. // 日历
  673. .el-calendar{
  674. .el-calendar-table .el-calendar-day{
  675. padding: 0;
  676. min-height: 65px;
  677. height: 100%;
  678. .weeked{
  679. text-align: center;
  680. }
  681. .notweeked{
  682. text-align: center;
  683. }
  684. }
  685. .eqCalendar-item{
  686. // width: ;
  687. background-color: #EBF4FE;
  688. position: relative;
  689. padding: 2px 6px;
  690. font-size: 12px;
  691. margin-bottom: 4px;
  692. overflow: auto;
  693. }
  694. .eqCalendar-item::after{
  695. content: '';
  696. position: absolute;
  697. top: 0;
  698. left: 0;
  699. width: 2px;
  700. height: 100%;
  701. background-color: #4F9AF6;
  702. }
  703. }
  704. }
  705. </style>