|
@@ -29,14 +29,68 @@
|
|
|
<uGantt :configColumns="configColumns" :taskLists="taskLists" ref="uGantt" @dbclick="rowDblclick" @addRow="addRow">
|
|
|
<!-- 其他需要自定义的弹窗数据 -->
|
|
|
<!-- 双击事件弹窗 -->
|
|
|
- <el-dialog :title="title" :visible.sync="dialogVisible" width="40%">
|
|
|
+ <el-dialog :title="title" :visible.sync="dialogVisible" width="35%">
|
|
|
<el-form ref="currentDbEdit" :model="currentDbEdit" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="开始" prop="start_date">
|
|
|
- <el-date-picker v-model="currentDbEdit.start_date" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
|
|
|
+ <el-form-item label="开始时间" prop="start_date">
|
|
|
+ <el-date-picker v-model="currentDbEdit.start_date" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" @change="dataChange"></el-date-picker>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="结束" prop="end_date">
|
|
|
- <el-date-picker v-model="currentDbEdit.end_date" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
|
|
|
+ <el-form-item label="持续时间" prop="lastTime">
|
|
|
+ <el-input-number v-model="currentDbEdit.lastTime" @change="handleChange" :min="1"></el-input-number>
|
|
|
+ <span style="padding-left: 10px;">{{currentDbEdit.end_date}}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="报告编号" prop="reportNo" v-if="currentDbEdit.pid == null">
|
|
|
+ <el-input v-model="currentDbEdit.reportNo" placeholder="请输入报告编号"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="试验设备" prop="shebeiId">
|
|
|
+ <el-select v-model="currentDbEdit.shebeiId" placeholder="请选择试验设备" style="width: 100%;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in deviceOption"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="传感器" prop="chuanganqiArray">
|
|
|
+ <el-select v-model="currentDbEdit.chuanganqiArray" multiple placeholder="请选择传感器" style="width: 100%;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in chuanganqi"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="试验类型" prop="shiiyanTypeArray" v-if="currentDbEdit.pid != null">
|
|
|
+ <el-select v-model="currentDbEdit.shiiyanTypeArray" multiple placeholder="请选择试验类型" style="width: 100%;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in testTypeOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="操作员" prop="worker" v-if="currentDbEdit.pid != null">
|
|
|
+ <el-select v-model="currentDbEdit.worker" placeholder="请选择操作员" style="width: 100%;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in worker"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="样品数量" prop="yangpinCount" v-if="currentDbEdit.pid != null">
|
|
|
+ <el-input-number v-model="currentDbEdit.yangpinCount" :min="1"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="内容" prop="neirong" v-if="currentDbEdit.pid != null">
|
|
|
+ <el-input type="textarea" autosize placeholder="请输入内容" v-model="currentDbEdit.neirong">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item label="结束" prop="end_date">
|
|
|
+ <el-date-picker v-model="currentDbEdit.end_date" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
|
|
|
+ </el-form-item> -->
|
|
|
</el-form>
|
|
|
<!-- <div> -->
|
|
|
<!-- 参数设定是固定格式,千万别改 -->
|
|
@@ -48,8 +102,22 @@
|
|
|
<!-- 其他需要自定义的弹窗数据 -->
|
|
|
<!-- <slot/> -->
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submit">确 定</el-button>
|
|
|
+ <el-popover
|
|
|
+ style="margin-right: 10px;"
|
|
|
+ placement="top"
|
|
|
+ width="160"
|
|
|
+ v-model="visible"
|
|
|
+ v-if="currentDbEdit.pid != null">
|
|
|
+ <p>确定删除改任务吗?</p>
|
|
|
+ <div style="text-align: right; margin: 0">
|
|
|
+ <el-button size="mini" type="text" @click="visible = false">取消</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="remove">确定</el-button>
|
|
|
+ </div>
|
|
|
+ <el-button slot="reference">删 除</el-button>
|
|
|
+ </el-popover>
|
|
|
+ <!-- <el-button @click="remove">删 除</el-button> -->
|
|
|
+ <el-button @click="cancel">关 闭</el-button>
|
|
|
+ <el-button type="primary" @click="submit" v-if="currentDbEdit.pid != null">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
</uGantt>
|
|
@@ -71,11 +139,12 @@ export default {
|
|
|
// tree:暂时没用
|
|
|
// 注意:start_date(开始日期)和end_date(结束日期)和add(添加按钮)是固定死的参数名,不能更改
|
|
|
configColumns: [
|
|
|
- { name: "testItems", label: "检测项目", width: 100, fixed: true, resize: true, align: "center", tree: true },
|
|
|
- { name: "sampleName", label: "样品名称", width: 90, fixed: true, resize: true, align: "center" },
|
|
|
- { name: "start_date", label: "开始时间", width: 100, fixed: true, resize: true, align: "center" },
|
|
|
- { name: "end_date", label: "结束时间", width: 100, fixed: true, resize: true, align: "center" },
|
|
|
- // { name: "statusC", label: "状态", width: 60, fixed: true, resize: true, align: "center" },
|
|
|
+ { name: "weituoNo", label: "委托编号", width: 140, fixed: true, resize: true, align: "center", tree: true },
|
|
|
+ { name: "testItems", label: "检测项目", width: 80, fixed: true, resize: true, align: "center"},
|
|
|
+ { name: "sampleName", label: "样品名称", width: 80, fixed: true, resize: true, align: "center" },
|
|
|
+ { name: "start_date", label: "开始时间", width: 80, fixed: true, resize: true, align: "center" },
|
|
|
+ { name: "end_date", label: "结束时间", width: 80, fixed: true, resize: true, align: "center" },
|
|
|
+ { name: "statusC", label: "状态", width: 60, fixed: true, resize: true, align: "center" },
|
|
|
{ name: "add", label:"", width: 30 }
|
|
|
],
|
|
|
// 注意:start_date(开始日期)和end_date(结束日期)和add(添加按钮)是固定死的参数名,不能更改
|
|
@@ -184,6 +253,14 @@ export default {
|
|
|
weituoClientOptions: [],
|
|
|
// 委托编号下拉列表
|
|
|
weituoNoOptions: [],
|
|
|
+ // 试验设备下拉列表
|
|
|
+ deviceOption: [],
|
|
|
+ // 传感器下拉列表
|
|
|
+ chuanganqi: [],
|
|
|
+ // 试验类型下拉列表
|
|
|
+ testTypeOptions: [],
|
|
|
+ // 操作员下拉列表
|
|
|
+ worker: [],
|
|
|
// 弹窗
|
|
|
dialogVisible: false,
|
|
|
title: '',
|
|
@@ -191,6 +268,8 @@ export default {
|
|
|
currentDbEdit: {},
|
|
|
// 数组中的第几个
|
|
|
currentIndex: null,
|
|
|
+ // 删除判断
|
|
|
+ visible: false,
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
},
|
|
@@ -198,6 +277,10 @@ export default {
|
|
|
},
|
|
|
created () {
|
|
|
this.getClientList()
|
|
|
+ this.getDevicelist()
|
|
|
+ this.getCgqlist()
|
|
|
+ this.initDictConfig()
|
|
|
+ this.getManagerList()
|
|
|
},
|
|
|
mounted () {
|
|
|
},
|
|
@@ -269,7 +352,7 @@ export default {
|
|
|
worker: res.worker,
|
|
|
yangpinCount:res.yangpinCount,
|
|
|
|
|
|
- duration: res.lastTime,
|
|
|
+ lastTime: res.lastTime,
|
|
|
sampleName: res.sampleName,
|
|
|
testItems: res.testItems,
|
|
|
deviceName: res.deviceName,
|
|
@@ -286,30 +369,156 @@ export default {
|
|
|
// }
|
|
|
})
|
|
|
},
|
|
|
+ // 获取设备下拉列表
|
|
|
+ getDevicelist(){
|
|
|
+ getDeviceList().then((res) => {
|
|
|
+ console.log(res)
|
|
|
+ this.deviceOption = res.map(response =>{
|
|
|
+ return {
|
|
|
+ value: response.id,
|
|
|
+ label: response.deviceName
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取传感器下拉列表
|
|
|
+ getCgqlist(){
|
|
|
+ getCgqList().then((res) => {
|
|
|
+ this.chuanganqi = res.map(response =>{
|
|
|
+ return {
|
|
|
+ key: response.id,
|
|
|
+ value: response.id,
|
|
|
+ label: response.xuliehao
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 字典获取试验类型下拉列表
|
|
|
+ initDictConfig() {
|
|
|
+ //获取字典 你的字典名称 ⬇⬇⬇⬇
|
|
|
+ ajaxGetDictItems('shiiyan_type').then((res) => {
|
|
|
+ console.log('字典',res)
|
|
|
+ this.testTypeOptions = res.result.map(response =>{
|
|
|
+ return {
|
|
|
+ key: response.value,
|
|
|
+ value: response.value,
|
|
|
+ label: response.label
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取操作员下拉列表
|
|
|
+ getManagerList(){
|
|
|
+ var query ={
|
|
|
+ position: "操作员"
|
|
|
+ }
|
|
|
+ getManagerList(query).then((res) => {
|
|
|
+ this.worker = res.map(response =>{
|
|
|
+ return {
|
|
|
+ key: response.name,
|
|
|
+ value: response.id,
|
|
|
+ label: response.name
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // this.initData()
|
|
|
+ })
|
|
|
+ },
|
|
|
// 双击事件
|
|
|
rowDblclick(current){
|
|
|
console.log(current)
|
|
|
- this.currentIndex = this.taskLists.findIndex(res=>res.id === current.id)
|
|
|
- this.currentDbEdit = this.taskLists[this.currentIndex]
|
|
|
+ this.currentDbEdit = current
|
|
|
+ this.title = this.currentDbEdit.sampleName + '-' + this.currentDbEdit.testItems + '-' + this.currentDbEdit.pm
|
|
|
+ // this.currentIndex = this.taskLists.findIndex(res=>res.id === current.id)
|
|
|
+ // this.currentDbEdit = this.taskLists[this.currentIndex]
|
|
|
this.dialogVisible = true
|
|
|
},
|
|
|
+ // 监听开始时间得到结束时间
|
|
|
+ dataChange(value){
|
|
|
+ console.log(value)
|
|
|
+ let nowDate = new Date(value)
|
|
|
+ nowDate.setDate(nowDate.getDate() + this.currentDbEdit.lastTime -1)
|
|
|
+ console.log(nowDate)
|
|
|
+ let y = nowDate.getFullYear()
|
|
|
+ let m = nowDate.getMonth() + 1
|
|
|
+ m = m < 10 ? ('0' + m) : m
|
|
|
+ let d = nowDate.getDate()
|
|
|
+ d = d < 10 ? ('0' + d) : d
|
|
|
+ this.currentDbEdit.end_date = y + '-' + m + '-' + d;
|
|
|
+ return this.currentDbEdit.end_date
|
|
|
+ },
|
|
|
+ // 监听持续时间得到结束时间
|
|
|
+ handleChange(value) {
|
|
|
+ console.log(value,this.currentDbEdit.start_date);
|
|
|
+ let nowDate = new Date(this.currentDbEdit.start_date)
|
|
|
+ nowDate.setDate(nowDate.getDate() + value -1)
|
|
|
+ console.log(nowDate)
|
|
|
+ let y = nowDate.getFullYear()
|
|
|
+ let m = nowDate.getMonth() + 1
|
|
|
+ m = m < 10 ? ('0' + m) : m
|
|
|
+ let d = nowDate.getDate()
|
|
|
+ d = d < 10 ? ('0' + d) : d
|
|
|
+ this.currentDbEdit.end_date = y + '-' + m + '-' + d;
|
|
|
+ return this.currentDbEdit.end_date
|
|
|
+ },
|
|
|
// 新增事件
|
|
|
addRow(row, index){
|
|
|
console.log(row, index)
|
|
|
+ this.currentDbEdit = {}
|
|
|
+ // 灯箱部分
|
|
|
+ this.currentDbEdit.shebeiId = row.shebeiId
|
|
|
+ // this.currentDbEdit.reportNo = row.reportNo
|
|
|
+ this.currentDbEdit.chuanganqiArray = row.chuanganqiArray
|
|
|
+ // 灯箱虽不展示,但也要赋值
|
|
|
+ this.currentDbEdit.parent = row.id
|
|
|
+ this.currentDbEdit.pid = row.id
|
|
|
+ this.currentDbEdit.deviceName = row.deviceName
|
|
|
+ this.currentDbEdit.yangpinId = row.yangpinId
|
|
|
+ this.currentDbEdit.sampleName = row.sampleName
|
|
|
+ this.currentDbEdit.shijiStartDate = row.shijiStartDate
|
|
|
+ this.currentDbEdit.testItems = row.testItems
|
|
|
+ this.currentDbEdit.testItemsId = row.testItemsId
|
|
|
+ this.currentDbEdit.testPlanId = row.testPlanId
|
|
|
+ this.currentDbEdit.weituoId = row.weituoId
|
|
|
+ this.currentDbEdit.weituoNo = row.weituoNo
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ remove(){
|
|
|
+
|
|
|
},
|
|
|
cancel(){
|
|
|
this.currentDbEdit = {}
|
|
|
this.dialogVisible = false
|
|
|
},
|
|
|
submit(){
|
|
|
- this.taskLists[this.currentIndex].start_date = this.currentDbEdit.start_date
|
|
|
- this.taskLists[this.currentIndex].end_date = this.currentDbEdit.end_date
|
|
|
- this.dialogVisible = false
|
|
|
- this.currentDbEdit = {}
|
|
|
+ // this.taskLists[this.currentIndex].start_date = this.currentDbEdit.start_date
|
|
|
+ // this.taskLists[this.currentIndex].end_date = this.currentDbEdit.end_date
|
|
|
+ // this.dialogVisible = false
|
|
|
+ // this.currentDbEdit = {}
|
|
|
+ console.log(this.currentDbEdit)
|
|
|
+ this.currentDbEdit.jihuaStartDate = this.currentDbEdit.start_date ;
|
|
|
+ this.currentDbEdit.parent = this.currentDbEdit.pid ;
|
|
|
+ console.log("提交",this.currentDbEdit)
|
|
|
+ saveProjectJl(this.currentDbEdit).then((res) => {
|
|
|
+ console.log("提交返回",res)
|
|
|
+ if (res.success) {
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.currentDbEdit = {}
|
|
|
+ this.getHjlist()
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+::v-deep .el-table th.el-table__cell>.cell{
|
|
|
+ padding-left: 0;
|
|
|
+ padding-right: 0;
|
|
|
+}
|
|
|
+::v-deep .el-table .cell{
|
|
|
+ padding-left: 0;
|
|
|
+ padding-right: 0;
|
|
|
+}
|
|
|
</style>
|